Database Reference
In-Depth Information
2. Check the logfile $EXIST_HOME/webapp/WEB-INF/logs/exist.log . You should
see the NoDeleteCollectionTrigger log messages that look similar to:
2014-01-16 14:18:52,918 [eXistThread-32] INFO
(NoDeleteCollectionTrigger.java [beforeDeleteCollection]:97) -
Preventing deletion of blacklisted collection '/db/ data/private'.
Java document triggers
While our discussion in “Java collection triggers” on page 459 focused on handling
the before and after events for various database operations on collections, here we'll
look at handling events during the storage of XML documents. This allows us to
modify a document dynamically as it is being stored. Of course, document triggers
still have all of the before and after events that you would expect for database opera‐
tions on documents, but implementing them is similar enough to implementing col‐
lection triggers that we need not discuss them further here. Document triggers also
give you the ability to perform streaming validation and transformations on docu‐
ments.
When you're implementing Java document triggers, your class must provide imple‐
mentations for all of the methods defined in org.exist.collections.trig
gers.Trigger and org.exist.collections.triggers.DocumentTrigger to compile.
The DocumentTrigger interface mainly varies from CollectionTrigger in that it also
acts as a SAX (Simple API for XML) event handler by extending org.xml.sax.Con
tentHandler and org.xml.sax.ext.LexicalHandler . With SAX events, your trigger
effectively sits in the middle of a pipeline, receiving SAX events from the parser
(which is reading the document to store) and sending them on to the database for
validation or storage (see Figure 16-6 ). If you choose to discard some of these events
or generate new events, you are effectively modifying the incoming document for val‐
idation or storage.
Search WWH ::




Custom Search