Package org.apache.synapse

Examples of org.apache.synapse.Startup


        return registry;
    }

    public static Startup defineStartup(SynapseConfiguration config, OMElement elem,
                                        Properties properties) {
        Startup startup = StartupFinder.getInstance().getStartup(elem, properties);
        config.addStartup(startup);
        return startup;
    }
View Full Code Here


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

        try {
            Startup st = StartupFinder.getInstance().getStartup(artifactConfig, properties);
                st.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("StartupTask named '" + st.getName()
                            + "' has been built from the file " + fileName);
                }
                st.init(getSynapseEnvironment());
                if (log.isDebugEnabled()) {
                    log.debug("Initialized the StartupTask : " + st.getName());
                }
                getSynapseConfiguration().addStartup(st);
                if (log.isDebugEnabled()) {
                    log.debug("StartupTask Deployment from file : " + fileName + " : Completed");
                }
                log.info("StartupTask named '" + st.getName()
                        + "' has been deployed from file : " + fileName);
                return st.getName();
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError(
                    "StartupTask Deployment from the file : " + fileName + " : Failed.", e);
        }
View Full Code Here

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

        try {
            Startup st = StartupFinder.getInstance().getStartup(artifactConfig, properties);
            st.setFileName((new File(fileName)).getName());

            if (log.isDebugEnabled()) {
                log.debug("StartupTask: " + st.getName() + " has been built from the file: " + fileName);
            }
            st.init(getSynapseEnvironment());

            Startup existingSt = getSynapseConfiguration().getStartup(existingArtifactName);
            if (existingArtifactName.equals(st.getName())) {
                getSynapseConfiguration().updateStartup(st);
            } else {
                getSynapseConfiguration().addStartup(st);
                getSynapseConfiguration().removeStartup(existingArtifactName);
                log.info("StartupTask: " + existingArtifactName + " has been undeployed");
            }

            existingSt.destroy();
            log.info("StartupTask: " + st.getName() + " has been updated from the file: " + fileName);
            return st.getName();

        } catch (DeploymentException e) {
            handleSynapseArtifactDeploymentError("Error while updating the startup task from the " +
View Full Code Here

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

        try {
            Startup st = getSynapseConfiguration().getStartup(artifactName);
            if (st != null) {
                getSynapseConfiguration().removeStartup(artifactName);
                if (log.isDebugEnabled()) {
                    log.debug("Destroying the StartupTask named : " + artifactName);
                }
                st.destroy();
                if (log.isDebugEnabled()) {
                    log.debug("StartupTask Undeployment of the sequence named : "
                            + artifactName + " : Completed");
                }
                log.info("StartupTask named '" + st.getName() + "' has been undeployed");
            } else if (log.isDebugEnabled()) {
                log.debug("Startup task " + artifactName + " has already been undeployed");
            }
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError(
View Full Code Here

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

        try {
            Startup st = getSynapseConfiguration().getStartup(artifactName);
            OMElement stElem = StartupFinder.getInstance().serializeStartup(null, st);
            if (st.getFileName() != null) {
                String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
                        + File.separator + MultiXMLConfigurationBuilder.TASKS_DIR
                        + File.separator + st.getFileName();
                writeToFile(stElem, fileName);
                if (log.isDebugEnabled()) {
                    log.debug("Restoring the StartupTask with name : " + artifactName + " : Completed");
                }
                log.info("StartupTask named '" + artifactName + "' has been restored");
View Full Code Here

            Iterator taskDefinitions = FileUtils.iterateFiles(tasksDir, extensions, false);
            while (taskDefinitions.hasNext()) {
                File file = (File) taskDefinitions.next();
                OMElement document = getOMElement(file);
                Startup startup = SynapseXMLConfigurationFactory.defineStartup(synapseConfig,
                        document, properties);
                startup.setFileName(file.getName());
                synapseConfig.getArtifactDeploymentStore().addArtifact(
                        file.getAbsolutePath(), startup.getName());
             }
        }
    }
View Full Code Here

        String inputXml = "<task class=\"org.apache.synapse.util.TestTask\" group=\"org\" " +
                "name=\"TestTask\" xmlns=\"http://ws.apache.org/ns/synapse\">" +
                "<property name=\"name\" value=\"foo\"/>" +
                "<trigger interval=\"5\"/></task>";
        OMElement inputOM = createOMElement(inputXml);
        Startup startup = StartupFinder.getInstance().getStartup(inputOM, new Properties());
        OMElement resultOM = StartupFinder.getInstance().serializeStartup(null, startup);
        assertTrue(compare(resultOM, inputOM));
    }
View Full Code Here

                "name=\"TestTask\" xmlns=\"http://ws.apache.org/ns/synapse\">" +
                "<description>Test description</description>" +
                "<property name=\"name\" value=\"foo\"/>" +
                "<trigger interval=\"5\"/></task>";
        OMElement inputOM = createOMElement(inputXml);
        Startup startup = StartupFinder.getInstance().getStartup(inputOM, new Properties());
        OMElement resultOM = StartupFinder.getInstance().serializeStartup(null, startup);
        assertTrue(compare(resultOM, inputOM));
    }
View Full Code Here

        synapseConfig.addProxyService(proxy.getName(), proxy);
        assertItemAdded(proxy.getName(), PROXY);
        synapseConfig.removeProxyService(proxy.getName());
        assertItemRemoved(proxy.getName(), PROXY);

        Startup startup = new SimpleQuartz();
        startup.setName("startup1");
        synapseConfig.addStartup(startup);
        assertItemAdded(startup.getName(), STARTUP);
        synapseConfig.removeStartup(startup.getName());
        assertItemRemoved(startup.getName(), STARTUP);

        SynapseEventSource eventSrc = new SynapseEventSource("eventSrc1");
        synapseConfig.addEventSource(eventSrc.getName(), eventSrc);
        assertItemAdded(eventSrc.getName(), EVENT_SRC);
        synapseConfig.removeEventSource(eventSrc.getName());
View Full Code Here

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

        try {
            Startup st = StartupFinder.getInstance().getStartup(artifactConfig, properties);
                st.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
                    log.debug("StartupTask named '" + st.getName()
                            + "' has been built from the file " + fileName);
                }
                st.init(getSynapseEnvironment());
                if (log.isDebugEnabled()) {
                    log.debug("Initialized the StartupTask : " + st.getName());
                }
                getSynapseConfiguration().addStartup(st);
                if (log.isDebugEnabled()) {
                    log.debug("StartupTask Deployment from file : " + fileName + " : Completed");
                }
                log.info("StartupTask named '" + st.getName()
                        + "' has been deployed from file : " + fileName);
                return st.getName();
        } catch (Exception e) {
            handleSynapseArtifactDeploymentError(
                    "StartupTask Deployment from the file : " + fileName + " : Failed.", e);
        }
View Full Code Here

TOP

Related Classes of org.apache.synapse.Startup

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.