/**
   * Initialize child mediators recursively
   *
   * @param se synapse environment
   */
  public void init(SynapseEnvironment se) {
    if (log.isDebugEnabled()) {
      log.debug("Initializing child mediators of mediator : " + getType());
    }

    for (int i = 0; i < mediators.size(); i++) {
      Mediator mediator = mediators.get(i);
      mediator.setMediatorPosition(i);

      if (mediator instanceof ManagedLifecycle) {
        ((ManagedLifecycle) mediator).init(se);
      }

      if (mediator.isContentAware()) {
        if (log.isDebugEnabled()) {
          log.debug(
              mediator.getType()
                  + " is content aware, setting sequence <"
                  + getType()
                  + "> as content aware");
        }
        contentAware = true;
      }
    }
  }
  /** Destroy child mediators recursively */
  public void destroy() {
    if (log.isDebugEnabled()) {
      log.debug("Destroying child mediators of mediator : " + getType());
    }

    for (Mediator mediator : mediators) {
      if (mediator instanceof ManagedLifecycle) {
        ((ManagedLifecycle) mediator).destroy();
      }
    }
  }
Esempio n. 3
0
  public void destroy() {
    log.info("Destroying API: " + name);
    for (Resource resource : resources.values()) {
      resource.destroy();
    }

    for (Handler handler : handlers) {
      if (handler instanceof ManagedLifecycle) {
        ((ManagedLifecycle) handler).destroy();
      }
    }
  }
Esempio n. 4
0
  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();
      }
    }
  }
Esempio n. 5
0
  public void init(SynapseEnvironment se) {

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

        if (targetSequence == null || targetSequence.isDynamic()) {
          se.addUnavailableArtifactRef(target.getSequenceRef());
        }
      }
      Endpoint endpoint = target.getEndpoint();
      if (endpoint != null) {
        endpoint.init(se);
      }
    }
  }
Esempio n. 6
0
  public void init(SynapseEnvironment se) {
    if (resources.isEmpty()) {
      handleException(
          "The API: " + name + " has been configured without " + "any resource definitions");
    }

    log.info("Initializing API: " + name);
    for (Resource resource : resources.values()) {
      resource.init(se);
    }

    for (Handler handler : handlers) {
      if (handler instanceof ManagedLifecycle) {
        ((ManagedLifecycle) handler).init(se);
      }
    }
  }