@Override public String updateSynapseArtifact( OMElement artifactConfig, String fileName, String existingArtifactName, Properties properties) { Endpoint ep = EndpointFactory.getEndpointFromElement(artifactConfig, false, properties); CustomLogSetter.getInstance().setLogAppender((ep != null) ? ep.getArtifactContainerName() : ""); if (log.isDebugEnabled()) { log.debug("Endpoint update from file : " + fileName + " has started"); } try { if (ep == null) { handleSynapseArtifactDeploymentError( "Endpoint update failed. The artifact " + "defined in the file: " + fileName + " is not a valid endpoint."); return null; } ep.setFileName(new File(fileName).getName()); if (log.isDebugEnabled()) { log.debug("Endpoint: " + ep.getName() + " has been built from the file: " + fileName); } ep.init(getSynapseEnvironment()); Endpoint existingEp = getSynapseConfiguration().getDefinedEndpoints().get(existingArtifactName); if (existingArtifactName.equals(ep.getName())) { getSynapseConfiguration().updateEndpoint(existingArtifactName, ep); } else { // The user has changed the name of the endpoint // We should add the updated endpoint as a new endpoint and remove the old one getSynapseConfiguration().addEndpoint(ep.getName(), ep); getSynapseConfiguration().removeEndpoint(existingArtifactName); log.info("Endpoint: " + existingArtifactName + " has been undeployed"); } log.info("Endpoint: " + ep.getName() + " has been updated from the file: " + fileName); waitForCompletion(); existingEp.destroy(); if (existingArtifactName.equals(ep.getName())) { // If the endpoint name was same as the old one, above method call (destroy) // will unregister the endpoint MBean - So we should register it again. MBeanRegistrar.getInstance().registerMBean(ep.getMetricsMBean(), "Endpoint", ep.getName()); } return ep.getName(); } catch (DeploymentException e) { handleSynapseArtifactDeploymentError( "Error while updating the endpoint from the " + "file: " + fileName); } return null; }