Class SwitchMediator

    • Constructor Detail

      • SwitchMediator

        public SwitchMediator()
    • Method Detail

      • init

        public void init​(SynapseEnvironment se)
        Description copied from interface: ManagedLifecycle
        This method should implement the initialization of the implemented parts of the configuration.
        Specified by:
        init in interface ManagedLifecycle
        Parameters:
        se - SynapseEnvironment to be used for initialization
      • destroy

        public void destroy()
        Description copied from interface: ManagedLifecycle
        This method should implement the destroying of the implemented parts of the configuration.
        Specified by:
        destroy in interface ManagedLifecycle
      • mediate

        public boolean mediate​(MessageContext synCtx)
        Iterate over switch cases and find match and execute selected sequence
        Specified by:
        mediate in interface Mediator
        Parameters:
        synCtx - current context
        Returns:
        as per standard semantics
      • mediate

        public boolean mediate​(MessageContext synCtx,
                               ContinuationState continuationState)
        Description copied from interface: FlowContinuableMediator
        Mediate the message using a ContinuationState. This is used when mediating the response message when service is invoked using a Call Mediator.
        Specified by:
        mediate in interface FlowContinuableMediator
        Parameters:
        synCtx - MessageContext
        continuationState - ContinuationState
        Returns:
        whether mediation flow is completed
      • addCase

        public void addCase​(SwitchCase m)
        Adds the given mediator (Should be a SwitchCaseMediator) to the list of cases of this Switch mediator
        Parameters:
        m - the SwitchCaseMediator instance to be added
      • getCases

        public List<SwitchCase> getCases()
        Get the list of cases
        Returns:
        the cases list
      • getSource

        public SynapsePath getSource()
        Return the source Path expression set
        Returns:
        thje source Path expression
      • setSource

        public void setSource​(SynapsePath source)
        Sets the source Path expression
        Parameters:
        source - the Path expression to be used as the source
      • getDefaultCase

        public SwitchCase getDefaultCase()
        Get default case
        Returns:
        the default case
      • setDefaultCase

        public void setDefaultCase​(SwitchCase defaultCase)
        setting the default case ...which contains mediators to invoke when no case condition satisfy
        Parameters:
        defaultCase - A SwitchCase instance representing default case