Package org.eclipse.emf.cdo.util
Class CDOUtil
java.lang.Object
org.eclipse.emf.cdo.util.CDOUtil
Various static methods that may help in CDO client applications.
- Author:
- Eike Stepper
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
static CDORevisionPrefetchingPolicy
createRevisionPrefetchingPolicy
(int chunkSize) static CDOFetchRuleManager
static CDOFeatureAnalyzer
static CDOFeatureAnalyzer
createUIFeatureAnalyzer
(long maxTimeBetweenOperation) static CDOXATransaction
createXATransaction
(Notifier... notifiers) 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) getCDOObjects
(Collection<? extends EObject> objects) getCDOObjects
(EObject... objects) static String
getDocumentation
(ModelElement modelElement) static EObject
getEObject
(EObject object) getIntrinsicIDToEObjectMap
(CDOResource resource) Returns the map used to cache the EObject that is identified by thevalue
of its ID feature.static CDOBranchPointRange
getLifetime
(CDOObject object) 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
static CDOView
getView
(ResourceSet resourceSet, URI uri) static CDOViewSet
getViewSet
(Notifier notifier) static CDOXATransaction
getXATransaction
(CDOViewSet viewSet) static boolean
isCDOObject
(EObject object) static boolean
Deprecated.As of 4.0 use CDOView.isInvalidationRunnerActive()static boolean
Deprecated.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) 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
static InputStream
openInputStream
(CDOLob<?> lob, String encoding) static InputStream
static boolean
prepareDynamicEPackage
(EPackage startPackage) static boolean
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) Deprecated.As of 4.2 the legacy mode is always enabled.static void
setNextViewLock
(Lock viewLock) Sets thelock
to be used for the next view that is opened in the context of the current thread.static CDOObject
wrapExternalObject
(EObject object, CDOView view)
-
Field Details
-
PROP_VIEW_CONFIGURATOR
- Since:
- 4.14
- See Also:
-
PROP_VIEW_CONFIGURATOR_TYPE
- Since:
- 4.14
- See Also:
-
PROP_VIEW_CONFIGURATOR_DESCRIPTION
- Since:
- 4.14
- See Also:
-
CDO_ANNOTATION_URI
- Since:
- 4.3
- See Also:
-
DOCUMENTATION_KEY
- Since:
- 4.3
- See Also:
-
-
Method Details
-
registerResourceFactory
- Since:
- 4.0
-
getIntrinsicIDToEObjectMap
Returns the map used to cache the EObject that is identified by thevalue
of its ID feature.- Returns:
- the map used to cache the EObject that is identified by the value of its ID feature.
- Since:
- 4.2
- See Also:
-
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 notnull
. The map will be lazily loaded by thegetEObjectByID
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.- Parameters:
intrinsicIDToEObjectMap
- the new map ornull
.- Since:
- 4.2
- See Also:
-
getSession
- Since:
- 3.0
-
setNextViewLock
Sets thelock
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
callDisplay.syncExec()
in response to CDO notifications. In these cases aDelegableReentrantLock
can be injected into the newview
, 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 inCDOViewContainer
andCDOTransactionContainer
. After calling this method make sure to either open a newview
from the current thread or callsetNextViewLock(null)
to clear theThreadLocal
variable.- Since:
- 4.5
- See Also:
-
configureView
- Since:
- 4.4
-
prepareDynamicEPackage
- Since:
- 2.0
-
createCollectionLoadingPolicy
public static CDOCollectionLoadingPolicy createCollectionLoadingPolicy(int initialChunkSize, int resolveChunkSize) - Since:
- 2.0
-
createRevisionPrefetchingPolicy
- Since:
- 2.0
-
createThreadLocalFetchRuleManager
- Since:
- 4.1
-
createModelBasedFeatureAnalyzer
- Since:
- 4.1
-
createUIFeatureAnalyzer
- Since:
- 4.1
-
createUIFeatureAnalyzer
- Since:
- 4.1
-
createXATransaction
- Since:
- 4.0
-
getXATransaction
- Since:
- 2.0
-
getViewSet
- Since:
- 4.0
-
getView
- Since:
- 4.4
-
getView
- Since:
- 4.4
-
isStaleObject
- Since:
- 3.0
-
cleanStaleReference
- Since:
- 3.0
-
cleanStaleReference
- Since:
- 3.0
-
load
- Since:
- 2.0
-
wrapExternalObject
- Since:
- 4.2
-
isReadable
- Since:
- 4.23
-
isWritable
- Since:
- 4.23
-
getEObject
- Since:
- 2.0
-
getCDOObject
- Since:
- 2.0
-
getCDOObject
- Since:
- 4.4
-
getCDOObjects
- Since:
- 4.6
-
getCDOObjects
- Since:
- 4.6
-
isCDOObject
- Since:
- 4.4
-
createBranch
- Since:
- 4.6
-
filterReadables
- Since:
- 4.3
-
getRevisionDelta
- Since:
- 4.20
-
getLifetime
- Since:
- 4.4
-
getRevisionByVersion
- Since:
- 2.0
-
getRevisionByVersion
- Since:
- 3.0
-
getResources
- Since:
- 2.0
-
isSessionDirty
- Since:
- 2.0
- See Also:
-
isInvalidationRunnerActive
Deprecated.As of 4.0 use CDOView.isInvalidationRunnerActive()- Since:
- 3.0
-
isWritableObject
Queries whether an object is writable (is permitted to be modified in the current view context).- Parameters:
eObject
- an object- Returns:
false
if theeObject
is managed by CDO and does not have write permission;true
, otherwise- Since:
- 4.3
-
isLegacyObject
- Since:
- 3.0
-
isLegacyModeDefault
Deprecated.As of 4.2 the legacy mode is always enabled.- Since:
- 3.0
-
setLegacyModeDefault
Deprecated.As of 4.2 the legacy mode is always enabled.- Since:
- 3.0
-
setCredentialsProvider
public static void setCredentialsProvider(URI uri, org.eclipse.net4j.util.security.IPasswordCredentialsProvider provider) - Since:
- 4.0
-
getAnnotation
- Since:
- 4.3
-
setAnnotation
public static Annotation setAnnotation(ModelElement modelElement, String sourceURI, String key, String value) - Since:
- 4.3
-
getDocumentation
- Since:
- 4.3
-
setDocumentation
- Since:
- 4.3
-
openInputStream
- Throws:
IOException
- Since:
- 4.13
-
openInputStream
- Throws:
IOException
- Since:
- 4.13
-