use of org.apache.axiom.om.OMAttribute in project wso2-synapse by wso2.
the class TemplateMediatorFactory method createSpecificMediator.
protected Mediator createSpecificMediator(OMElement elem, Properties properties) {
TemplateMediator templateTemplateMediator = new TemplateMediator();
OMAttribute nameAttr = elem.getAttribute(ATT_NAME);
if (nameAttr != null) {
templateTemplateMediator.setName(nameAttr.getAttributeValue());
processAuditStatus(templateTemplateMediator, elem);
initParameters(elem, templateTemplateMediator);
OMElement templateBodyElem = elem.getFirstChildWithName(TEMPLATE_BODY_Q);
addChildren(templateBodyElem, templateTemplateMediator, properties);
} else {
String msg = "A EIP template should be a named mediator .";
log.error(msg);
throw new SynapseException(msg);
}
return templateTemplateMediator;
}
use of org.apache.axiom.om.OMAttribute in project wso2-synapse by wso2.
the class TransactionMediatorFactory method createSpecificMediator.
/**
* Create a Transaction mediator instance referring to the bean and configuration given
* by the OMElement declaration
*
* @param elem the OMElement that specifies the Transaction mediator configuration
* @param properties
* @return the Transaction mediator instance created
*/
public Mediator createSpecificMediator(OMElement elem, Properties properties) {
TransactionMediator tm = new TransactionMediator();
OMAttribute action = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "action"));
if (action == null) {
handleException("The 'action' attribute " + "is required for Transaction mediator definition");
} else {
// after successfully creating the mediator
// set its common attributes such as tracing etc
processAuditStatus(tm, elem);
tm.setAction(action.getAttributeValue());
return tm;
}
return null;
}
use of org.apache.axiom.om.OMAttribute in project wso2-synapse by wso2.
the class AddressEndpointFactory method createEndpoint.
@Override
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) {
AddressEndpoint addressEndpoint = new AddressEndpoint();
OMAttribute name = epConfig.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
if (name != null) {
addressEndpoint.setName(name.getAttributeValue());
}
OMElement addressElement = epConfig.getFirstChildWithName(new QName(SynapseConstants.SYNAPSE_NAMESPACE, "address"));
if (addressElement != null) {
EndpointDefinition definition = createEndpointDefinition(addressElement);
addressEndpoint.setDefinition(definition);
processAuditStatus(definition, addressEndpoint.getName(), addressElement);
}
processProperties(addressEndpoint, epConfig);
return addressEndpoint;
}
use of org.apache.axiom.om.OMAttribute in project wso2-synapse by wso2.
the class ClassEndpointFactory method createEndpoint.
protected Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint, Properties properties) {
ClassEndpoint clazzEndpoint = new ClassEndpoint();
OMAttribute endpointName = epConfig.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
if (endpointName != null) {
clazzEndpoint.setName(endpointName.getAttributeValue());
}
OMElement classElement = epConfig.getFirstChildWithName(CLASS_QNAME);
if (classElement == null) {
return null;
}
String nameAttr = classElement.getAttributeValue(NAME_QNAME);
if (nameAttr == null) {
return null;
}
Endpoint endpoint = null;
try {
Class clazz = Class.forName(nameAttr);
endpoint = (Endpoint) clazz.newInstance();
for (Iterator iter = classElement.getChildrenWithName(PARAMETER_QNAME); iter.hasNext(); ) {
OMElement paramEle = (OMElement) iter.next();
setParameter(endpoint, paramEle, clazzEndpoint);
}
} catch (Exception e) {
handleException("Cannot create class endpoint", e);
}
clazzEndpoint.setClassEndpoint(endpoint);
return clazzEndpoint;
}
use of org.apache.axiom.om.OMAttribute in project wso2-synapse by wso2.
the class DefaultEndpointFactory method extractSpecificEndpointProperties.
@Override
protected void extractSpecificEndpointProperties(EndpointDefinition definition, OMElement elem) {
OMAttribute format = elem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "format"));
if (format != null) {
String forceValue = format.getAttributeValue().trim().toLowerCase();
if (SynapseConstants.FORMAT_POX.equals(forceValue)) {
definition.setForcePOX(true);
definition.setFormat(SynapseConstants.FORMAT_POX);
} else if (SynapseConstants.FORMAT_GET.equals(forceValue)) {
definition.setForceGET(true);
definition.setFormat(SynapseConstants.FORMAT_GET);
} else if (SynapseConstants.FORMAT_SOAP11.equals(forceValue)) {
definition.setForceSOAP11(true);
definition.setFormat(SynapseConstants.FORMAT_SOAP11);
} else if (SynapseConstants.FORMAT_SOAP12.equals(forceValue)) {
definition.setForceSOAP12(true);
definition.setFormat(SynapseConstants.FORMAT_SOAP12);
} else if (SynapseConstants.FORMAT_REST.equals(forceValue)) {
definition.setForceREST(true);
definition.setFormat(SynapseConstants.FORMAT_REST);
}
/*else if(!TemplateMappingsPopulator.populateMapping(definition, EndpointDefinition.EndpointDefKey.format, forceValue)) {
handleException("force value -\"" + forceValue + "\" not yet implemented");
}*/
}
}
Aggregations