You generate a POJO (Plain Old Java™ Object) client project for RuleApps by
using the POJO generator. The POJO generator generates files that
make it possible to execute a ruleset in Java SE
with a file or database persistence.
Before you begin
To be able to create a client project for RuleApps, you must first
create RuleApp projects with ruleset archives.
Procedure
To create a POJO client project for RuleApps:
- Click .
- In the New Project wizard, select Client
Project for RuleApps, and then click Next.
- Expand the Rule Execution Server category,
select the Plain Old Java Object generator,
and then click Next.
- On the Client Project Name page, enter
the name of the project, and then click Next.
- On the RuleApp Project page, select the RuleApp project for which
you want to generate the project, and then click Next.
- On the Ruleset Archive page, select
the ruleset archives that you want to execute from the project, and
then click Next.
- On the Ruleset Parameters page, use
the default parameter values or change them.
Rule Designer
reads the default parameter values for each selected ruleset from
their ruleset archive and displays them on the New Client
Project for RuleApps page. That page displays only IN and IN_OUT ruleset
parameters because the values of OUT parameters
are not user-defined but computed.
To change a ruleset parameter
value:
- Select the relevant row in the table and click Change.
- In the Edit Ruleset Parameter dialog, select
Expression or Method.
- Enter a value, and then click OK.
- To accept the default values or after you have changed
parameter values, click Next.
- On the Main Task Name page, proceed
as follows:
- Select the check box to specify an alternative rule
flow task to start the execution of a ruleset.
You can
specify an alternative rule flow task only if the ruleset archive
contains a rule flow. If a ruleset has no rule flow, no alternative
tasks are listed.
- Select the name of the alternative task.
- Click Next.
- On the POJO Properties page, proceed
as follows:
- Either accept the default names for Interface
Name and Implementation Name or
replace them.
- If you do not want to generate an interface for the
POJO, clear the Generate an interface for the POJO check
box.
- Click Browse.
- On the Execution Server Configuration Selection page,
select the appropriate configuration, click OK to
return to the POJO Properties page, and then
click Next to move to the Execution
Options page.
- If no configuration is available for you to select, create
one by using the Rule Execution Server Configuration
wizard, as follows:
- On the Execution Server Configuration Selection page,
click Create a configuration.
- On the Add New Configuration to a Project page,
select the Rule Execution Server
project for which you want to add the new configuration, and click Next to
specify the Rule Execution Server
Configuration Project name.
If no project is available
for you to select, create one as follows:
- Click Create a new configuration project.
- On the New Rule Execution Server Configuration Project page, enter the name
of the new configuration project.
- Click Finish.
- On the Add New Configuration to a Project page, select the configuration
project that you just created and click Next.
- On the Configuration Name page,
either accept the default configuration name or replace it, and then
click Next.
- On the RuleApp Deployment page, select the appropriate deployment
mode: file or database.
- If you select to a file system, use the default destination directory or
browse and select a different one.
- If you select to a database, add the following details for the project:
- Driver: Select a driver from the drop-down list.
- Driver path: Click Browse and locate the
driver.
- URL: Enter the URL of the database.
- Login: Enter the user ID and password to access the database.
- Password: Enter the password for this login.
- Click Finish and select the new
Rule Execution Server
configuration.
- On the POJO Properties page, with
the Rule Execution Server configuration
selected, click Next.
- Click Finish.
Results
The new POJO client project is displayed in the Rule Explorer
view. The generated project includes the following files:
- .java files that implement the POJO client
- An Ant build file, named build.xml, which
uses the class paths that are defined in <InstallDir>/executionserver/lib/classpath-executionserver.xml to
call the correct libraries
- A build.properties file
- An Eclipse launch configuration named <projectname>.launch
- The RuleApp archive file
- The execution unit (XU) configuration file named ra.xml
- Run the following Ant commands in the build file to run the POJO
client and update your RuleApp archive on Rule Execution Server:
-
ant run.ruleapp
-
ant deploy.ruleapp
- Refresh the project in Eclipse to view the latest version of the
RuleApp.