}
try {
Template st = getSynapseConfiguration().getEndpointTemplate(artifactName);
if (st != null) {
TemplateSerializer ts = new TemplateSerializer();
OMElement stElem = ts.serializeEndpointTemplate(st, null);
if (st.getFileName() != null) {
String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
+ File.separator + MultiXMLConfigurationBuilder.TEMPLATES_DIR
+ File.separator + st.getFileName();
writeToFile(stElem, fileName);
if (log.isDebugEnabled()) {
log.debug("Restoring the Endpoint Template with name : " +
artifactName + " : Completed");
}
log.info("Template named '" + artifactName + "' has been restored");
}
} else {
TemplateMediator mt = getSynapseConfiguration().getSequenceTemplate(artifactName);
if (mt != null) {
TemplateMediatorSerializer ts = new TemplateMediatorSerializer();
OMElement stElem = ts.serializeMediator(null, mt);
if (mt.getFileName() != null) {
String fileName = getServerConfigurationInformation().getSynapseXMLLocation()
+ File.separator + MultiXMLConfigurationBuilder.TEMPLATES_DIR
+ File.separator + st.getFileName();
writeToFile(stElem, fileName);