CDO in Collaborative Mode

This document will help you to migrate existing models to CDO Native mode.

  1. CDO in Collaborative Mode
    1. CDO Native vs CDO Legacy mode
      1. Activate Legacy mode support
      2. Activate Legacy model detection
      3. Setting the default preference value
    2. Migrate existing meta-models to CDO Native
      1. Create a CDO-native gen-model from scratch
      2. Convert an existing gen-model to CDO Native
      3. Meta-model constraints
      4. EMF generated editors constraints
    3. CDO R20191029-1629 - by Obeo

CDO Native vs CDO Legacy mode

By default, the code generated for a meta-model is generic and does not have any strong dependency to CDO. In this case, CDO relies on a Legacy mode to support collaboration above such models. See Activate Legacy mode support.

However, in order to gain in performance and scalability, you should modify your gen-models to make the generated code rely on CDO (we talk about CDO Native meta-models).

The usage of CDO Native meta-models is required in production.

There is no warantee in Legacy mode. It comes with several drawbacks regarding scalability and stability. Though, it can be enabled if you want to test an existing tooling based on EMF and Sirius or simply start and discover collaborative features without the constraint to generate CDO Native model in a first step.

Activate Legacy mode support

Nevertheless, if you decide to use the Legacy mode, we encourage you to set the non UI preference CDOSiriusPreferenceKeys.PREF_SUPPORT_LEGACY_MODE to true . It will solve some legacy mode issues. There is no guarantee that this preference will solve other potential issues.

Activate Legacy model detection

Sometimes it is complex to determine if all cdo native meta-models are generated and you may want to detect such cases. The preference CDOSiriusPreferenceKeys.PREF_LEGACY_MODEL_DETECTION is used to activate the detection.
When creating a shared modeling project or other connection wizards, if CDOSiriusPreferenceKeys.PREF_SUPPORT_LEGACY_MODE=false, CDOSiriusPreferenceKeys.PREF_LEGACY_MODEL_DETECTION=true and if there is at least a legacy model (not CDO Native) among semantic models, then,

By default, the preference value is false, that is the detection is disabled. Nevertheless, you may override its default value.

Setting the default preference value

You can follow the steps below to initialize this preference without providing a plug-in to do it.
To do so, we will use pluginCustomization

Migrate existing meta-models to CDO Native

Create a CDO-native gen-model from scratch

Righ-click on your metamodel (ECore) file and select New > Other... > EMF Generator Model . Press Next and select Ecore model (CDO Native) in the Select a Model Importer page.

Convert an existing gen-model to CDO Native

Modify your gen-model or create a copy of it if you want to keep your previous gen-model. If you choose to copy an existing gen-model and if it references other gen-models, modify these references to reference cdo-native gen-models.

Meta-model constraints

Transient references must be properly derived

As a transient reference is not persistent, it has to be properly derived in order to be able to calculate its result each time. This algorithm must be based on non transient feature. At a given instant, every connected (non dirty) clients must have the same result for this transient and derived reference. Otherwise, refresh on each clients will produce a difference, the session will be dirty and the lock will be taken in loop.

Finally, a transient feature must be derived for this calculating equivalence among clients.

EClasses with identical names

It is possible to have the same name for 2 EClasses in different packages or metamodels. However, the following property must be added in the server configuration, in the store/mappingStrategy section:
<property name="qualifiedNames" value="true"/>

This will make all database tables prefixed with the qualified EPackage name, and hence allow your database to support EClasses with the same name.

Support of Generic Types

CDO does not support metamodels containing EClasses parameterized with Generics yet.

EMF generated editors constraints

As with a shared modeling project, it is possible to open a shared semantic resource with associated EMF generated editor by double click, it is necessary to have generated code with EMF 2.7 to avoid a ClassCastException at the beginning of XXXEditor.createModel() or replace the two first instruction at the beginning of XXXEditor.createModel() by URI resourceURI = EditUIUtil.getURI(getEditorInput());.

CDO R20191029-1629 – by Obeo

This version of CDO 4.7 is provided by Obeo. It brings several forks with fixes not yet included in the official CDO repository.
The official CDO 4.7.0 release is available at https://www.eclipse.org/cdo/downloads/

For information about CDO or Net4j, see their homepage or wiki

Forks provided by Obeo: