org.ceryle.xnode
Class XNodeStoreChangeCache

java.lang.Object
  extended by org.ceryle.xnode.XNodeStoreChangeCache

public class XNodeStoreChangeCache
extends Object

Backed by a Stack, acts as a list of XNodeStoreEvents received by an XNodeStoreListener attached to the XNodeStore. Note that upon creation of an XNodeStoreChangeCache object, it will automatically attach a listener to the XNodeStore (which is a singleton class in this implementation). It's possible to create multiple caches (for whatever reason); each will add its own listener. To remove a cache, it's first necessary to call its removeListener() method to remove the listener, otherwise it will remain, hanging.

The cache can be directly manipulated as a Stack.

There is some code to support separate indexing on a per-Collection basis, but given that indexes are currently for the entire database, it's not used.

Since:
XNode 1.1
Version:
$Id: XNodeStoreChangeCache.java,v 3.9 2007-06-15 12:10:31 altheim Exp $
Author:
Murray Altheim

Field Summary
static int COL_ADD
          The int code indicating a new Collection has been added.
static int COL_DEL
          The int code indicating a Collection has been deleted.
static int COL_MOD
          The int code indicating a Collection has been modified (by adding, modifying or deleting nodes).
static int NODE_ADD
          The int code indicating a new Node has been added.
static int NODE_DEL
          The int code indicating a Node has been deleted.
static int NODE_MOD
          The int code indicating a Node has been modified.
static int REINDEX
          The int code indicating that the number of changes that have occurred has passed the threshold for rebuilding the entire database index.
 
Constructor Summary
XNodeStoreChangeCache(XNodeStore xnodestore)
          Default constructor with an XNodeStore.
 
Method Summary
protected  void addDefaultListener()
          Adds the listener that this XNodeStoreChangeCache uses to create the cache of event notifications to the XNodeStore.
 void clear()
          Clear the cache contents.
 Stack getCache()
          Return the cache contents as a Stack.
static String[] parseEntry(String entry)
          Provided a space-delimited cache entry, returns a three element array containing its fields in entry order: type, cid, nid.
 void removeListener()
          Removes this XNodeStoreChangeCache's listener from the XNodeStore.
 String tostring()
          Returns the cache as a string (nl-delimited list of type+cid).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REINDEX

public static final int REINDEX
The int code indicating that the number of changes that have occurred has passed the threshold for rebuilding the entire database index.

See Also:
Constant Field Values

COL_ADD

public static final int COL_ADD
The int code indicating a new Collection has been added.

See Also:
Constant Field Values

COL_DEL

public static final int COL_DEL
The int code indicating a Collection has been deleted.

See Also:
Constant Field Values

COL_MOD

public static final int COL_MOD
The int code indicating a Collection has been modified (by adding, modifying or deleting nodes).

See Also:
Constant Field Values

NODE_ADD

public static final int NODE_ADD
The int code indicating a new Node has been added.

See Also:
Constant Field Values

NODE_DEL

public static final int NODE_DEL
The int code indicating a Node has been deleted.

See Also:
Constant Field Values

NODE_MOD

public static final int NODE_MOD
The int code indicating a Node has been modified.

See Also:
Constant Field Values
Constructor Detail

XNodeStoreChangeCache

public XNodeStoreChangeCache(XNodeStore xnodestore)
                      throws XNodeException
Default constructor with an XNodeStore.

Throws:
XNodeException - if unable to add the cache listener to the XNodeStore.
Method Detail

addDefaultListener

protected void addDefaultListener()
Adds the listener that this XNodeStoreChangeCache uses to create the cache of event notifications to the XNodeStore.


removeListener

public void removeListener()
Removes this XNodeStoreChangeCache's listener from the XNodeStore.


parseEntry

public static String[] parseEntry(String entry)
Provided a space-delimited cache entry, returns a three element array containing its fields in entry order: type, cid, nid. The last element (the node ID) may be null, for those events that did not involve capturing it.


clear

public void clear()
Clear the cache contents.


getCache

public Stack getCache()
Return the cache contents as a Stack.


tostring

public String tostring()
Returns the cache as a string (nl-delimited list of type+cid).



The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.