return TAG_NAME;
}
public Mediator createSpecificMediator(OMElement elem, Properties properties) {
XSLTMediator transformMediator = new XSLTMediator();
OMAttribute attXslt = elem.getAttribute(ATT_KEY);
OMAttribute attSource = elem.getAttribute(ATT_SOURCE);
OMAttribute attTarget = elem.getAttribute(ATT_TARGET);
if (attXslt != null) {
// ValueFactory for creating dynamic or static Value
ValueFactory keyFac = new ValueFactory();
// create dynamic or static key based on OMElement
Value generatedKey = keyFac.createValue(XMLConfigConstants.KEY, elem);
// set generated key as the Value
transformMediator.setXsltKey(generatedKey);
} else {
handleException("The '" + XMLConfigConstants.KEY + "' " +
"attribute is required for the XSLT mediator");
}
if (attSource != null) {
try {
transformMediator.setSourceXPathString(attSource.getAttributeValue());
transformMediator.setSource(SynapseXPathFactory.getSynapseXPath(elem, ATT_SOURCE));
} catch (JaxenException e) {
handleException("Invalid XPath specified for the source attribute : " +
attSource.getAttributeValue());
}
}
if (attTarget != null) {
transformMediator.setTargetPropertyName(attTarget.getAttributeValue());
}
// after successfully creating the mediator
// set its common attributes such as tracing etc
processAuditStatus(transformMediator, elem);
// set the features
for (Map.Entry<String,String> entry : collectNameValuePairs(elem, FEATURE_Q).entrySet()) {
String value = entry.getValue();
boolean isFeatureEnabled;
if ("true".equals(value)) {
isFeatureEnabled = true;
} else if ("false".equals(value)) {
isFeatureEnabled = false;
} else {
handleException("The feature must have value true or false");
break;
}
transformMediator.addFeature(entry.getKey(), isFeatureEnabled);
}
for (Map.Entry<String,String> entry : collectNameValuePairs(elem, ATTRIBUTE_Q).entrySet()) {
transformMediator.addAttribute(entry.getKey(), entry.getValue());
}
transformMediator.addAllProperties(
MediatorPropertyFactory.getMediatorProperties(elem));
transformMediator.setResourceMap(ResourceMapFactory.createResourceMap(elem));
return transformMediator;
}