Using A Transaction Filter
For detailed information about configuration files, configuration layers and an explanation of the configuration-root 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
configuration-root/Initial.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:
service.60-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) -
configuration-root/com/mycompany/WordCountFilter.properties
in this case. The file must at least contain $class
,
filterName
and objectUpdater
entries. These specify the class that implements the filter, a name, and
the component to register the TransactionFilter
against:
$class=com.mycompany.transactionFilters.WordCount filterName=MyWordCountFilter objectUpdater=/io/api/ObjectUpdater
You can also set class properties in this file. For example:
$class=com.mycompany.transactionFilters.WordCount filterName=MyWordCountFilter objectUpdater=/io/api/ObjectUpdater 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 TransactionFilterService
class has a
serviceEnabled
property that can be used to
enable/disable filters. You can therefore disable any filter by
adding
serviceEnabled=false
to the properties file.
If no other transaction filters or post-transaction filters have
been defined, then there may be no
configuration-root/Initial.properties
file. In this case you must create one.