org.apache.openjpa.util
Interface ChangeTracker

All Known Subinterfaces:
CollectionChangeTracker, MapChangeTracker
All Known Implementing Classes:
AbstractChangeTracker, AbstractLRSProxyCollection, AbstractLRSProxyMap, CollectionChangeTrackerImpl, LRSProxyCollection, MapChangeTrackerImpl

public interface ChangeTracker

Interface for components that track changes to containers at a fine-grained level. Proxies that use change trackers might have better update performance than non-tracking proxies.

Author:
Abe White

Method Summary
 Collection getAdded()
          Return the collection of values that need to be added to the managed container.
 Collection getChanged()
          Return the set of elements that have changed.
 int getNextSequence()
          The next element sequence value for this proxy at load time.
 Collection getRemoved()
          Return the set of values that need to be removed from the managed container.
 boolean isTracking()
          Return true if this tracker has an up-to-date view of all the changes to the container it is managing.
 void setNextSequence(int seq)
          The maximum element sequence value for this proxy at load time.
 void startTracking()
          Reset the state of the change tracker, and turn change tracking back on if it has been disabled.
 void stopTracking()
          Tell the tracker to stop tracking changes for its container.
 

Method Detail

isTracking

boolean isTracking()
Return true if this tracker has an up-to-date view of all the changes to the container it is managing.


startTracking

void startTracking()
Reset the state of the change tracker, and turn change tracking back on if it has been disabled.


stopTracking

void stopTracking()
Tell the tracker to stop tracking changes for its container.


getAdded

Collection getAdded()
Return the collection of values that need to be added to the managed container.


getRemoved

Collection getRemoved()
Return the set of values that need to be removed from the managed container.


getChanged

Collection getChanged()
Return the set of elements that have changed. In maps, this marks a possible change in value for a key. In collections, this marks an element that has been removed and re-added.


getNextSequence

int getNextSequence()
The next element sequence value for this proxy at load time. If the data store keeps this proxy's data in sequence order but allows holes for removed objects, the implementation can set the next sequence at load time, then retrieve it and start from there for added objects at flush time. This value is set back to 0 if the proxy stops tracking changes. For ordered proxies, it is set to the proxy's size when the proxy starts tracking changes again.


setNextSequence

void setNextSequence(int seq)
The maximum element sequence value for this proxy at load time. If the data store keeps this proxy's data in sequence order but allows holes for removed objects, the implementation can set the next sequence at load time, then retrieve it and start from there for added objects at flush time. This value is set back to 0 if the proxy stops tracking changes. For ordered proxies, it is set to the proxy's size when the proxy starts tracking changes again.



Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.