Preprocessors

SQLPreproc | XindiceDbPreproc | XindiceIndexPreproc | DateMetadataPreproc

 

Preprocessors are components that execute only once during adaptor execution, before polling source.
Unlike sources, pipes and sinks, they carry no message, but they do carry metadatas.

 

Parameters :

type SQLPreproc
SQL SQL Statement to be executed.
dbType

The JDBC driver of your database (for example : com.mysql.jdbc.Driver)

dsn The JDBC URL (for ex : jdbc:mysql://localhost/xpweb3)
user Login to connect to db
password Password to connect to db

 

 

Create or drop an Xindice collection (database).

Parameters :

type XindiceDbPreproc
action "Create db" or "Drop db"
db Name of the collection to create/drop
url Url of the Xindice server (ex : xmldb:xindice://localhost:4080/db)

 

 

Create or drop an index on an Xindice collection.

Parameters :

type XindiceIndexPreproc
action "Create index" or "Drop index"
db Name of the collection where to index (or where index must be dropped)
indexName Name of the index to create/drop
indexPattern Pattern of the index (see Xindice doc)
indexType Type of the index (short, int, ... - See Xindice doc)
url Url of the Xindice server (ex : xmldb:xindice://localhost:4080/db)

 

 

Create a metadata entry that contains the result of an evaluated expression implying dates.

For example, let's say you need to have a metadata entry containing a string that would express current date in the following form : YYYYMM
Well, this preprocessor is what you need.

It "evaluates" a python expression that may imply the "time" and "string" jython modules (or python 2.1).

Parameters :

type DateMetadataPreproc
valueName Name of the metadata entry
expression The expression that must be evaluated

 

For the example I've spoken about before ( current date => YYYYMM ), the expression attribute will take the following value : time.strftime('%Y%m',time.localtime())

If we wanted last month in the same form, we'd have to put the following expression instead:
time.strftime('%Y%m',time.localtime(time.mktime(time.localtime())-time.mktime((1970, 2, 1, 1, 0, 0, 3, 1, 0))))