Class CDORevisionCrawler
java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.emf.cdo.common.revision.CDORevisionCrawler
- All Implemented Interfaces:
org.eclipse.net4j.util.event.INotifier,org.eclipse.net4j.util.event.INotifier.INotifier2,org.eclipse.net4j.util.lifecycle.IDeactivateable,org.eclipse.net4j.util.lifecycle.ILifecycle,org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivation
public final class CDORevisionCrawler
extends org.eclipse.net4j.util.lifecycle.Lifecycle
A crawler that visits CDO revisions and their features according to a
feature strategy
and passes them to a handler.
Example usage:
MessageDigest digest = MessageDigest.getInstance("SHA-256");
new CDORevisionCrawler()
.handler(new CDORevisionCrawler.MessageDigestHandler(digest))
.revisionProvider(revisionProvider)
.featureStrategy(CDORevisionCrawler.FeatureStrategy.TREE)
.containmentProxyStrategy(CDORevisionCrawler.ContainmentProxyStrategy.Physical)
.begin()
.addRevision(rootRevision)
.finish();
byte[] hash = digest.digest();
- Since:
- 4.26
- Author:
- Eike Stepper
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumStrategy for handling containment proxies during crawling.static interfaceStrategy for deciding how to handle features during crawling.static interfaceHandler interface for receiving crawl events.static classHandler implementation that calculates a message digest over crawled data.static classHandler implementation that writes crawl data to an output stream.Nested classes/interfaces inherited from class org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.event.Notifier.CancelationNested classes/interfaces inherited from interface org.eclipse.net4j.util.lifecycle.ILifecycle
org.eclipse.net4j.util.lifecycle.ILifecycle.DeferrableActivationNested classes/interfaces inherited from interface org.eclipse.net4j.util.event.INotifier
org.eclipse.net4j.util.event.INotifier.INotifier2 -
Field Summary
Fields inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
USE_LABEL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddRevision(CDORevision revision) Adds a revision to the crawl queue and processes reachable revisions.begin()Activates the crawler and prepares it for crawling.Returns the current containment proxy strategy.containmentProxyStrategy(CDORevisionCrawler.ContainmentProxyStrategy containmentProxyStrategy) Sets the containment proxy strategy.protected voidPerforms activation logic.protected voidChecks the state of required fields before activation.protected voidPerforms deactivation logic.Returns the current feature strategy.featureStrategy(CDORevisionCrawler.FeatureStrategy featureStrategy) Sets the feature strategy.finish()Deactivates the crawler and finalizes crawling.handler()Returns the current handler used by this crawler.handler(CDORevisionCrawler.Handler handler) Sets the handler to be used by this crawler.longReturns the number of revisions crawled so far.Returns the current revision provider.revisionProvider(CDORevisionProvider revisionProvider) Sets the revision provider.Methods inherited from class org.eclipse.net4j.util.lifecycle.Lifecycle
activate, checkActive, checkArg, checkArg, checkInactive, checkNull, checkState, checkState, deactivate, deferredActivate, doAfterActivate, doBeforeDeactivate, dump, getLifecycleState, isActive, isDeferredActivation, toStringMethods inherited from class org.eclipse.net4j.util.event.Notifier
addListener, addUniqueListener, fireEvent, fireEvent, fireEvent, fireThrowable, firstListenerAdded, getListeners, getNotificationService, hasListener, hasListeners, lastListenerRemoved, listenerAdded, listenerRemoved, removeListenerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.net4j.util.event.INotifier
addListener, getListeners, hasListeners, removeListener
-
Constructor Details
-
CDORevisionCrawler
public CDORevisionCrawler()Creates a new CDO revision crawler.
-
-
Method Details
-
handler
Returns the current handler used by this crawler. -
handler
Sets the handler to be used by this crawler.- Parameters:
handler- the handler implementation- Returns:
- this crawler instance for chaining
-
containmentProxyStrategy
Returns the current containment proxy strategy. -
containmentProxyStrategy
public CDORevisionCrawler containmentProxyStrategy(CDORevisionCrawler.ContainmentProxyStrategy containmentProxyStrategy) Sets the containment proxy strategy.- Parameters:
containmentProxyStrategy- the strategy to use- Returns:
- this crawler instance for chaining
-
featureStrategy
Returns the current feature strategy. -
featureStrategy
Sets the feature strategy.- Parameters:
featureStrategy- the strategy to use- Returns:
- this crawler instance for chaining
-
revisionProvider
Returns the current revision provider. -
revisionProvider
Sets the revision provider.- Parameters:
revisionProvider- the provider to use- Returns:
- this crawler instance for chaining
-
revisionCount
public long revisionCount()Returns the number of revisions crawled so far. -
addRevision
Adds a revision to the crawl queue and processes reachable revisions.- Parameters:
revision- the root revision to start crawling from- Returns:
- this crawler instance for chaining
-
begin
Activates the crawler and prepares it for crawling.- Returns:
- this crawler instance for chaining
-
finish
Deactivates the crawler and finalizes crawling.- Returns:
- this crawler instance for chaining
-
doBeforeActivate
Checks the state of required fields before activation.- Overrides:
doBeforeActivatein classorg.eclipse.net4j.util.lifecycle.Lifecycle- Throws:
Exception
-
doActivate
Performs activation logic.- Overrides:
doActivatein classorg.eclipse.net4j.util.lifecycle.Lifecycle- Throws:
Exception
-
doDeactivate
Performs deactivation logic.- Overrides:
doDeactivatein classorg.eclipse.net4j.util.lifecycle.Lifecycle- Throws:
Exception
-