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 Summary
Methods Modifier and Type Method and Description IlrManagementSession
createManagementSession()
Returns a new management session.IlrSessionRequest
createRequest()
Returns a request object used to execute rulesets.IlrStatefulSession
createStatefulSession(IlrPath rulesetPath, java.io.Serializable userData, java.util.Map<java.lang.String,java.lang.Object> initParameters, boolean forceUptodate)
Returns a stateful rule session.IlrStatefulSession
createStatefulSession(IlrPath rulesetPath, java.io.Serializable userData, java.util.Map<java.lang.String,java.lang.Object> initParameters, boolean forceUptodate, boolean enableInterceptor)
Returns a stateful rule session.IlrStatelessSession
createStatelessSession()
Returns a stateless rule session.IlrTraceDAOFactory
createTraceDAOFactory()
Returns an initializedIlrTraceDAOFactory
instance used to write traces for the rule sessions created by this factory.IlrXUInfo
getXUInfo()
Returns XU-related information.boolean
isInterceptorEnabled()
Returns whether interceptors are enabled.void
setInterceptorEnabled(boolean interceptorEnabled)
Sets the "interceptors enabled" flag for all the requests created by this factory.
-
-
-
Method Detail
-
createStatelessSession
IlrStatelessSession createStatelessSession() throws IlrSessionCreationException
Returns a stateless rule session.- Throws:
IlrSessionCreationException
- if an error occurred when the stateless session was created:- Returns:
- A new stateless session.
-
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 totrue
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.
-
createManagementSession
IlrManagementSession createManagementSession() throws IlrSessionCreationException
Returns a new management session.- Throws:
IlrSessionCreationException
- if an error occurs when the management session is created.- Returns:
- A new management session.
-
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 totrue
to enable interceptors.
-
createTraceDAOFactory
IlrTraceDAOFactory createTraceDAOFactory() throws IlrTraceDAOException
Returns an initializedIlrTraceDAOFactory
instance used to write traces for the rule sessions created by this factory. Override this method when you need a differentIlrTraceDAOFactory
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 totrue
to indicate that the latest version of the ruleset must be used.enableInterceptor
- Set totrue
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.
-
-