FileDocCategorySizeDatePackage
TransformationRuleConfigFactory.javaAPI DocGlassfish v2 API6469Fri May 04 22:23:20 BST 2007com.sun.enterprise.management.config

TransformationRuleConfigFactory

public final class TransformationRuleConfigFactory extends ConfigFactory

Fields Summary
private final com.sun.enterprise.management.support.oldconfig.OldWebServiceEndpointConfigMBean
mOldWebServiceEndpointConfigMBean
private TransformerFactory
_tFactory
private final Set
LEGAL_OPTIONAL_KEYS
private static final String
CREATE_TRANSFORMATION_RULE
private static final String[]
CREATE_TRANSFORMATION_RULE_SIG
private static final String
REMOVE_TRANSFORMATION_RULE
private static final String[]
REMOVE_TRANSFORMATION_RULE_SIG
Constructors Summary
public TransformationRuleConfigFactory(ConfigFactoryCallback callbacks)

		super( callbacks );

         _tFactory = TransformerFactory.newInstance();

        mOldWebServiceEndpointConfigMBean =
        getOldWebServiceEndpointConfigMBean();
	
Methods Summary
public javax.management.ObjectNamecreate(java.lang.String name, java.lang.String ruleFileLocation, boolean enabled, java.lang.String applyTo, java.util.Map reserved)


         String appId = getFactoryContainer().getContainer().getName(); 

         String finalRuleFileLocation = null;
         
         try {
             StreamSource stylesource =
                   new StreamSource(new File(ruleFileLocation));
            Transformer transformer = _tFactory.newTransformer(stylesource);

             finalRuleFileLocation = WebServiceMgrBackEnd.getManager().
                moveFileToRepository(ruleFileLocation, appId);
        } catch (Throwable t) {
            throw new RuntimeException(t);
        }
         
         Map<String,String>  optional = new HashMap<String,String>();
         optional.put(TransformationRuleConfigKeys.ENABLED_KEY,
         Boolean.toString(enabled));
         optional.put(TransformationRuleConfigKeys.APPLY_TO_KEY, applyTo);
         final String[] requiredParams = new String[] {
            TransformationRuleConfigKeys.RULE_FILE_LOCATION_KEY,
            finalRuleFileLocation };

        if (reserved != null) {
            optional.putAll(reserved);
        }

        final Map<String,String> params = initParams(name, requiredParams, optional);

        trace( "params as processed: " + stringify( params ) );

		final ObjectName	amxName	= createChild( params );
		
		return( amxName );
    
protected javax.management.ObjectNamecreateOldChildConfig(javax.management.AttributeList translatedAttrs)
The caller is responsible for dealing with any Properties.

            final ObjectName oldObjectName = (ObjectName)
	        getCallbacks().getDelegate().invoke(
	            CREATE_TRANSFORMATION_RULE, new Object[] { translatedAttrs }, 
                CREATE_TRANSFORMATION_RULE_SIG );
		
		return oldObjectName;

	
protected java.util.SetgetLegalOptionalCreateKeys()

	
	     
	
	
		return( LEGAL_OPTIONAL_KEYS );
	
private final com.sun.enterprise.management.support.oldconfig.OldWebServiceEndpointConfigMBeangetOldWebServiceEndpointConfigMBean()

        final String name   = getFactoryContainer().getName();
		return getOldConfigProxies().getOldWebServiceEndpointConfigMBean( name );

    
protected final voidremoveByName(java.lang.String name)

        String appId = getFactoryContainer().getContainer().getName(); 
        String epName = getFactoryContainer().getName(); 
        WebServiceMgrBackEnd.getManager().
                removeFileFromRepository(appId,epName,name);
		mOldWebServiceEndpointConfigMBean.removeTransformationRuleByName(name);