Data sources for decision tables sample details

You use Rule Designer to run this sample.

Running this sample

You can run this sample in several stages.

To run the File Provider:

  1. If necessary, switch to the Rule perspective:

    Click Window  > Open Perspective  > Other. Select Rule > Rule Perspective, and then click OK.

  2. Click Run  > External Tools  > External Tools Configurations.

    The External Tools Configurations window opens.

  3. In the Configurations list, click Ant Build  > dtpopulate-application.
  4. Click the Targets tab.
  5. Select the run.file target check box.
  6. Click Run.

    The Console view displays the output:

    ...
    [java] Received arguments:
    [java] targetproject='dtpopulate-rule'
    [java] dtname='dtsample'
    [java] driver=' '
    [java] url='csv://./data/script/data.txt'
    [java] user=''
    [java] password=''
    [java] data=';'
    [java] dtsample successfully loaded 
  7. In the Rule Explorer, right-click the decision table dtpopulate-rule  > rules  > dtsample and click Refresh.
  8. Double-click the decision table dtsample to open it and load the associated data.
  9. Close the dtsample decision table.

To run the Excel Provider:

  1. In the Rule perspective, on the Run menu, click External Tools  > External Tools Configurations.

    The External Tools Configurations window opens.

  2. In the Configurations list, click Ant Build  > dtpopulate-application.
  3. Click the Targets tab.
  4. Clear run.file and select the run.xl target check box.
  5. Click Run.

    The Console view displays the output:

    ...
    [java] Received arguments:
    [java] targetproject='dtpopulate-rule'
    [java] dtname='dtsample'
    [java] driver=' '
    [java] url='xl://./data/script/data.xls'
    [java] user=''
    [java] password=''
    [java] data='sheet'
    [java] dtsample successfully loaded 
  6. In the Rule Explorer, right-click the decision table dtpopulate-rule  > rules  > dtsample and click Refresh to refresh the decision table.
  7. Double-click the decision table dtsample to open it and load the associated data.
  8. Close the dtsample decision table.

To run the Database Provider:

  1. In the Rule perspective, on the Run menu, click External Tools  > External Tools Configurations.

    The External Tools Configurations window opens.

  2. In the Configurations list, click Ant Build  > dtpopulate-application.
  3. Click the Targets tab.
  4. Clear the run.xl target check box and select the run.db target check box.
  5. Click Run.

    The run.db target first creates and loads a simple Derby database schema. The Console view displays the output:

    ...
    [java] Received arguments:
    [java] targetproject='dtpopulate-rule'
    [java] dtname='dtsample'
    [java] driver='org.apache.derby.jdbc.ClientDriver'
    [java] url='jdbc:derby://localhost:1527/DTPOPULATION'
    [java] user='DTPOPULATIONSAMPLE'
    [java] password='DTPOPULATIONSAMPLE'
    [java] data='SELECT * FROM DATATABLE'
    [java] dtsample successfully loaded
    ...
  6. In the Rule Explorer, right-click the dtpopulate-rule  > rules  > dtsample decision table and click Refresh to refresh the decision table.
  7. Double-click the dtsample to open it and load the associated data.
  8. Close the dtsample decision table.

How this sample works

The classes and arguments required in this sample are summarized below:

Source files

To display the source code of the dtpopulate Eclipse plug-in, do the following:

  1. Click File  > Import.
  2. In the Import Wizard, select Plug-in Development > Plug-ins and Fragments and click Next.
  3. In the Import As section, select the Projects with source folders option and click Next.
  4. In the Plug-ins and Fragments Found list, scroll down and select the ilog.rules.studio.samples.dtpopulate plug-in, and then click Add.
  5. Click Finish.

    Rule Explorer displays the source code of the plug-in.

  6. Switch to the Plug-in Development perspective.

    Click Window  > Open Perspective  > Other. Select the Plug-in Development perspective, and then click OK.

  7. In the Package Explorer, navigate to the Java™ source files in the ilog.rules.studio.samples.dtpopulate  > dtpopulatesrc folder.

    The sample uses the following classes, which are described in How this sample works:

    ilog.rules.studio.samples.dtpopulate.DTFeeder

    ilog.rules.studio.samples.dtpopulate.helper.Argument

    ilog.rules.studio.samples.dtpopulate.helper.FileLoader

    ilog.rules.studio.samples.dtpopulate.helper.JdbcLoader

    ilog.rules.studio.samples.dtpopulate.helper.ExcelLoader

    ilog.rules.studio.samples.dtpopulate.helper.DataProvider