Package org.apache.synapse.api

Examples of org.apache.synapse.api.Mediator


                ApplicationContext appContext = ((SpringConfigExtension) cfg).getAppContext();
                log.debug("Loading bean : " + beanName + " from Spring configuration named : " + configName);
                Object o = appContext.getBean(beanName);

                if (o != null && Mediator.class.isAssignableFrom(o.getClass())) {
                    Mediator m = (Mediator) o;
                    return m.mediate(synCtx);

                } else {
                    handleException("Could not find the bean named : " + beanName +
                        " from the Spring configuration named : " + configName);
                }
            } else {
                handleException("Could not get a reference to a valid Spring configuration named : " + configName);
            }

        } else if (appContext != null) {

            log.debug("Loading bean : " + beanName + " from inline Spring configuration");
            Object o = appContext.getBean(beanName);

            if (o != null && Mediator.class.isAssignableFrom(o.getClass())) {
                Mediator m = (Mediator) o;
                return m.mediate(synCtx);

            } else {
                handleException("Could not find the bean named : " + beanName +
                    " from the inline Spring configuration");
            }
View Full Code Here


        log.debug("Sequence mediator <" + (name == null? "anonymous" : name ) +"> :: mediate()");
        if (ref == null) {
            return super.mediate(synCtx);

        } else {
            Mediator m = synCtx.getConfiguration().getNamedMediator(ref);
            if (m == null) {
                String msg = "Sequence mediator instance named " + ref + " cannot be found.";
                log.error(msg);
                throw new SynapseException(msg);
            } else {
                return m.mediate(synCtx);
            }
        }
    }
View Full Code Here

     * @return as per standard semantics
     */
    public boolean mediate(MessageContext synCtx) {

        log.debug("Class mediator <" + clazz.getName() + ">:: mediate()");
        Mediator m = null;
        try {
            m = (Mediator) clazz.newInstance();

        } catch (Exception e) {
            String msg = "Error while creating an instance of the specified mediator class : " + clazz.getName();
            log.error(msg, e);
            throw new SynapseException(msg, e);
        }

        setProperties(m, synCtx);

        return m.mediate(synCtx);
    }
View Full Code Here

    public boolean mediate(MessageContext synCtx) {
        log.debug("Implicit Sequence <" + getType() + "> :: mediate()");

        Iterator it = mediators.iterator();
        while (it.hasNext()) {
            Mediator m = (Mediator) it.next();
            if (!m.mediate(synCtx)) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

    public void addChildren(OMElement el, ListMediator m)
    {
        Iterator it = el.getChildElements();
        while (it.hasNext()) {
            OMElement child = (OMElement) it.next();
            Mediator med = MediatorFactoryFinder.getInstance().getMediator(child);
            if (med != null) {
                m.addChild(med);
            } else {
                String msg = "Unknown mediator : " + child.getLocalName();
                log.error(msg);
View Full Code Here

public class ServiceMediatorMessageReceiver extends AbstractMessageReceiver {
    public void receive(MessageContext messageContext) throws AxisFault {
        Object obj = makeNewServiceObject(messageContext);

        Mediator mediator = (Mediator) obj;

        if (EnvironmentAware.class.isAssignableFrom(mediator.getClass())) {
            SynapseEnvironment se = (SynapseEnvironment) messageContext
                    .getProperty(Constants.MEDIATOR_SYNAPSE_ENV_PROPERTY);
            ((EnvironmentAware) mediator).setSynapseEnvironment(se);
            ((EnvironmentAware) mediator).setClassLoader(
                    messageContext.getAxisService().getClassLoader());
        }
        SynapseMessage smc = new Axis2SynapseMessage(messageContext);
        boolean returnValue = mediator.mediate(smc);
        messageContext.setProperty(Constants.MEDIATOR_RESPONSE_PROPERTY,
                new Boolean(returnValue));
    }
View Full Code Here

  private Class clazz = null;

 

  public boolean process(SynapseEnvironment se, SynapseMessage smc) {
    Mediator m = null;

    try {
      m = (Mediator) getClazz().newInstance();
    } catch (Exception e) {
      throw new SynapseException(e);
    }
    if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
      ((EnvironmentAware) m).setSynapseEnvironment(se);
    }
    return m.mediate(smc);

  }
View Full Code Here

  private GenericApplicationContext ctx = null;

  private String beanName = null;

  public boolean process(SynapseEnvironment se, SynapseMessage smc) {
    Mediator m = (Mediator) getContext().getBean(getBeanName());
    if (EnvironmentAware.class.isAssignableFrom(m.getClass())) {
      ((EnvironmentAware) m).setSynapseEnvironment(se);
    }
    return m.mediate(smc);

  }
View Full Code Here

TOP

Related Classes of org.apache.synapse.api.Mediator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.