コード例 #1
0
  @Override
  public void undeploySynapseArtifact(String artifactName) {

    if (log.isDebugEnabled()) {
      log.debug("Endpoint Undeployment of the endpoint named : " + artifactName + " : Started");
    }

    try {
      Endpoint ep = getSynapseConfiguration().getDefinedEndpoints().get(artifactName);
      if (ep != null) {

        CustomLogSetter.getInstance()
            .setLogAppender((ep != null) ? ep.getArtifactContainerName() : "");

        getSynapseConfiguration().removeEndpoint(artifactName);
        if (log.isDebugEnabled()) {
          log.debug("Destroying the endpoint named : " + artifactName);
        }
        ep.destroy();
        if (log.isDebugEnabled()) {
          log.debug(
              "Endpoint Undeployment of the endpoint named : " + artifactName + " : Completed");
        }
        log.info("Endpoint named '" + ep.getName() + "' has been undeployed");
      } else if (log.isDebugEnabled()) {
        log.debug("Endpoint " + artifactName + " has already been undeployed");
      }
    } catch (Exception e) {
      handleSynapseArtifactDeploymentError(
          "Endpoint Undeployement of endpoint named : " + artifactName + " : Failed", e);
    }
  }
コード例 #2
0
ファイル: CloneMediator.java プロジェクト: ruks/wso2-synapse
  public void destroy() {

    for (Target target : targets) {
      ManagedLifecycle seq = target.getSequence();
      if (seq != null) {
        seq.destroy();
      } else if (target.getSequenceRef() != null) {
        SequenceMediator targetSequence =
            (SequenceMediator)
                synapseEnv.getSynapseConfiguration().getSequence(target.getSequenceRef());

        if (targetSequence == null || targetSequence.isDynamic()) {
          synapseEnv.removeUnavailableArtifactRef(target.getSequenceRef());
        }
      }
      Endpoint endpoint = target.getEndpoint();
      if (endpoint != null) {
        endpoint.destroy();
      }
    }
  }
コード例 #3
0
  @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;
  }
コード例 #4
0
 public void destroy() {
   if (endpoint != null) {
     endpoint.destroy();
   }
   synapseEnv.updateCallMediatorCount(false);
 }
コード例 #5
0
ファイル: SendMediator.java プロジェクト: riskmetrics/sapon
 public void destroy() {
   if (endpoint != null) {
     endpoint.destroy();
   }
 }