1 23 24 29 30 31 package com.sun.enterprise.management.config; 32 33 import java.util.Set ; 34 import java.util.Properties ; 35 import java.util.Map ; 36 import java.util.HashMap ; 37 import java.util.Collections ; 38 39 import javax.management.ObjectName ; 40 import javax.management.AttributeList ; 41 import javax.management.ObjectName ; 42 43 import com.sun.appserv.management.config.DomainConfig; 44 import com.sun.appserv.management.config.ResourceAdapterConfig; 45 46 import com.sun.appserv.management.util.misc.MapUtil; 47 import com.sun.appserv.management.util.misc.GSetUtil; 48 49 import com.sun.appserv.management.config.ConnectorConnectionPoolConfigKeys; 50 import com.sun.appserv.management.config.CommonConfigKeys; 51 52 55 56 public final class ConnectorConnectionPoolConfigFactory extends ResourceFactoryImplBase 57 { 59 public 60 ConnectorConnectionPoolConfigFactory( final ConfigFactoryCallback callbacks) 61 { 62 super( callbacks ); 63 } 64 65 66 69 protected ObjectName 70 createOldChildConfig( 71 final AttributeList translatedAttrs ) 72 { 73 return( getOldResourcesMBean().createConnectorConnectionPool( translatedAttrs ) ); 74 } 75 76 77 public static final String CONNECTION_DEFINITION_NAME_KEY = "ConnectionDefinitionName"; 78 public static final String RESOURCE_ADAPTER_NAME_KEY = "ResourceAdapterName"; 79 80 81 private final Set <String > LEGAL_OPTIONAL_KEYS = 82 GSetUtil.newUnmodifiableStringSet( 83 ConnectorConnectionPoolConfigKeys.STEADY_POOL_SIZE_KEY, 84 ConnectorConnectionPoolConfigKeys.MAX_POOL_SIZE_KEY, 85 ConnectorConnectionPoolConfigKeys.MAX_WAIT_TIME_IN_MILLIS_KEY, 86 ConnectorConnectionPoolConfigKeys.POOL_RESIZE_QUANTITY_KEY, 87 ConnectorConnectionPoolConfigKeys.IDLE_TIMEOUT_IN_SECONDS_KEY, 88 ConnectorConnectionPoolConfigKeys.FAIL_ALL_CONNECTIONS_KEY, 89 ConnectorConnectionPoolConfigKeys.TRANSACTION_SUPPORT_KEY, 90 ConnectorConnectionPoolConfigKeys.TRANSACTION_SUPPORT_KEY, 91 CommonConfigKeys.IGNORE_MISSING_REFERENCES_KEY ); 92 93 protected Set <String > 94 getLegalOptionalCreateKeys() 95 { 96 return( LEGAL_OPTIONAL_KEYS ); 97 } 98 99 100 private void 101 checkResourceAdapterExists( final String resourceAdapterName ) 102 { 103 final Map <String ,ResourceAdapterConfig> resourceAdapters = 104 getDomainRoot().getDomainConfig().getResourceAdapterConfigMap(); 105 106 if( ! resourceAdapters.containsKey( resourceAdapterName ) ) 107 { 108 throw new IllegalArgumentException ( "No resource adapter exists with the name: " + resourceAdapterName ); 109 } 110 } 111 112 public ObjectName 113 create( 114 final String name, 115 final String resourceAdapterName, 116 final String connectionDefinitionName, 117 final Map <String ,String > options ) 118 { 119 final String [] requiredParams = new String [] 120 { 121 RESOURCE_ADAPTER_NAME_KEY, resourceAdapterName, 122 CONNECTION_DEFINITION_NAME_KEY, connectionDefinitionName, 123 }; 124 125 if ( requireValidReferences( options ) ) 126 { 127 checkResourceAdapterExists( resourceAdapterName ); 128 } 129 130 final Map <String ,String > params = initParams( name, requiredParams, options ); 131 132 final ObjectName amxName = createNamedChild( name, params ); 133 134 return( amxName ); 135 } 136 137 138 protected void 139 removeByName( final String name ) 140 { 141 getOldResourcesMBean().removeConnectorConnectionPoolByName( name ); 142 } 143 } 144 145 146 147 148 149 150 151 | Popular Tags |