The JavaScript interface enables you to get two different sets of configuration properties, the filter specific properties, and the general replicator properties. The filter specific properties should be used configure and specify configuration information unique to that instance of the filter configuration. Since multiple filter configurations using the same filter definition can be created, using the filter-specific content is the simplest method for obtaining this information.
Getting Filter Properties
To obtain the properties configured for the filter within the static
configuration file according to the context of the filter
configuration, use the filterProperties
class
with the getString()
method. For example,
the dbrename
filter uses two
properties, dbsource and
dbtarget to identify the
database to be renamed and the new name. The definition for the
filter within the configuration file might be:
replicator.filter.jsdbrename=com.continuent.tungsten.replicator.filter.JavaScriptFilter replicator.filter.jsdbrename.script=${replicator.home.dir}/support/filters-javascript/dbrename.js replicator.filter.jsdbrename.dbsource=contacts replicator.filter.jsdbrename.dbtarget=nyc_contacts
Within the JavaScript filter, they are retrieved using:
sourceName = filterProperties.getString("dbsource"); targetName = filterProperties.getString("dbtarget");
Generic Replicator Properties
General properties can be retrieved using the
properties
class and the
getString()
method:
master = properties.getString("replicator.thl.remote_uri");