To package a POJO rule session for Java™ EE, you use
the rule session factory API to write an application that calls the ruleset. Then you edit the
deployment descriptors and put the rule session JAR file and other files into the relevant
archives.
Procedure
To package an application by using a POJO factory:
- Write a client application (a WAR file) by using JavaServer
Pages (JSPs) and HTML files.
Use the rule session factory
API in your ruleset execution code: IlrPOJOSessionFactory.
- Edit the deployment descriptors to authorize access to the execution unit (XU) by adding
a
<resource-ref> element to your web.xml file if you want
to execute one ruleset per transaction scope:
<resource-ref>
<res-ref-name>eis/XUConnectionFactory</res-ref-name>
<res-type>javax.resource.cci.ConnectionFactory</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Unshareable</res-sharing-scope>
</resource-ref>
Important:
Setting the res-sharing-scope value to Shareable might
imply a sharing of the ruleset without consideration of the canonical ruleset path. You must set
this value to UnShareable to isolate unexpected behavior that might be related to
the connection.
Restriction:
The predefined ruleset property ruleset.shareable is not supported by
decision engine.
In most cases, you must add this reference at the level of the deployment descriptor that is
specific to the application server, for example:.
<reference-descriptor>
<resource-description>
<res-ref-name>eis/XUConnectionFactory</res-ref-name>
<jndi-name>eis/XUConnectionFactory</jndi-name>
</resource-description>
</reference-descriptor>
This segment of the descriptor binds the reference name that is used in the Rule Execution Server component to the real JNDI name
eis/XUConnectionFactory. This is the name of the XU that is supplied at deployment
time.
For JBoss, use java:/eis/XUConnectionFactory.
- Package the .class, .jsp,
and .html files, and the deployment descriptors
into the appropriate archive files.
If you use only
POJO factories, package the <InstallDir>/executionserver/lib/jrules-res-session-java.jar in
your WEB-INF/lib directory. You can repackage
as you want, but the goal is to grant access to the classes inside
your servlet or JavaServer Pages. If your rules are written on Java classes, package them in the
WAR file.