1 23 24 29 30 31 package com.sun.enterprise.management.config; 32 33 import java.util.Map ; 34 import java.util.Set ; 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.util.misc.MapUtil; 42 43 import com.sun.appserv.management.config.AMXConfig; 44 import com.sun.appserv.management.config.ResourceConfigKeys; 45 import com.sun.appserv.management.config.ResourceRefConfig; 46 47 import com.sun.appserv.management.base.XTypes; 48 49 import com.sun.enterprise.management.config.AMXConfigImplBase; 50 import com.sun.enterprise.management.support.Delegate; 51 52 53 56 57 public final class AdminObjectResourceConfigFactory extends ResourceFactoryImplBase 58 { 59 public 60 AdminObjectResourceConfigFactory( final ConfigFactoryCallback callbacks ) 61 { 62 super( callbacks ); 63 } 64 65 66 protected Map <String ,String > 67 getParamNameOverrides() 68 { 69 return( MapUtil.newMap( CONFIG_NAME_KEY, "jndi_name" ) ); 70 } 71 72 75 protected ObjectName 76 createOldChildConfig( 77 final AttributeList translatedAttrs ) 78 { 79 return( getOldResourcesMBean().createAdminObjectResource( translatedAttrs ) ); 80 } 81 82 83 91 public ObjectName 92 create( 93 final String jndiName, 94 final String resType, 95 final String resAdapter, 96 final Map <String ,String > reserved ) 97 { 98 final String [] requiredParams = new String [] 99 { 100 RESOURCE_TYPE_KEY, resType, 101 RESOURCE_ADAPTER_KEY, resAdapter, 102 }; 103 104 final Map <String ,String > params = initParams( jndiName, requiredParams, reserved ); 105 106 final ObjectName amxName = createNamedChild( jndiName, params ); 107 108 return( amxName ); 109 } 110 111 112 protected void 113 removeByName( final String name ) 114 { 115 final Set <ResourceRefConfig> refs = 116 findAllRefConfigs( XTypes.ADMIN_OBJECT_RESOURCE_CONFIG, name ); 117 118 if ( refs.size() == 0 ) 119 { 120 getOldResourcesMBean().removeAdminObjectResourceByJndiName( name ); 121 } 122 else 123 { 124 for( final ResourceRefConfig ref : refs ) 125 { 126 final String target = ref.getContainer().getName(); 127 getOldResourcesMBean().deleteAdminObjectResource( name, target ); 128 } 129 } 130 } 131 } 132 133 | Popular Tags |