1 23 24 package com.sun.enterprise.management.config; 25 26 import java.util.Set ; 27 import java.util.Map ; 28 import com.sun.appserv.management.util.misc.MapUtil; 29 import javax.management.AttributeList ; 30 31 import javax.management.ObjectName ; 32 33 import com.sun.appserv.management.util.misc.GSetUtil; 34 import com.sun.appserv.management.config.ClusterRefConfigCR; 35 import com.sun.enterprise.management.support.oldconfig.OldClusterMBean; 36 import com.sun.enterprise.management.support.oldconfig.OldLbConfig; 37 38 final class ClusterRefConfigFactory extends ConfigFactory { 39 40 private final OldLbConfig mOldLbConfigMBean; 41 42 private final Set <String > LEGAL_OPTIONAL_KEYS = 43 GSetUtil.newUnmodifiableStringSet( 44 ClusterRefConfigCR.LB_POLICY_KEY, 45 ClusterRefConfigCR.LB_POLICY_MODULE_KEY ); 46 47 protected Map <String ,String > getParamNameOverrides() { 48 return(MapUtil.newMap(CONFIG_NAME_KEY, "ref")); 49 } 50 51 protected Set <String > getLegalOptionalCreateKeys() { 52 return(LEGAL_OPTIONAL_KEYS); 53 } 54 55 public ClusterRefConfigFactory(final ConfigFactoryCallback callbacks) { 56 super(callbacks); 57 final String containerName = getFactoryContainer().getName(); 58 mOldLbConfigMBean = getOldConfigProxies().getOldLbConfig(containerName); 59 } 60 61 protected ObjectName createOldChildConfig(final AttributeList translatedAttrs) { 62 return mOldLbConfigMBean.createClusterRef(translatedAttrs); 63 } 64 65 public ObjectName create(final String referencedClusterName, 66 final Map <String ,String > optional) { 67 68 final String [] requiredParams = new String [] {}; 69 final Map <String ,String > params = initParams(referencedClusterName, requiredParams, optional); 70 final ObjectName amxName = createNamedChild(referencedClusterName, params); 71 return(amxName); 72 } 73 74 public ObjectName create(final String referencedClusterName, 75 final String lbPolicy, final String lbPolicyModule) { 76 77 final Map <String ,String > optionalParams = new java.util.HashMap <String ,String >(); 78 optionalParams.put(ClusterRefConfigCR.LB_POLICY_KEY,lbPolicy); 79 optionalParams.put(ClusterRefConfigCR.LB_POLICY_MODULE_KEY,lbPolicyModule); 80 81 return create(referencedClusterName, optionalParams); 82 } 83 84 public void removeByName(final String referencedClusterName) { 85 mOldLbConfigMBean.removeClusterRefByRef(referencedClusterName); 86 } 87 } | Popular Tags |