1 23 24 29 30 31 package com.sun.enterprise.management.config; 32 33 import java.util.Set ; 34 import java.util.Map ; 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.util.misc.MapUtil; 41 42 import com.sun.appserv.management.config.ResourceRefConfig; 43 44 47 48 public final class CustomResourceConfigFactory extends ResourceFactoryImplBase 49 { 51 public 52 CustomResourceConfigFactory( final ConfigFactoryCallback callbacks ) 53 { 54 super( callbacks ); 55 } 56 57 58 59 60 63 protected ObjectName 64 createOldChildConfig( 65 final AttributeList translatedAttrs ) 66 { 67 trace( "CustomResourceConfigFactory.createOldChildConfig: creating using: " + 68 stringify( translatedAttrs ) ); 69 70 final ObjectName objectName = 71 getOldResourcesMBean().createCustomResource( translatedAttrs ); 72 73 return objectName; 74 } 75 76 protected Map <String ,String > 77 getParamNameOverrides() 78 { 79 return( MapUtil.newMap( CONFIG_NAME_KEY, "jndi-name" ) ); 80 } 81 82 public static final String RES_TYPE_KEY = "ResType"; 83 public static final String FACTORY_CLASS_KEY = "FactoryClass"; 84 85 93 public ObjectName create( 94 String jndiName, 95 String resType, 96 String factoryClass, 97 Map <String ,String > optional) 98 { 99 final String [] requiredParams = new String [] 100 { 101 RES_TYPE_KEY, resType, 102 FACTORY_CLASS_KEY, factoryClass, 103 }; 104 105 final Map <String ,String > params = initParams( jndiName, requiredParams, optional ); 106 107 final ObjectName amxName = createNamedChild( jndiName, params ); 108 109 return( amxName ); 110 } 111 112 113 protected void 114 removeByName( final String name ) 115 { 116 final Set <ResourceRefConfig> refs = 117 findAllRefConfigs( XTypes.CUSTOM_RESOURCE_CONFIG, name ); 118 119 if ( refs.size() == 0 ) 120 { 121 getOldResourcesMBean().removeCustomResourceByJndiName( name ); 122 } 123 else 124 { 125 for( final ResourceRefConfig ref : refs ) 126 { 127 final String target = ref.getContainer().getName(); 128 getOldResourcesMBean().deleteCustomResource( name, target ); 129 } 130 } 131 } 132 } 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | Popular Tags |