Package org.apache.synapse.endpoints

Examples of org.apache.synapse.endpoints.AddressEndpoint


                if (targetEp != null) {
                    Endpoint ep = messageContext.getEndpoint(targetEp);

                    if (ep instanceof AddressEndpoint) {
                        AddressEndpoint addEp = (AddressEndpoint) ep;
                        String addressUrl = addEp.getDefinition().getAddress();

                        try {
                            MessageContext outCtx = sender.send(messageContext, addressUrl);

                            if (outCtx != null && "true".equals(outCtx.
View Full Code Here


        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement
                = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);

        AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint;

        // serialize the properties
        serializeProperties(addressEndpoint, endpointElement);
        //serialize attributes
        serializeCommonAttributes(endpoint, endpointElement);

        EndpointDefinition epAddress = addressEndpoint.getDefinition();
        OMElement addressElement = serializeEndpointDefinition(epAddress);
        endpointElement.addChild(addressElement);

        return endpointElement;
    }
View Full Code Here

     *
     * @param endpointUrl      URL
     * @return AddressEndpoint address endpoint
     */
    private Endpoint getEndpointFromURL(String endpointUrl) {
        AddressEndpoint endpoint = new AddressEndpoint();
        EndpointDefinition def = new EndpointDefinition();
        def.setAddress(endpointUrl.trim());
        endpoint.setDefinition(def);
        return endpoint;
    }
View Full Code Here

        OMElement config2 = serializer.serializeMediator(null, send1);
        SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());

        assertTrue("Top level endpoint should be a address endpoint.",
                send1.getEndpoint() instanceof AddressEndpoint);
        AddressEndpoint ep1 = (AddressEndpoint) send1.getEndpoint();

        assertTrue("Top level endpoint should be a WSDL endpoint.",
                send2.getEndpoint() instanceof AddressEndpoint);
        AddressEndpoint ep2 = (AddressEndpoint) send2.getEndpoint();

        assertEquals("Address URI is not serialized properly",
                ep1.getDefinition().getAddress(), ep2.getDefinition().getAddress());

        assertEquals(
                "Addressing information is not serialized properly",
                ep1.getDefinition().isAddressingOn(),
                ep2.getDefinition().isAddressingOn());
    }
View Full Code Here

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(1) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(2) instanceof AddressEndpoint);

        AddressEndpoint addressEndpoint = (AddressEndpoint) addresses.get(0);
        assertTrue("URI of address endpoint is not serialized properly",
                "http://localhost:9001/services/Service1".equals(addressEndpoint.getDefinition().getAddress()));
    }
View Full Code Here

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(1) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(2) instanceof AddressEndpoint);

        AddressEndpoint addressEndpoint = (AddressEndpoint) addresses.get(0);
        assertTrue("URI of address endpoint is not serialized properly",
                "http://localhost:9001/services/Service1".equals(addressEndpoint.getDefinition().getAddress()));
    }
View Full Code Here

                        LB_WEIGHTED_RRLC_WEIGHT);

                String key;
                URL url;
                if (e instanceof AddressEndpoint) {
                    AddressEndpoint addressEndpoint = (AddressEndpoint) e;
                    try {
                        url = new URL(addressEndpoint.getDefinition().getAddress());
                    } catch (MalformedURLException e1) {
                        String msg = "Mulformed URL in address endpoint";
                        log.error(msg);
                        throw new SynapseException(msg);
                    }
View Full Code Here


    private List<Endpoint> createEndpoints() {
        List<Endpoint> endpoints = new ArrayList<Endpoint>();
        for (int i = 0; i < hosts.length; i++) {
            AddressEndpoint addressEndpoint = new AddressEndpoint();

            EndpointDefinition definition = new EndpointDefinition();
            definition.setAddress("http://" + hosts[i] + "/");
            addressEndpoint.setDefinition(definition);

            MediatorProperty property = new MediatorProperty();
            property.setName(WeightedRRLCAlgorithm.LB_WEIGHTED_RRLC_WEIGHT);
            property.setValue(weights[i]);
            addressEndpoint.addProperty(property);

            endpoints.add(addressEndpoint);
        }

        return endpoints;
View Full Code Here

    @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;
View Full Code Here

        fac = OMAbstractFactory.getOMFactory();
        OMElement endpointElement
                = fac.createOMElement("endpoint", SynapseConstants.SYNAPSE_OMNAMESPACE);

        AddressEndpoint addressEndpoint = (AddressEndpoint) endpoint;

        // serialize the properties
        serializeProperties(addressEndpoint, endpointElement);
        //serialize attributes
        serializeCommonAttributes(endpoint,endpointElement);

        EndpointDefinition epAddress = addressEndpoint.getDefinition();
        OMElement addressElement = serializeEndpointDefinition(epAddress);
        endpointElement.addChild(addressElement);

        return endpointElement;
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.endpoints.AddressEndpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.