Package org.eclipse.emf.cdo.common.util
Class EObjectCrawler
java.lang.Object
org.eclipse.net4j.util.event.Notifier
org.eclipse.net4j.util.lifecycle.Lifecycle
org.eclipse.emf.cdo.common.util.EObjectCrawler
- 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 EObjectCrawler
extends org.eclipse.net4j.util.lifecycle.Lifecycle
A crawler for arbitrary
EObjects that creates CDORevisions on the fly and
feeds them to a CDORevisionCrawler.
The EObjectCrawler.ModelScope inner class allows to register EObjects and then create an EObjectCrawler for the registered
objects.
Example usage:
MessageDigest digest = MessageDigest.getInstance("SHA-1");
Handler handler = new CDORevisionCrawler.MessageDigestHandler(digest);
ModelScope scope = new ModelScope();
scope.registerObject(EcorePackage.eINSTANCE, true);
EObjectCrawler crawler = scope.createCrawler().handler(handler);
crawler.begin();
crawler.addObject(EcorePackage.Literals.EOBJECT);
crawler.finish();
System.out.println(HexUtil.bytesToHex(digest.digest()));
The example above registers the EcorePackage and all its contents in a model scope, creates an EObjectCrawler for
the scope, sets a handler that computes a SHA-1 message digest, begins the crawling session, adds the EObject class
(which causes it to be crawled according to the default feature strategy), and finally finishes the crawling session.
At this point, the digest contains the SHA-1 message digest of the binary representation of all the
CDORevisions that were crawled.
- Since:
- 4.27
- Author:
- Eike Stepper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA model scope for registering EObjects and creating anEObjectCrawlerfor them.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 -
Method Summary
Modifier and TypeMethodDescriptionbegin()containmentProxyStrategy(CDORevisionCrawler.ContainmentProxyStrategy containmentProxyStrategy) protected voidprotected voidfeatureStrategy(CDORevisionCrawler.FeatureStrategy featureStrategy) finish()handler()handler(CDORevisionCrawler.Handler handler) longMethods 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, 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
-
Method Details
-
handler
-
handler
-
containmentProxyStrategy
-
containmentProxyStrategy
public EObjectCrawler containmentProxyStrategy(CDORevisionCrawler.ContainmentProxyStrategy containmentProxyStrategy) -
featureStrategy
-
featureStrategy
-
objectCount
public long objectCount() -
addObject
-
begin
-
finish
-
doActivate
- Overrides:
doActivatein classorg.eclipse.net4j.util.lifecycle.Lifecycle- Throws:
Exception
-
doDeactivate
- Overrides:
doDeactivatein classorg.eclipse.net4j.util.lifecycle.Lifecycle- Throws:
Exception
-