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;
}
Aggregations