| Samples > Rule Execution Server Integration > How to Use a Rule Session in Java EE |
How to Use a Rule Session in Java EE |
PREVIOUS NEXT |
The sample shows you how to execute a simple stateless rule session on a Java EE application server. You can execute the sample on the Web using Java Server Pages (JSP), or by using a Java client.
Key features include:
IlrJmxMutableModel
http://jcp.org/en/jsr/detail?id=94)
Before installing the sample, you will need to start the Rule Execution Server Console using:
If you are using an application server other than the JBoss Samples Server, configure the sample property files for your application server as follows:
<InstallDir>/executionserver/samples/j2eerulesession/weblogic92|100/build.properties:
WL_HOME=${env.WL_HOME}. By default the variable is set to your WL_HOME environment variable.
<InstallDir>/executionserver/samples/j2eerulesession/weblogic92|100/jndi.properties:
java.naming.provider.url=<JNDIService>. This defines the URI of the machine running the JNDI service. For example: java.naming.provider.url=t3://localhost:7001/
<InstallDir>/executionserver/samples/j2eerulesession/websphere6/build.properties:
WAS_HOME=${env.WAS_HOME}. By default the variable is set to your WAS_HOME environment variable.
<InstallDir>/executionserver/samples/j2eerulesession/websphere6/jndi.properties:
java.naming.provider.url=<JNDIService>. This defines the URI of the machine running the JNDI service.
<InstallDir>/executionserver/samples/j2eerulesession/jboss40/build.properties:
jboss.home=<JBoss_Installation_Directory> . By default the path is set to the Samples Server.
jboss.config=<JBoss_Configuration>. By default this property is set to the configuration file of the Samples Server.
<InstallDir>/executionserver/samples/j2eerulesession/jboss40/jndi.properties:
java.naming.provider.url=<JNDIService>. This defines the URI of the machine running the JNDI service. By default, this property is set to the Samples Server URI.
<InstallDir>/executionserver/samples/j2eerulesession/sunas82/build.properties:
SUNAS82_HOME=${env.SUNAS_HOME}. By default the variable is set to your SUNAS_HOME environment variable.
<InstallDir>/executionserver/samples/j2eerulesession/oracle10g/build.properties:
ORACLE_HOME=${env.ORACLE_HOME}. By default the variable is set to your ORACLE_HOME environment variable.
<InstallDir>/executionserver/samples/j2eerulesession/oracle10g/jndi.properties:
java.naming.provider.url=<JNDIService>. This defines the URI of the machine running the JNDI service.
You need to build the sample if you are using an application server other than the JBoss Samples Server.
To build the sample:
executionserver > j2eerulesession > <APPLICATION_SERVER_NAME>
ear command to build the XOM classes and package the following files:
To install the sample on JBoss through the sample server:
ear.
deploy.
The EARs for the other application servers should be deployed through the respective application server console.
The sample can only be run through the Samples Console.
To run the sample:
http://localhost:8080/rulesession
http://localhost:7001/rulesession
http://localhost:9080/rulesession
http://localhost:8080/rulesession
http://localhost:8888/rulesession
http://localhost:8080/rulesession
balsample2).
IlrExecutionResult class, you have access to a lot of information about the execution, such as: working memory, execution times, number of rules fired, and so on. In the sample we have displayed the following information:
The Java client connects to the Remote EJB Rulesession, executes the rules and displays the output.
The sample is located in:
<InstallDir>/executionserver/samples/j2eerulesession
The XOM source files located are in:
<InstallDir>/executionserver/samples/j2eerulesession/src/shopmodel
Customer is the XOM class of a customer.
Item is the XOM class of an item.
ItemType is the XOM class of an item type.
ShoppingCart is the XOM class of a shopping cart.
The source files for the web tier control classes are located in:
<InstallDir>/executionserver/samples/j2eerulesession/src/controller
ComponentSessionListener
RuleAppController
RuleExecutionController: -- this class provides two generic methods to execute the sample ruleset, using the JSR-94 API and the JRules vendor API. It also provides methods that demonstrate how to use the same JRules vendor API-based source code to execute a ruleset using a Javabean, a local EJB, or a remote EJB-based rule session.
Webutil: Utility class used in the Web tier.
MySessionProvider
The source file for the Java remote client is located in:
<InstallDir>/executionserver/samples/j2eerulesession/src/client
RemoteJavaClient -- this is a Java SE program that remotely invokes the stateless rule session and re-uses the methods provided by the sample RuleExecutionController class.
The JSP source files are located in:
<InstallDir>/executionserver/samples/j2eerulesession/src/WebContent
The sample demonstrates a Java EE execution stack use case in EJB, POJO, and JSR-94 modes.
In the sample you can:
The sample can be deployed and executed on all JRules supported platforms.
You can rebuild the sample through the Samples Console.
To rebuild the sample from the Java source files:
executionserver > j2eerulesession > jboss40.
ear command to build the XOM classes and package the following files:
deploy command to deploy the EAR on the Samples Server.
| Copyright © 1987-2008 ILOG S.A. All rights reserved. Legal terms. Documentation homepage. | PREVIOUS NEXT |