org.eclipse.emf.cdo.client
Interface ResourceManager

All Superinterfaces:
org.eclipse.net4j.spring.Loggable, org.eclipse.net4j.spring.Service
All Known Implementing Classes:
ResourceManagerImpl

public interface ResourceManager
extends org.eclipse.net4j.spring.Service

Manages the CDOResource instances in an associated ResourceSet.

A ResourceManager can be seen as a "CDO session" for the ResourceSet. It holds a handle to the Channel that connects this ResourceManager to the CDO server.


Nested Class Summary
static interface ResourceManager.InvalidationListener
          Can be registered with a ResourceManager to be subsequently notified about invalidated objects.
 
Method Summary
 void addInvalidationListener(ResourceManager.InvalidationListener listener)
          Adds a ResourceManager.InvalidationListener to the list of listeners to be notified about invalidated obejcts in the scope of this PackageManager.
 void commit()
          Commits all changes to the CDO repository that have been applied to the contained CDOPersistable instances since the last call to commit() or the creation of this ResourceManager, whichever occurred more recently.
 org.eclipse.emf.ecore.EObject createEObject(org.eclipse.emf.ecore.EClass eClass, long oid, int oca, CDOResource resource)
          For internal use only.
 org.eclipse.emf.common.util.URI createProxyURI(long oid)
          For internal use only.
 org.eclipse.emf.ecore.resource.Resource createResource(org.eclipse.emf.common.util.URI uri)
          A convenience method for creating a resource in the associated ResourceSet.
 org.eclipse.net4j.core.Channel getChannel()
          Returns the Channel that represents the connection of this ResourceManager to the CDO server.
 org.eclipse.emf.ecore.EObject getObject(long oid)
          Returns the EObject that is internally identified by the given global OID.
 PackageManager getPackageManager()
          Returns the PackageManager used by this ResourceManager.
 org.eclipse.emf.ecore.EObject getProxyObject(long oid)
          For internal use only.
 CDOResource getResource(int rid)
          Returns the CDOResource instance with the given RID and loads that CDOResource if necessary.
 org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri, boolean loadOnDemand)
          A convenience method for querying a resource in the associated ResourceSet and eventually loading that resource.
 org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
          Returns the ResourceSet that is associated with and managed by this ResourceManager.
 PausableChangeRecorder getTransaction()
          For internal use only.
 void handleRemovedResources(int[] rids)
          For internal use only.
 boolean hasDeferredInvalidation(org.eclipse.emf.ecore.EObject object)
          Returns true if an invalidation has been deferred for the given EObject within the current transaction, false otherwise.
 void invalidateObjects(long[] oids)
          For internal use only.
 boolean isRequestingObjects()
          For internal use only.
 boolean isRollbackOnly()
          Returns true if the current transaction can only be rolled back due to changes by another transaction, false otherwise.
 org.eclipse.emf.common.util.EList queryCrossReferences(org.eclipse.emf.ecore.EObject object)
          TODO Document method queryCrossReferences The queryCrossReferences method.
 org.eclipse.emf.common.util.EList queryCrossReferences(org.eclipse.emf.ecore.EObject object, CDOResource resource)
          TODO Document method queryCrossReferences The queryCrossReferences method.
 java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context)
          Convenience method to query polymorphic, gloabl extents, returns the same result as queryExtent(context, false, null).
 java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context, boolean exactMatch)
          Convenience method to query gloabl extents, returns the same result as queryExtent(context, exactMatch, null).
 java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context, boolean exactMatch, CDOResource resource)
          Sends a request to the CDO server to query all CDOPersistable instances in the given CDOResource or in all resources of the CDO repository that are instances of the context EClass or of any of its subclasses.
 java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context, CDOResource resource)
          Convenience method to query polymorphic extents, returns the same result as queryExtent(context, false, resource).
 void registerObject(long id, org.eclipse.emf.ecore.EObject object)
          For internal use only.
 void registerResource(CDOResource resource)
          For internal use only.
 void registerResourcePath(CDOResource cdoResource, java.lang.String path)
          For internal use only.
 void removeInvalidationListener(ResourceManager.InvalidationListener listener)
          Removes a ResourceManager.InvalidationListener from the list of listeners to be notified about invalidated obejcts in the scope of this PackageManager.
 void requestObject(CDOPersistable cdoObject)
          For internal use only.
 void reRegisterObject(org.eclipse.emf.ecore.EObject object, long newId)
          For internal use only.
 void rollback()
          Rolls back the current transaction that is started with the creation of this ResourceManager or after a call to commit(), whichever occurred more recently.
 void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Associates the given ResourceSet with this ResourceManager.
 void startRequestingObjects()
          For internal use only.
 void stopRequestingObjects()
          For internal use only.
 
Methods inherited from interface org.eclipse.net4j.spring.Service
addStateListener, dump, getState, isActive, isAutoStart, isStarted, removeStateListener, start, stop, testSetState
 
Methods inherited from interface org.eclipse.net4j.spring.Loggable
debug, debug, error, error, fatal, fatal, getBeanName, getChild, getContainer, getFullBeanName, getLogger, info, info, isDebugEnabled, isErrorEnabled, isFatalEnabled, isInfoEnabled, isWarnEnabled, warn, warn
 

Method Detail

isRollbackOnly

boolean isRollbackOnly()
Returns true if the current transaction can only be rolled back due to changes by another transaction, false otherwise.

Returns:
true if the current transaction can only be rolled back due to changes by another transaction, false otherwise.


hasDeferredInvalidation

boolean hasDeferredInvalidation(org.eclipse.emf.ecore.EObject object)
Returns true if an invalidation has been deferred for the given EObject within the current transaction, false otherwise.

Parameters:
object - The EObject to check.

Returns:
true if an invalidation has been deferred for the given EObject within the current transaction, false otherwise.


commit

void commit()
            throws OptimisticControlException
Commits all changes to the CDO repository that have been applied to the contained CDOPersistable instances since the last call to commit() or the creation of this ResourceManager, whichever occurred more recently.

This is a blocking call. The calling thread gets suspended until the confirmation for the CommitTransactionRequest is received and processed.

Throws:
OptimisticControlException - if one or several of the objects to be committed has never versions at server side.

See Also:
CommitTransactionRequest

rollback

void rollback()
Rolls back the current transaction that is started with the creation of this ResourceManager or after a call to commit(), whichever occurred more recently.

The associated ResourceSet and the contained Resource and EObject instances are put back into the state before the first change in the current transaction.

Finally a new transaction is started.


getTransaction

PausableChangeRecorder getTransaction()
For internal use only.


getResourceSet

org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
Returns the ResourceSet that is associated with and managed by this ResourceManager.

Returns:
The associated ResourceSet.


setResourceSet

void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Associates the given ResourceSet with this ResourceManager.

This method can only be called once!

Parameters:
resourceSet - The ResourceSet to associate.


getChannel

org.eclipse.net4j.core.Channel getChannel()
Returns the Channel that represents the connection of this ResourceManager to the CDO server.

Returns:
The Channel that represents the connection of this ResourceManager to the CDO server.


getResource

CDOResource getResource(int rid)
Returns the CDOResource instance with the given RID and loads that CDOResource if necessary.

Parameters:
rid - The RID of the resource to load.

Returns:
The CDOResource or null if no resource with the given RID exists in the CDO repository.


createResource

org.eclipse.emf.ecore.resource.Resource createResource(org.eclipse.emf.common.util.URI uri)
A convenience method for creating a resource in the associated ResourceSet.

Identical to calling getResourceSet().createResource(uri).

Parameters:
uri - The URI of the resource to create.
Returns:
a new resource, or null if no factory is registered.

getResource

org.eclipse.emf.ecore.resource.Resource getResource(org.eclipse.emf.common.util.URI uri,
                                                    boolean loadOnDemand)
A convenience method for querying a resource in the associated ResourceSet and eventually loading that resource.

Identical to calling getResourceSet().getResource(uri, loadOnDemand).

Parameters:
uri - The URI to resolve.
loadOnDemand - Whether to create and load the resource, if it doesn't already exists.
Returns:
The resource resolved by the URI.
Throws:
java.lang.RuntimeException - if a resource can't be demand created.
org.eclipse.emf.common.util.WrappedException - if a problem occurs during demand load.

isRequestingObjects

boolean isRequestingObjects()
For internal use only.


startRequestingObjects

void startRequestingObjects()
For internal use only.


stopRequestingObjects

void stopRequestingObjects()
For internal use only.


requestObject

void requestObject(CDOPersistable cdoObject)
For internal use only.


createProxyURI

org.eclipse.emf.common.util.URI createProxyURI(long oid)
For internal use only.


getProxyObject

org.eclipse.emf.ecore.EObject getProxyObject(long oid)
For internal use only.


invalidateObjects

void invalidateObjects(long[] oids)
For internal use only.


handleRemovedResources

void handleRemovedResources(int[] rids)
For internal use only.


registerObject

void registerObject(long id,
                    org.eclipse.emf.ecore.EObject object)
For internal use only.


reRegisterObject

void reRegisterObject(org.eclipse.emf.ecore.EObject object,
                      long newId)
For internal use only.


createEObject

org.eclipse.emf.ecore.EObject createEObject(org.eclipse.emf.ecore.EClass eClass,
                                            long oid,
                                            int oca,
                                            CDOResource resource)
For internal use only.


getObject

org.eclipse.emf.ecore.EObject getObject(long oid)
Returns the EObject that is internally identified by the given global OID.

If the CDOResource that contains the found EObject is not loaded yet, it is automatically loaded into the associated ResourceSet before.

Parameters:
oid - The OID of the EObject to return.

Returns:
The EObject that is internally identified by the given global OID.


registerResource

void registerResource(CDOResource resource)
For internal use only.


registerResourcePath

void registerResourcePath(CDOResource cdoResource,
                          java.lang.String path)
For internal use only.


getPackageManager

PackageManager getPackageManager()
Returns the PackageManager used by this ResourceManager.

Returns:
The PackageManager used by this ResourceManager.


queryExtent

java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context)
Convenience method to query polymorphic, gloabl extents, returns the same result as queryExtent(context, false, null).

Parameters:
context - The EClass that all the objects to be queried shall be castable to.
Returns:
A Set of all the objects that can safely be casted to the context EClass.
See Also:
queryExtent(EClass, boolean, CDOResource)

queryExtent

java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context,
                          CDOResource resource)
Convenience method to query polymorphic extents, returns the same result as queryExtent(context, false, resource).

Parameters:
context - The EClass that all the objects to be queried shall be castable to.
resource - The CDOResource to be used as the scope for the extent or null for global extent scope.

Returns:
A Set of all the objects that can safely be casted to the context EClass.
See Also:
queryExtent(EClass, boolean, CDOResource)

queryExtent

java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context,
                          boolean exactMatch,
                          CDOResource resource)
Sends a request to the CDO server to query all CDOPersistable instances in the given CDOResource or in all resources of the CDO repository that are instances of the context EClass or of any of its subclasses.

The CDOPersistable instances do not have to be already loaded in order to be found by this remote query. If they had not been loaded before, CDO will create proxies for them and lazily load them while iterating over the returned Set. The remote query is performed on each call to this method, no caching will occur.

Parameters:
context - The EClass that all the objects to be queried shall be castable to.
exactMatch - Pass true to exclude objects from the result that are instances of subclasses of the context EClass, false otherwise.
resource - The CDOResource to be used as the scope for the extent or null for global extent scope.

Returns:
A Set of all the objects that can safely be casted to the context EClass.
See Also:
CDOResource.queryExtent(EClass, boolean)

queryExtent

java.util.Set queryExtent(org.eclipse.emf.ecore.EClass context,
                          boolean exactMatch)
Convenience method to query gloabl extents, returns the same result as queryExtent(context, exactMatch, null).

Parameters:
context - The EClass that all the objects to be queried shall be castable to.
exactMatch - Pass true to exclude objects from the result that are instances of subclasses of the context EClass, false otherwise.
Returns:
A Set of all the objects in all resources of the CDO respository that can safely be casted to the context EClass.
See Also:
queryExtent(EClass, boolean, CDOResource)

queryCrossReferences

org.eclipse.emf.common.util.EList queryCrossReferences(org.eclipse.emf.ecore.EObject object)
TODO Document method queryCrossReferences

The queryCrossReferences method.

Parameters:
object -
Returns:

queryCrossReferences

org.eclipse.emf.common.util.EList queryCrossReferences(org.eclipse.emf.ecore.EObject object,
                                                       CDOResource resource)
TODO Document method queryCrossReferences

The queryCrossReferences method.

Parameters:
object -
resource -
Returns:

addInvalidationListener

void addInvalidationListener(ResourceManager.InvalidationListener listener)
Adds a ResourceManager.InvalidationListener to the list of listeners to be notified about invalidated obejcts in the scope of this PackageManager.

Parameters:
listener - The ResourceManager.InvalidationListener to be added.


removeInvalidationListener

void removeInvalidationListener(ResourceManager.InvalidationListener listener)
Removes a ResourceManager.InvalidationListener from the list of listeners to be notified about invalidated obejcts in the scope of this PackageManager.

Parameters:
listener - The ResourceManager.InvalidationListener to be removed.


Copyright (c) 2004, 2005, 2006 Eike Stepper, Germany.
All Rights Reserved.