Package org.apache.synapse

Examples of org.apache.synapse.Mediator


                }
            }
        }
        if (canAccess) {
            if (onAcceptSeqKey != null) {
                Mediator mediator = synCtx.getSequence(onAcceptSeqKey);
                if (mediator != null) {
                    return mediator.mediate(synCtx);
                } else {
                    handleException("Unable to find onAccept sequence with key : "
                            + onAcceptSeqKey, synCtx);
                }
            } else if (onAcceptMediator != null) {
                return onAcceptMediator.mediate(synCtx);
            } else {
                return true;
            }

        } else {
            if (onRejectSeqKey != null) {
                Mediator mediator = synCtx.getSequence(onRejectSeqKey);
                if (mediator != null) {
                    return mediator.mediate(synCtx);
                } else {
                    handleException("Unable to find onReject sequence with key : "
                            + onRejectSeqKey, synCtx);
                }
            } else if (onRejectMediator != null) {
View Full Code Here


        if (service != null) {
            Parameter inMediationParam
                    = service.getParameter(HandlerConstants.IN_SEQUENCE_PARAM_NAME);
            if (inMediationParam != null && inMediationParam.getValue() != null) {
                if (inMediationParam.getValue() instanceof Mediator) {
                    Mediator inMessageSequence = (Mediator) inMediationParam.getValue();
                    return inMessageSequence.mediate(synCtx);
                } else if (inMediationParam.getValue() instanceof String) {
                    Mediator inMessageSequence = synCtx.getConfiguration().getSequence(
                            (String) inMediationParam.getValue());
                    return inMessageSequence.mediate(synCtx);
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("The provided in message mediation " +
                                "sequence is not a proper mediator");
                    }
View Full Code Here

        if (service != null) {
            Parameter inMediationParam
                    = service.getParameter(HandlerConstants.OUT_SEQUENCE_PARAM_NAME);
            if (inMediationParam != null && inMediationParam.getValue() != null) {
                if (inMediationParam.getValue() instanceof Mediator) {
                    Mediator inMessageSequence = (Mediator) inMediationParam.getValue();
                    return inMessageSequence.mediate(synCtx);
                } else if (inMediationParam.getValue() instanceof String) {
                    Mediator inMessageSequence = synCtx.getConfiguration().getSequence(
                            (String) inMediationParam.getValue());
                    return inMessageSequence.mediate(synCtx);
                } else {
                    if (log.isDebugEnabled()) {
                        log.debug("The provided out message mediation " +
                                "sequence is not a proper mediator");
                    }
View Full Code Here

    protected void mediateSequence(MessageContext synCtx) {

        if (sequence != null && synCtx != null && "true".equalsIgnoreCase(
                (String) synCtx.getProperty(SynapseConstants.MESSAGE_STORE_REDELIVERED))) {
            Mediator seq = synCtx.getSequence(sequence);
            if (seq != null) {
                seq.mediate(synCtx);
            }
        }
    }
View Full Code Here

        if (appContext != null) {

            Object o = appContext.getBean(beanName);   
            if (o != null && Mediator.class.isAssignableFrom(o.getClass())) {
                Mediator m = (Mediator) o;
                if (synLog.isTraceOrDebugEnabled()) {
                    synLog.traceOrDebug("Loaded mediator from bean : " + beanName + " executing...");
                }
                return m.mediate(synCtx);

            } else {
                if (synLog.isTraceOrDebugEnabled()) {
                    synLog.traceOrDebug("Unable to load mediator from bean : " + beanName);
                }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Sequence Deployment from file : " + fileName + " : Started");
        }

        try {   
            Mediator m = MediatorFactoryFinder.getInstance().getMediator(
                    artifactConfig, properties);
            if (m instanceof SequenceMediator) {
                SequenceMediator seq = (SequenceMediator) m;
                seq.setFileName((new File(fileName)).getName());
                if (log.isDebugEnabled()) {
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Sequence Update from file : " + fileName + " : Started");
        }

        try {
            Mediator m = MediatorFactoryFinder.getInstance().getMediator(
                    artifactConfig, properties);
            if (m instanceof SequenceMediator) {
                SequenceMediator seq = (SequenceMediator) m;
                if ((SynapseConstants.MAIN_SEQUENCE_KEY.equals(existingArtifactName)
                        || SynapseConstants.FAULT_SEQUENCE_KEY.equals(existingArtifactName))
View Full Code Here

        }
        return false;
    }

    public void init(SynapseEnvironment se) {
        Mediator mediator = se.getSynapseConfiguration().getSequence(consumer);
        sedaQueue = new SEDAQueue(sedaQueuePolicy,
                new SEDAQueueConsumerWorkerFactory(sedaQueueConsumerPolicy,
                        new DefaultConsumer(mediator)));
        sedaQueueProducer = new SEDAQueueProducer(sedaQueueProducerPolicy,
                sedaQueue);
View Full Code Here

    private static final OMElement MY_MEDIATOR_FOO_FUNC = TestUtils.createOMElement(
       "<x><![CDATA[ function foo(mc) { return true;} ]]></x>");

    public void testInlineScriptMediatorFactory() throws XMLStreamException {
        ScriptMediatorFactory mf = new ScriptMediatorFactory();
        Mediator mediator = mf.createMediator(INLINE_MEDIATOR_CONFIG, new Properties());
        try{
            MessageContext mc = TestUtils.getTestContext("<foo/>",null);
            assertTrue(mediator.mediate(mc));
        }catch(Exception e){
            e.printStackTrace();
        }
    }
View Full Code Here

        Map<String,Entry> props = new HashMap<String,Entry>();
        props.put("MyMediator", prop);
        MessageContext mc = TestUtils.getTestContext("<foo/>", props);

        ScriptMediatorFactory mf = new ScriptMediatorFactory();
        Mediator mediator = mf.createMediator(REG_PROP_MEDIATOR_CONFIG, new Properties());
        assertTrue(mediator.mediate(mc));
    }
View Full Code Here

TOP

Related Classes of org.apache.synapse.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.