/** * Creates a new Target from the OMElement * @param attributeName Name of the attribute where the property name/ XPath expression is * stored. * @param element OMElement where the the XPath expression and the namespaces are stored. */ public Target(String attributeName, OMElement element) { this.value = new ValueFactory().createValue(attributeName, element); }
/** * Creates a new Target from the OMElement * @param attributeName Name of the attribute where the property name/ XPath expression is * stored. * @param element OMElement where the the XPath expression and the namespaces are stored. */ public Target(String attributeName, OMElement element) { this.value = new ValueFactory().createValue(attributeName, element); }
private void buildParamteres(OMElement connectorElem, InvokeMediator invokeMediator) { Iterator parameters = connectorElem.getChildElements(); while (parameters.hasNext()) { OMNode paramNode = (OMNode) parameters.next(); if (paramNode instanceof OMElement) { String paramName = ((OMElement) paramNode).getLocalName(); //((OMElement) paramNode).getAttributeValue(new QName("name")); String paramValueStr = ((OMElement) paramNode).getText();//((OMElement) paramNode).getAttributeValue(new QName("value")); if (paramName != null && !paramName.equals("") && paramValueStr != null && !paramValueStr.equals("")) { Value paramValue = new ValueFactory().createTextValue((OMElement) paramNode); invokeMediator.addExpressionForParamName(paramName, paramValue); } } } } }
private void buildParameters(OMElement elem) { Iterator subElements = elem.getChildElements(); while (subElements.hasNext()) { OMElement child = (OMElement) subElements.next(); if (child.getQName().equals(WITH_PARAM_Q)) { OMAttribute paramNameAttr = child.getAttribute(ATT_NAME); if (paramNameAttr != null) { //set parameter value Value paramValue = new ValueFactory().createValue("value", child); invoker.addExpressionForParamName(paramNameAttr.getAttributeValue(), paramValue); } } } }
private void buildParameters(OMElement elem) { Iterator subElements = elem.getChildElements(); while (subElements.hasNext()) { OMElement child = (OMElement) subElements.next(); Value paramValue = new ValueFactory().createTextValue(child); invoker.addExpressionForParamName(child.getLocalName(), paramValue); } } }
private Map<Value, Object> getIncludeKeysMap(OMElement elem) { // get <include /> scripts // map key = registry entry key, value = script source // at this time map values are null, later loaded // from void ScriptMediator.prepareExternalScript(MessageContext synCtx) // TreeMap used to keep given scripts order if needed Map<Value, Object> includeKeysMap = new LinkedHashMap<Value, Object>(); Iterator itr = elem.getChildrenWithName(INCLUDE_Q); while (itr.hasNext()) { OMElement includeElem = (OMElement) itr.next(); OMAttribute key = includeElem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "key")); // 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, includeElem); if (key == null) { throw new SynapseException("Cannot use 'include' element without 'key'" + " attribute for a script mediator"); } includeKeysMap.put(generatedKey, null); } return includeKeysMap; }
private Map<Value, Object> getIncludeKeysMap(OMElement elem) { // get <include /> scripts // map key = registry entry key, value = script source // at this time map values are null, later loaded // from void ScriptMediator.prepareExternalScript(MessageContext synCtx) // TreeMap used to keep given scripts order if needed Map<Value, Object> includeKeysMap = new LinkedHashMap<Value, Object>(); Iterator itr = elem.getChildrenWithName(INCLUDE_Q); while (itr.hasNext()) { OMElement includeElem = (OMElement) itr.next(); OMAttribute key = includeElem.getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "key")); // 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, includeElem); if (key == null) { throw new SynapseException("Cannot use 'include' element without 'key'" + " attribute for a script mediator"); } includeKeysMap.put(generatedKey, null); } return includeKeysMap; }
private void buildParameters(OMElement elem) { Iterator subElements = elem.getChildElements(); while (subElements.hasNext()) { OMElement child = (OMElement) subElements.next(); if (child.getQName().equals(WITH_PARAM_Q)) { OMAttribute paramNameAttr = child.getAttribute(ATT_NAME); Value paramValue = new ValueFactory().createValue("value", child); if (paramNameAttr != null) { if (StringUtils.isNotEmpty(paramNameAttr.getAttributeValue())) { //set parameter value invoker.addExpressionForParamName(paramNameAttr.getAttributeValue(), paramValue); } else { String msg = "Call template mediator parameters should have non empty name."; log.error(msg); throw new SynapseException(msg); } } } } }
log.warn(msg); } else { Value paramValue = new ValueFactory().createValue("default", paramEle); param.setDefaultValue(paramValue);
private void populateSetPropertyCase(BeanMediator mediator, OMElement elem) { mediator.setAction(BeanMediator.Action.SET_PROPERTY); populatePropertyName(mediator, elem); if (elem.getAttributeValue(ATT_VALUE) != null) { mediator.setValue(new ValueFactory().createValue(BeanConstants.VALUE, elem)); } else { handleException("'value' attribute of Bean mediator is required when 'SET_PROPERTY' " + "action is set."); } }
private void populateSetPropertyCase(BeanMediator mediator, OMElement elem) { mediator.setAction(BeanMediator.Action.SET_PROPERTY); populatePropertyName(mediator, elem); if (elem.getAttributeValue(ATT_VALUE) != null) { mediator.setValue(new ValueFactory().createValue(BeanConstants.VALUE, elem)); } else { handleException("'value' attribute of Bean mediator is required when 'SET_PROPERTY' " + "action is set."); } }
ValueFactory keyFac = new ValueFactory();
ValueFactory keyFac = new ValueFactory();
public InvokeMediator getDynamicInvokeMediator(OMElement connectorElem, String libraryName) { InvokeMediator invokeMediator = new InvokeMediator(); if (connectorElem.getLocalName() != null && libraryName != null && !libraryName.equals("")) { invokeMediator.setTargetTemplate(libraryName + "." + connectorElem.getLocalName()); } // load configuration based references for the given connector OMAttribute config_key = connectorElem.getAttribute(new QName(XMLConfigConstants.CONFIG_REF)); if (config_key != 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.CONFIG_REF, connectorElem); // setKey invokeMediator.setKey(generatedKey); } buildParamteres(connectorElem, invokeMediator); invokeMediator.setPackageName(libraryName); invokeMediator.setDynamicMediator(true); return invokeMediator; }
public Mediator createSpecificMediator(OMElement elem, Properties properties) { SendMediator sm = new SendMediator(); // after successfully creating the mediator // set its common attributes such as tracing etc processAuditStatus(sm,elem); OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q); if (epElement != null) { // create the endpoint and set it in the send mediator Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { sm.setEndpoint(endpoint); } } String receivingSequence = elem.getAttributeValue(RECEIVING_SEQUENCE); if (receivingSequence != null) { ValueFactory valueFactory = new ValueFactory(); Value value = valueFactory.createValue(XMLConfigConstants.RECEIVE, elem); sm.setReceivingSequence(value); } String buildMessage = elem.getAttributeValue(BUILD_MESSAGE); if ("true".equals(buildMessage)) { sm.setBuildMessage(true); } return sm; }
public Mediator createSpecificMediator(OMElement elem, Properties properties) { SendMediator sm = new SendMediator(); // after successfully creating the mediator // set its common attributes such as tracing etc processAuditStatus(sm,elem); OMElement epElement = elem.getFirstChildWithName(ENDPOINT_Q); if (epElement != null) { // create the endpoint and set it in the send mediator Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { sm.setEndpoint(endpoint); } } String receivingSequence = elem.getAttributeValue(RECEIVING_SEQUENCE); if (receivingSequence != null) { ValueFactory valueFactory = new ValueFactory(); Value value = valueFactory.createValue(XMLConfigConstants.RECEIVE, elem); sm.setReceivingSequence(value); } return sm; }
ValueFactory keyFac = new ValueFactory();
Value dynamicEndpointSet = new ValueFactory().createValue("value", dynamicSetElement); String maxCacheStr = dynamicSetElement.getAttributeValue(new QName("max-cache")); int maxCache = RecipientListEndpoint.DEFAULT_MAX_POOL ;
if (n != null) { ValueFactory keyFac = new ValueFactory();
if (n != null) { ValueFactory keyFac = new ValueFactory();