## org.exist.collections.triggers
Class FilteringTrigger

    java.lang.Object
      org.exist.collections.triggers.FilteringTrigger

All Implemented Interfaces:
  org.xml.sax.ContentHandler, DocumentTrigger, org.xml.sax.ext.LexicalHandler, Trigger

Direct Known Subclasses:
  Dumper, HistoryTrigger, STXTransformerTrigger, XQueryTrigger

public abstract class FilteringTrigger
extends java.lang.Object
implements DocumentTrigger

Abstract default implementation of a Trigger. This implementation just forwards all SAX events to the output content handler.

Author:
  wolf

Field Summary

Fields inherited from interface org.exist.collections.triggers.Trigger
`CREATE_COLLECTION_EVENT, DELETE_COLLECTION_EVENT, REMOVE_DOCUMENT_EVENT, RENAME_COLLECTION_EVENT, STORE_DOCUMENT_EVENT, UPDATE_DOCUMENT_EVENT`

Constructor Summary
`FilteringTrigger()`

Method Summary
`void` `characters(char[] ch, int start, int length)`
`void` `comment(char[] ch, int start, int length)`
`void` `configure(DBBroker broker, Collection parent, java.util.Map parameters)` Configure the trigger.
`void` `endCDATA()`
`void` `endDocument()`
`void` `endDTD()`
`void` `endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qname)`
`void` `endEntity(java.lang.String arg0)`
`void` `endPrefixMapping(java.lang.String prefix)`
`void` `finish(int event, DBBroker broker, Txn transaction, DocumentImpl document)` This method is called after the operation completed.
`Collection` `getCollection()`
`org.xml.sax.ContentHandler` `getInputHandler()` Returns the input content handler.
`org.xml.sax.ext.LexicalHandler` `getLexicalInputHandler()` Returns the lexical input handler for this trigger.
`org.xml.sax.ext.LexicalHandler` `getLexicalOutputHandler()` Called by the database to set the lexical output handler for this trigger.
`org.apache.log4j.Logger` `getLogger()` Returns a Logger object.
`org.xml.sax.ContentHandler` `getOutputHandler()` Returns the output handler to which SAX events should be forwarded.
`void` `ignorableWhitespace(char[] ch, int start, int length)`
`boolean` `isValidating()` Returns true if the SAX parser is currently in validation phase.
`void` `processingInstruction(java.lang.String target, java.lang.String data)`
`void` `setDocumentLocator(org.xml.sax.Locator locator)`
`void` `setLexicalOutputHandler(org.xml.sax.ext.LexicalHandler handler)` Called by the database to set the lexical output content handler for this trigger.
`void` `setOutputHandler(org.xml.sax.ContentHandler handler)` Called by the database to set the output content handler for this trigger.
`void` `setValidating(boolean validating)` Called by the database to report that it is entering validation phase.
`void` `skippedEntity(java.lang.String arg0)`
`void` `startCDATA()`
`void` `startDocument()`
`void` `startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)`
`void` `startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qname, org.xml.sax.Attributes attributes)`
`void` `startEntity(java.lang.String arg0)`
`void` `startPrefixMapping(java.lang.String prefix, java.lang.String namespaceURI)`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.exist.collections.triggers.DocumentTrigger
`prepare`

Constructor Detail

### FilteringTrigger

    public FilteringTrigger()

Method Detail

### configure

    public void configure(DBBroker broker,
                          Collection parent,
                          java.util.Map parameters)
                   throws CollectionConfigurationException

  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`
  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.

### 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`
  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 context
    `document` - the stored document

### setValidating

    public void setValidating(boolean validating)

  Description copied from interface: `DocumentTrigger`
  Called by the database to report that it is entering validation phase.

  Specified by:
    `setValidating` in interface `DocumentTrigger`
  Parameters:
    `validating` -

### isValidating

    public boolean isValidating()

  Description copied from interface: `DocumentTrigger`
  Returns true if the SAX parser is currently in validation phase. During validation phase, the trigger may safely throw a SAXException. However, if is `isValidating` returns false, no exceptions should be thrown.

  Specified by:
    `isValidating` in interface `DocumentTrigger`
  Returns:
    true if the parser is in validation phase.

### getCollection

    public Collection getCollection()

### getInputHandler

    public org.xml.sax.ContentHandler getInputHandler()

  Description copied from interface: `DocumentTrigger`
  Returns the input content handler. Usually, this method should just return the trigger object itself, i.e. this. However, the trigger may choose to provide a different content handler.

  Specified by:
    `getInputHandler` in interface `DocumentTrigger`
  Returns:
    the ContentHandler to be called by the database.

### getLexicalInputHandler

    public org.xml.sax.ext.LexicalHandler getLexicalInputHandler()

  Description copied from interface: `DocumentTrigger`
  Returns the lexical input handler for this trigger. See `getInputHandler`.

  Specified by:
    `getLexicalInputHandler` in interface `DocumentTrigger`
  Returns:
    The LexicalHandler instance for the input.

### getOutputHandler

    public org.xml.sax.ContentHandler getOutputHandler()

  Description copied from interface: `DocumentTrigger`
  Returns the output handler to which SAX events should be forwarded.

  Specified by:
    `getOutputHandler` in interface `DocumentTrigger`
  Returns:
    The ContentHandler instance for the output.

### getLexicalOutputHandler

    public org.xml.sax.ext.LexicalHandler getLexicalOutputHandler()

  Description copied from interface: `DocumentTrigger`
  Called by the database to set the lexical output handler for this trigger.

  Specified by:
    `getLexicalOutputHandler` in interface `DocumentTrigger`
  Returns:
    The LexicalHandler instance for the output.

### setOutputHandler

    public void setOutputHandler(org.xml.sax.ContentHandler handler)

  Description copied from interface: `DocumentTrigger`
  Called by the database to set the output content handler for this trigger.

  Specified by:
    `setOutputHandler` in interface `DocumentTrigger`
  Parameters:
    `handler` -

### setLexicalOutputHandler

    public void setLexicalOutputHandler(org.xml.sax.ext.LexicalHandler handler)

  Description copied from interface: `DocumentTrigger`
  Called by the database to set the lexical output content handler for this trigger.

  Specified by:
    `setLexicalOutputHandler` in interface `DocumentTrigger`
  Parameters:
    `handler` -

### getLogger

    public org.apache.log4j.Logger getLogger()

  Description copied from interface: `Trigger`
  Returns a Logger object. Use this to log debugging information.

  Specified by:
    `getLogger` in interface `Trigger`

### setDocumentLocator

    public void setDocumentLocator(org.xml.sax.Locator locator)

  Specified by:
    `setDocumentLocator` in interface `org.xml.sax.ContentHandler`

### startDocument

    public void startDocument()
                       throws org.xml.sax.SAXException

  Specified by:
    `startDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endDocument

    public void endDocument()
                     throws org.xml.sax.SAXException

  Specified by:
    `endDocument` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### startPrefixMapping

    public void startPrefixMapping(java.lang.String prefix,
                                   java.lang.String namespaceURI)
                            throws org.xml.sax.SAXException

  Specified by:
    `startPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endPrefixMapping

    public void endPrefixMapping(java.lang.String prefix)
                          throws org.xml.sax.SAXException

  Specified by:
    `endPrefixMapping` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### startElement

    public void startElement(java.lang.String namespaceURI,
                             java.lang.String localName,
                             java.lang.String qname,
                             org.xml.sax.Attributes attributes)
                      throws org.xml.sax.SAXException

  Specified by:
    `startElement` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### endElement

    public void endElement(java.lang.String namespaceURI,
                           java.lang.String localName,
                           java.lang.String qname)
                    throws org.xml.sax.SAXException

  Specified by:
    `endElement` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### characters

    public void characters(char[] ch,
                           int start,
                           int length)
                    throws org.xml.sax.SAXException

  Specified by:
    `characters` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### ignorableWhitespace

    public void ignorableWhitespace(char[] ch,
                                    int start,
                                    int length)
                             throws org.xml.sax.SAXException

  Specified by:
    `ignorableWhitespace` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### processingInstruction

    public void processingInstruction(java.lang.String target,
                                      java.lang.String data)
                               throws org.xml.sax.SAXException

  Specified by:
    `processingInstruction` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### skippedEntity

    public void skippedEntity(java.lang.String arg0)
                       throws org.xml.sax.SAXException

  Specified by:
    `skippedEntity` in interface `org.xml.sax.ContentHandler`
  Throws:
    `org.xml.sax.SAXException`

### startDTD

    public void startDTD(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws org.xml.sax.SAXException

  Specified by:
    `startDTD` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

### endDTD

    public void endDTD()
                throws org.xml.sax.SAXException

  Specified by:
    `endDTD` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

### startEntity

    public void startEntity(java.lang.String arg0)
                     throws org.xml.sax.SAXException

  Specified by:
    `startEntity` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

### endEntity

    public void endEntity(java.lang.String arg0)
                   throws org.xml.sax.SAXException

  Specified by:
    `endEntity` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

### startCDATA

    public void startCDATA()
                    throws org.xml.sax.SAXException

  Specified by:
    `startCDATA` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

### endCDATA

    public void endCDATA()
                  throws org.xml.sax.SAXException

  Specified by:
    `endCDATA` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

### comment

    public void comment(char[] ch,
                        int start,
                        int length)
                 throws org.xml.sax.SAXException

  Specified by:
    `comment` in interface `org.xml.sax.ext.LexicalHandler`
  Throws:
    `org.xml.sax.SAXException`

Copyright (C) Wolfgang Meier. All rights reserved.