Package org.apache.synapse

Examples of org.apache.synapse.Startup


            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

        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

    }

    private static void serializeStartups(OMElement definitions, Collection startups) {
        for (Object o : startups) {
            if (o instanceof Startup) {
                Startup s = (Startup) o;
                StartupFinder.getInstance().serializeStartup(definitions, s);
            }
        }
    }
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

        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

    private static void addStartup(OMElement startupElement, String fileName, boolean generateFileName,
                            SynapseConfiguration synapseConfiguration,
                            SynapseEnvironment synapseEnvironment) {

        SimpleQuartzFactory factory = new SimpleQuartzFactory();
        Startup startup = factory.createStartup(startupElement);

        if (startup == null) {
            handleException("Startup is null");
        } else {
            if (startup instanceof AbstractStartup) {
                if (generateFileName) {
                    fileName = ServiceBusUtils.generateFileName((startup.getName()));
                }
                startup.setFileName(fileName);
            }
            synapseConfiguration.addStartup(startup);
            startup.init(synapseEnvironment);
            persistStartup(startup, synapseConfiguration.getAxisConfiguration());

            if (log.isDebugEnabled()) {
                log.debug("Added Startup : " + startup + " from the configuration");
            }
View Full Code Here

    public static void updateStartup(String name, OMElement taskElement,
                              SynapseConfiguration synapseConfiguration,
                              SynapseEnvironment synapseEnvironment) {

        Startup st = synapseConfiguration.getStartup(name);

        if (st == null) {
            log.warn("Cannot update the startup named: " + name
                    + ", it doesn't exists in the SynapseConfiguration");
            return;
        }

        String fileName = null;
        if (st instanceof AbstractStartup) {
            fileName = st.getFileName();
        }

        deleteStartup(st.getName(), synapseConfiguration);
        addStartup(taskElement, fileName, false, synapseConfiguration, synapseEnvironment);
    }
View Full Code Here

        deleteStartup(st.getName(), synapseConfiguration);
        addStartup(taskElement, fileName, false, synapseConfiguration, synapseEnvironment);
    }

    public static void deleteStartup(String name, SynapseConfiguration synapseConfiguration) {
        Startup st = synapseConfiguration.getStartup(name);
        if (st != null) {
            st.destroy();
            String fileName = null;
            if (st instanceof AbstractStartup) {
                fileName = st.getFileName();
            }
            synapseConfiguration.removeStartup(name);
            MediationPersistenceManager pm = ServiceBusUtils.getMediationPersistenceManager(
                    synapseConfiguration.getAxisConfiguration());
            pm.deleteItem(name, fileName, ServiceBusConstants.ITEM_TYPE_TASK);
View Full Code Here

    }

    private static void serializeStartups(OMElement definitions, Collection startups) {
        for (Object o : startups) {
            if (o instanceof Startup) {
                Startup s = (Startup) o;
                StartupFinder.getInstance().serializeStartup(definitions, s);
            }
        }
    }
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.