Jump to: navigation, search

CDO/New And Noteworthy for CDO 2.0

Revision as of 13:43, 10 October 2008 by Smcduff.hotmail.com (Talk | contribs)

Create save point

Creates a save point in the CDOTransaction, that can be used to roll back a part of the transaction and specifies the save point.

Note: Save points do not involve the server side, everything is done on the client side.

Make remote invalidation configurable

Specifies whether an object will be invalidated by others users' changes.


By default this property is enabled. If this property is disabled the latest versions of objects can still be obtained by calling {@link #refresh()}.


Passive update can be disabled in cases where more performance is needed and/or more control over when objects will be refreshed.

When the feature is turned on, it will automatically performs a refresh to be in sync with the server.

Change subscription

Allows listeners to be notified when objects are modified from other CDOTransaction (remotely or not). It uses adapters for the notification process (see CDONotification).

To activate the policy, you must to do the following:


To register an object, you must add an adapter to the object in which you are interested.


If anAdapter matches the current policy, eObject will be registered to the server and you will receive all changes from others {@link CDOTransaction}.

By default, the value is set to {@link CDOChangeSubscriptionPolicy#NONE}.

When this feature is activated, every object that has at least one adapter matching the current policy will be registered to the server and will be notified for every change happening in any other CDOTransaction.

{@link CDOChangeSubscriptionPolicy#NONE} - Disabled.
{@link CDOChangeSubscriptionPolicy#ALL} - Enabled for all adapters used.
{@link CDOChangeSubscriptionPolicy#ONLY_CDOADAPTER} - Enabled only for adapters that implement {@link CDOAdapter}.

Any other classes that implement {@link CDOChangeSubscriptionPolicy} will enable the feature for whatever rules defined in that class.


The query feature allows you to retrieve objects from the repository in a native way. It could support as many languages as the Store wants to support.

CDOQuery query = view.createQuery(<LANGUAGE>, <QUERY STRING>);

At this point, it can set parameters that are going to be transferred to the server. (Eclass, EObject or primitive)

query.setParameter(key, value);

Once all your parameters are set, you can retrieve the results in a standard way.

List<SalesOrder> salesOrders = query.getResult(SalesOrder.class);

or asynchronously

CloseableIterator<SalesOrder> salesOrders = query.getResultAsync(SalesOrder.class);

In asynchronous mode, objects are returned as soon as they are retrieved from the Server. The query feature does not keep any reference to the results. This means that you could possibly return millions of objects.

The iterator could be closed at any time, resulting in the query being cancelled at the server side.


Support getURIFragment and getEObject

CDOResource now supports the getURIFragment and getEObject methods.

Note: The URIs of temporary objects will change when the CDOTransaction is committed. Objects will no longer be accessible using their temporary URI once the CDOTransaction is committed.

Support external references

CDO supports many resources from different sources in the same resource set. Objects can refer to each other even if they are not from the same store or source.

  • An object from XMIResource can refer to objects from CDOResource.
  • An object from CDOResource can refer to objects from XMIResource.
  • An object from CDOResourceA (repositoryA) can refer to objects from another CDOResourceB(repositoryB)

Each resource set has a CDOViewSet. A CDOViewSet could have many CDOViews but each CDOView refers to one CDOViewSet only.

To use that feature, the same resource set must be used when opening CDOView.

ResourceSet resourceSet = new ResourceSetImpl();
CDOTransaction transactionA1 = sessionA.openTransaction(resourceSet);
CDOTransaction transactionB1 = sessionB.openTransaction(resourceSet);

Note: Two CDOViews from the same repository cannot belong to the same resource set.


This feature provides the ability to use many transactions from many repositories as a whole instead of individually. Its three-phase commit allows the clients to commit circular graphs and complex graphs that are from multiple repositories or CDOTransactions.

CDOXATransaction xaTransaction = CDOUtil.createXATransaction();

Support containment proxies

This feature provides the ability to have an object that is in resourceA and its container could be in another resource. The object and container are in different resource and it does support external references as well.This is to be in line with EMF. However, it needs to be define in your model.