Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "CDO/New And Noteworthy for CDO 2.0"

< CDO
Line 119: Line 119:
  
 
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.
 
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.
 +
 +
== Auto-Reload configurable in CDO Editor ==
 +
 +
A global preference option allows to ignore remote invalidated objects of your model: CDOEditor will keep showing the state of the model that initially opened (while the model is being passively updated).
 +
 +
[[Image:Autoreload1.png]]
 +
 +
The new preference option, to configure the behaviour of CDOEditor on invalidated objects
 +
 +
[[Image:Autoreload2.png]]
 +
 +
You could compare the value of the object at the time you retrieved it and the current value in the repository (only if passive update is enabled)

Revision as of 11:51, 11 December 2008


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.

session.options().setPassiveUpdateEnabled(false);

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

session.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:

transaction.options().setChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);

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

eObject.eAdapters().add(anAdapter);

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 CDOAdapterPolicy#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 CDOAdapterPolicy#NONE} - Disabled.
{@link CDOAdapterPolicy#ALL} - Enabled for all adapters used.
{@link CDOAdapterPolicy#ONLY_CDOADAPTER} - Enabled only for adapters that implement {@link CDOAdapter}.

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

Query

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.

salesOrders.close();

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.


XATransaction

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();
CDOUtil.prepareResourceSet(resourceSet);
xaTransaction.add(CDOUtil.getViewSet(resourceSet));
xaTransaction.setSavepoint();
xaTransaction.rollback();
xaTransaction.commit();

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.

Auto-Reload configurable in CDO Editor

A global preference option allows to ignore remote invalidated objects of your model: CDOEditor will keep showing the state of the model that initially opened (while the model is being passively updated).

Autoreload1.png

The new preference option, to configure the behaviour of CDOEditor on invalidated objects

Autoreload2.png

You could compare the value of the object at the time you retrieved it and the current value in the repository (only if passive update is enabled)

Back to the top