Introduction

Shows you how to create a Java rules enabled application. This application opens an Oracle Business Rules dictionary, processes the rules from the dictionary, and runs the rules to obtain results. The rules in the dictionary use Java Beans for business objects (as Facts).

Build, deploy, and run a sample rules enabled Java application that uses Java Facts in an Oracle Business Rules rule set.

Using the Run Function with a Rule Session

session.callFunctionWithArgument( "run", rsname);

Running the Rule Enabled Application and Examining Results

Run the setCP Command Script

The setCP, or setCP.cmd scripts set the appropriate CLASSPATH environment variable for running the TestMain program from this directory. If you need to run TestMain from a different directory, then modify the source code in %HOWTO_HOME%/src/carrental/TestMain.java. The dictionary is currently loaded from a relative path that assumes the program is running from %HOWTO_HOME%. Either make the path for the repository to be an absolute path or modify the source code retrieve the repository path from a command line argument or the environment.

To run the test program:

On unix systems:

$ . setCP

On windows systems:

> setCP.cmd

Run the Application

> java carrental.TestMain
Rental declined Qun Under age: age is: 15
>

Building the Rule Enabled Application

%ORACLE_HOME%/ant/bin

Ensure the %ORACLE_HOME% environment variable is defined, and from the %HOWTO_HOME% directory, type the command: