You use a web browser to run this sample.
Running this sample
To
run this sample:
- Open a web browser and type the appropriate URL for your application
server:
- WebSphere® 8.5
- http://localhost:<PORT>/rulesession
- WebSphere 8.0
- http://localhost:<PORT>/rulesession
- WebLogic Server 10
and 12
- http://localhost:7001/rulesession
- Tomcat 7
- http://localhost:8080/rulesession
- Log in by using the following user name and password:
- User name: resAdmin
- Password: resAdmin
- Click the Explorer tab. The application
server displays the available rulesets.
- Click View to view the Business Action
Language (BAL) rules that are contained in the ruleset.
- Click Deploy to deploy the ruleset
(for example, balsample2).
- Select the Execution tab.
The Java™ rule session produces an execution
report. In the Rule execution section, each icon
represents a different mode of executing a ruleset.
- Click the Java Rule Session icon.
The
execution results and the execution report display the following information:
- Execution results
- Messages: Parameters with values that are affected by the execution
of the rules.
- Normal Price: The normal price of the item.
- Discount: The discount that the rules calculate.
- Final Price: The cost of the item minus the calculated discount.
- Execution report
The
IlrExecutionTrace API provides
access to information about the execution such as working memory,
execution time, and number of executed rules. The sample displays
the following trace information:
- The number of executed rules.
- The executed rules.
- On the application servers that support Enterprise JavaBeans (EJB), you can also execute the
rules remotely by using a Java client,
as follows:
- Switch to the Samples Console perspective.
- In the Samples Commands view, navigate to .
The
<appserver_name> variable
is one of the following application servers:
- WebSphere Application Server 8.5
(sample server): websphere85
- WebSphere Application Server 8.0: websphere8
- WebLogic Server 10: weblogic10
- WebLogic Server 12: weblogic12
- Make sure that you have deployed the ruleset, as described in
step 5.
- Expand Commands and double-click the run command.
If your are working on the sample server, you are prompted for your
credentials. Enter resAdmin and resAdmin for
both the user name and the password.
How this sample works
This
sample demonstrates the use case of a Java EE
execution stack in EJB, plain Java objects
(POJO), and JSR-94 modes.
In the sample, you can perform the
following tasks:
- Deploy a RuleApp using a web interface.
- Execute rules from a web interface.
- Execute rules remotely from a Java client.
You can deploy and execute the sample on all supported platforms.