## org.exist.storage
Interface ContentLoadingObserver

All Known Implementing Classes:
  NativeElementIndex, NativeTextEngine, NativeValueIndex, NativeValueIndexByQName

public interface ContentLoadingObserver

Receives callback event during document(s) loading and removal; implemented by several classes that generate various indices; Observer Design Pattern: role Observer; the class @link org.exist.storage.NativeBroker is the subject (alias observable). startElement() and endElement() bear the same names as the corresponding SAX events. However storeXXX() have no corresponding method in SAX. Note: when we will have more than one runtime switch , we will refactor fullTextIndexSwitch into an object

Method Summary
`void` `dropIndex(Collection collection)` Drop all index entries for the given collection.
`void` `dropIndex(DocumentImpl doc)` Drop all index entries for the given document.
`void` `endElement(int xpathType, ElementImpl node, java.lang.String content)` store and index given element (called storeElement before)
`void` `flush()` writes the pending items, for the current document's collection
`void` `reindex(DocumentImpl oldDoc, StoredNode node)` Reindexes all pending items for the specified document.
`void` `remove()` remove all pending modifications, for the current document.
`void` `removeElement(ElementImpl node, NodePath currentPath, java.lang.String content)` Mark given Element for removal; added entries are written to the list of pending entries.
`void` `setDocument(DocumentImpl document)` set the current document; generally called before calling an operation
`void` `startElement(ElementImpl impl, NodePath currentPath, boolean index)` corresponds to SAX function of the same name
`void` `storeAttribute(AttrImpl node, NodePath currentPath, boolean fullTextIndexSwitch)` store and index given attribute
`void` `storeText(TextImpl node, NodePath currentPath, boolean fullTextIndexSwitch)` store and index given text node
`void` `sync()` triggers a cache sync, i.e.

Method Detail

### storeAttribute

    public void storeAttribute(AttrImpl node,
                               NodePath currentPath,
                               boolean fullTextIndexSwitch)

  store and index given attribute

### storeText

    public void storeText(TextImpl node,
                          NodePath currentPath,
                          boolean fullTextIndexSwitch)

  store and index given text node

### startElement

    public void startElement(ElementImpl impl,
                             NodePath currentPath,
                             boolean index)

  corresponds to SAX function of the same name

### endElement

    public void endElement(int xpathType,
                           ElementImpl node,
                           java.lang.String content)

  store and index given element (called storeElement before)

### removeElement

    public void removeElement(ElementImpl node,
                              NodePath currentPath,
                              java.lang.String content)

  Mark given Element for removal; added entries are written to the list of pending entries. `flush()` is called later to flush all pending entries.
  Notes: changed name from storeElement()

### setDocument

    public void setDocument(DocumentImpl document)

  set the current document; generally called before calling an operation

### flush

    public void flush()

  writes the pending items, for the current document's collection

### sync

    public void sync()

  triggers a cache sync, i.e. forces to write out all cached pages. sync() is called from time to time by the background sync daemon.

### dropIndex

    public void dropIndex(Collection collection)

  Drop all index entries for the given collection.

  Parameters:
    `collection` -

### dropIndex

    public void dropIndex(DocumentImpl doc)
                   throws ReadOnlyException

  Drop all index entries for the given document.

  Parameters:
    `doc` -
  Throws:
    `ReadOnlyException`

### reindex

    public void reindex(DocumentImpl oldDoc,
                        StoredNode node)

  Reindexes all pending items for the specified document.

  Parameters:
    `oldDoc` - the document to be reindexed.
    `node` - if != null, only nodes being descendants of the specified node will be reindexed. Other nodes are not touched. This is used for a partial reindex.

### remove

    public void remove()

  remove all pending modifications, for the current document.

Copyright (C) Wolfgang Meier. All rights reserved.