org.exist.collections.triggers
Interface Trigger
- All Known Subinterfaces:
- CollectionTrigger, DocumentTrigger
- All Known Implementing Classes:
- Dumper, FilteringTrigger, HistoryTrigger, STXTransformerTrigger, XQueryTrigger
public interface Trigger
Defines the base interface for collection triggers. Triggers are registered through the
collection configuration file, called "collection.xconf", which should be
stored in the corresponding database collection. If a collection configuration file is
found in the collection, it will be parsed and any triggers will be created and configured.
The configure
method is called once on each trigger.
Triggers listen to events. Currently, there are five events to which triggers may be
attached:
The document-related events are handled by the sub-interface DocumentTrigger
,
collection-related events are handled by CollectionTrigger
.
The collection configuration file looks as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<exist:collection xmlns:exist="http://exist-db.org/collection-config/1.0">
<exist:triggers>
<exist:trigger event="store"
class="fully qualified classname of the trigger">
<exist:parameter name="parameter-name"
value="parameter-value"/>
</exist:trigger>
</exist:triggers>
</exist:collection>
- Author:
- wolf
- See Also:
DocumentTrigger
STORE_DOCUMENT_EVENT
static final int STORE_DOCUMENT_EVENT
- See Also:
- Constant Field Values
UPDATE_DOCUMENT_EVENT
static final int UPDATE_DOCUMENT_EVENT
- See Also:
- Constant Field Values
REMOVE_DOCUMENT_EVENT
static final int REMOVE_DOCUMENT_EVENT
- See Also:
- Constant Field Values
CREATE_COLLECTION_EVENT
static final int CREATE_COLLECTION_EVENT
- See Also:
- Constant Field Values
RENAME_COLLECTION_EVENT
static final int RENAME_COLLECTION_EVENT
- See Also:
- Constant Field Values
DELETE_COLLECTION_EVENT
static final int DELETE_COLLECTION_EVENT
- See Also:
- Constant Field Values
configure
void configure(DBBroker broker,
Collection parent,
Map parameters)
throws CollectionConfigurationException
- The configure method is called once whenever the collection configuration is loaded. Use it to
initialize the trigger, probably by looking at the parameters.
- Parameters:
broker
- the database instance used to load the collection configuration. The broker object is
required for all database actions. Please note: the broker instance used for configuration is probably
different from the one passed to the prepare method. Don't store the broker object in your class.parent
- the collection to which this trigger belongs.parameters
- a Map containing any key/value parameters defined in the configuration file.
- Throws:
CollectionConfigurationException
- if the trigger cannot be initialized.
getLogger
Logger getLogger()
- Returns a Logger object. Use this to log debugging information.
Copyright (C) Wolfgang Meier. All rights reserved.