You use Rule Designer to run this sample.
You can run this sample in several stages.
To run the File Provider:
Click OK.
. Select , and then clickThe External Tools Configurations window opens.
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
To run the Excel Provider:
The External Tools Configurations window opens.
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
To run the Database Provider:
The External Tools Configurations window opens.
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
...
The classes and arguments required in this sample are summarized below:
When the application launches, it calls this class. The class parses arguments passed through from the build.xml file and retrieves the project and the decision table.
It creates the data provider and the controller. You use Controller to load the data (with its provider). Any modifications made are committed over the decision table, which is persisted in the workspace.
This class parses the arguments passed and creates the data loader depending on input arguments.
You use the following arguments when using the database provider:
You use the following arguments when using the file provider:
You use the following arguments when using the Excel provider:
The data loader is a delegated object used by the data provider. The url input argument specifies the data loader to use:
The application calls this class when it uses a file loader. The class reads data from a file.
This class implements the ilog.rules.studio.samples.dtpopulate.helper.DataLoader interface. The main processing is done in the public void load() method.
When the application uses a jdbc loader, it calls this class. The class reads data from a database.
This class implements the ilog.rules.studio.samples.dtpopulate.helper.DataLoader interface. The main processing is done in the public void load() method.
This class is called when the application use an Excel loader. It reads data from an Excel spreadsheet.
This class implements the ilog.rules.studio.samples.dtpopulate.helper.DataLoader interface. The main processing is done in the public void load() method. Note that the Excel spreadsheet contains numbered columns. When read, these columns return their value as a double.
This class extends the ilog.rules.dt.model.provider.IlrDTAbstractDataProviderTableModel. It is the provider. It is contracted with a ilog.rules.studio.samples.dtpopulate.helper.DataLoader implementing class and delegates all its works to it. Three factory methods create the data loader:
public static IlrDTDataProvider createFileDataProvider (String filepath, String separator) which creates the file provider.
public static IlrDTDataProvider createExcelDataProvider (String filepath, String sheet) which creates the Excel provider.
public static IlrDTDataProvider createJDBCDataProvider (String driver, String url, String user, String password, String query) which creates the database provider.
To display the source code of the dtpopulate Eclipse plug-in, do the following:
Rule Explorer displays the source code of the plug-in.
Click OK.
. Select the Plug-in Development perspective, and then clickThe 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