/** * Constructs the Endpoint implementation for the given OMNode. * * @param om OMNode containing endpoint configuration. This should be an OMElement. * @return Endpoint implementation for the given OMNode. */ public Object getObjectFromOMNode(OMNode om, Properties properties) { if (om instanceof OMElement) { OMElement epElement = (OMElement) om; return EndpointFactory.getEndpointFromElement(epElement, false, properties); } else { throw new SynapseException("Configuration is not in proper format."); } } }
/** * Constructs the Endpoint implementation for the given OMNode. * * @param om OMNode containing endpoint configuration. This should be an OMElement. * @return Endpoint implementation for the given OMNode. */ public Object getObjectFromOMNode(OMNode om, Properties properties) { if (om instanceof OMElement) { OMElement epElement = (OMElement) om; return EndpointFactory.getEndpointFromElement(epElement, false, properties); } else { throw new SynapseException("Configuration is not in proper format."); } } }
public Endpoint create(TemplateEndpoint templateEndpoint, Properties properties) { // first go through all the elements and replace with the parameters OMElement clonedElement = element.cloneOMElement(); replaceElement(templateEndpoint, clonedElement); return EndpointFactory.getEndpointFromElement(clonedElement, false, properties); }
public Endpoint create(TemplateEndpoint templateEndpoint, Properties properties) { // first go through all the elements and replace with the parameters OMElement clonedElement = element.cloneOMElement(); replaceElement(templateEndpoint, clonedElement); return EndpointFactory.getEndpointFromElement(clonedElement, false, properties); }
/** * Helper method to construct children endpoints * * @param listEndpointElement OMElement representing the children endpoints * @param parent Parent endpoint * @param properties bag of properties to pass in any information to the factory * @return List of children endpoints */ protected ArrayList<Endpoint> getEndpoints(OMElement listEndpointElement, Endpoint parent, Properties properties) { ArrayList<Endpoint> endpoints = new ArrayList<Endpoint>(); ArrayList<String> keys = new ArrayList<String>(); Iterator iter = listEndpointElement.getChildrenWithName(XMLConfigConstants.ENDPOINT_ELT); while (iter.hasNext()) { OMElement endptElem = (OMElement) iter.next(); Endpoint endpoint = EndpointFactory.getEndpointFromElement(endptElem, true, properties); if (endpoint instanceof IndirectEndpoint) { String key = ((IndirectEndpoint) endpoint).getKey(); if (!keys.contains(key)) { keys.add(key); } else { handleException("Same endpoint definition cannot be used with in the siblings"); } } endpoint.setParentEndpoint(parent); endpoints.add(endpoint); } return endpoints; }
/** * Helper method to construct children endpoints * * @param listEndpointElement OMElement representing the children endpoints * @param parent Parent endpoint * @param properties bag of properties to pass in any information to the factory * @return List of children endpoints */ protected ArrayList<Endpoint> getEndpoints(OMElement listEndpointElement, Endpoint parent, Properties properties) { ArrayList<Endpoint> endpoints = new ArrayList<Endpoint>(); ArrayList<String> keys = new ArrayList<String>(); Iterator iter = listEndpointElement.getChildrenWithName(XMLConfigConstants.ENDPOINT_ELT); while (iter.hasNext()) { OMElement endptElem = (OMElement) iter.next(); Endpoint endpoint = EndpointFactory.getEndpointFromElement(endptElem, true, properties); if (endpoint instanceof IndirectEndpoint) { String key = ((IndirectEndpoint) endpoint).getKey(); if (!keys.contains(key)) { keys.add(key); } else { handleException("Same endpoint definition cannot be used with in the siblings"); } } endpoint.setParentEndpoint(parent); endpoints.add(endpoint); } return endpoints; }
public static Endpoint defineEndpoint(SynapseConfiguration config, OMElement ele, Properties properties) { String name = ele.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); Endpoint endpoint = null; if (name != null) { try { endpoint = EndpointFactory.getEndpointFromElement(ele, false, properties); if (endpoint != null) { config.addEndpoint(name.trim(), endpoint); } } catch (Exception e) { String msg = "Endpoint configuration: " + name + " cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EP, msg, e); } return endpoint; } else { String msg = "Invalid endpoint definition without a name"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EP, msg); } return null; }
public static Endpoint defineEndpoint(SynapseConfiguration config, OMElement ele, Properties properties) { String name = ele.getAttributeValue(new QName(XMLConfigConstants.NULL_NAMESPACE, "name")); Endpoint endpoint = null; if (name != null) { try { endpoint = EndpointFactory.getEndpointFromElement(ele, false, properties); if (endpoint != null) { config.addEndpoint(name.trim(), endpoint); } } catch (Exception e) { String msg = "Endpoint configuration: " + name + " cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EP, msg, e); } return endpoint; } else { String msg = "Invalid endpoint definition without a name"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_SEQUENCES, msg); } return null; }
Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties); if (ep != null) { ep.setFileName((new File(fileName)).getName());
Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties);
Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties); if (ep == null) { handleSynapseArtifactDeploymentError("Endpoint update failed. The artifact " +
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "endpoint")); if (endpoint != null) { this.endpoint = EndpointFactory.getEndpointFromElement(endpoint, true, new Properties());
String existingArtifactName, Properties properties) { Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties);
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "endpoint")); if (endpoint != null) { target.setEndpoint(EndpointFactory.getEndpointFromElement(endpoint, true, properties));
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "endpoint")); if (endpoint != null) { target.setEndpoint(EndpointFactory.getEndpointFromElement(endpoint, true, properties));
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; }
if (epElement != null) { Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { callMediator.setEndpoint(endpoint);
/** * Create a RecipientListEndpoint by config and test sending a message * @throws Exception on an issue sending out the message */ @Test public void testSendToEndpointList() throws Exception { OMElement omBody = AXIOMUtil.stringToOM("<endpoint><recipientlist xmlns=\"http://ws.apache.org/ns/synapse\">\n" + " <endpoint xmlns=\"http://ws.apache.org/ns/synapse\">\n" + " <address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/>\n" + " </endpoint>\n" + " <endpoint xmlns=\"http://ws.apache.org/ns/synapse\">\n" + " <address uri=\"http://localhost:9001/services/SimpleStockQuoteService\"/>\n" + " </endpoint>\n" + "</recipientlist></endpoint>"); RecipientListEndpoint recipientListEndpoint = (RecipientListEndpoint) EndpointFactory. getEndpointFromElement(omBody,true, null); Axis2SynapseEnvironment synapseEnvironment = getMockedSynapseEnvironment(); Mockito.when(synapseEnvironment.createMessageContext()).thenReturn(createMessageContext()); //test send message String samplePayload = "<test><a>WSO2</a></test>"; Axis2MessageContext messageContext = getMessageContext(samplePayload); //message will be sent to EP using this env (which is mocked and do nothing) messageContext.setEnvironment(synapseEnvironment); recipientListEndpoint.init(synapseEnvironment); recipientListEndpoint.sendMessage(messageContext); }
Endpoint endpoint = EndpointFactory.getEndpointFromElement(epElement, true, properties); if (endpoint != null) { if (endpoint instanceof AbstractEndpoint &&