Using A Transaction Filter

For detailed information about configuration files, configuration layers and an explanation of the engine-config placeholder used in the file paths in this section, see the Escenic Content Engine Server Administration Guide.

The transaction filters executed by the Content Engine are defined in a configuration file called engine-config/io/api/ObjectUpdater.properties. To enable the WordCount filter, therefore, you must add a declaration to this file in one or more of your configuration layers. For example:

filter.wordcount=/com/mycompany/WordCountFilter

You must also create a properties file for the filter called WordCountFilter.properties, and save it in the location you have specified in the same configuration layer(s) - engine-config/com/mycompany/WordCountFilter.properties in this case. The file must at least contain a $class entry specifying the class that implements the filter:

$class=com.mycompany.WordCount

You can also set class properties in this file. For example:

$class=com.mycompany.WordCount

fieldToCount=main
fieldToUpdate=articleLength

Once you have added these configuration files, word counts will be added to any content items that are created or saved. The TransactionFilterAdapter class has an enabled property that can be used to enable/disable filters. You can therefore disable any filter by adding

enabled=false

to the properties file.

If no other transaction filters or post-transaction filters have been defined, then there may be no engine-config/io/api/ObjectUpdater.properties file. In this case you must create one.