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; } }
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; } }
/** * 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; } }
SynapseXPathSerializer.serializeXPath(expression,property,"expression");
SynapseXPathSerializer.serializeXPath( mediator.getExpression(), header, "expression");
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");
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(itrMed.getAttachPath(), itrElem, "attachPath"); SynapseXPathSerializer.serializeXPath(itrMed.getExpression(), itrElem, "expression"); } else { handleException("Missing expression of the IterateMediator which is required.");
/** * 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; }
SynapseXPathSerializer.serializeXPath(mediator.getSource(), validate, "source");
SynapseXPathSerializer.serializeXPath(itrMed.getAttachPath(), itrElem, "attachPath"); SynapseXPathSerializer.serializeXPath(itrMed.getExpression(), itrElem, "expression"); } else { handleException("Missing expression of the IterateMediator which is required.");
SynapseXPathSerializer.serializeXPath(mediator.getSource(), switchMed, "source");
SynapseXPathSerializer.serializeXPath(mediator.getSource(), filter, "source"); SynapseXPathSerializer.serializeXPath(mediator.getXpath(), filter, "xpath");
SynapseXPathSerializer.serializeXPath(forEachMed.getExpression(), forEachElem, "expression"); } else {
private OMElement serializeSource(Source source) { OMElement sourceEle = fac.createOMElement("source", synNS); if (source.getSourceType() != EnrichMediator.CUSTOM) { sourceEle.addAttribute(fac.createOMAttribute("type", nullNS, intTypeToString(source.getSourceType()))); } if (!source.isClone()) { sourceEle.addAttribute(fac.createOMAttribute("clone", nullNS, Boolean.toString(source.isClone()))); } if (source.getSourceType() == EnrichMediator.PROPERTY) { sourceEle.addAttribute(fac.createOMAttribute("property", nullNS, source.getProperty())); } else if (source.getSourceType() == EnrichMediator.CUSTOM) { SynapseXPathSerializer.serializeXPath(source.getXpath(), sourceEle, "xpath"); } else if (source.getSourceType() == EnrichMediator.INLINE) { if (source.getInlineOMNode() instanceof OMElement) { sourceEle.addChild(((OMElement) source.getInlineOMNode()).cloneOMElement()); } else if (source.getInlineOMNode() instanceof OMText) { /*Text as inline content*/ sourceEle.setText(((OMText) source.getInlineOMNode()).getText()); } else if (source.getInlineKey() != null) { sourceEle.addAttribute("key", source.getInlineKey(), null); } } return sourceEle; }
SynapseXPathSerializer.serializeXPath(mediator.getSource(), xslt, "source");
SynapseXPathSerializer.serializeXPath(mediator.getSource(), xslt, "source");
property.addChild(mediator.getValueElement()); } else if (mediator.getExpression() != null) { SynapseXPathSerializer.serializeXPath(mediator.getExpression(), property, "expression"); } else if (mediator.getAction() == PropertyMediator.ACTION_SET) {