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 35 36 import javax.management.ObjectName ; 37 import javax.management.AttributeList ; 38 39 import com.sun.appserv.management.base.XTypes; 40 import com.sun.appserv.management.base.Container; 41 import com.sun.appserv.management.base.Util; 42 import com.sun.appserv.management.util.jmx.JMXUtil; 43 import com.sun.appserv.management.config.JMXConnectorConfigKeys; 44 import com.sun.appserv.management.config.JMXConnectorConfigKeys; 45 46 import com.sun.enterprise.management.support.oldconfig.OldAdminServiceMBean; 47 48 49 import com.sun.appserv.management.util.misc.GSetUtil; 50 51 53 public final class JMXConnectorConfigFactory extends ConfigFactory 54 { 55 private final OldAdminServiceMBean mOldAdminServiceMBean; 56 57 public 58 JMXConnectorConfigFactory( 59 final ConfigFactoryCallback callbacks) 60 { 61 super( callbacks ); 62 63 mOldAdminServiceMBean = getOldAdminServiceMBean(); 64 } 65 66 67 private final OldAdminServiceMBean 68 getOldAdminServiceMBean() 69 { 70 return( getOldConfigProxies().getOldAdminServiceMBean( getConfigName() ) ); 71 } 72 73 74 private final Set <String > LEGAL_OPTIONAL_KEYS = 75 GSetUtil.newUnmodifiableStringSet( 76 JMXConnectorConfigKeys.ACCEPT_ALL_KEY, 77 JMXConnectorConfigKeys.SECURITY_ENABLED_KEY ); 78 protected Set <String > 79 getLegalOptionalCreateKeys() 80 { 81 return( LEGAL_OPTIONAL_KEYS ); 82 } 83 84 private static final String ADDRESS_KEY = "Address"; 85 private static final String PORT_KEY = "Port"; 86 private static final String AUTH_REALM_NAME_KEY = "AuthRealmName"; 87 88 89 90 public ObjectName 91 create( String name, String address, String port, 92 String authRealmName, Map <String ,String > optional ) 93 { 94 final String [] requiredParams = 95 { 96 ADDRESS_KEY, address, 97 PORT_KEY, port, 98 AUTH_REALM_NAME_KEY, authRealmName, 99 }; 100 final Map <String ,String > params = initParams( name, requiredParams, optional ); 101 final ObjectName amxObjectName = createNamedChild( name, params ); 102 return amxObjectName; 103 } 104 105 protected void 106 removeByName( final String name ) 107 { 108 mOldAdminServiceMBean.removeJmxConnectorByName( name ); 109 } 110 111 protected ObjectName 112 createOldChildConfig( final AttributeList translatedAttrs ) 113 { 114 return mOldAdminServiceMBean.createJmxConnector( translatedAttrs ); 115 } 116 } 117 118 119 120 121 | Popular Tags |