org.exist.collections.triggers
Class XQueryTrigger
java.lang.Object
org.exist.collections.triggers.FilteringTrigger
org.exist.collections.triggers.XQueryTrigger
- All Implemented Interfaces:
- org.xml.sax.ContentHandler, DocumentTrigger, org.xml.sax.ext.LexicalHandler, Trigger
- public class XQueryTrigger
- extends FilteringTrigger
A trigger that executes a user XQuery statement when invoked.
The XQuery source executed is the value of the context parameter named "query".
These external variables are accessible to the user XQuery statement :
xxx:collectionName : the name of the collection from which the event is triggered
xxx:documentName : the name of the document from wich the event is triggered
xxx:triggeredEvent : the kind of triggered event
xxx:document : the document from wich the event is triggered
- Author:
- Pierrick Brihaye
| Methods inherited from class org.exist.collections.triggers.FilteringTrigger |
characters, comment, endCDATA, endDTD, endElement, endEntity, endPrefixMapping, getCollection, getInputHandler, getLexicalInputHandler, getLexicalOutputHandler, getLogger, getOutputHandler, ignorableWhitespace, isValidating, processingInstruction, setDocumentLocator, setLexicalOutputHandler, setOutputHandler, setValidating, skippedEntity, startCDATA, startDTD, startElement, startEntity, startPrefixMapping |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
XQueryTrigger
public XQueryTrigger()
configure
public void configure(DBBroker broker,
Collection parent,
java.util.Map parameters)
throws CollectionConfigurationException
- Description copied from class:
FilteringTrigger
- Configure the trigger. The default implementation just stores the parent collection
reference into the field
collection. Use method getCollection
to later retrieve the collection.
- Specified by:
configure in interface Trigger- Overrides:
configure in class FilteringTrigger
- Throws:
CollectionConfigurationException- See Also:
org.exist.collections.Trigger#configure(org.exist.storage.DBBroker, org.exist.collections.Collection, java.util.Map)
prepare
public void prepare(int event,
DBBroker broker,
Txn transaction,
java.lang.String documentName,
DocumentImpl existingDocument)
throws TriggerException
- Description copied from interface:
DocumentTrigger
- This method is called once before the database will actually parse the input data. You may take any action
here, using the supplied broker instance.
- Parameters:
event - the type of event that triggered this call (see the constants defined in this interface).broker - the database instance used to process the current action.transaction - the current transaction contextdocumentName - the full absolute path of the document currently processed.existingDocument - optional: if event is a Trigger.UPDATE_DOCUMENT_EVENT,
existingDocument will contain the Document object for the old document, which will be overwritten. Otherwise, the parameter
is null.
- Throws:
TriggerException - throwing a TriggerException will abort the current action.- See Also:
org.exist.collections.Trigger#prepare(java.lang.String, org.w3c.dom.Document)
finish
public void finish(int event,
DBBroker broker,
Txn transaction,
DocumentImpl document)
- Description copied from interface:
DocumentTrigger
- This method is called after the operation completed. At this point, the document has already
been stored.
- Specified by:
finish in interface DocumentTrigger- Overrides:
finish in class FilteringTrigger
- See Also:
org.exist.collections.triggers.DocumentTrigger#finish(int, org.exist.storage.DBBroker, java.lang.String, org.w3c.dom.Document)
startDocument
public void startDocument()
throws org.xml.sax.SAXException
- Specified by:
startDocument in interface org.xml.sax.ContentHandler- Overrides:
startDocument in class FilteringTrigger
- Throws:
org.xml.sax.SAXException
endDocument
public void endDocument()
throws org.xml.sax.SAXException
- Specified by:
endDocument in interface org.xml.sax.ContentHandler- Overrides:
endDocument in class FilteringTrigger
- Throws:
org.xml.sax.SAXException
eventToString
public static java.lang.String eventToString(int event)
toString
public java.lang.String toString()
<oXygen/>
XML Editor
provides support for editing and debugging XQuery
expressions against the eXist XML Database.