1 23 24 29 package com.sun.enterprise.management.config; 30 31 import java.util.Map ; 32 import java.util.Set ; 33 import java.util.Collections ; 34 import java.util.Properties ; 35 36 import javax.management.ObjectName ; 37 import javax.management.AttributeList ; 38 import javax.management.InstanceNotFoundException ; 39 import javax.management.IntrospectionException ; 40 import javax.management.ReflectionException ; 41 42 43 import com.sun.appserv.management.base.XTypes; 44 import com.sun.enterprise.management.config.AMXConfigImplBase; 45 import com.sun.enterprise.management.support.Delegate; 46 47 import com.sun.appserv.management.base.XTypes; 48 49 import com.sun.appserv.management.config.ConfigConfig; 50 import com.sun.appserv.management.config.ConfigConfigKeys; 51 52 import com.sun.appserv.management.util.jmx.JMXUtil; 53 54 import com.sun.appserv.management.util.misc.GSetUtil; 55 56 import com.sun.enterprise.management.support.ObjectNames; 57 import com.sun.enterprise.management.support.oldconfig.OldConfigsMBean; 58 59 61 public final class ConfigConfigFactory extends ConfigFactory 62 { 63 private String mSrcConfigName; 64 private String mNewConfigName; 65 66 public 67 ConfigConfigFactory( final ConfigFactoryCallback callbacks ) 68 { 69 super( callbacks ); 70 71 mSrcConfigName = null; 72 mNewConfigName = null; 73 } 74 75 private final Set <String > LEGAL_OPTIONAL_KEYS = 76 GSetUtil.newUnmodifiableStringSet( 77 ConfigConfigKeys.DYNAMIC_RECONFIGURATION_ENABLED_KEY, 78 ConfigConfigKeys.SRC_CONFIG_NAME_KEY ); 79 80 protected Set <String > 81 getLegalOptionalCreateKeys() 82 { 83 return( LEGAL_OPTIONAL_KEYS ); 84 } 85 86 87 protected ObjectName 88 createOldChildConfig( 89 final AttributeList translatedAttrs, 90 final Properties props ) 91 { 92 trace( "ConfigConfigFactory.createOldChildConfig: creating using: " + 93 stringify( translatedAttrs ) ); 94 95 final OldConfigsMBean old = getOldConfigProxies().getOldConfigsMBean(); 96 97 final ObjectName objectName = old.copyConfiguration( mSrcConfigName, mNewConfigName, props); 98 99 return( objectName ); 100 } 101 102 public ObjectName 103 create( 104 final String name, 105 final Map <String ,String > optional) 106 { 107 final String [] requiredParams = new String [] {}; 108 final Map <String ,String > params = initParams(name, requiredParams, optional); 109 110 mNewConfigName = name; 111 mSrcConfigName = (String )optional.get( ConfigConfigKeys.SRC_CONFIG_NAME_KEY ); 112 if ( mSrcConfigName == null ) 113 { 114 mSrcConfigName = ConfigConfigKeys.DEFAULT_SRC_CONFIG_NAME; 115 } 116 117 118 final ObjectName amxName = createNamedChild(name, params); 119 120 121 if ( amxName != null ) 123 { 124 final ConfigConfig config = getCallbacks().getProxyFactory().getProxy( amxName, ConfigConfig.class); 125 126 Object value; 127 128 value = optional.get( ConfigConfigKeys.DYNAMIC_RECONFIGURATION_ENABLED_KEY ); 129 if ( value != null ) 130 { 131 config.setDynamicReconfigurationEnabled( Boolean.parseBoolean( "" + value ) ); 132 } 133 } 134 135 return( amxName ); 136 } 137 138 139 protected void 140 removeByName(String name) 141 { 142 getOldConfigProxies().getOldConfigsMBean().deleteConfiguration(name); 143 } 144 } 145 146 147 148 149 | Popular Tags |