1 23 24 29 30 31 package com.sun.enterprise.management.config; 32 33 import java.util.Set ; 34 import java.util.Map ; 35 import java.util.Properties ; 36 import java.util.Collections ; 37 38 import javax.management.ObjectName ; 39 import javax.management.AttributeList ; 40 41 import com.sun.appserv.management.base.XTypes; 42 43 import com.sun.appserv.management.config.ResourceRefConfig; 44 45 import com.sun.enterprise.management.config.AMXConfigImplBase; 46 47 import com.sun.enterprise.management.support.Delegate; 48 49 import com.sun.appserv.management.util.misc.MapUtil; 50 51 52 public final class ConnectorResourceConfigFactory extends ResourceFactoryImplBase 53 { 54 public 55 ConnectorResourceConfigFactory( final ConfigFactoryCallback callbacks ) 56 { 57 super( callbacks ); 58 } 59 60 protected Map <String ,String > 61 getParamNameOverrides() 62 { 63 return( MapUtil.newMap( CONFIG_NAME_KEY, "jndi-name" ) ); 64 } 65 66 protected ObjectName 67 createOldChildConfig( 68 final AttributeList translatedAttrs, 69 final Properties props ) 70 { 71 return( getOldResourcesMBean().createConnectorResource( translatedAttrs, props, null ) ); 72 } 73 74 75 public final static String RESOURCE_POOL_NAME_KEY = "PoolName"; 76 77 84 public ObjectName 85 create( final String jndiName, 86 final String poolName, 87 final Map <String ,String > optional ) 88 { 89 final String [] requiredParams = new String [] 90 { 91 RESOURCE_POOL_NAME_KEY, poolName, 92 }; 93 94 final Map <String ,String > params = initParams( jndiName, requiredParams, optional ); 95 96 final ObjectName amxName = createNamedChild( jndiName, params ); 97 98 return( amxName ); 99 } 100 101 protected void 102 removeByName( final String name ) 103 { 104 final Set <ResourceRefConfig> refs = 105 findAllRefConfigs( XTypes.CONNECTOR_RESOURCE_CONFIG, name ); 106 107 if ( refs.size() == 0 ) 108 { 109 getOldResourcesMBean().removeConnectorResourceByJndiName( name ); 110 } 111 else 112 { 113 for( final ResourceRefConfig ref : refs ) 114 { 115 final String target = ref.getContainer().getName(); 116 getOldResourcesMBean().deleteConnectorResource( name, target ); 117 } 118 } 119 } 120 } 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | Popular Tags |