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.
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");
| 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 initialized
IlrTraceDAOFactory 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.
|
IlrStatelessSession createStatelessSession() throws IlrSessionCreationException
IlrSessionCreationException - if an error occurred when the
stateless session was created:IlrStatefulSession createStatefulSession(IlrPath rulesetPath, java.io.Serializable userData, java.util.Map<java.lang.String,java.lang.Object> initParameters, boolean forceUptodate) throws IlrSessionCreationException
IlrSessionCreationException - if an error occurred when the
stateful session was created.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.IlrSessionRequest createRequest()
IlrManagementSession createManagementSession() throws IlrSessionCreationException
IlrSessionCreationException - if an error occurs when the
management session is created.boolean isInterceptorEnabled()
true if interceptors are enabled.void setInterceptorEnabled(boolean interceptorEnabled)
interceptorEnabled - Set to true to enable interceptors.IlrTraceDAOFactory createTraceDAOFactory() throws IlrTraceDAOException
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.IlrTraceDAOException - if an error occurred when the
factory was created.IlrTraceDAOFactory instance.IlrStatefulSession createStatefulSession(IlrPath rulesetPath, java.io.Serializable userData, java.util.Map<java.lang.String,java.lang.Object> initParameters, boolean forceUptodate, boolean enableInterceptor) throws IlrSessionCreationException
IlrSessionCreationException - if an error occurred when the
stateful session was created.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 enabledIlrXUInfo getXUInfo() throws IlrSessionException
IlrSessionException© Copyright IBM Corp. 1987, 2017