Bug 398690 - [CDO] ModelSet/IModel API independence of IFiles
Summary: [CDO] ModelSet/IModel API independence of IFiles
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.10.0   Edit
Hardware: PC Mac OS X
: P2 enhancement (vote)
Target Milestone: M6   Edit
Assignee: Christian Damus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 290952
  Show dependency tree
 
Reported: 2013-01-21 17:31 EST by Christian Damus CLA
Modified: 2013-03-06 11:07 EST (History)
0 users

See Also:
give.a.damus: kepler+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2013-01-21 17:31:39 EST
Currently, much of the ModelSet/IModel and related API is defined in terms of IFiles and IPaths.  This ties the API to persistence of UML models in the Eclipse workspace.

For the CDO context, a more abstract API based on URIs or some other suitable abstraction is required.  As much as possible, this should be a backwards-compatible evolution of the current IFile-centric API.
Comment 1 Christian Damus CLA 2013-01-21 17:33:10 EST
I'll take this on.
Comment 2 Christian Damus CLA 2013-01-21 17:49:24 EST
The scope of this enhancement includes a CDO-aware implementation of the ModelSet service, for which I have a prototype in progress.
Comment 3 Christian Damus CLA 2013-01-31 16:24:18 EST
r9981 on cdo_kepler branch:

Deprecated all of the methods in ModelSet and IModel that accept IFiles as identifiers of the "model" resources, replacing them with equivalent API using URIs.  As much as possible, the IFile-based implementations delegate to the URI-based implementations for backwards compatibility.

Clients of the ModelSet and IModel, in editors, wizards, etc. are updated to use the new URI-based APIs.

Additionally, the ReadOnlyManager for determining whether resources are not editable by the user, although the API is based on URIs, still depends largely on IFiles.  In particular, all of the IReadOnlyHandlers currently implemented assume that there is a file either in the workspace, or in SVN, or whatever that has read/write permission state.  Because CDO resources do not trace to files of any kind, the default file-based handlers just assume that they are not editable (i.e., they are read-only) because they must be in plug-in JARs or something.  A CDO-aware IReadOnlyHandler can indicate that the resources are not read-only, but all handlers of lower priority are still consulted until one returns a read-only answer.  Therefore, a new IReadOnlyHandler2 interface is defined that may be implemented to tell the ReadOnlyManager that the handler definitively knows the read-only-ness of a resource, and no other handlers of lower priority should be consulted.
Comment 4 Christian Damus CLA 2013-01-31 16:44:28 EST
Also in r9981 on cod_kepler branch:

The ModelSet::registerModel(IModel) API is changed to add only the most specific IModel implementation for the same key, to avoid creation of repeated resources when creating a model.  Also, the AbstractBaseModel::createModel(...) API is updated to check whether the resource to be created already exists, instead of creating a duplicate.

For example, previously, both the NotationModel and the CSSNotationModel (which specializes it) would be added to a ModelSet.  When, later, the ModelSet::createModel(...) API is called, both of these IModels would create their xyz.notation resources in the ModelSet.  This is not a problem in a regular EMF ResourceSet, because the first xyz.notation is the only one that is "visible" or "addressable"; the other one is shadowed and doesn't have any effect.

However, in a CDO-managed resource set, this is an error and a transaction with duplicate resource URIs in its resource set will fail to commit.
Comment 5 Christian Damus CLA 2013-01-31 18:08:01 EST
r9996 on cdo_kepler branch:

Committed initial implementation of CDO-aware implementations of various Papyrus services, including:

  - CDOAwareModelSet (specializing OnDemandLoadingModelSet)
  - CDOAwareTransactionalEditingDomain
  - CDOReadOnlyHandler
  - PapyrusDawnResourceImpl

The last item above is a specialization of Dawn's specialization of the CDOResourceImpl, which caches the resource URI for access without locking the transaction, to prevent deadlocks in the UI caused by interactions with the ReadOnlyManager.
Comment 6 Christian Damus CLA 2013-03-06 11:07:09 EST
r10380

These changes have been merged to trunk.

Some new IPath-based API, the IVersionableModel interface, was added since the initial refactoring.  But this API will not be applicable in the CDO context, so it is not in the scope of this enhancement.