Package org.apache.synapse.commons.executors

Examples of org.apache.synapse.commons.executors.PriorityExecutor


            Iterator executors = FileUtils.iterateFiles(executorsDir, extensions, false);
            while (executors.hasNext()) {
                File file = (File) executors.next();
                OMElement document = getOMElement(file);
                PriorityExecutor executor = SynapseXMLConfigurationFactory.
                        defineExecutor(synapseConfig, document, properties);
                if (executor != null) {
                    executor.setFileName(file.getName());
                    synapseConfig.getArtifactDeploymentStore().addArtifact(
                            file.getAbsolutePath(), executor.getName());
                }
            }
        }
    }
View Full Code Here


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

        try {
            PriorityExecutor e = PriorityExecutorFactory.createExecutor(
                    SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties);
            if (e != null) {
                e.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("PriorityExecutor with name '" + e.getName()
                            + "' has been built from the file " + fileName);
                }
                getSynapseConfiguration().addPriorityExecutor(e.getName(), e);

                e.init();

                if (log.isDebugEnabled()) {
                    log.debug("PriorityExecutor Deployment from file : " + fileName + " : Completed");
                }
                log.info("PriorityExecutor named '" + e.getName()
                        + "' has been deployed from file : " + fileName);
                return e.getName();
            } else {
                handleSynapseArtifactDeploymentError("PriorityExecutor Deployment Failed. " +
                        "The artifact described in the file " + fileName +
                        " is not a PriorityExecutor");
            }
View Full Code Here

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

        try {
            PriorityExecutor e = PriorityExecutorFactory.createExecutor(
                    SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties);
            if (e == null) {
                handleSynapseArtifactDeploymentError("PriorityExecutor update failed. The artifact " +
                        "defined in the file: " + fileName + " is not a valid executor.");
                return null;
            }
            e.setFileName(new File(fileName).getName());

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

            e.init();
            PriorityExecutor existingExecutor = getSynapseConfiguration().getPriorityExecutors().
                    get(existingArtifactName);
            if (existingArtifactName.equals(e.getName())) {
                getSynapseConfiguration().updatePriorityExecutor(existingArtifactName, e);
            } else {
                // The user has changed the name of the executor
                // We should add the updated executor as a new executor and remove the old one
                getSynapseConfiguration().addPriorityExecutor(e.getName(), e);
                getSynapseConfiguration().removeExecutor(existingArtifactName);
                log.info("Executor: " + existingArtifactName + " has been undeployed");
            }

            waitForCompletion();
            existingExecutor.destroy();

            log.info("PriorityExecutor: " + e.getName() + " has been updated from the file: " + fileName);
            return e.getName();

        } catch (DeploymentException e) {
View Full Code Here

            log.debug("PriorityExecutor Undeployment of the entry named : "
                    + artifactName + " : Started");
        }

        try {
            PriorityExecutor e = getSynapseConfiguration().getPriorityExecutors().get(artifactName);
            if (e != null) {
                e = getSynapseConfiguration().removeExecutor(artifactName);
                if (log.isDebugEnabled()) {
                    log.debug("PriorityExecutor Undeployment of the entry named : "
                            + artifactName + " : Completed");
                }
                e.destroy();
                log.info("PriorityExecutor named '" + e.getName() + "' has been undeployed");
            } else if (log.isDebugEnabled()) {
                log.debug("PriorityExecutor " + artifactName + " has already been undeployed");
            }
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError(
View Full Code Here

         if (log.isDebugEnabled()) {
            log.debug("Restoring PriorityExecutor with name : " + artifactName + " : Started");
        }

        try {
            PriorityExecutor e = getSynapseConfiguration().getPriorityExecutors().get(artifactName);
            OMElement entryElem = PriorityExecutorSerializer.serialize(null, e,
                    SynapseConstants.SYNAPSE_NAMESPACE);
            if (e.getFileName() != null) {
                String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
                        + File.separator + MultiXMLConfigurationBuilder.EXECUTORS_DIR
                        + File.separator + e.getFileName();
                writeToFile(entryElem, fileName);
                if (log.isDebugEnabled()) {
                    log.debug("Restoring the PriorityExecutor with name : "
                            + artifactName + " : Completed");
                }
View Full Code Here

    }

    public static PriorityExecutor defineExecutor(SynapseConfiguration config,
                                                       OMElement elem, Properties properties) {

        PriorityExecutor executor = null;
        try {
            executor = PriorityExecutorFactory.createExecutor(
                    XMLConfigConstants.SYNAPSE_NAMESPACE, elem, true, properties);
            assert executor != null;
            config.addPriorityExecutor(executor.getName(), executor);
        } catch (AxisFault axisFault) {
            String msg = "Executor configuration cannot be built";
            handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EXECUTORS, msg, axisFault);
        }
        return executor;
View Full Code Here

            }
        }

        Collection<PriorityExecutor> executors = newConfig.getPriorityExecutors().values();
        for (PriorityExecutor exec : executors) {
            PriorityExecutor oldExec = currentConfig.getPriorityExecutors().get(exec.getName());
            if (oldExec != null) {
                exec.setFileName(oldExec.getFileName());
            }
        }

        Collection<MessageStore> messageStores = newConfig.getMessageStores().values();
View Full Code Here

TOP

Related Classes of org.apache.synapse.commons.executors.PriorityExecutor

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.