About Datasources

A Datasource defines a table format for a source of data and, in the case of RDBMS datasources, a connection to a table of a database.

InterPlay provides 3 types of datasources:

  • DBTable: RDBMS datasource to query a database table.
  • InterPlay table: RDBMS datasource to query a table of InterPlay database that stores instances of an Object Type or an Element Type.
  • Import file: definition of the format of CSV files to import. ‘Import file’ datasources are used in Importer.

In the Designer, once you have defined an RDBMS datasource, you can generate automatically a set of functions that you attach to editor fields to control or restrict the value of the fields. These functions enable you to:

  • Check if an entered value is declared in the datasource and generate an error if it is not the case. You can filter the datasource values by using other field values of the editor. For instance, if the editor contains the A, B, C fields, you can get the possible values for A depending on the entered values for B and C.
  • Get the possible values from the datasource to propose to the user for a specific field. You can filter the possible values and provide localized label for each value.
  • Change another property when the user enters a value. For instance, if the editor contains the A and B fields then the function can set the value of B depending on the entered A value by looking into the datasource for the A-B mapping.

You can also access RDBMS datasources in the custom code to use the managed connection to the DBMS and store the retrieved values in the InterPlay cache memory.

DBTable Datasource

An external Datasource queries a database table.

To create a DBTable Datasource, you must provide the following parameters.

Parameter Description
Name Name of the Datasource
URL URL of the target RDBMS
Driver Driver to use
User name and password User name and password to open the connection
MAX active Maximum number of connections that can be open simultaneously
Schema Schema name required for certain databases such as MySQL
Table name Name of the table that provides the values
List of Columns

List of columns that are pertinent for the Datasource.

They correspond to the columns of the target Database table you want to use as data or filtering parameters.

For each Column, you must define a:

  • Name that identifies the column in the datasource.
    This name will be the same as the argument name in the functions that will be generated from the Datasource.
  • Database table column name
  • Filter Key.
    If set to True, the columns will be used as filter parameters in the generated functions. For instance, if the Datasource contains the A and B columns and if B is a key column then functions that query possible values will returns A values using a B value as filter.
Resource definition
  • Name of the Datasource connection service that can be used to define different target databases depending on the environment that hosts the configuration
  • Name of a JNDI datasource.
    To specify a configured JNDI datasource such as java:comp/env/jdbc/myDataSource, use the jndi:myDataSource syntax.
  • If you use the Resource definition to define a datasource then all the properties defined at the top of the form are no longer required (and no longer used).

InterPlay table Datasource

To create an InterPlay table Datasource, you must provide the following parameters.

Parameter Description
Name Name of the Datasource
Object Type Target Object Type
Path Target path to the Object Type or sub-Element
List of Columns

List of columns that are pertinent for the Datasource.

They correspond to the columns of the target Database table you want to use as data or filtering parameters.

For each Column, you must define a:

  • Name that identifies the column in the datasource.
    This name will be the same as the argument name in the functions that will be generated from the Datasource.
  • Database table column name
  • Filter Key.
    If set to True, the columns will be used as filter parameters in the generated functions. For instance, if the Datasource contains the A and B columns and if B is a key column then functions that query possible values will returns A values using a B value as filter.

Import file Datasource

To create an Import File Datasource, you must provide the following parameters.

Parameter Description
Name Name of the Datasource
Object Type Target Object Type
Path Target path to the Object Type or sub-Element
List of Columns

List of columns of the file to import.

For each Column, you must define the:

  • Name of the column in the file, that is, given in the first line of the file.
  • Name of the property of the referenced type
  • Type of the column in the file
    If set to True, the columns will be used as filter parameters in the generated functions. For instance, if the Datasource contains the A and B columns and if B is a key column then functions that query possible values will returns A values using a B value as filter.

At import time, for each line of the file to import, the default Importer creates an Object or Element of the specified type and sets its property values with the corresponding values found in the file, the property name being equal to the column name.

Creating a custom Rule or Java Importer enables you to define your own mapping mechanism to fill the Object and Element properties from the Columns in the file.

Caching a Datasource

To enable caching for your Datasource, you must provide the cache reset strategy, item reset or global reset, and the corresponding settings.

Item reset

For the item reset, the items in the cache are deleted one by one from the cache. This option requires that you supply the cache maximum size, the maximum number of entries and the entry lifetime.

Global reset

For the global reset, the cache is cleaned all at once. This option requires that you supply the cache maximum size, the maximum number of entries.

You can also reset the cache periodically each x days at a certain hour and minute set via the cache lifetime and reset hour parameters. If you want to specify a more complex period to reset the cache you use a Cron expression to configure the cache. For more information on Cron expressions, refer to http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger.

Datasource Column

A Datasource Column corresponds to a column of the target Database table. You must only create columns for the Database table column that you want to use as data or filtering parameters.

For each Column, you must define:

Parameter Description
Name Name that identifies the column in the datasource. This name will be the same as the argument name in the functions that will be generated from the Datasource.
Column name Database table column name
Filter Key If set to Yes, the columns will be used as filter parameters in the generated functions. For instance, if the Datasource contains the A and B columns and if B is a key column then functions that query possible values will returns A values using a B value as filter.
Column type Type of column in the database table.
Default operator

The left operand is the datasource column and the right operand is the function argument. If Filter key is set to Yes, the Default operator filters the Datasource column in:

  • Either the getRecord function inside the rules
  • Or the function call of a datasource function when the operator is not specified

Related Links