Package org.apache.synapse.endpoints

Examples of org.apache.synapse.endpoints.FailoverEndpoint


        if (!(endpoint instanceof FailoverEndpoint)) {
            handleException("Invalid endpoint type.");
        }

        FailoverEndpoint failoverEndpoint = (FailoverEndpoint) endpoint;

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

        // serialize the parameters
        serializeProperties(failoverEndpoint, endpointElement);

        OMElement failoverElement
                = fac.createOMElement("failover", SynapseConstants.SYNAPSE_OMNAMESPACE);
        endpointElement.addChild(failoverElement);

        serializeCommonAttributes(endpoint,endpointElement);

        for (Endpoint childEndpoint : failoverEndpoint.getChildren()) {
            failoverElement.addChild(EndpointSerializer.getElementFromEndpoint(childEndpoint));
        }

        if (!failoverEndpoint.isDynamic()) {
            failoverElement.addAttribute("dynamic", "false", null);
        }

        return endpointElement;
    }
View Full Code Here


        OMElement failoverElement = epConfig.getFirstChildWithName
                (new QName(SynapseConstants.SYNAPSE_NAMESPACE, "failover"));
        if (failoverElement != null) {

            FailoverEndpoint failoverEndpoint = new FailoverEndpoint();
            // set endpoint name
            String name = epConfig.getAttributeValue(new QName("name"));
            if (name != null) {
                failoverEndpoint.setName(name);
            }

            List<Endpoint> childEndpoints = getEndpoints(
                    failoverElement, failoverEndpoint, properties);
            if(childEndpoints == null || childEndpoints.size() == 0){
                String msg = "Invalid Synapse configuration.\n"
                        + "A FailOver must have child elements, but the FailOver "
                        + "'" + failoverEndpoint.getName() + "' does not have any child elements.";
                log.error(msg);
                throw new SynapseException(msg);
            }

            // set endpoints and return
            failoverEndpoint.setChildren(getEndpoints(
                    failoverElement, failoverEndpoint, properties));
            // process the parameters
            processProperties(failoverEndpoint, epConfig);

            return failoverEndpoint;
View Full Code Here

        SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());

        assertTrue("Top level endpoint should be a failover endpoint.",
                send2.getEndpoint() instanceof FailoverEndpoint);

        FailoverEndpoint endpoint = (FailoverEndpoint) send2.getEndpoint();
        List addresses = endpoint.getChildren();
        assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(0) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
View Full Code Here

                children.get(0) instanceof AddressEndpoint);

        assertTrue("Second child should be a fail over endpoint",
                children.get(1) instanceof FailoverEndpoint);

        FailoverEndpoint failoverEndpoint = (FailoverEndpoint) children.get(1);
        List children2 = failoverEndpoint.getChildren();

        assertEquals("Fail over endpoint should have 2 children.", children2.size(), 2);
        assertTrue("Children of the fail over endpoint should be address endpoints.",
                children2.get(0) instanceof AddressEndpoint);
        assertTrue("Children of the fail over endpoint should be address endpoints.",
View Full Code Here

        if (!(endpoint instanceof FailoverEndpoint)) {
            handleException("Invalid endpoint type.");
        }

        FailoverEndpoint failoverEndpoint = (FailoverEndpoint) endpoint;

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

        // serialize the parameters
        serializeProperties(failoverEndpoint, endpointElement);

        OMElement failoverElement
                = fac.createOMElement("failover", SynapseConstants.SYNAPSE_OMNAMESPACE);
        endpointElement.addChild(failoverElement);

        serializeCommonAttributes(endpoint,endpointElement);


        for (Endpoint childEndpoint : failoverEndpoint.getChildren()) {
            failoverElement.addChild(EndpointSerializer.getElementFromEndpoint(childEndpoint));
        }

        return endpointElement;
    }
View Full Code Here

        OMElement failoverElement = epConfig.getFirstChildWithName
                (new QName(SynapseConstants.SYNAPSE_NAMESPACE, "failover"));
        if (failoverElement != null) {

            FailoverEndpoint failoverEndpoint = new FailoverEndpoint();
            // set endpoint name
            String name = epConfig.getAttributeValue(new QName("name"));
            if (name != null) {
                failoverEndpoint.setName(name);
            }

            List<Endpoint> childEndpoints = getEndpoints(
                    failoverElement, failoverEndpoint, properties);
            if(childEndpoints == null || childEndpoints.size() == 0){
                String msg = "Invalid Synapse configuration.\n"
                        + "A FailOver must have child elements, but the FailOver "
                        + "'" + failoverEndpoint.getName() + "' does not have any child elements.";
                log.error(msg);
                throw new SynapseException(msg);
            }

            // set endpoints and return
            failoverEndpoint.setChildren(getEndpoints(failoverElement, failoverEndpoint, properties));

            String dynamicFO = failoverElement.getAttributeValue(new QName("dynamic"));
            if (dynamicFO != null && JavaUtils.isFalseExplicitly(dynamicFO)) {
                failoverEndpoint.setDynamic(false);
            }
           
            // process the parameters
            processProperties(failoverEndpoint, epConfig);
View Full Code Here

        if (!(endpoint instanceof FailoverEndpoint)) {
            handleException("Invalid endpoint type.");
        }

        FailoverEndpoint failoverEndpoint = (FailoverEndpoint) endpoint;

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

        OMElement failoverElement
                = fac.createOMElement("failover", SynapseConstants.SYNAPSE_OMNAMESPACE);
        endpointElement.addChild(failoverElement);

        serializeCommonAttributes(endpoint,endpointElement);

        for (Endpoint childEndpoint : failoverEndpoint.getChildren()) {
            failoverElement.addChild(EndpointSerializer.getElementFromEndpoint(childEndpoint));
        }

        if (!failoverEndpoint.isDynamic()) {
            failoverElement.addAttribute("dynamic", "false", null);
        }

        // serialize the parameters
        serializeProperties(failoverEndpoint, endpointElement);
View Full Code Here

        SendMediator send2 = (SendMediator) factory.createMediator(config2, new Properties());

        assertTrue("Top level endpoint should be a failover endpoint.",
                send2.getEndpoint() instanceof FailoverEndpoint);

        FailoverEndpoint endpoint = (FailoverEndpoint) send2.getEndpoint();
        List addresses = endpoint.getChildren();
        assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(0) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
View Full Code Here

                children.get(0) instanceof AddressEndpoint);

        assertTrue("Second child should be a fail over endpoint",
                children.get(1) instanceof FailoverEndpoint);

        FailoverEndpoint failoverEndpoint = (FailoverEndpoint) children.get(1);
        List children2 = failoverEndpoint.getChildren();

        assertEquals("Fail over endpoint should have 2 children.", children2.size(), 2);
        assertTrue("Children of the fail over endpoint should be address endpoints.",
                children2.get(0) instanceof AddressEndpoint);
        assertTrue("Children of the fail over endpoint should be address endpoints.",
View Full Code Here

        SendMediator send2 = (SendMediator) factory.createMediator(config2);

        assertTrue("Top level endpoint should be a failover endpoint.",
                send2.getEndpoint() instanceof FailoverEndpoint);

        FailoverEndpoint endpoint = (FailoverEndpoint) send2.getEndpoint();
        List addresses = endpoint.getEndpoints();
        assertEquals("There should be 3 leaf level address endpoints", addresses.size(), 3);

        assertTrue("Leaf level endpoints should be address endpoints",
                addresses.get(0) instanceof AddressEndpoint);
        assertTrue("Leaf level endpoints should be address endpoints",
View Full Code Here

TOP

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

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.