This documentation is for WSO2 Enterprise Service Bus version 4.8.1 . View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Java
Java
package samples.mediators;

    import org.apache.synapse.MessageContext;
    import org.apache.synapse.mediators.AbstractMediator;
    import org.apache.axiom.om.OMElement;
    import org.apache.axiom.om.OMAbstractFactory;
    import org.apache.axiom.om.OMFactory;
    import org.apache.axiom.soap.SOAPFactory;
    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    import javax.xml.namespace.QName;

    public class SimpleClassMediator implementsextends AbstractMediator {

        private static final Log log = LogFactory.getLog(SimpleClassMediator.class);

        private String variable1="10";

        private String variable2="10";

        private int variable3=0;

        public SimpleClassMediator(){}

        public boolean mediate(MessageContext mc) {
            // Do somthing useful..
            // Note the access to the Synapse Message context
            return true;
        }

        public String getType() {
            return null;
        }

        public void setTraceState(int traceState) {
            traceState = 0;
        }

        public int getTraceState() {
            return 0;
        }

        public void setVariable1(String newValue) {
            variable1=newValue;
        }

        public String getVariable1() {
            return variable1;
        }

        public void setVariable2(String newValue){
            variable2=newValue;
        }

        public String getVariable2(){
            return variable2;
        }
    }

...