Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Noob question about remote changes handling
[CDO] Noob question about remote changes handling [message #633128] Fri, 15 October 2010 13:09 Go to next message
Eclipse UserFriend
Originally posted by: swt.magellium.fr

Hello !

I'm starting to develop a CDO client app, and I'd like to reproduce the
behaviour of EMF generated editors.
For instance, when a root object is added to a resource, other clients
displaying the standard resource editor get refreshed automatically.
When a change is in conflict with a commit on another client's session,
the changed item becomes red.
I can't find in the code where these changes are received and propagated
to the UI...
Can someone briefly explain it to me ?
Or at least indicate some resources/classes to study...

I found some pointers in the FAQ on how to handle remote changes :
CDOSessionInvalidationEvent
CDOViewInvalidationEvent
CDOInvalidationNotification
CDOChangeSubscriptionPolicy
But I did not investigate these classes for the moment. At least some
hints on which events/notification are most useful would be a good start...

For the moment, I tried to use standard EMF notifications by adding
adapters to the resource object, then to the resource's root objects, etc.
But this way, I'll end up having an adapter for each object ! (if I need
to track *all* remote changes to the model.)
This is a good thing because only loaded objects will have an adapter,
so I will only receive notifications concerning loaded objects.
But there may be other ways to receive notifications, and I'd like to
know all the API capabilities to make the right choices...

So I'm asking which are the "correct" ways of handling remote changes.
Is it better to add/remove adapters on every loaded object, or to track
global model changes ?
And what is the best way to track these model changes ?

Thanks in advance !
Stephane
Re: [CDO] Noob question about remote changes handling [message #633193 is a reply to message #633128] Fri, 15 October 2010 15:27 Go to previous messageGo to next message
Stefan Winkler is currently offline Stefan WinklerFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Stephane,

I think what you are looking for is
org.eclipse.emf.cdo.view.CDOView.Options.addChangeSubscripti onPolicy(CDOAdapterPolicy)

The Javadoc there states

> Adds a change subscription policy to this view.
>
> To activate a policy, you must do the following:
> view.options().addChangeSubscriptionPolicy(CDOChangeSubscrip tionPolicy.ALL);
>
> To register an object, you must add an adapter to the object in which you are interested:
> eObject.eAdapters().add(myAdapter);
>
> By activating this feature, each object having at least one adapter that matches the current policy will be registered with the server and will be notified for each change occurring in the scope of any other transaction.
>
> CDOAdapterPolicy.NONE - Ignored.
> CDOAdapterPolicy.ALL - Enabled for all adapters used.
> CDOAdapterPolicy.CDO - Enabled only for adapters that implement CDOAdapter.
> Any other class that implement CDOAdapterPolicy will enable for whatever rules defined in that class.
>
> If myAdapter in the above example matches the current policy, eObject will be registered with the server and you will receive all changes from other transaction.
>
> When the policy is changed all objects in the cache will automatically be recalculated.
>
> You can subscribe to temporary objects. Even if you cannot receive notifications from other CDOTransaction for these because they are only local to you, at commit time these objects will be registered automatically.

Probably Eike can complement this with a more concrete example when he's
back next week.

Cheers,
Stefan




On 15.10.2010 15:09, SWT wrote:
> Hello !
>
> I'm starting to develop a CDO client app, and I'd like to reproduce the
> behaviour of EMF generated editors.
> For instance, when a root object is added to a resource, other clients
> displaying the standard resource editor get refreshed automatically.
> When a change is in conflict with a commit on another client's session,
> the changed item becomes red.
> I can't find in the code where these changes are received and propagated
> to the UI...
> Can someone briefly explain it to me ?
> Or at least indicate some resources/classes to study...
>
> I found some pointers in the FAQ on how to handle remote changes :
> CDOSessionInvalidationEvent
> CDOViewInvalidationEvent
> CDOInvalidationNotification
> CDOChangeSubscriptionPolicy
> But I did not investigate these classes for the moment. At least some
> hints on which events/notification are most useful would be a good start...
>
> For the moment, I tried to use standard EMF notifications by adding
> adapters to the resource object, then to the resource's root objects, etc.
> But this way, I'll end up having an adapter for each object ! (if I need
> to track *all* remote changes to the model.)
> This is a good thing because only loaded objects will have an adapter,
> so I will only receive notifications concerning loaded objects.
> But there may be other ways to receive notifications, and I'd like to
> know all the API capabilities to make the right choices...
>
> So I'm asking which are the "correct" ways of handling remote changes.
> Is it better to add/remove adapters on every loaded object, or to track
> global model changes ?
> And what is the best way to track these model changes ?
>
> Thanks in advance !
> Stephane
Re: [CDO] Noob question about remote changes handling [message #633296 is a reply to message #633128] Sat, 16 October 2010 05:45 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Hi,

There is a FAQ entry that might get you set up: http://wiki.eclipse.org/FAQ_for_CDO_and_Net4j#How_can_I_reac t_to_remote_changes_to_my_objects.3F

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Am 15.10.2010 15:09, schrieb SWT:
> Hello !
>
> I'm starting to develop a CDO client app, and I'd like to reproduce the behaviour of EMF generated editors.
> For instance, when a root object is added to a resource, other clients displaying the standard resource editor get refreshed automatically.
> When a change is in conflict with a commit on another client's session, the changed item becomes red.
> I can't find in the code where these changes are received and propagated to the UI...
> Can someone briefly explain it to me ?
> Or at least indicate some resources/classes to study...
>
> I found some pointers in the FAQ on how to handle remote changes :
> CDOSessionInvalidationEvent
> CDOViewInvalidationEvent
> CDOInvalidationNotification
> CDOChangeSubscriptionPolicy
> But I did not investigate these classes for the moment. At least some hints on which events/notification are most useful would be a good start...
>
> For the moment, I tried to use standard EMF notifications by adding adapters to the resource object, then to the resource's root objects, etc.
> But this way, I'll end up having an adapter for each object ! (if I need to track *all* remote changes to the model.)
> This is a good thing because only loaded objects will have an adapter, so I will only receive notifications concerning loaded objects.
> But there may be other ways to receive notifications, and I'd like to know all the API capabilities to make the right choices...
>
> So I'm asking which are the "correct" ways of handling remote changes.
> Is it better to add/remove adapters on every loaded object, or to track global model changes ?
> And what is the best way to track these model changes ?
>
> Thanks in advance !
> Stephane


Re: [CDO] Noob question about remote changes handling [message #633306 is a reply to message #633128] Sat, 16 October 2010 07:46 Go to previous messageGo to next message
Martin Fluegge is currently offline Martin FlueggeFriend
Messages: 141
Registered: July 2009
Senior Member
Hi Stephane,

if you are only interest in CDO-ifying (let it work on a CDO
Resource;show/handle conflicts etc.) your generated editor you should
have a look at this bugzilla:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=323828

I am going to bring up a tutorial for the generator asap but basically
it works as descibed here (only on the *.genmodel):

http://wiki.eclipse.org/Dawn_Codegen

Cheers,

Martin

Am 15.10.2010 15:09, schrieb SWT:
> Hello !
>
> I'm starting to develop a CDO client app, and I'd like to reproduce the
> behaviour of EMF generated editors.
> For instance, when a root object is added to a resource, other clients
> displaying the standard resource editor get refreshed automatically.
> When a change is in conflict with a commit on another client's session,
> the changed item becomes red.
> I can't find in the code where these changes are received and propagated
> to the UI...
> Can someone briefly explain it to me ?
> Or at least indicate some resources/classes to study...
>
> I found some pointers in the FAQ on how to handle remote changes :
> CDOSessionInvalidationEvent
> CDOViewInvalidationEvent
> CDOInvalidationNotification
> CDOChangeSubscriptionPolicy
> But I did not investigate these classes for the moment. At least some
> hints on which events/notification are most useful would be a good start...
>
> For the moment, I tried to use standard EMF notifications by adding
> adapters to the resource object, then to the resource's root objects, etc.
> But this way, I'll end up having an adapter for each object ! (if I need
> to track *all* remote changes to the model.)
> This is a good thing because only loaded objects will have an adapter,
> so I will only receive notifications concerning loaded objects.
> But there may be other ways to receive notifications, and I'd like to
> know all the API capabilities to make the right choices...
>
> So I'm asking which are the "correct" ways of handling remote changes.
> Is it better to add/remove adapters on every loaded object, or to track
> global model changes ?
> And what is the best way to track these model changes ?
>
> Thanks in advance !
> Stephane
Re: [CDO] Noob question about remote changes handling [message #633495 is a reply to message #633128] Mon, 18 October 2010 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: swt.magellium.fr

Thank you for the javadoc copy Stefan.
I don't have CDO sources and the CDO features don't download them.
I manually downloaded some plugins from CVS, but they are CDO 4.0 plugins.
Is there an archive repository where I can find CDO 3.0 sources ?
Anyway, the 4.0 sources seems to be enough to get some general
information on the non-internal API. At least I can see the Javadoc you
provided here :)
I hope I won't have to ask for such noobie questions again now :)

@Martin : Dawn seems to be a very interesting project, but a bit too far
from my original goal.
I hope I'll have some time to try it in the near future !

Le 15/10/2010 15:09, SWT a écrit :
> Hello !
>
> I'm starting to develop a CDO client app, and I'd like to reproduce the
> behaviour of EMF generated editors.
> For instance, when a root object is added to a resource, other clients
> displaying the standard resource editor get refreshed automatically.
> When a change is in conflict with a commit on another client's session,
> the changed item becomes red.
> I can't find in the code where these changes are received and propagated
> to the UI...
> Can someone briefly explain it to me ?
> Or at least indicate some resources/classes to study...
>
> I found some pointers in the FAQ on how to handle remote changes :
> CDOSessionInvalidationEvent
> CDOViewInvalidationEvent
> CDOInvalidationNotification
> CDOChangeSubscriptionPolicy
> But I did not investigate these classes for the moment. At least some
> hints on which events/notification are most useful would be a good start...
>
> For the moment, I tried to use standard EMF notifications by adding
> adapters to the resource object, then to the resource's root objects, etc.
> But this way, I'll end up having an adapter for each object ! (if I need
> to track *all* remote changes to the model.)
> This is a good thing because only loaded objects will have an adapter,
> so I will only receive notifications concerning loaded objects.
> But there may be other ways to receive notifications, and I'd like to
> know all the API capabilities to make the right choices...
>
> So I'm asking which are the "correct" ways of handling remote changes.
> Is it better to add/remove adapters on every loaded object, or to track
> global model changes ?
> And what is the best way to track these model changes ?
>
> Thanks in advance !
> Stephane
Re: [CDO] Noob question about remote changes handling [message #633496 is a reply to message #633495] Mon, 18 October 2010 08:34 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6446
Registered: July 2009
Senior Member
Am 18.10.2010 10:09, schrieb SWT:
> Thank you for the javadoc copy Stefan.
> I don't have CDO sources and the CDO features don't download them.
The source features are part of the SDKs so they're definitely available. You should also be able to install them separately. Maybe you have to uncheck the "Show elements in categories" checkbox to see them.


> I manually downloaded some plugins from CVS, but they are CDO 4.0 plugins.
> Is there an archive repository where I can find CDO 3.0 sources ?
See above.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper


> Anyway, the 4.0 sources seems to be enough to get some general information on the non-internal API. At least I can see the Javadoc you provided here :)
> I hope I won't have to ask for such noobie questions again now :)
>
> @Martin : Dawn seems to be a very interesting project, but a bit too far from my original goal.
> I hope I'll have some time to try it in the near future !
>
> Le 15/10/2010 15:09, SWT a écrit :
>> Hello !
>>
>> I'm starting to develop a CDO client app, and I'd like to reproduce the
>> behaviour of EMF generated editors.
>> For instance, when a root object is added to a resource, other clients
>> displaying the standard resource editor get refreshed automatically.
>> When a change is in conflict with a commit on another client's session,
>> the changed item becomes red.
>> I can't find in the code where these changes are received and propagated
>> to the UI...
>> Can someone briefly explain it to me ?
>> Or at least indicate some resources/classes to study...
>>
>> I found some pointers in the FAQ on how to handle remote changes :
>> CDOSessionInvalidationEvent
>> CDOViewInvalidationEvent
>> CDOInvalidationNotification
>> CDOChangeSubscriptionPolicy
>> But I did not investigate these classes for the moment. At least some
>> hints on which events/notification are most useful would be a good start...
>>
>> For the moment, I tried to use standard EMF notifications by adding
>> adapters to the resource object, then to the resource's root objects, etc.
>> But this way, I'll end up having an adapter for each object ! (if I need
>> to track *all* remote changes to the model.)
>> This is a good thing because only loaded objects will have an adapter,
>> so I will only receive notifications concerning loaded objects.
>> But there may be other ways to receive notifications, and I'd like to
>> know all the API capabilities to make the right choices...
>>
>> So I'm asking which are the "correct" ways of handling remote changes.
>> Is it better to add/remove adapters on every loaded object, or to track
>> global model changes ?
>> And what is the best way to track these model changes ?
>>
>> Thanks in advance !
>> Stephane
>


Previous Topic:Using variables in EMF query2 queries
Next Topic:Abstract class with InstanceTypeName and Reflective Serialization
Goto Forum:
  


Current Time: Sun Oct 20 17:29:04 GMT 2019

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

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

Back to the top