Search in sources :

Example 1 with DOOMSourceBuilderFactory

use of org.apache.synapse.util.jaxp.DOOMSourceBuilderFactory in project wso2-synapse by wso2.

the class XSLTMediator method addFeature.

/**
 * Add a feature to be set on the {@link TransformerFactory} used by this mediator instance.
 * This method can also be used to enable some Synapse specific optimizations and
 * enhancements as described in the documentation of this class.
 *
 * @param featureName The name of the feature
 * @param isFeatureEnable the desired state of the feature
 *
 * @see TransformerFactory#setFeature(String, boolean)
 * @see XSLTMediator
 */
public void addFeature(String featureName, boolean isFeatureEnable) {
    MediatorProperty mp = new MediatorProperty();
    mp.setName(featureName);
    if (isFeatureEnable) {
        mp.setValue("true");
    } else {
        mp.setValue("false");
    }
    transformerFactoryFeatures.add(mp);
    if (USE_DOM_SOURCE_AND_RESULTS.equals(featureName)) {
        if (isFeatureEnable) {
            sourceBuilderFactory = new DOOMSourceBuilderFactory();
            resultBuilderFactory = new DOOMResultBuilderFactory();
        }
    } else {
        try {
            transFact.setFeature(featureName, isFeatureEnable);
        } catch (TransformerConfigurationException e) {
            String msg = "Error occurred when setting features to the TransformerFactory";
            log.error(msg, e);
            throw new SynapseException(msg, e);
        }
    }
}
Also used : MediatorProperty(org.apache.synapse.mediators.MediatorProperty) TransformerConfigurationException(javax.xml.transform.TransformerConfigurationException) SynapseException(org.apache.synapse.SynapseException) DOOMResultBuilderFactory(org.apache.synapse.util.jaxp.DOOMResultBuilderFactory) DOOMSourceBuilderFactory(org.apache.synapse.util.jaxp.DOOMSourceBuilderFactory)

Aggregations

TransformerConfigurationException (javax.xml.transform.TransformerConfigurationException)1 SynapseException (org.apache.synapse.SynapseException)1 MediatorProperty (org.apache.synapse.mediators.MediatorProperty)1 DOOMResultBuilderFactory (org.apache.synapse.util.jaxp.DOOMResultBuilderFactory)1 DOOMSourceBuilderFactory (org.apache.synapse.util.jaxp.DOOMSourceBuilderFactory)1