Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Using CDO with editors based on Transactional Editing Domain
[CDO] Using CDO with editors based on Transactional Editing Domain [message #422853] Wed, 17 September 2008 09:46 Go to next message
Stephane  Fournier is currently offline Stephane FournierFriend
Messages: 299
Registered: July 2009
Senior Member
Hi,

For few days, I try to use CDO with an editor based on Transactional
Editing Domain. My goal is to wire a GMF-based editor with CDO for
multi-user purpose.

To simplify the job, I first use the famous Extended Library meta-model
that I modify to have a transactional editing domain (TED) rather a
standard EMF one.
I made some changes to generate the model API for CDO.
CDO seems to not support Feature Map ? Thus, I changed that...

To mix CDO with a TED, I implement my own transactional editing domain
factory (declared through org.eclipse.emf.transaction.editingDomains
extension-point) where I override the createEditingDomain() method to
provide a transactional editing domain compatible with CDO (this one
extends TransactionalEditingDomainImpl).

I have to override some methods of TransactionalEditingDomainImpl.

First, I override isReadOnlyURI(URI) to always answer true (this behavior
could be improved, nevertheless that fits my tests) otherwise, the open
editor is in a read-only mode and I can't create objects or changes values
from the property sheet.

I have also overridden the createResource(String fileNameURI) method where
I create a CDO resource. First call initializes a CDO session, a CDO
transaction for transactional editing domain resource set. I use the
getOrCreateResource with specified path to finally create the resource.

In the EMF-based editor (slightly modified to use a TED rather a standard
EMF editing domain as presented in EMF transaction tutorial) I called
createResource method on this TED. I got a CDO resource in return. If its
content is empty, I add a Library to have a root node that allows me to
create books, writers and so on.

The library creation changes my editor as a dirty one. Great !
Nevertheless, when I create some children (book, writer), EMFT
transactions are not handled correctly.
The CDO resource is not registered as a loaded one in ResourceSetManager
singleton. Hence, all modifications on created objects notified to the
TransactionChangeRecorder are not handled due to their resource is not in
the
ResourceSetManager singleton loadedResources WeakHashMap, thus no
notification is added to current transaction and finally my editor is not
aware of model changes.

To workaround this issue, I call setLoaded(true) on CDO resource. This
call sends a notification caught by the ResourceSetManager singleton in
its observe(Resource res, Notification notification) method,
notification.getNewBooleanValue() in Resource.RESOURCE__IS_LOADED case
throws an exception because it expects primitive types rather Boolean
objects. What a pity !

At this step, I'm a bit stuck.

Does anyone have an idea or figure out how to wire both frameworks ?

That's a long post, I do hope people can understand what I tried to
explain...

Stephane.
Re: [CDO] Using CDO with editors based on Transactional Editing Domain [message #422855 is a reply to message #422853] Wed, 17 September 2008 10:51 Go to previous message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Stephane,

I've just started working in the integration of CDO and GMF. Maybe we
could collaborate to get this done :)

I've been taking a look at GMF's generated editor, with the objective to
create something like a GMF Enhanced Editor generator (as I did for
Sample Ecore editor, take a look at bug 245836). Generating an extended
editor would be more feasible than multiple potential patches being
accepted, although this last option will probably be necessary in some
cases anyway.

What you've get so far with TED's is very promising. It's a great first
step! I thought TED was going to be the worst problem...

I've identified another problem in the generated GMF editor, which
heavily relies on workspace resources (IFiles...) and specially in the
WorkspaceSynchronizer class, which seems only to understand about files
as well.

For instance, those editors work with FileEditorInput and
URIEditorInput. To workaround this, an AdapterFactory could be
registered to adapt CDOEditorInput to a URIEditorInput. A properly
prepared ResourceSet in the TED (a ResourceSet with a registered
CDOResourceFactory) would then properly resolve CDOResources. With that
(and some patching in GMF generated code) EditorInput shouldn't be a
problem. I still don't know what to do with WorkspaceSynchronizer...

This is just another problem I've identified, there will be more issues
to be discovered. I bet there is a lot of people interested in this
topic, so what about raising a Bugzilla and working all together?

Regards,
Víctor.

Stephane escribió:
> Hi,
>
> For few days, I try to use CDO with an editor based on Transactional
> Editing Domain. My goal is to wire a GMF-based editor with CDO for
> multi-user purpose.
>
> To simplify the job, I first use the famous Extended Library meta-model
> that I modify to have a transactional editing domain (TED) rather a
> standard EMF one.
> I made some changes to generate the model API for CDO. CDO seems to not
> support Feature Map ? Thus, I changed that...
>
> To mix CDO with a TED, I implement my own transactional editing domain
> factory (declared through org.eclipse.emf.transaction.editingDomains
> extension-point) where I override the createEditingDomain() method to
> provide a transactional editing domain compatible with CDO (this one
> extends TransactionalEditingDomainImpl).
>
> I have to override some methods of TransactionalEditingDomainImpl.
>
> First, I override isReadOnlyURI(URI) to always answer true (this
> behavior could be improved, nevertheless that fits my tests) otherwise,
> the open editor is in a read-only mode and I can't create objects or
> changes values from the property sheet.
>
> I have also overridden the createResource(String fileNameURI) method
> where I create a CDO resource. First call initializes a CDO session, a
> CDO transaction for transactional editing domain resource set. I use the
> getOrCreateResource with specified path to finally create the resource.
>
> In the EMF-based editor (slightly modified to use a TED rather a
> standard EMF editing domain as presented in EMF transaction tutorial) I
> called createResource method on this TED. I got a CDO resource in
> return. If its content is empty, I add a Library to have a root node
> that allows me to create books, writers and so on.
>
> The library creation changes my editor as a dirty one. Great !
> Nevertheless, when I create some children (book, writer), EMFT
> transactions are not handled correctly.
> The CDO resource is not registered as a loaded one in ResourceSetManager
> singleton. Hence, all modifications on created objects notified to the
> TransactionChangeRecorder are not handled due to their resource is not
> in the ResourceSetManager singleton loadedResources WeakHashMap, thus
> no notification is added to current transaction and finally my editor is
> not aware of model changes.
>
> To workaround this issue, I call setLoaded(true) on CDO resource. This
> call sends a notification caught by the ResourceSetManager singleton in
> its observe(Resource res, Notification notification) method,
> notification.getNewBooleanValue() in Resource.RESOURCE__IS_LOADED case
> throws an exception because it expects primitive types rather Boolean
> objects. What a pity !
>
> At this step, I'm a bit stuck.
>
> Does anyone have an idea or figure out how to wire both frameworks ?
>
> That's a long post, I do hope people can understand what I tried to
> explain...
>
> Stephane.
>
>
>
Previous Topic:LINQ for EMF, experience so far
Next Topic:Validation question
Goto Forum:
  


Current Time: Mon Jan 27 15:56:34 GMT 2020

Powered by FUDForum. Page generated in 0.01618 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top