Package org.apache.synapse.config.xml

Examples of org.apache.synapse.config.xml.SwitchCase


        // set xpath condition to select symbol
        SynapseXPath xpath = new SynapseXPath("//wsx:symbol");
        xpath.addNamespace("wsx", "http://www.webserviceX.NET/");
        switchMediator.setSource(xpath);
        SwitchCase caseOne = new SwitchCase();
        caseOne.setRegex(Pattern.compile("IBM"));
        AnonymousListMediator mediatorOne = new AnonymousListMediator();
        mediatorOne.addAll(Arrays.asList(new Mediator[] {ibmMediator}));
        caseOne.setCaseMediator(mediatorOne);
        SwitchCase caseTwo = new SwitchCase();
        caseTwo.setRegex(Pattern.compile("MSFT"));
        AnonymousListMediator mediatorTwo = new AnonymousListMediator();
        mediatorTwo.addAll(Arrays.asList(new Mediator[] {msftMediator}));
        caseTwo.setCaseMediator(mediatorTwo);

        SwitchCase caseDefault = new SwitchCase();
        AnonymousListMediator mediatorDefault = new AnonymousListMediator();
        mediatorDefault.addAll(Arrays.asList(new Mediator[] {defaultMediator}));
        caseDefault.setCaseMediator(mediatorDefault);
        // set ibm mediator to be called for IBM, msft for MSFT and default for others..
        switchMediator.addCase(caseOne);
        switchMediator.addCase(caseTwo);
        switchMediator.setDefaultCase(caseDefault);      
    }
View Full Code Here


                return defaultCase.mediate(synCtx);

            } else {
                for (Iterator iter = cases.iterator(); iter.hasNext();) {
                    SwitchCase swCase = (SwitchCase) iter.next();

                    if (swCase != null) {
                        if (swCase.matches(sourceText)) {
                            if (traceOrDebugOn) {
                                traceOrDebug(traceOn, "Matching case found : " + swCase.getRegex());
                            }
                            return swCase.mediate(synCtx);
                        }
                    }
                }

                if (defaultCase != null) {
View Full Code Here

                trace.trace("Start Case mediator list");
            }
            if (sourceText != null) {
                Iterator iter = cases.iterator();
                while (iter.hasNext()) {
                    SwitchCase swCase = (SwitchCase) iter.next();
                    if (swCase != null) {
                        if (swCase.matches(sourceText)) {
                            if (shouldTrace) {
                                trace.trace("Executing case for : " + swCase.getRegex());
                            }
                            return swCase.mediate(synCtx);
                        }
                    }
                }
                if (shouldTrace) {
                    trace.trace("End Case mediator list");
View Full Code Here

                return defaultCase.mediate(synCtx);

            } else {
                for (Iterator iter = cases.iterator(); iter.hasNext();) {
                    SwitchCase swCase = (SwitchCase) iter.next();

                    if (swCase != null) {
                        if (swCase.matches(sourceText)) {
                            if (traceOrDebugOn) {
                                traceOrDebug(traceOn, "Matching case found : " + swCase.getRegex());
                            }
                            return swCase.mediate(synCtx);
                        }
                    }
                }

                if (defaultCase != null) {
View Full Code Here

        // set xpath condition to select symbol
        AXIOMXPath xpath = new AXIOMXPath("//wsx:symbol");
        xpath.addNamespace("wsx", "http://www.webserviceX.NET/");
        switchMediator.setSource(xpath);
        SwitchCase caseOne = new SwitchCase();
        caseOne.setRegex(Pattern.compile("IBM"));
        AnonymousListMediator mediatorOne = new AnonymousListMediator();
        mediatorOne.addAll(Arrays.asList(new Mediator[] {ibmMediator}));
        caseOne.setCaseMediator(mediatorOne);
        SwitchCase caseTwo = new SwitchCase();
        caseTwo.setRegex(Pattern.compile("MSFT"));
        AnonymousListMediator mediatorTwo = new AnonymousListMediator();
        mediatorTwo.addAll(Arrays.asList(new Mediator[] {msftMediator}));
        caseTwo.setCaseMediator(mediatorTwo);

        SwitchCase caseDefault = new SwitchCase();
        AnonymousListMediator mediatorDefault = new AnonymousListMediator();
        mediatorDefault.addAll(Arrays.asList(new Mediator[] {defaultMediator}));
        caseDefault.setCaseMediator(mediatorDefault);
        // set ibm mediator to be called for IBM, msft for MSFT and default for others..
        switchMediator.addCase(caseOne);
        switchMediator.addCase(caseTwo);
        switchMediator.setDefaultCase(caseDefault);      
    }
View Full Code Here

                return defaultCase.mediate(synCtx);

            } else {
                for (Iterator iter = cases.iterator(); iter.hasNext();) {
                    SwitchCase swCase = (SwitchCase) iter.next();

                    if (swCase != null) {
                        if (swCase.matches(sourceText)) {
                            if (traceOrDebugOn) {
                                traceOrDebug(traceOn, "Matching case found : " + swCase.getRegex());
                            }
                            return swCase.mediate(synCtx);
                        }
                    }
                }

                if (defaultCase != null) {
View Full Code Here

TOP

Related Classes of org.apache.synapse.config.xml.SwitchCase

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.