org.eclipse.emf.cdo.spi.common.revision
Class DelegatingCDORevisionManager

java.lang.Object
  extended by org.eclipse.net4j.util.event.Notifier
      extended by org.eclipse.net4j.util.lifecycle.Lifecycle
          extended by org.eclipse.emf.cdo.spi.common.revision.DelegatingCDORevisionManager
All Implemented Interfaces:
CDORevisionCacheAdder, CDORevisionManager, InternalCDORevisionManager, INotifier, ILifecycle, ILifecycle.DeferrableActivation

public abstract class DelegatingCDORevisionManager
extends Lifecycle
implements InternalCDORevisionManager

If the meaning of this type isn't clear, there really should be more of a description here...

Since:
3.0

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.cdo.spi.common.revision.InternalCDORevisionManager
InternalCDORevisionManager.RevisionLoader, InternalCDORevisionManager.RevisionLocker
 
Nested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
ILifecycle.DeferrableActivation
 
Field Summary
 
Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABEL
 
Constructor Summary
DelegatingCDORevisionManager()
           
 
Method Summary
 void addRevision(CDORevision revision)
          Adds the given revision to this cache.
 boolean containsRevision(CDOID id, CDOBranchPoint branchPoint)
          Returns true if the revision cache contains a revision with the given ID at the given branch point (branch + timestamp), false otherwise.
 boolean containsRevisionByVersion(CDOID id, CDOBranchVersion branchVersion)
          Returns true if the revision cache contains a revision with the given ID at the given branch version (branch + version), false otherwise.
protected  void doActivate()
           
protected  void doDeactivate()
           
 InternalCDORevisionCache getCache()
           
protected abstract  InternalCDORevisionManager getDelegate()
           
 CDORevisionFactory getFactory()
           
 EClass getObjectType(CDOID id)
          Returns the type of an object if a revision for that object is in the revision cache, null otherwise.
 InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand)
          Returns the revision with the given ID at the given branch point (branch + timestamp), optionally demand loading it if it is not already in the cache.
 InternalCDORevision getRevision(CDOID id, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
           
 InternalCDORevision getRevisionByVersion(CDOID id, CDOBranchVersion branchVersion, int referenceChunk, boolean loadOnDemand)
          Returns the revision with the given ID at the given branch version (branch + version), optionally demand loading it if it is not already in the cache.
 InternalCDORevisionManager.RevisionLoader getRevisionLoader()
           
 InternalCDORevisionManager.RevisionLocker getRevisionLocker()
           
 List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand)
          Returns the revisions with the given IDs at the given branch point (branch + timestamp), optionally demand loading them if they are not already in the cache.
 List<CDORevision> getRevisions(List<CDOID> ids, CDOBranchPoint branchPoint, int referenceChunk, int prefetchDepth, boolean loadOnDemand, SyntheticCDORevision[] synthetics)
           
protected  boolean isDelegatingLifecycle()
           
 boolean isSupportingAudits()
           
 boolean isSupportingBranches()
           
 void reviseLatest(CDOID id, CDOBranch branch)
          Called on client via postCommit when there is no version of detached objects available.
 void reviseVersion(CDOID id, CDOBranchVersion branchVersion, long timeStamp)
           
 void setCache(CDORevisionCache cache)
           
 void setFactory(CDORevisionFactory factory)
           
 void setRevisionLoader(InternalCDORevisionManager.RevisionLoader revisionLoader)
           
 void setRevisionLocker(InternalCDORevisionManager.RevisionLocker revisionLocker)
           
 void setSupportingAudits(boolean on)
           
 void setSupportingBranches(boolean on)
           
 
Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toString
 
Methods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListeners, lastListenerRemoved, removeListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.cdo.common.revision.CDORevisionManager
getObjectType
 
Methods inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
activate, deactivate, getLifecycleState, isActive
 
Methods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
 

Constructor Detail

DelegatingCDORevisionManager

public DelegatingCDORevisionManager()
Method Detail

getCache

public InternalCDORevisionCache getCache()
Specified by:
getCache in interface InternalCDORevisionManager

setCache

public void setCache(CDORevisionCache cache)
Specified by:
setCache in interface InternalCDORevisionManager
Since:
4.0

setFactory

public void setFactory(CDORevisionFactory factory)
Specified by:
setFactory in interface InternalCDORevisionManager

getFactory

public CDORevisionFactory getFactory()
Specified by:
getFactory in interface InternalCDORevisionManager

getRevisionLoader

public InternalCDORevisionManager.RevisionLoader getRevisionLoader()
Specified by:
getRevisionLoader in interface InternalCDORevisionManager

setRevisionLoader

public void setRevisionLoader(InternalCDORevisionManager.RevisionLoader revisionLoader)
Specified by:
setRevisionLoader in interface InternalCDORevisionManager

getRevisionLocker

public InternalCDORevisionManager.RevisionLocker getRevisionLocker()
Specified by:
getRevisionLocker in interface InternalCDORevisionManager

setRevisionLocker

public void setRevisionLocker(InternalCDORevisionManager.RevisionLocker revisionLocker)
Specified by:
setRevisionLocker in interface InternalCDORevisionManager

isSupportingAudits

public boolean isSupportingAudits()
Specified by:
isSupportingAudits in interface InternalCDORevisionManager
Since:
4.0

setSupportingAudits

public void setSupportingAudits(boolean on)
Specified by:
setSupportingAudits in interface InternalCDORevisionManager
Since:
4.0

isSupportingBranches

public boolean isSupportingBranches()
Specified by:
isSupportingBranches in interface InternalCDORevisionManager

setSupportingBranches

public void setSupportingBranches(boolean on)
Specified by:
setSupportingBranches in interface InternalCDORevisionManager

addRevision

public void addRevision(CDORevision revision)
Description copied from interface: CDORevisionCacheAdder
Adds the given revision to this cache.

Specified by:
addRevision in interface CDORevisionCacheAdder
Since:
4.0

containsRevision

public boolean containsRevision(CDOID id,
                                CDOBranchPoint branchPoint)
Description copied from interface: CDORevisionManager
Returns true if the revision cache contains a revision with the given ID at the given branch point (branch + timestamp), false otherwise.

Specified by:
containsRevision in interface CDORevisionManager
See Also:
CDORevisionManager.getRevision(CDOID, CDOBranchPoint, int, int, boolean), CDORevisionManager.getRevisions(List, CDOBranchPoint, int, int, boolean)

containsRevisionByVersion

public boolean containsRevisionByVersion(CDOID id,
                                         CDOBranchVersion branchVersion)
Description copied from interface: CDORevisionManager
Returns true if the revision cache contains a revision with the given ID at the given branch version (branch + version), false otherwise.

Specified by:
containsRevisionByVersion in interface CDORevisionManager
See Also:
CDORevisionManager.getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)

getObjectType

public EClass getObjectType(CDOID id)
Description copied from interface: CDORevisionManager
Returns the type of an object if a revision for that object is in the revision cache, null otherwise.

Same as calling getObjectType(id, null).

Specified by:
getObjectType in interface CDORevisionManager
See Also:
EObject.eClass(), CDORevisionManager.getObjectType(CDOID, CDOBranchManager)

getRevisionByVersion

public InternalCDORevision getRevisionByVersion(CDOID id,
                                                CDOBranchVersion branchVersion,
                                                int referenceChunk,
                                                boolean loadOnDemand)
Description copied from interface: CDORevisionManager
Returns the revision with the given ID at the given branch version (branch + version), optionally demand loading it if it is not already in the cache.

Prefetching of nested containment levels is not support by this method because the version of a particular revision can not serve as a reasonable baseline criterium for a consistent graph of multiple revisions.

Specified by:
getRevisionByVersion in interface CDORevisionManager
Specified by:
getRevisionByVersion in interface InternalCDORevisionManager
referenceChunk - The number of target IDs to load for each many-valued reference in the returned revision, or CDORevision.UNCHUNKED for all such list elements (IDs).
loadOnDemand - If the requested revision is not contained in the revision cache it depends on this parameter's value whether the revision is loaded from the server or null is returned.
See Also:
CDORevisionManager.getRevision(CDOID, CDOBranchPoint, int, int, boolean)

getRevision

public InternalCDORevision getRevision(CDOID id,
                                       CDOBranchPoint branchPoint,
                                       int referenceChunk,
                                       int prefetchDepth,
                                       boolean loadOnDemand)
Description copied from interface: CDORevisionManager
Returns the revision with the given ID at the given branch point (branch + timestamp), optionally demand loading it if it is not already in the cache.

Specified by:
getRevision in interface CDORevisionManager
Specified by:
getRevision in interface InternalCDORevisionManager
referenceChunk - The number of target IDs to load for each many-valued reference in the returned revision, or CDORevision.UNCHUNKED for all such list elements (IDs).
prefetchDepth - The number of nested containment levels to load revisions for in one round trip. Use the symbolic constants CDORevision.DEPTH_INFINITE to prefetch all contained revisions or CDORevision.DEPTH_NONE to not prefetch anything. Only the explicitely requested revision is returned by this method. If additional revisions are prefetched they are placed in the revision cache to speed up subsequent calls to this method.
loadOnDemand - If the requested revision is not contained in the revision cache it depends on this parameter's value whether the revision is loaded from the server or null is returned.
See Also:
CDORevisionManager.getRevisions(List, CDOBranchPoint, int, int, boolean), CDORevisionManager.getRevisionByVersion(CDOID, CDOBranchVersion, int, boolean)

getRevision

public InternalCDORevision getRevision(CDOID id,
                                       CDOBranchPoint branchPoint,
                                       int referenceChunk,
                                       int prefetchDepth,
                                       boolean loadOnDemand,
                                       SyntheticCDORevision[] synthetics)
Specified by:
getRevision in interface InternalCDORevisionManager

getRevisions

public List<CDORevision> getRevisions(List<CDOID> ids,
                                      CDOBranchPoint branchPoint,
                                      int referenceChunk,
                                      int prefetchDepth,
                                      boolean loadOnDemand)
Description copied from interface: CDORevisionManager
Returns the revisions with the given IDs at the given branch point (branch + timestamp), optionally demand loading them if they are not already in the cache.

Specified by:
getRevisions in interface CDORevisionManager
referenceChunk - The number of target IDs to load for each many-valued reference in the returned revisions, or CDORevision.UNCHUNKED for all such list elements (IDs).
prefetchDepth - The number of nested containment levels to load revisions for in one round trip. Use the symbolic constants CDORevision.DEPTH_INFINITE to prefetch all contained revisions or CDORevision.DEPTH_NONE to not prefetch anything. Only the explicitely requested revisions are returned by this method. If additional revisions are prefetched they are placed in the revision cache to speed up subsequent calls to this method.
loadOnDemand - If one or more of the requested revisions is/are not contained in the revision cache it depends on this parameter's value whether the revision(s) is/are loaded from the server or null is placed in the list that is returned.
See Also:
CDORevisionManager.getRevision(CDOID, CDOBranchPoint, int, int, boolean)

getRevisions

public List<CDORevision> getRevisions(List<CDOID> ids,
                                      CDOBranchPoint branchPoint,
                                      int referenceChunk,
                                      int prefetchDepth,
                                      boolean loadOnDemand,
                                      SyntheticCDORevision[] synthetics)
Specified by:
getRevisions in interface InternalCDORevisionManager

reviseLatest

public void reviseLatest(CDOID id,
                         CDOBranch branch)
Description copied from interface: InternalCDORevisionManager
Called on client via postCommit when there is no version of detached objects available.

Specified by:
reviseLatest in interface InternalCDORevisionManager

reviseVersion

public void reviseVersion(CDOID id,
                          CDOBranchVersion branchVersion,
                          long timeStamp)
Specified by:
reviseVersion in interface InternalCDORevisionManager

doActivate

protected void doActivate()
                   throws Exception
Overrides:
doActivate in class Lifecycle
Throws:
Exception

doDeactivate

protected void doDeactivate()
                     throws Exception
Overrides:
doDeactivate in class Lifecycle
Throws:
Exception

isDelegatingLifecycle

protected boolean isDelegatingLifecycle()

getDelegate

protected abstract InternalCDORevisionManager getDelegate()


Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.