Package org.eclipse.emf.cdo.util

# Klasse CDOUtil

java.lang.Object
org.eclipse.emf.cdo.util.CDOUtil

public final class CDOUtil extends Object
Various static methods that may help in CDO client applications.

Autor:
  Eike Stepper

## Feldübersicht

Felder
Modifizierer und Typ
Feld
Beschreibung
`static final String`
`CDO_ANNOTATION_URI`
`static final String`
`DOCUMENTATION_KEY`
`static final String`
`PROP_VIEW_CONFIGURATOR`
`static final String`
`PROP_VIEW_CONFIGURATOR_DESCRIPTION`
`static final String`
`PROP_VIEW_CONFIGURATOR_TYPE`

## Methodenübersicht

Modifizierer und Typ
Methode
Beschreibung
`static void`
`cleanStaleReference(EObject eObject, EStructuralFeature eFeature)`
`static void`
`cleanStaleReference(EObject eObject, EStructuralFeature eFeature, int index)`
`static void`
`configureView(CDOView view)`
`static CDOBranch`
`createBranch(CDOBranchPoint base, String name)`
`static CDOCollectionLoadingPolicy`
`createCollectionLoadingPolicy(int initialChunkSize, int resolveChunkSize)`
`static CDOFeatureAnalyzer`
`createModelBasedFeatureAnalyzer()`
`static CDORevisionPrefetchingPolicy`
`createRevisionPrefetchingPolicy(int chunkSize)`
`static CDOFetchRuleManager`
`createThreadLocalFetchRuleManager()`
`static CDOFeatureAnalyzer`
`createUIFeatureAnalyzer()`
`static CDOFeatureAnalyzer`
`createUIFeatureAnalyzer(long maxTimeBetweenOperation)`
`static CDOXATransaction`
`createXATransaction(Notifier... notifiers)`
`static <T extends EObject>
EList<T>`
`filterReadables(Collection<T> collection)`
`static String`
`getAnnotation(ModelElement modelElement, String sourceURI, String key)`
`static CDOObject`
`getCDOObject(EObject object)`
`static CDOObject`
`getCDOObject(EObject object, boolean adaptLegacy)`
`static List<? extends CDOObject>`
`getCDOObjects(Collection<? extends EObject> objects)`
`static List<? extends CDOObject>`
`getCDOObjects(EObject... objects)`
`static String`
`getDocumentation(ModelElement modelElement)`
`static EObject`
`getEObject(EObject object)`
`static Map<String,EObject>`
`getIntrinsicIDToEObjectMap(CDOResource resource)`
Returns the map used to cache the EObject that is identified by the `value` of its ID feature.
`static CDOBranchPointRange`
`getLifetime(CDOObject object)`
`static EList<Resource>`
`getResources(ResourceSet resourceSet)`
`static CDORevision`
`getRevisionByVersion(CDOObject object, int version)`
`static CDORevision`
`getRevisionByVersion(CDOObject object, CDOBranch branch, int version)`
`static CDORevisionDelta`
`getRevisionDelta(CDOObject object)`
`static CDOSession`
`getSession(Object object)`
`static CDOView`
`getView(Notifier notifier)`
`static CDOView`
`getView(ResourceSet resourceSet, URI uri)`
`static CDOViewSet`
`getViewSet(Notifier notifier)`
`static CDOXATransaction`
`getXATransaction(CDOViewSet viewSet)`
`static boolean`
`isCDOObject(EObject object)`
`static boolean`
`isInvalidationRunnerActive()`
Veraltet.
As of 4.0 use CDOView.isInvalidationRunnerActive()
`static boolean`
`isLegacyModeDefault()`
Veraltet.
As of 4.2 the legacy mode is always enabled.
`static boolean`
`isLegacyObject(EObject object)`
`static boolean`
`isReadable(EObject object)`
`static boolean`
`isSessionDirty(CDOSession session)`
Returns `true` if the given `session` contains a dirty `transaction`, `false` otherwise.
`static boolean`
`isStaleObject(Object object)`
`static boolean`
`isWritable(EObject object)`
`static boolean`
`isWritableObject(EObject eObject)`
Queries whether an object is writable (is permitted to be modified in the current view context).
`static void`
`load(EObject eObject, CDOView view)`
`static InputStream`
`openInputStream(CDOLob<?> lob, String encoding)`
`static InputStream`
`openInputStream(CDOResourceLeaf leaf)`
`static boolean`
`prepareDynamicEPackage(EPackage startPackage)`
`static boolean`
`registerResourceFactory(Resource.Factory.Registry registry)`
`static Annotation`
`setAnnotation(ModelElement modelElement, String sourceURI, String key, String value)`
`static void`
`setCredentialsProvider(URI uri, org.eclipse.net4j.util.security.IPasswordCredentialsProvider provider)`
`static Annotation`
`setDocumentation(ModelElement modelElement, String value)`
`static void`
`setIntrinsicIDToEObjectMap(CDOResource resource, Map<String,EObject> intrinsicIDToEObjectMap)`
Sets the map used to cache the EObject identified by the value of its ID feature.
`static void`
`setLegacyModeDefault(boolean on)`
Veraltet.
As of 4.2 the legacy mode is always enabled.
`static void`
`setNextViewLock(Lock viewLock)`
Sets the `lock` to be used for the next view that is opened in the context of the current thread.
`static CDOObject`
`wrapExternalObject(EObject object, CDOView view)`

### Von Klasse geerbte Methoden java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Felddetails

### PROP_VIEW_CONFIGURATOR

public static final String PROP_VIEW_CONFIGURATOR

Seit:
  4.14
Siehe auch:
  - Konstantenfeldwerte

### PROP_VIEW_CONFIGURATOR_TYPE

public static final String PROP_VIEW_CONFIGURATOR_TYPE

Seit:
  4.14
Siehe auch:
  - Konstantenfeldwerte

### PROP_VIEW_CONFIGURATOR_DESCRIPTION

public static final String PROP_VIEW_CONFIGURATOR_DESCRIPTION

Seit:
  4.14
Siehe auch:
  - Konstantenfeldwerte

### CDO_ANNOTATION_URI

public static final String CDO_ANNOTATION_URI

Seit:
  4.3
Siehe auch:
  - Konstantenfeldwerte

### DOCUMENTATION_KEY

public static final String DOCUMENTATION_KEY

Seit:
  4.3
Siehe auch:
  - Konstantenfeldwerte

## Methodendetails

### registerResourceFactory

public static boolean registerResourceFactory(Resource.Factory.Registry registry)

Seit:
  4.0

### getIntrinsicIDToEObjectMap

public static Map<String,EObject> getIntrinsicIDToEObjectMap(CDOResource resource)
Returns the map used to cache the EObject that is identified by the `value` of its ID feature.

Gibt zurück:
  the map used to cache the EObject that is identified by the value of its ID feature.
Seit:
  4.2
Siehe auch:
  - `setIntrinsicIDToEObjectMap(org.eclipse.emf.cdo.eresource.CDOResource, java.util.Map<java.lang.String, org.eclipse.emf.ecore.EObject>)`

### setIntrinsicIDToEObjectMap

public static void setIntrinsicIDToEObjectMap(CDOResource resource, Map<String,EObject> intrinsicIDToEObjectMap)
Sets the map used to cache the EObject identified by the value of its ID feature. This cache is only activated if the map is not `null`. The map will be lazily loaded by the `getEObjectByID` method. It is up to the client to clear the cache when it becomes invalid, e.g., when the ID of a previously mapped EObject is changed.

Parameter:
  `intrinsicIDToEObjectMap` - the new map or `null`.
Seit:
  4.2
Siehe auch:
  - `getIntrinsicIDToEObjectMap(org.eclipse.emf.cdo.eresource.CDOResource)`

### getSession

public static CDOSession getSession(Object object)

Seit:
  3.0

### setNextViewLock

public static void setNextViewLock(Lock viewLock)
Sets the `lock` to be used for the next view that is opened in the context of the current thread.

This method is useful, for example, if EMF `adapters` call `Display.syncExec()` in response to CDO notifications. In these cases a `DelegableReentrantLock` can be injected into the new `view`, which does not deadlock when both CDO's invalidation thread and the display thread acquire the view lock.

This method involves a `ThreadLocal` variable to avoid method explosion in `CDOViewContainer` and `CDOTransactionContainer`. After calling this method make sure to either open a new `view` from the current thread or call `setNextViewLock(null)` to clear the `ThreadLocal` variable.

Seit:
  4.5
Siehe auch:
  - `CDOSession.Options.setDelegableViewLockEnabled(boolean)`

### configureView

public static void configureView(CDOView view)

Seit:
  4.4

### prepareDynamicEPackage

public static boolean prepareDynamicEPackage(EPackage startPackage)

Seit:
  2.0

### createCollectionLoadingPolicy

public static CDOCollectionLoadingPolicy createCollectionLoadingPolicy(int initialChunkSize, int resolveChunkSize)

Seit:
  2.0

### createRevisionPrefetchingPolicy

public static CDORevisionPrefetchingPolicy createRevisionPrefetchingPolicy(int chunkSize)

Seit:
  2.0

### createThreadLocalFetchRuleManager

public static CDOFetchRuleManager createThreadLocalFetchRuleManager()

Seit:
  4.1

### createModelBasedFeatureAnalyzer

public static CDOFeatureAnalyzer createModelBasedFeatureAnalyzer()

Seit:
  4.1

### createUIFeatureAnalyzer

public static CDOFeatureAnalyzer createUIFeatureAnalyzer()

Seit:
  4.1

### createUIFeatureAnalyzer

public static CDOFeatureAnalyzer createUIFeatureAnalyzer(long maxTimeBetweenOperation)

Seit:
  4.1

### createXATransaction

public static CDOXATransaction createXATransaction(Notifier... notifiers)

Seit:
  4.0

### getXATransaction

public static CDOXATransaction getXATransaction(CDOViewSet viewSet)

Seit:
  2.0

### getViewSet

public static CDOViewSet getViewSet(Notifier notifier)

Seit:
  4.0

### getView

public static CDOView getView(Notifier notifier)

Seit:
  4.4

### getView

public static CDOView getView(ResourceSet resourceSet, URI uri)

Seit:
  4.4

### isStaleObject

public static boolean isStaleObject(Object object)

Seit:
  3.0

### cleanStaleReference

public static void cleanStaleReference(EObject eObject, EStructuralFeature eFeature)

Seit:
  3.0

### cleanStaleReference

public static void cleanStaleReference(EObject eObject, EStructuralFeature eFeature, int index)

Seit:
  3.0

### load

public static void load(EObject eObject, CDOView view)

Seit:
  2.0

### wrapExternalObject

public static CDOObject wrapExternalObject(EObject object, CDOView view)

Seit:
  4.2

### isReadable

public static boolean isReadable(EObject object)

Seit:
  4.23

### isWritable

public static boolean isWritable(EObject object)

Seit:
  4.23

### getEObject

public static EObject getEObject(EObject object)

Seit:
  2.0

### getCDOObject

public static CDOObject getCDOObject(EObject object)

Seit:
  2.0

### getCDOObject

public static CDOObject getCDOObject(EObject object, boolean adaptLegacy)

Seit:
  4.4

### getCDOObjects

public static List<? extends CDOObject> getCDOObjects(EObject... objects)

Seit:
  4.6

### getCDOObjects

public static List<? extends CDOObject> getCDOObjects(Collection<? extends EObject> objects)

Seit:
  4.6

### isCDOObject

public static boolean isCDOObject(EObject object)

Seit:
  4.4

### createBranch

public static CDOBranch createBranch(CDOBranchPoint base, String name)

Seit:
  4.6

### filterReadables

public static <T extends EObject> EList<T> filterReadables(Collection<T> collection)

Seit:
  4.3

### getRevisionDelta

public static CDORevisionDelta getRevisionDelta(CDOObject object)

Seit:
  4.20

### getLifetime

public static CDOBranchPointRange getLifetime(CDOObject object)

Seit:
  4.4

### getRevisionByVersion

public static CDORevision getRevisionByVersion(CDOObject object, int version)

Seit:
  2.0

### getRevisionByVersion

public static CDORevision getRevisionByVersion(CDOObject object, CDOBranch branch, int version)

Seit:
  3.0

### getResources

public static EList<Resource> getResources(ResourceSet resourceSet)

Seit:
  2.0

### isSessionDirty

public static boolean isSessionDirty(CDOSession session)
Returns `true` if the given `session` contains a dirty `transaction`, `false` otherwise.

Seit:
  2.0
Siehe auch:
  - `CDOTransaction`

### isInvalidationRunnerActive

@Deprecated public static boolean isInvalidationRunnerActive()
Veraltet.
As of 4.0 use CDOView.isInvalidationRunnerActive()

Seit:
  3.0

### isWritableObject

public static boolean isWritableObject(EObject eObject)
Queries whether an object is writable (is permitted to be modified in the current view context).

Parameter:
  `eObject` - an object
Gibt zurück:
  `false` if the `eObject` is managed by CDO and does not have write permission; `true`, otherwise
Seit:
  4.3

### isLegacyObject

public static boolean isLegacyObject(EObject object)

Seit:
  3.0

### isLegacyModeDefault

@Deprecated public static boolean isLegacyModeDefault()
Veraltet.
As of 4.2 the legacy mode is always enabled.

Seit:
  3.0

### setLegacyModeDefault

@Deprecated public static void setLegacyModeDefault(boolean on)
Veraltet.
As of 4.2 the legacy mode is always enabled.

Seit:
  3.0

### setCredentialsProvider

public static void setCredentialsProvider(URI uri, org.eclipse.net4j.util.security.IPasswordCredentialsProvider provider)

Seit:
  4.0

### getAnnotation

public static String getAnnotation(ModelElement modelElement, String sourceURI, String key)

Seit:
  4.3

### setAnnotation

public static Annotation setAnnotation(ModelElement modelElement, String sourceURI, String key, String value)

Seit:
  4.3

### getDocumentation

public static String getDocumentation(ModelElement modelElement)

Seit:
  4.3

### setDocumentation

public static Annotation setDocumentation(ModelElement modelElement, String value)

Seit:
  4.3

### openInputStream

public static InputStream openInputStream(CDOResourceLeaf leaf) throws IOException

Löst aus:
  `IOException`
Seit:
  4.13

### openInputStream

public static InputStream openInputStream(CDOLob<?> lob, String encoding) throws IOException

Löst aus:
  `IOException`
Seit:
  4.13