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 39 import com.sun.enterprise.management.support.oldconfig.OldServersMBean; 40 41 import com.sun.appserv.management.util.misc.GSetUtil; 42 import com.sun.appserv.management.util.misc.MapUtil; 43 import com.sun.appserv.management.config.ServerConfigKeys; 44 45 46 public class StandaloneServerConfigFactory extends ConfigFactory 47 { 48 private final OldServersMBean mOldServersMBean; 49 50 public 51 StandaloneServerConfigFactory( final ConfigFactoryCallback callbacks ) 52 { 53 super( callbacks ); 54 55 mOldServersMBean = callbacks.getOldConfigProxies().getOldServersMBean(); 56 } 57 58 private final Set <String > LEGAL_OPTIONAL_KEYS = 59 GSetUtil.newUnmodifiableStringSet( 60 ServerConfigKeys.HTTP_LISTENER_1_PORT_KEY, 61 ServerConfigKeys.HTTP_LISTENER_2_PORT_KEY, 62 ServerConfigKeys.ORB_LISTENER_1_PORT_KEY, 63 ServerConfigKeys.ADMIN_LISTENER_PORT_KEY, 64 ServerConfigKeys.SSL_PORT_KEY, 65 ServerConfigKeys.SSL_MUTUALAUTH_PORT_KEY, 66 ServerConfigKeys.JMX_SYSTEM_CONNECTOR_PORT_KEY, 67 ServerConfigKeys.JMS_PROVIDER_PORT_KEY ); 68 69 protected Set <String > 70 getLegalOptionalCreateKeys() 71 { 72 return( LEGAL_OPTIONAL_KEYS ); 73 } 74 75 76 public ObjectName 77 create( 78 final String name, 79 final String nodeAgentName, 80 final String configName, 81 final Map <String ,String > optional) 82 { 83 debug( "create:\n" + (optional == null ? "null" : MapUtil.toString( optional )) ); 84 85 final Map <String ,String > all = initParams(name, null, optional ); 86 final Properties props = new Properties (); 87 final AttributeList attrList = new AttributeList (); 88 translateParams(all, attrList, props); 89 90 final ObjectName oldObjectName = 92 mOldServersMBean.createServerInstance(nodeAgentName, name, configName, null, props); 93 94 return syncNewAMXMBeanWithOld(oldObjectName); 95 } 96 97 protected void 98 removeByName(final String name) 99 { 100 mOldServersMBean.deleteServerInstance(name); 101 } 102 } 103 104 105 106 107 | Popular Tags |