Package org.apache.synapse

Examples of org.apache.synapse.Mediator.mediate()


        }
        populateParameters(synCtx);
        //get the target function template and invoke by passing populated parameters
        Mediator mediator = synCtx.getSequenceTemplate(targetTemplate);
        if (mediator != null && mediator instanceof TemplateMediator) {
            return mediator.mediate(synCtx);
        }
        return false;
    }

    /**
 
View Full Code Here


        MessageContext synCtx = TestUtils.createLightweightSynapseMessageContext("<empty/>", config);
        Mediator seq1 = synCtx.getSequence(KEY_DYNAMIC_SEQUENCE_1);
        assertNotNull(seq1);
        assertTrue(((SequenceMediator) seq1).isInitialized());
        assertEquals(1, registry.getHitCount());
        seq1.mediate(synCtx);
        assertEquals("bar", synCtx.getProperty("foo"));

        // Phase 2
        System.out.println("Testing basic sequence caching...");
        synCtx = TestUtils.createLightweightSynapseMessageContext("<empty/>", config);
View Full Code Here

        synCtx = TestUtils.createLightweightSynapseMessageContext("<empty/>", config);
        Mediator seq2 = synCtx.getSequence(KEY_DYNAMIC_SEQUENCE_1);
        assertNotNull(seq2);
        assertTrue(((SequenceMediator) seq2).isInitialized());
        assertEquals(1, registry.getHitCount());
        seq2.mediate(synCtx);
        assertEquals("bar", synCtx.getProperty("foo"));
        assertTrue(seq1 == seq2);

        // Phase 3
        System.out.println("Testing advanced sequence caching...");
View Full Code Here

        Thread.sleep(8500L);
        Mediator seq3 = synCtx.getSequence(KEY_DYNAMIC_SEQUENCE_1);
        assertNotNull(seq3);
        assertTrue(((SequenceMediator) seq3).isInitialized());
        assertEquals(1, registry.getHitCount());
        seq3.mediate(synCtx);
        assertEquals("bar", synCtx.getProperty("foo"));
        assertTrue(seq1 == seq3);

        // Phase 4
        System.out.println("Testing sequence reloading...");
View Full Code Here

        synCtx = TestUtils.createLightweightSynapseMessageContext("<empty/>", config);
        Mediator seq4 = synCtx.getSequence(KEY_DYNAMIC_SEQUENCE_1);
        assertNotNull(seq4);
        assertTrue(((SequenceMediator) seq4).isInitialized());
        assertEquals(2, registry.getHitCount());
        seq4.mediate(synCtx);
        assertEquals("baz", synCtx.getProperty("foo"));
        assertTrue(seq1 != seq4);
        assertTrue(!((SequenceMediator) seq1).isInitialized());

        // Phase 5
View Full Code Here

        }
        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) {
View Full Code Here

        } 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

            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 {
View Full Code Here

                    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

            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 {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.