protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof ResolvingEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); ResolvingEndpoint resolvingEndpoint = (ResolvingEndpoint) endpoint; SynapseXPathSerializer.serializeXPath(resolvingEndpoint.getKeyExpression(), endpointElement, "key-expression"); if (resolvingEndpoint.getName() != null && !resolvingEndpoint.isAnonymous()) { endpointElement.addAttribute("name", resolvingEndpoint.getName(), null); } // serialize the parameters serializeProperties(resolvingEndpoint, endpointElement); return endpointElement; } }
public static OMElement serializeTextXPath(SynapseXPath xpath, String expression, OMElement elem, String attribName) { if (xpath != null && expression != null) { elem.setText(expression); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
protected OMElement serializeEndpoint(Endpoint endpoint) { if (!(endpoint instanceof ResolvingEndpoint)) { handleException("Invalid endpoint type."); } fac = OMAbstractFactory.getOMFactory(); OMElement endpointElement = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE); ResolvingEndpoint resolvingEndpoint = (ResolvingEndpoint) endpoint; SynapseXPathSerializer.serializeXPath(resolvingEndpoint.getKeyExpression(), endpointElement, "key-expression"); if (resolvingEndpoint.getName() != null && !resolvingEndpoint.isAnonymous()) { endpointElement.addAttribute("name", resolvingEndpoint.getName(), null); } // serialize the parameters serializeProperties(resolvingEndpoint, endpointElement); return endpointElement; } }
public static OMElement serializeXPath(SynapseXPath xpath, String expression, OMElement elem, String attribName) { OMNamespace nullNS = elem.getOMFactory() .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); if (xpath != null && expression != null) { elem.addAttribute(elem.getOMFactory().createOMAttribute( attribName, nullNS, expression)); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
/** * Creates the XML representation of the given mediator property * * @param property Property for which the XML representation should be created * @return XML representation of the property as an OMElement */ private OMElement createElementForProperty(Property property) { OMElement attributeElement = fac.createOMElement(PublishEventMediatorFactory.ATTRIBUTE_QNAME.getLocalPart(), synNS); attributeElement.addAttribute( fac.createOMAttribute(PublishEventMediatorFactory.getNameAttributeQ().getLocalPart(), nullNS, property.getKey())); attributeElement.addAttribute( fac.createOMAttribute(PublishEventMediatorFactory.TYPE_QNAME.getLocalPart(), nullNS, property.getType())); attributeElement.addAttribute( fac.createOMAttribute(PublishEventMediatorFactory.DEFAULT_QNAME.getLocalPart(), nullNS, property.getDefaultValue())); if (property.getExpression() != null) { SynapseXPathSerializer.serializeXPath(property.getExpression(), attributeElement, PublishEventMediatorFactory.getExpressionAttributeQ().getLocalPart()); } else { attributeElement.addAttribute( fac.createOMAttribute(PublishEventMediatorFactory.getValueAttributeQ().getLocalPart(), nullNS, property.getValue())); } return attributeElement; } }
public static OMElement serializeXPath(SynapseXPath xpath, String expression, OMElement elem, String attribName) { OMNamespace nullNS = elem.getOMFactory() .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); if (xpath != null && expression != null) { elem.addAttribute(elem.getOMFactory().createOMAttribute( attribName, nullNS, expression)); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
SynapseXPathSerializer.serializeXPath(expression,property,"expression");
public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) { OMNamespace nullNS = elem.getOMFactory() .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); if (xpath != null) { elem.addAttribute(elem.getOMFactory().createOMAttribute( attribName, nullNS, xpath.toString())); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
SynapseXPathSerializer.serializeXPath( mediator.getExpression(), header, "expression");
public static OMElement serializeXPath(SynapseXPath xpath, OMElement elem, String attribName) { OMNamespace nullNS = elem.getOMFactory() .createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, ""); if (xpath != null) { elem.addAttribute(elem.getOMFactory().createOMAttribute( attribName, nullNS, xpath.toString())); serializeNamespaces(elem, xpath); } else { handleException("Couldn't find the xpath in the SynapseXPath"); } return elem; }
mediator.getContextGetterProperties().get(propName))); } else if (mediator.getMessageGetterProperties().containsKey(propName)) { SynapseXPathSerializer.serializeXPath( mediator.getMessageGetterProperties().get(propName), prop, "expression"); OMElement prop = fac.createOMElement(PROP_Q); prop.addAttribute(fac.createOMAttribute("name", nullNS, propName)); SynapseXPathSerializer.serializeXPath( mediator.getMessageSetterProperties().get(propName), prop, "expression"); prop.addAttribute(fac.createOMAttribute("action", nullNS, "ReadAndUpdateContext")); } else if (mediator.getMessageGetterProperties().containsKey(propName)) { SynapseXPathSerializer.serializeXPath( mediator.getMessageGetterProperties().get(propName), prop, "expression"); prop.addAttribute(fac.createOMAttribute("action", nullNS, "ReadContext")); OMElement prop = fac.createOMElement(PROP_Q); prop.addAttribute(fac.createOMAttribute("name", nullNS, propName)); SynapseXPathSerializer.serializeXPath( mediator.getMessageGetterProperties().get(propName), prop, "expression"); prop.addAttribute(fac.createOMAttribute("action", nullNS, "UpdateMessage"));
private OMElement serializeTarget(Target target) { OMElement targetEle = fac.createOMElement("target", synNS); if (target.getTargetType() != EnrichMediator.CUSTOM) { targetEle.addAttribute(fac.createOMAttribute("type", nullNS, intTypeToString(target.getTargetType()))); } if (!target.getAction().equals(Target.ACTION_REPLACE)) { targetEle.addAttribute(fac.createOMAttribute("action", nullNS, target.getAction())); } if (target.getTargetType() == EnrichMediator.PROPERTY) { targetEle.addAttribute(fac.createOMAttribute("property", nullNS, target.getProperty())); } else if (target.getTargetType() == EnrichMediator.CUSTOM) { SynapseXPathSerializer.serializeXPath(target.getXpath(), targetEle, "xpath"); } return targetEle; }
argElem.addAttribute(fac.createOMAttribute(VALUE, nullNS, arg.getValue())); } else if (arg.getExpression() != null) { SynapseXPathSerializer.serializeXPath(arg.getExpression(), argElem, EXPRESSION);
SynapseXPathSerializer.serializeXPath(mp.getExpression(), prop, "expression");
SynapseXPathSerializer.serializeXPath( mediator.getExpression(), header, "expression");
protected void serializeMediatorProperties(OMElement parent, Collection<MediatorProperty> props, QName childElementName) { for (MediatorProperty mp : props) { OMElement prop = fac.createOMElement(childElementName, parent); if (mp.getName() != null) { prop.addAttribute(fac.createOMAttribute("name", nullNS, mp.getName())); } else { handleException("Mediator property name missing"); } if (mp.getValue() != null) { prop.addAttribute(fac.createOMAttribute("value", nullNS, mp.getValue())); } else if (mp.getExpression() != null) { SynapseXPathSerializer.serializeXPath(mp.getExpression(), prop, "expression"); } else { handleException("Mediator property must have a literal value or be an expression"); } } }
SynapseXPathSerializer.serializeXPath( mediator.getCorrelateExpression(), corelateOn, "expression"); aggregator.addChild(corelateOn); SynapseXPathSerializer.serializeXPath( mediator.getAggregationExpression(), onCompleteElem, "expression");
SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath"); SynapseXPathSerializer.serializeXPath(itrMed.getExpression(), itrElem, "expression"); } else { handleException("Missing expression of the IterateMediator which is required.");
mediator.getContextGetterProperties().get(propName))); } else if (mediator.getMessageGetterProperties().containsKey(propName)) { SynapseXPathSerializer.serializeXPath( mediator.getMessageGetterProperties().get(propName), prop, "expression"); OMElement prop = fac.createOMElement(PROP_Q); prop.addAttribute(fac.createOMAttribute("name", nullNS, propName)); SynapseXPathSerializer.serializeXPath( mediator.getMessageSetterProperties().get(propName), prop, "expression"); prop.addAttribute(fac.createOMAttribute("action", nullNS, "ReadAndUpdateContext")); } else if (mediator.getMessageGetterProperties().containsKey(propName)) { SynapseXPathSerializer.serializeXPath( mediator.getMessageGetterProperties().get(propName), prop, "expression"); prop.addAttribute(fac.createOMAttribute("action", nullNS, "ReadContext")); OMElement prop = fac.createOMElement(PROP_Q); prop.addAttribute(fac.createOMAttribute("name", nullNS, propName)); SynapseXPathSerializer.serializeXPath( mediator.getMessageGetterProperties().get(propName), prop, "expression"); prop.addAttribute(fac.createOMAttribute("action", nullNS, "UpdateMessage"));
/** * Serialize the Value object to an OMElement representing the entry * * @param key Value to serialize * @param elem OMElement * @return OMElement */ public OMElement serializeValue(Value key, String name, OMElement elem) { if (key != null) { if (key.getExpression() == null) { //static key elem.addAttribute(fac.createOMAttribute(name, nullNS, key.getKeyValue())); } else { String startChar = "{" , endChar = "}"; //if this is an expr type key we add an additional opening and closing brace if(key.hasExprTypeKey()){ startChar = startChar + "{"; endChar = endChar + "}"; } //dynamic key SynapseXPathSerializer.serializeXPath(key.getExpression(), startChar + key.getExpression().toString() + endChar, elem, name); } } return elem; }