|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ilog.rules.res.session.impl.IlrSessionFactoryBase ilog.rules.res.session.IlrJ2SESessionFactory
public class IlrJ2SESessionFactory
The IlrJ2SESessionFactory
class is a rule session factory for Java SE environments.
This class is a wrapper for a fully functional J2SE Execution Unit (XU). It does not depend on application server
resources.
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 Map<String, Object> inputParameters = new HashMap<String, Object>(); 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; }
Constructor Summary | |
---|---|
IlrJ2SESessionFactory()
|
|
IlrJ2SESessionFactory(IlrSessionFactoryConfig config)
Creates a session factory with a custom configuration. |
Method Summary | |
---|---|
static IlrSessionFactoryConfig |
createDefaultConfig()
Creates a session factory configuration that holds default settings. |
IlrManagementSession |
createManagementSession()
Returns a new management 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. |
protected InputStream |
findXUDescriptorStream()
|
void |
release()
Releases the resources that are used by this session factory. After this method has been called, any rule session that is created by this factory and still in use may have an unpredictable behaviour. Call this method only if you no longer want to execute rule sessions and need to release the corresponding resources. |
Methods inherited from class ilog.rules.res.session.impl.IlrSessionFactoryBase |
---|
createRequest, createStatefulSession, createTraceDAOFactory, isInterceptorEnabled, setInterceptorEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public IlrJ2SESessionFactory()
public IlrJ2SESessionFactory(IlrSessionFactoryConfig config)
createDefaultConfig()
to create a session factory configuration.
config
- a session factory configurationMethod Detail |
---|
public static IlrSessionFactoryConfig createDefaultConfig()
IlrJ2SESessionFactory(IlrSessionFactoryConfig)
to create a custom session factory.
public IlrStatelessSession createStatelessSession() throws IlrSessionCreationException
IlrSessionFactory
IlrSessionCreationException
- if an error occurred when the
stateless session was created:
public IlrStatefulSession createStatefulSession(IlrPath rulesetPath, Serializable userData, Map<String,Object> initParameters, boolean forceUptodate, boolean enableInterceptor) throws IlrSessionCreationException
IlrSessionFactory
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
public IlrManagementSession createManagementSession() throws IlrSessionCreationException
IlrSessionFactory
IlrSessionCreationException
- if an error occurs when the
management session is created.
protected InputStream findXUDescriptorStream()
public void release()
|
Rule Execution Server API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |