Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Listening to changes in a CDOResource
[CDO] Listening to changes in a CDOResource [message #422595] Wed, 10 September 2008 18:22 Go to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Eike,

I've been trying to obtain notifications from a CDOResource.
For instance, I would like to know when did the resource changes got
committed, to refresh some views we have, or even if the resource got
deleted.

I already tried out adding a new Adapter to CDOResource.eAdapters(), but
with no success.

Could you point me out which is the best way to achieve this?

Thank you very much.

ViK
Re: [CDO] Listening to changes in a CDOResource [message #422605 is a reply to message #422595] Thu, 11 September 2008 06:06 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Hi Victor,

You can start to look at CDOTransactionHandler.

public void addingObject(CDOTransaction transaction, CDOObject object);

public void modifyingObject(CDOTransaction transaction, CDOObject object,
CDOFeatureDelta featureDelta);

public void committingTransaction(CDOTransaction transaction);

public void rolledBackTransaction(CDOTransaction transaction);

Is it what you are looking for ?

To be notified when an object is being detached...we don't have that.

I think we should add
public void detachingObject(CDOTransaction transaction, CDOObject object);

Will it fill your needs ?

If yes, please open a bugzilla !


"V
Re: [CDO] Listening to changes in a CDOResource [message #422617 is a reply to message #422605] Thu, 11 September 2008 11:02 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Simon,

it think this handler might work. Thanks!

However, this seems like I'll get notified of events that would happen
within a specific transaction (the handler gets added to a transaction
through CDOTransaction.addHandler()). What happens if someone else
modifies my resource? Will I get notified? Furthermore, CDOView doesn't
have such handlers, which means that a view won't get notified of a
resource being changed.

> I think we should add
> public void detachingObject(CDOTransaction transaction, CDOObject
object);
>
> Will it fill your needs ?
>
> If yes, please open a bugzilla !

I think it would :D

Thanks!

Simon McDuff escribió:
> Hi Victor,
>
> You can start to look at CDOTransactionHandler.
>
> public void addingObject(CDOTransaction transaction, CDOObject object);
>
> public void modifyingObject(CDOTransaction transaction, CDOObject object,
> CDOFeatureDelta featureDelta);
>
> public void committingTransaction(CDOTransaction transaction);
>
> public void rolledBackTransaction(CDOTransaction transaction);
>
> Is it what you are looking for ?
>
> To be notified when an object is being detached...we don't have that.
>
> I think we should add
> public void detachingObject(CDOTransaction transaction, CDOObject object);
>
> Will it fill your needs ?
>
> If yes, please open a bugzilla !
>
>
> "Víctor Roldán Betancort" <vroldan@opencanarias.com> a écrit dans le message
> de news: ga938t$mti$1@build.eclipse.org...
>> Hi Eike,
>>
>> I've been trying to obtain notifications from a CDOResource.
>> For instance, I would like to know when did the resource changes got
>> committed, to refresh some views we have, or even if the resource got
>> deleted.
>>
>> I already tried out adding a new Adapter to CDOResource.eAdapters(), but
>> with no success.
>>
>> Could you point me out which is the best way to achieve this?
>>
>> Thank you very much.
>>
>> ViK
>
>
Re: [CDO] Listening to changes in a CDOResource [message #422618 is a reply to message #422617] Thu, 11 September 2008 11:29 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Víctor Roldán Betancort schrieb:
> Hi Simon,
>
> it think this handler might work. Thanks!
>
> However, this seems like I'll get notified of events that would happen
> within a specific transaction (the handler gets added to a transaction
> through CDOTransaction.addHandler()). What happens if someone else
> modifies my resource? Will I get notified?
Who is someone else?
Another local thread or a remote user?

The CDOTransactionHandler is really a local concept to intercept the
framework while local changes are happening or committed.
If you want to intercept remote changes you will want to use a change
subscription or the CDOSessionInvalidationEvent or the
CDOInvalidationNotification.

> Furthermore, CDOView doesn't have such handlers, which means that a
> view won't get notified of a resource being changed.
A resource attached to a CDOView can't be changed locally (CDOView is
read-only). You need a CDOTransaction to change a resource locally.
For remote changes my above explanations apply ;-)

Cheers
/Eike


>
> > I think we should add
> > public void detachingObject(CDOTransaction transaction, CDOObject
> object);
> >
> > Will it fill your needs ?
> >
> > If yes, please open a bugzilla !
>
> I think it would :D
>
> Thanks!
>
> Simon McDuff escribió:
>> Hi Victor,
>>
>> You can start to look at CDOTransactionHandler.
>>
>> public void addingObject(CDOTransaction transaction, CDOObject object);
>>
>> public void modifyingObject(CDOTransaction transaction, CDOObject
>> object, CDOFeatureDelta featureDelta);
>>
>> public void committingTransaction(CDOTransaction transaction);
>>
>> public void rolledBackTransaction(CDOTransaction transaction);
>>
>> Is it what you are looking for ?
>>
>> To be notified when an object is being detached...we don't have that.
>>
>> I think we should add
>> public void detachingObject(CDOTransaction transaction, CDOObject
>> object);
>>
>> Will it fill your needs ?
>>
>> If yes, please open a bugzilla !
>>
>>
>> "Víctor Roldán Betancort" <vroldan@opencanarias.com> a écrit dans le
>> message de news: ga938t$mti$1@build.eclipse.org...
>>> Hi Eike,
>>>
>>> I've been trying to obtain notifications from a CDOResource.
>>> For instance, I would like to know when did the resource changes got
>>> committed, to refresh some views we have, or even if the resource
>>> got deleted.
>>>
>>> I already tried out adding a new Adapter to CDOResource.eAdapters(),
>>> but with no success.
>>>
>>> Could you point me out which is the best way to achieve this?
>>>
>>> Thank you very much.
>>>
>>> ViK
>>
>>


Re: [CDO] Listening to changes in a CDOResource [message #422620 is a reply to message #422618] Thu, 11 September 2008 11:38 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Eike,

> Who is someone else?
> Another local thread or a remote user?

remote user.

> The CDOTransactionHandler is really a local concept to intercept the
> framework while local changes are happening or committed.
> If you want to intercept remote changes you will want to use a change
> subscription or the CDOSessionInvalidationEvent or the
> CDOInvalidationNotification.

I already saw CDOViewImpl.subscribe(EObject, Adapter). Maybe that's what
Im looking for. I'll try it out!

Thanks for the feedback!

Best Regards,
ViK.
Re: [CDO] Listening to changes in a CDOResource [message #422624 is a reply to message #422620] Thu, 11 September 2008 11:50 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Víctor Roldán Betancort schrieb:
> Hi Eike,
>
> > Who is someone else?
> > Another local thread or a remote user?
>
> remote user.
>
> > The CDOTransactionHandler is really a local concept to intercept the
> > framework while local changes are happening or committed.
> > If you want to intercept remote changes you will want to use a change
> > subscription or the CDOSessionInvalidationEvent or the
> > CDOInvalidationNotification.
>
> I already saw CDOViewImpl.subscribe(EObject, Adapter). Maybe that's
> what Im looking for. I'll try it out!
Yes, but don't use the CDOViewImpl class! Instead call:

CDOView.setChangeSubscriptionPolicy(CDOChangeSubscriptionPol icy.ALL);

And then just add adapters to your objects as usual.
You might want to optimze this later by specifying your own
CDOChangeSubscriptionPolicy.

Cheers
/Eike


Re: [CDO] Listening to changes in a CDOResource [message #422636 is a reply to message #422624] Thu, 11 September 2008 15:03 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Hi Eike,

I already notification work (found a possible glitch in
CDONotificationImpl... not sure though). However, what I get is not what
I actually expected.

I add the adapter to the CDOResource, and I only get notified of changes
in the CDOResource, not in their children. Listening to changes in the
whole object tree would imply adding an adapter to each object (usage of
EContentAdapter?), which doesn't seem feasible when the object graph is
huge, and specially, when they are store in a remote database, I assume
that would load locally the whole object graph locally, disabling one of
the best advantages of CDO: lazy loading.

Another solution is the initial indicated by simon, by just listening to
changes in transactions opened in the local machine, and ignore remote
changes. How does CDO act in the case a client tries to commit changes
over a resource that was already changed remotely? Invalidation
notifications?
Re: [CDO] Listening to changes in a CDOResource [message #422643 is a reply to message #422636] Thu, 11 September 2008 16:04 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
"V
Re: [CDO] Listening to changes in a CDOResource [message #422645 is a reply to message #422643] Thu, 11 September 2008 16:28 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Simon McDuff escribió:
> "Víctor Roldán Betancort" <vroldan@opencanarias.com> a écrit dans le message
> de news: gabbvi$1l9$1@build.eclipse.org...
>> Hi Eike,
>>
>> I already notification work (found a possible glitch in
>> CDONotificationImpl... not sure though). However, what I get is not what I
>> actually expected.
>>
>> I add the adapter to the CDOResource, and I only get notified of changes
>> in the CDOResource, not in their children. Listening to changes in the
>> whole object tree would imply adding an adapter to each object (usage of
>> EContentAdapter?), which doesn't seem feasible when the object graph is
>> huge, and specially, when they are store in a remote database, I assume
>> that would load locally the whole object graph locally, disabling one of
>> the best advantages of CDO: lazy loading.
>>
> You are right.
> But, how it is useful to know an objects was modified when the client didn't
> load it.

....uhm, you are right. I would be more coherent to add adapters to this
objects only when loaded.

> Because what we could do is add an adapter automatically when it is loaded
> for every objects for a specific Resource. In some cases will be slow but it
> is feasible.

I think that would be a great idea! So it will be something like a
EContentAdapter, but with lazy self-adapt, right? This way we don't have
to take care of adding an adapter each time an object is loaded.

> Will it fill your needs? If yes please create a new bugzilla! :-)

I'll fill that bugzilla :D

>> Another solution is the initial indicated by simon, by just listening to
>> changes in transactions opened in the local machine, and ignore remote
>> changes. How does CDO act in the case a client tries to commit changes
>> over a resource that was already changed remotely? Invalidation
>> notifications?

> When you talk about resource, do you mean every objects that is contained by
> the resource ?

Sorry, yes, I meant here "all the object graph under a resource".

> If isPassiveUpdate is turned on, the invalidation process will put objects
> into conflict
> If isPassiveUpdate is turned off, at commit time you will get an exception.
>

Good to know, thanks!

> If you want to fix the detach to be added in the interface please create a
> new bugzilla!

I'll do it!

>
> Thank you
>

Thank you!
Re: [CDO] Listening to changes in a CDOResource [message #422653 is a reply to message #422645] Fri, 12 September 2008 01:02 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
I will wait for you bugzilla to start it!

:-)


"V
Re: [CDO] Listening to changes in a CDOResource [message #422663 is a reply to message #422653] Fri, 12 September 2008 10:52 Go to previous messageGo to next message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Simon,

the bug has been created.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=247141

Thanks!

Simon McDuff escribió:
> I will wait for you bugzilla to start it!
>
> :-)
>
>
> "Víctor Roldán Betancort" <vroldan@opencanarias.com> a écrit dans le message
> de news: gabgvl$qam$1@build.eclipse.org...
>> Simon McDuff escribió:
>>> "Víctor Roldán Betancort" <vroldan@opencanarias.com> a écrit dans le
>>> message de news: gabbvi$1l9$1@build.eclipse.org...
>>>> Hi Eike,
>>>>
>>>> I already notification work (found a possible glitch in
>>>> CDONotificationImpl... not sure though). However, what I get is not what
>>>> I actually expected.
>>>>
>>>> I add the adapter to the CDOResource, and I only get notified of changes
>>>> in the CDOResource, not in their children. Listening to changes in the
>>>> whole object tree would imply adding an adapter to each object (usage of
>>>> EContentAdapter?), which doesn't seem feasible when the object graph is
>>>> huge, and specially, when they are store in a remote database, I assume
>>>> that would load locally the whole object graph locally, disabling one of
>>>> the best advantages of CDO: lazy loading.
>>>>
>>> You are right.
>>> But, how it is useful to know an objects was modified when the client
>>> didn't load it.
>> ...uhm, you are right. I would be more coherent to add adapters to this
>> objects only when loaded.
>>
>>> Because what we could do is add an adapter automatically when it is
>>> loaded for every objects for a specific Resource. In some cases will be
>>> slow but it is feasible.
>> I think that would be a great idea! So it will be something like a
>> EContentAdapter, but with lazy self-adapt, right? This way we don't have
>> to take care of adding an adapter each time an object is loaded.
>>
>>> Will it fill your needs? If yes please create a new bugzilla! :-)
>> I'll fill that bugzilla :D
>>
>>>> Another solution is the initial indicated by simon, by just listening to
>>>> changes in transactions opened in the local machine, and ignore remote
>>>> changes. How does CDO act in the case a client tries to commit changes
>>>> over a resource that was already changed remotely? Invalidation
>>>> notifications?
>>> When you talk about resource, do you mean every objects that is contained
>>> by the resource ?
>> Sorry, yes, I meant here "all the object graph under a resource".
>>
>>> If isPassiveUpdate is turned on, the invalidation process will put
>>> objects into conflict
>>> If isPassiveUpdate is turned off, at commit time you will get an
>>> exception.
>>>
>> Good to know, thanks!
>>
>>> If you want to fix the detach to be added in the interface please create
>>> a new bugzilla!
>> I'll do it!
>>
>>> Thank you
>>>
>> Thank you!
>
>
Re: [CDO] Listening to changes in a CDOResource [message #422664 is a reply to message #422643] Fri, 12 September 2008 10:57 Go to previous message
Victor Roldan Betancort is currently offline Victor Roldan BetancortFriend
Messages: 524
Registered: July 2009
Senior Member
Simon,
> If you want to fix the detach to be added in the interface please create a
> new bugzilla!

Created as well!
"Add detach object handling to CDOTransactionHandler"

https://bugs.eclipse.org/bugs/show_bug.cgi?id=247143
Previous Topic:[CDO] using generated .edit with CDO repo
Next Topic:EStore and "equals"
Goto Forum:
  


Current Time: Tue Apr 16 21:24:11 GMT 2024

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

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

Back to the top