ilog.rules.res.session.interceptor

Interface IlrSessionInterceptor



  • public interface IlrSessionInterceptor
    IlrSessionInterceptor represents the interface of rule-session execution interceptors. Interceptors transparently influence ruleset path selection. Using interceptors, you can inject custom behaviors before and after ruleset execution.

    Use this interface to intercept both stateless and stateful rule sessions. The only difference lies in the way the methods are called:

    • For stateless sessions, three interceptor methods are called for each ruleset execution. The transformRsPath and beforeExecute methods are triggered before the ruleset is executed. The afterExecute method is triggered after the ruleset is executed.
    • For stateful sessions, the transformRsPath method is called only once when the stateful session is created. The ruleset path is immutable inside a stateful session. The beforeExecute and afterExecute methods are called before and after each ruleset execution inside the same stateful session.
    Since:
    7.0
    • Method Detail

      • transformRsPath

        IlrPath transformRsPath(IlrPath path,
                              IlrRuleAppInformation ruleAppInformation,
                              java.io.Serializable userData,
                              java.util.Map<java.lang.String,java.lang.Object> parameters,
                              IlrSessionFactory sessionFactory)
                                throws IlrSessionInterceptorException
        Used for interceptor-based ruleset selection. This method is called by a rule session before ruleset execution. Implement this method to change the ruleset path used by registering an interceptor. In a stateless session, this method is called just before the calls to the beforeExecute method. In stateful sessions, it is called only once when the session is created.
        Throws:
        An - IlrSessionInterceptorException object stops the ruleset execution process when thrown in implementations of this class.
        IlrSessionInterceptorException
        Parameters:
        path - The initial ruleset path. This path is supplied when a stateless session is executed or a stateful session is initialized.
        ruleAppInformation - The RuleApp information.
        userData - Arbitrary user data. This data comes from:
        • Request for stateless sessions.
        • Init for stateful sessions.
        parameters - Arbitrary parameters. This data comes from:
        • Request for stateless sessions.
        • Init for stateful sessions.
        sessionFactory - The session factory used to create the session that fired the interceptor.
        Returns:
        The path to be used.
      • beforeExecute

        void beforeExecute(IlrInterceptorContext context)
                           throws IlrSessionInterceptorException
        Called before ruleset execution. Calls the transformRsPath method when the interceptor needs to change the ruleset path before execution. The transformRsPath method has a consistent behavior for stateful and stateless rule sessions.
        Throws:
        An - IlrSessionInterceptorException object stops the ruleset execution process when thrown in implementations of this class.
        IlrSessionInterceptorException
        Parameters:
        context - The interceptor context. No response is set at this time.

© Copyright IBM Corp. 1987, 2017