Source:
public void saveTemplate(OMElement templateElement) throws AxisFault { final Lock lock = getLock(); try { lock.lock(); if (templateElement != null && templateElement.getLocalName().equals( XMLConfigConstants.TEMPLATE_ELT.getLocalPart())) { String templateName = templateElement.getAttributeValue(new QName("name")); SynapseConfiguration config = getSynapseConfiguration(); log.debug("Saving template : " + templateName); TemplateMediator preSeq = config.getSequenceTemplates().get(templateName); if (preSeq == null) { handleException("Unable to save template " + templateName + ". Does not exist"); } else { Mediator mediator = MediatorFactoryFinder.getInstance().getMediator( templateElement, getSynapseConfiguration().getProperties()); boolean statisticsEnable = preSeq.isStatisticsEnable(); config.removeSequenceTemplate(templateName); if (mediator instanceof TemplateMediator) { if (statisticsEnable) { ((TemplateMediator) mediator).enableStatistics(); } ((TemplateMediator) mediator).setFileName(preSeq.getFileName()); config.addSequenceTemplate(templateName, (TemplateMediator) mediator); } log.debug("Saved template : " + templateName + " to the configuration"); TemplateMediator templ = config.getSequenceTemplates().get(templateName); if (templ != null) { templ.init(getSynapseEnvironment()); CAppArtifactDataService cAppArtifactDataService = ConfigHolder.getInstance(). getcAppArtifactDataService(); if (cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), ServiceBusConstants.TEMPLATE_TYPE + File.separator + templateName)) { cAppArtifactDataService.setEdited(getTenantId(), ServiceBusConstants.TEMPLATE_TYPE + File.separator + templateName); } else { persistTemplate(templ); } } } } else { handleException("Unable to save template. Invalid definition"); } } catch (Exception fault) { handleException("Unable to save the Template : " + fault.getMessage(), fault); } finally { lock.unlock(); } }

Target:
public void saveTemplate(OMElement templateElement) throws AxisFault { final Lock lock = getLock(); try { lock.lock(); if (templateElement != null && templateElement.getLocalName().equals( XMLConfigConstants.TEMPLATE_ELT.getLocalPart())) { String templateName = templateElement.getAttributeValue(new QName("name")); SynapseConfiguration config = getSynapseConfiguration(); log.debug("Saving template : " + templateName); TemplateMediator preSeq = config.getSequenceTemplates().get(templateName); if (preSeq == null) { handleException("Unable to save template " + templateName + ". Does not exist"); } else { Mediator mediator = MediatorFactoryFinder.getInstance().getMediator( templateElement, getSynapseConfiguration().getProperties()); boolean statisticsEnable = preSeq.isStatisticsEnable(); config.removeSequenceTemplate(templateName); if (mediator instanceof TemplateMediator) { if (statisticsEnable) { ((TemplateMediator) mediator).enableStatistics(); } ((TemplateMediator) mediator).setFileName(preSeq.getFileName()); config.addSequenceTemplate(templateName, (TemplateMediator) mediator); } log.debug("Saved template : " + templateName + " to the configuration"); TemplateMediator templ = config.getSequenceTemplates().get(templateName); String artifactName = getArtifactName(artifactType, templateName); if (templ != null) { templ.init(getSynapseEnvironment()); CAppArtifactDataService cAppArtifactDataService = ConfigHolder.getInstance(). getcAppArtifactDataService(); if (cAppArtifactDataService.isArtifactDeployedFromCApp(getTenantId(), artifactName)) { cAppArtifactDataService.setEdited(getTenantId(), artifactName); } else { persistTemplate(templ); } } } } else { handleException("Unable to save template. Invalid definition"); } } catch (Exception fault) { handleException("Unable to save the Template : " + fault.getMessage(), fault); } finally { lock.unlock(); } }