This document will help you to migrate existing models to CDO Native 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.
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.
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.
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
<plugin_name>/<preference_name>=<value>
. For example:
fr.obeo.dsl.viewpoint.collab/PREF_SUPPORT_LEGACY_MODE=true
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.
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.
CDO=org.eclipse.emf.cdo
org.eclipse.emf.internal.cdo.CDOObjectImpl
org.eclipse.emf.cdo.CDOObject
eGet()
method.
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.
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.
CDO does not support metamodels containing EClasses parameterized with Generics yet.
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());
.
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: