org.apache.jackrabbit.core.state
Class ChangeLog

java.lang.Object
  extended byorg.apache.jackrabbit.core.state.ChangeLog

public class ChangeLog
extends Object

Registers changes made to states and references and consolidates empty changes.


Constructor Summary
ChangeLog()
           
 
Method Summary
 void added(ItemState state)
          A state has been added
 Iterator addedStates()
          Return an iterator over all added states.
 void deleted(ItemState state)
          A state has been deleted.
 Iterator deletedStates()
          Return an iterator over all deleted states.
 void disconnect()
          Disconnect all states in the change log from their overlaid states.
 ItemState get(ItemId id)
          Return an item state given its id.
 NodeReferences get(NodeReferencesId id)
          Return a node references object given its id.
 boolean has(ItemId id)
          Return a flag indicating whether a given item state exists.
 void merge(ChangeLog other)
          Merge another change log with this change log
 void modified(ItemState state)
          A state has been modified.
 void modified(NodeReferences refs)
          A references has been modified
 Iterator modifiedRefs()
          Return an iterator over all modified references.
 Iterator modifiedStates()
          Return an iterator over all modified states.
 void persisted()
          After the states have actually been persisted, update their internal states and notify listeners.
 void push()
          Push all states contained in the various maps of items we have.
 void reset()
          Reset this change log, removing all members inside the maps we built.
 String toString()
          Returns a string representation of this change log for diagnostic purposes.
 void undo(ItemStateManager parent)
          Undo changes made to items in the change log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChangeLog

public ChangeLog()
Method Detail

added

public void added(ItemState state)
A state has been added

Parameters:
state - state that has been added

modified

public void modified(ItemState state)
A state has been modified. If the state is not a new state (not in the collection of added ones), then disconnect the local state from its underlying shared state and add it to the modified states collection.

Parameters:
state - state that has been modified

deleted

public void deleted(ItemState state)
A state has been deleted. If the state is not a new state (not in the collection of added ones), then disconnect the local state from its underlying shared state, remove it from the modified states collection and add it to the deleted states collection.

Parameters:
state - state that has been deleted

modified

public void modified(NodeReferences refs)
A references has been modified

Parameters:
refs - refs that has been modified

get

public ItemState get(ItemId id)
              throws NoSuchItemStateException
Return an item state given its id. Returns null if the item state is neither in the added nor in the modified section. Throws a NoSuchItemStateException if the item state is in the deleted section.

Returns:
item state or null
Throws:
NoSuchItemStateException - if the item has been deleted

has

public boolean has(ItemId id)
Return a flag indicating whether a given item state exists.

Returns:
true if item state exists within this log; false otherwise

get

public NodeReferences get(NodeReferencesId id)
Return a node references object given its id. Returns null if the node reference is not in the modified section.

Returns:
node references or null

addedStates

public Iterator addedStates()
Return an iterator over all added states.

Returns:
iterator over all added states.

modifiedStates

public Iterator modifiedStates()
Return an iterator over all modified states.

Returns:
iterator over all modified states.

deletedStates

public Iterator deletedStates()
Return an iterator over all deleted states.

Returns:
iterator over all deleted states.

modifiedRefs

public Iterator modifiedRefs()
Return an iterator over all modified references.

Returns:
iterator over all modified references.

merge

public void merge(ChangeLog other)
Merge another change log with this change log

Parameters:
other - other change log

push

public void push()
Push all states contained in the various maps of items we have.


persisted

public void persisted()
After the states have actually been persisted, update their internal states and notify listeners.


reset

public void reset()
Reset this change log, removing all members inside the maps we built.


disconnect

public void disconnect()
Disconnect all states in the change log from their overlaid states.


undo

public void undo(ItemStateManager parent)
Undo changes made to items in the change log. Discards added items, refreshes modified and resurrects deleted items.

Parameters:
parent - parent manager that will hold current data

toString

public String toString()
Returns a string representation of this change log for diagnostic purposes.

Returns:
a string representation of this change log


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.