ilog.rules.res.session

Interface IlrSessionFactory

  • All Known Implementing Classes:
    IlrEJB3SessionFactory, IlrJ2SESessionFactory, IlrPOJOSessionFactory, ilog.rules.res.session.impl.IlrSessionFactoryBase


    public interface IlrSessionFactory
    IlrSessionFactory is the interface implemented by all rule session factories. Use rule session factories to retrieve management, stateless, or stateful sessions and session requests. A rule session factory is the entry point for connections to the Rule Execution Server using the rule session API.

    Code example

    The following code example shows how to execute rules in a Java SE session.

        IlrSessionFactory factory = new IlrJ2SESessionFactory();
        IlrStatelessSession session = factory.createStatelessSession();
        IlrSessionRequest sessionReq = factory.createRequest();
        sessionReq.setRulesetPath(IlrPath.parsePath("/loanvalidation/loanvalidationrules"));
        // Ensure that the last deployed version of the ruleset is taken into account
        sessionReq.setForceUptodate(true);
        sessionReq.setTraceEnabled(true);
        sessionReq.getTraceFilter().setInfoAllFilters(true);
        // Set the input parameters for the execution of the rules
        sessionReq.getInputParameters().put("loan", createLoan());
        sessionReq.getInputParameters().put("borrower", createBorrower());
        IlrSessionResponse sessionResp = session.execute(sessionReq);
        report = (Report)sessionResp.getOutputParameters().get("report");
     
    Since:
    7.0
    • Method Detail

      • createStatefulSession

        IlrStatefulSession createStatefulSession(IlrPath rulesetPath,
                                               java.io.Serializable userData,
                                               java.util.Map<java.lang.String,java.lang.Object> initParameters,
                                               boolean forceUptodate)
                                                 throws IlrSessionCreationException
        Returns a stateful rule session.
        Throws:
        IlrSessionCreationException - if an error occurred when the stateful session was created.
        Parameters:
        rulesetPath - The ruleset path for the session.
        userData - A serializable object supplied by the user.
        initParameters - Initialization parameters used by the interceptors if necessary.
        forceUptodate - Set to true to indicate that the latest version of the ruleset must be used.
        Returns:
        A new stateful session.
      • createRequest

        IlrSessionRequest createRequest()
        Returns a request object used to execute rulesets.
        Returns:
        A new request.
      • isInterceptorEnabled

        boolean isInterceptorEnabled()
        Returns whether interceptors are enabled.
        Returns:
        true if interceptors are enabled.
      • setInterceptorEnabled

        void setInterceptorEnabled(boolean interceptorEnabled)
        Sets the "interceptors enabled" flag for all the requests created by this factory. You can override this method at the request level.
        Parameters:
        interceptorEnabled - Set to true to enable interceptors.
      • createTraceDAOFactory

        IlrTraceDAOFactory createTraceDAOFactory()
                                                 throws IlrTraceDAOException
        Returns an initialized IlrTraceDAOFactory instance used to write traces for the rule sessions created by this factory. Override this method when you need a different IlrTraceDAOFactory instance from the one configured at the Rule Execution Server level.
        Throws:
        IlrTraceDAOException - if an error occurred when the factory was created.
        Returns:
        An initialized IlrTraceDAOFactory instance.
      • createStatefulSession

        IlrStatefulSession createStatefulSession(IlrPath rulesetPath,
                                               java.io.Serializable userData,
                                               java.util.Map<java.lang.String,java.lang.Object> initParameters,
                                               boolean forceUptodate,
                                               boolean enableInterceptor)
                                                 throws IlrSessionCreationException
        Returns a stateful rule session.
        Throws:
        IlrSessionCreationException - if an error occurred when the stateful session was created.
        Parameters:
        rulesetPath - The ruleset path for the session.
        userData - A serializable object supplied by the user.
        initParameters - Initialization parameters used by the interceptors if necessary.
        forceUptodate - Set to true to indicate that the latest version of the ruleset must be used.
        enableInterceptor - Set to true to indicate that the interceptors should be enabled
        Returns:
        A new stateful session.
      • getXUInfo

        IlrXUInfo getXUInfo()
                            throws IlrSessionException
        Returns XU-related information. Calling this method might significantly decrease performance because it prevents any other concurrent usage of the XU, like ruleset execution.
        Throws:
        IlrSessionException
        Returns:
        XU-related information.

© Copyright IBM Corp. 1987, 2020