|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
public IlrSessionResponse executeRulesOnJ2SESession(Customer user, ShoppingCart cart) throws IlrFormatException, IlrSessionException { IlrSessionFactory factory = new IlrJ2SESessionFactory(); IlrStatelessSession session = factory.createStatelessSession(); IlrSessionRequest sessionRequest = factory.createRequest(); sessionRequest.setRulesetPath(IlrPath.parsePath(rulesetPath)); // Ensure correct version of the ruleset is taken in account sessionRequest.setForceUptodate(true); sessionRequest.setTraceEnabled(true); sessionRequest.getTraceFilter().setInfoAllFilters(true); // Set the input parameters for the execution of the rules MapinputParameters = new HashMap (); Announcement announcement = new Announcement(); inputParameters.put("announcement", announcement); inputParameters.put("customer", user); inputParameters.put("shoppingCart", cart); sessionRequest.setInputParameters(inputParameters); IlrSessionResponse sessionResponse = session.execute(sessionRequest); return sessionResponse; }
Method Summary | |
---|---|
IlrManagementSession |
createManagementSession()
Returns a new management session. |
IlrSessionRequest |
createRequest()
Returns a request object used to execute rulesets. |
IlrStatefulSession |
createStatefulSession(IlrPath rulesetPath,
Serializable userData,
Map<String,Object> initParameters,
boolean forceUptodate)
Returns a stateful rule session. |
IlrStatefulSession |
createStatefulSession(IlrPath rulesetPath,
Serializable userData,
Map<String,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. |
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 |
---|
IlrStatelessSession createStatelessSession() throws IlrSessionCreationException
IlrSessionCreationException
- if an error occurred when the
stateless session was created:
IlrStatefulSession createStatefulSession(IlrPath rulesetPath, Serializable userData, Map<String,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
- Initalization 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, Serializable userData, Map<String,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
- Initalization 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
|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |