handleSynapseArtifactDeploymentError("Sequence update failed. The artifact " +
"defined in the file: " + fileName + " is not a valid sequence.");
return null;
}
SequenceMediator seq = (SequenceMediator) m;
seq.setFileName(new File(fileName).getName());
if ((SynapseConstants.MAIN_SEQUENCE_KEY.equals(existingArtifactName) ||
SynapseConstants.FAULT_SEQUENCE_KEY.equals(existingArtifactName)) &&
!existingArtifactName.equals(seq.getName())) {
handleSynapseArtifactDeploymentError(existingArtifactName + " sequence cannot be renamed");
}
if (log.isDebugEnabled()) {
log.debug("Sequence: " + seq.getName() + " has been built from the file: " + fileName);
}
seq.init(getSynapseEnvironment());
SequenceMediator existingSeq = getSynapseConfiguration().getDefinedSequences().
get(existingArtifactName);
if (existingArtifactName.equals(seq.getName())) {
getSynapseConfiguration().updateSequence(existingArtifactName, seq);
} else {
getSynapseConfiguration().addSequence(seq.getName(), seq);
getSynapseConfiguration().removeSequence(existingArtifactName);
log.info("Sequence: " + existingArtifactName + " has been undeployed");
}
log.info("Sequence: " + seq.getName() + " has been updated from the file: " + fileName);
waitForCompletion(); // Give some time for worker threads to release the old sequence
existingSeq.destroy();
return seq.getName();
} catch (DeploymentException e) {
handleSynapseArtifactDeploymentError("Error while updating the sequence from the " +
"file: " + fileName);