Search in sources :

Example 11 with Startup

use of org.apache.synapse.Startup in project wso2-synapse by wso2.

the class TaskDeployer method updateSynapseArtifact.

@Override
public String updateSynapseArtifact(OMElement artifactConfig, String fileName, String existingArtifactName, Properties properties) {
    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);
        }
        Startup existingSt = getSynapseConfiguration().getStartup(existingArtifactName);
        existingSt.destroy();
        st.init(getSynapseEnvironment());
        if (existingArtifactName.equals(st.getName())) {
            getSynapseConfiguration().updateStartup(st);
        } else {
            getSynapseConfiguration().addStartup(st);
            getSynapseConfiguration().removeStartup(existingArtifactName);
            log.info("StartupTask: " + existingArtifactName + " has been undeployed");
        }
        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 " + "file: " + fileName);
    }
    return null;
}
Also used : DeploymentException(org.apache.axis2.deployment.DeploymentException) File(java.io.File) Startup(org.apache.synapse.Startup)

Aggregations

Startup (org.apache.synapse.Startup)11 OMElement (org.apache.axiom.om.OMElement)5 DeploymentException (org.apache.axis2.deployment.DeploymentException)4 File (java.io.File)2 Properties (java.util.Properties)2 PriorityExecutor (org.apache.synapse.commons.executors.PriorityExecutor)2 ProxyService (org.apache.synapse.core.axis2.ProxyService)2 SynapseEventSource (org.apache.synapse.eventing.SynapseEventSource)2 InboundEndpoint (org.apache.synapse.inbound.InboundEndpoint)2 SequenceMediator (org.apache.synapse.mediators.base.SequenceMediator)2 TemplateMediator (org.apache.synapse.mediators.template.TemplateMediator)2 Collection (java.util.Collection)1 Iterator (java.util.Iterator)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 OMFactory (org.apache.axiom.om.OMFactory)1 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)1 SynapseException (org.apache.synapse.SynapseException)1 Entry (org.apache.synapse.config.Entry)1 TemplateSerializer (org.apache.synapse.config.xml.endpoints.TemplateSerializer)1 AbstractEndpoint (org.apache.synapse.endpoints.AbstractEndpoint)1