Creating a POJO client project for RuleApps

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:

  1. Click File > New  >  Project.
  2. In the New Project wizard, select Client Project for RuleApps, and then click Next.
  3. Expand the Rule Execution Server category, select the Plain Old Java Object generator, and then click Next.
  4. On the Client Project Name page, enter the name of the project, and then click Next.
  5. On the RuleApp Project page, select the RuleApp project for which you want to generate the project, and then click Next.
  6. On the Ruleset Archive page, select the ruleset archives that you want to execute from the project, and then click Next.
  7. On the Ruleset Parameters page, use the default parameter values or change them.
    Ruleset Parameters page that shows the default ruleset parameter values

    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:

    1. Select the relevant row in the table and click Change.
    2. In the Edit Ruleset Parameter dialog, select Expression or Method.
    3. Enter a value, and then click OK.
  8. To accept the default values or after you have changed parameter values, click Next.
  9. On the Main Task Name page, proceed as follows:
    1. 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.

    2. Select the name of the alternative task.
    3. Click Next.
  10. On the POJO Properties page, proceed as follows:
    1. Either accept the default names for Interface Name and Implementation Name or replace them.
    2. If you do not want to generate an interface for the POJO, clear the Generate an interface for the POJO check box.
    3. Click Browse.
    4. 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.
  11. If no configuration is available for you to select, create one by using the Rule Execution Server Configuration wizard, as follows:
    1. On the Execution Server Configuration Selection page, click Create a configuration.
    2. 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:

      1. Click Create a new configuration project.
      2. On the New Rule Execution Server Configuration Project page, enter the name of the new configuration project.
      3. Click Finish.
      4. On the Add New Configuration to a Project page, select the configuration project that you just created and click Next.
    3. On the Configuration Name page, either accept the default configuration name or replace it, and then click Next.
    4. 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.
    5. Click Finish and select the new Rule Execution Server configuration.
  12. On the POJO Properties page, with the Rule Execution Server configuration selected, click Next.
  13. 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
  1. 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
  2. Refresh the project in Eclipse to view the latest version of the RuleApp.