Package org.apache.synapse.endpoints

Examples of org.apache.synapse.endpoints.Endpoint


        Map<String, Endpoint> definedEndpoints = new HashMap<String, Endpoint>();
        synchronized (this) {
            for (Object o : localRegistry.values()) {
                if (o instanceof Endpoint) {
                    Endpoint ep = (Endpoint) o;
                    definedEndpoints.put(ep.getName(), ep);
                }
            }
        }

        return definedEndpoints;
View Full Code Here


     * @param algorithmContext The context in which holds run time states related to the algorithm
     * @return endpoint to send the next message
     */
    public Endpoint getNextEndpoint(MessageContext synCtx, AlgorithmContext algorithmContext) {

        Endpoint nextEndpoint;
        int attempts = 0;
        synchronized (algorithmContext) {
            int currentEPR = algorithmContext.getCurrentEndpointIndex();
            do {
                // two successive clients could get the same endpoint if not synchronized.
                nextEndpoint = (Endpoint) endpoints.get(currentEPR);

                if (currentEPR == endpoints.size() - 1) {
                    currentEPR = 0;
                } else {
                    currentEPR++;
                }
                algorithmContext.setCurrentEndpointIndex(currentEPR);

                attempts++;
                if (attempts > endpoints.size()) {
                    return null;
                }

            } while (!nextEndpoint.readyToSend());
        }

        return nextEndpoint;
    }
View Full Code Here

                o = registry.getResource(entry, getProperties());
                if (o != null && o instanceof Endpoint) {
                    localRegistry.put(key, entry);
                    return (Endpoint) o;
                } else if (o instanceof OMNode){
                    Endpoint e = (Endpoint) XMLToEndpointMapper.getInstance().
                            getObjectFromOMNode((OMNode) o, properties);
                    if (e != null) {
                        entry.setValue(e);
                        return e;
                    }
View Full Code Here

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

    public Endpoint getEndpoint(String key) {
        Object o = localEntries.get(key);
        if (o != null && o instanceof Endpoint) {
            return (Endpoint) o;
        } else {
            Endpoint e = getConfiguration().getEndpoint(key);
            if (e != null) {
                if (!e.isInitialized()) {
                    synchronized (e) {
                        if (!e.isInitialized()) {
                            e.init(synEnv);
                        }
                    }
                }
                localEntries.put(key, e);
            }
View Full Code Here

            }

            // if inSequence returns true, forward message to endpoint
            if(inSequenceResult) {
                if (proxy.getTargetEndpoint() != null) {
                    Endpoint endpoint = synCtx.getEndpoint(proxy.getTargetEndpoint());

                    if (endpoint != null) {
                        traceOrDebug(traceOn, "Forwarding message to the endpoint : "
                            + proxy.getTargetEndpoint());
                        endpoint.send(synCtx);

                    } else {
                        handleException("Unable to find the endpoint specified : " +
                            proxy.getTargetEndpoint(), synCtx);
                    }
View Full Code Here

            // there can always be only one instance of an Endpoint in the faultStack of a message
            // if the send was successful, so remove it before we proceed any further
            Stack faultStack = synapseOutMsgCtx.getFaultStack();
            if (faultStack != null && !faultStack.isEmpty()
                && faultStack.peek() instanceof Endpoint) {
                Endpoint successfulEndpoint = (Endpoint) faultStack.pop();
                successfulEndpoint.onSuccess();
            }
            if (log.isDebugEnabled()) {
                log.debug("Synapse received an asynchronous response message");
                log.debug("Received To: " +
                        (response.getTo() != null ? response.getTo().getAddress() : "null"));
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Endpoint Deployment from file : " + fileName + " : Started");
        }

        try {
            Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties);
            if (ep != null) {
                ep.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("Endpoint named '" + ep.getName()
                            + "' has been built from the file " + fileName);
                }
                ep.init(getSynapseEnvironment());
                if (log.isDebugEnabled()) {
                    log.debug("Initialized the endpoint : " + ep.getName());
                }
                getSynapseConfiguration().addEndpoint(ep.getName(), ep);
                if (log.isDebugEnabled()) {
                    log.debug("Endpoint Deployment from file : " + fileName + " : Completed");
                }
                log.info("Endpoint named '" + ep.getName()
                        + "' has been deployed from file : " + fileName);
                return ep.getName();
            } else {
                handleSynapseArtifactDeploymentError("Endpoint Deployment Failed. The artifact " +
                        "described in the file " + fileName + " is not an Endpoint");
            }
        } catch (Exception e) {
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Endpoint update from file : " + fileName + " has started");
        }

        try {
            Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties);
            if (ep == null) {
                handleSynapseArtifactDeploymentError("Endpoint update failed. The artifact " +
                        "defined in the file: " + fileName + " is not a valid endpoint.");
                return null;
            }
            ep.setFileName(new File(fileName).getName());

            if (log.isDebugEnabled()) {
                log.debug("Endpoint: " + ep.getName() + " has been built from the file: " + fileName);
            }

            ep.init(getSynapseEnvironment());
            Endpoint existingEp = getSynapseConfiguration().getDefinedEndpoints().get(existingArtifactName);
            if (existingArtifactName.equals(ep.getName())) {
                getSynapseConfiguration().updateEndpoint(existingArtifactName, ep);
            } else {
                // The user has changed the name of the endpoint
                // We should add the updated endpoint as a new endpoint and remove the old one
                getSynapseConfiguration().addEndpoint(ep.getName(), ep);
                getSynapseConfiguration().removeEndpoint(existingArtifactName);
                log.info("Endpoint: " + existingArtifactName + " has been undeployed");
            }

            log.info("Endpoint: " + ep.getName() + " has been updated from the file: " + fileName);

            waitForCompletion();
            existingEp.destroy();
            if (existingArtifactName.equals(ep.getName())) {
                // If the endpoint name was same as the old one, above method call (destroy)
                // will unregister the endpoint MBean - So we should register it again.
                MBeanRegistrar.getInstance().registerMBean(
                        ep.getMetricsMBean(), "Endpoint", ep.getName());
View Full Code Here

            log.debug("Endpoint Undeployment of the endpoint named : "
                    + artifactName + " : Started");
        }
       
        try {
            Endpoint ep = getSynapseConfiguration().getDefinedEndpoints().get(artifactName);
            if (ep != null) {
                getSynapseConfiguration().removeEndpoint(artifactName);
                if (log.isDebugEnabled()) {
                    log.debug("Destroying the endpoint named : " + artifactName);
                }
                ep.destroy();
                if (log.isDebugEnabled()) {
                    log.debug("Endpoint Undeployment of the endpoint named : "
                            + artifactName + " : Completed");
                }
                log.info("Endpoint named '" + ep.getName() + "' has been undeployed");
            } else if (log.isDebugEnabled()) {
                log.debug("Endpoint " + artifactName + " has already been undeployed");
            }
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError("Endpoint Undeployement of endpoint named : "
View Full Code Here

TOP

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

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.