Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Listen to passive updates.
[CDO] Listen to passive updates. [message #431025] Wed, 24 June 2009 14:01 Go to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Hello.

Is it somehow possible for a view/transaction to listen and get the object that is updated (activ or
passiv)?
I could add a IListener that indeed is called, but it doesn't tell me what object.
A CDOTransactionHandler can only monitor what the transaction does itself.
But how do I get those objects that are passive updated?
I don't want to add an Adapter to every object in my view.

Regards,
Kai
Re: [CDO] Listen to passive updates. [message #431028 is a reply to message #431025] Wed, 24 June 2009 19:04 Go to previous messageGo to next message
Simon Mc Duff is currently offline Simon Mc DuffFriend
Messages: 596
Registered: July 2009
Senior Member
Kai Schlamp wrote:

> Hello.
Hello! :-)

> Is it somehow possible for a view/transaction to listen and get the object
that is updated (activ or
> passiv)?

> I could add a IListener that indeed is called, but it doesn't tell me what
object.
> A CDOTransactionHandler can only monitor what the transaction does itself.
> But how do I get those objects that are passive updated?

> I don't want to add an Adapter to every object in my view.
For the passive you can do the following

http://wiki.eclipse.org/FAQ_for_CDO_and_Net4j#How_can_I_reac t_to_remote_changes_to_my_objects.3F

+

CDOViewInvalidationEvent
- getDirtyObjects and getDetchedObject

private IListener viewListener = new IListener()
{
public void notifyEvent(IEvent event)
{
if (event instanceof CDOViewInvalidationEvent)
{
CDOViewInvalidationEvent e = (CDOViewInvalidationEvent)event;
// Remove detached object from selection, could incur into
unwanted exceptions

e.getDirtyObjects();
}
}
}
Quick note:

CDOViewInvalidationEvent will only include dirtyObjects that you have in
your views.
CDOSessionInvalidationEvent will gives you ALL dirty CDOID that happens
passively.

Is it helping you ?

> Regards,
> Kai
Re: [CDO] Listen to passive updates. [message #431029 is a reply to message #431025] Wed, 24 June 2009 19:05 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Kai,

Maybe you can find the anser in this FAQ entry:
http://wiki.eclipse.org/FAQ_for_CDO_and_Net4j#How_can_I_reac t_to_remote_changes_to_my_objects.3F*

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


*
Kai Schlamp schrieb:
> Hello.
>
> Is it somehow possible for a view/transaction to listen and get the
> object that is updated (activ or passiv)?
> I could add a IListener that indeed is called, but it doesn't tell me
> what object.
> A CDOTransactionHandler can only monitor what the transaction does
> itself.
> But how do I get those objects that are passive updated?
> I don't want to add an Adapter to every object in my view.
>
> Regards,
> Kai


Re: [CDO] Listen to passive updates. [message #431033 is a reply to message #431028] Wed, 24 June 2009 21:05 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Hy Simon,

comment below.

Simon Mc Duff wrote:
> Kai Schlamp wrote:
>
>> Hello.
> Hello! :-)
>
>> Is it somehow possible for a view/transaction to listen and get the
>> object
> that is updated (activ or
>> passiv)?
>
>> I could add a IListener that indeed is called, but it doesn't tell me
>> what
> object.
>> A CDOTransactionHandler can only monitor what the transaction does
>> itself.
>> But how do I get those objects that are passive updated?
>
>> I don't want to add an Adapter to every object in my view.
> For the passive you can do the following
>
> http://wiki.eclipse.org/FAQ_for_CDO_and_Net4j#How_can_I_reac t_to_remote_changes_to_my_objects.3F
>
>
> +
>
> CDOViewInvalidationEvent
> - getDirtyObjects and getDetchedObject
>
> private IListener viewListener = new IListener()
> {
> public void notifyEvent(IEvent event)
> {
> if (event instanceof CDOViewInvalidationEvent)
> {
> CDOViewInvalidationEvent e = (CDOViewInvalidationEvent)event;
> // Remove detached object from selection, could incur into
> unwanted exceptions
> e.getDirtyObjects();
> }
> }
> }
> Quick note:
>
> CDOViewInvalidationEvent will only include dirtyObjects that you have in
> your views. CDOSessionInvalidationEvent will gives you ALL dirty CDOID
> that happens passively.
>
> Is it helping you ?

Yes, looks good. The problem is that I don't have the method
CDOView.setInvalidationNotificationEnabled(boolean enabled); available. When I browse the source by
hitting F3 on the class, I see it's there. But when I try to access it in the editor, it tells my
that it is undefined ... strange.
Most probably a setup problem. I will reinstall everything (I only updated for several Milestones
and RCs now) and report back then. It's even a good time for reinstallation ... the new Galileo
release ;-)

Regards,
Kai
Re: [CDO] Listen to passive updates. [message #431042 is a reply to message #431033] Thu, 25 June 2009 07:04 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070700050902090805040103
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 7bit

Kai,

Please use:

view.options().setInvalidationNotificationEnabled(*true*);


Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Kai Schlamp schrieb:
> Hy Simon,
>
> comment below.
>
> Simon Mc Duff wrote:
>> Kai Schlamp wrote:
>>
>>> Hello.
>> Hello! :-)
>>
>>> Is it somehow possible for a view/transaction to listen and get the
>>> object
>> that is updated (activ or
>>> passiv)?
>>
>>> I could add a IListener that indeed is called, but it doesn't tell
>>> me what
>> object.
>>> A CDOTransactionHandler can only monitor what the transaction does
>>> itself.
>>> But how do I get those objects that are passive updated?
>>
>>> I don't want to add an Adapter to every object in my view.
>> For the passive you can do the following
>>
>> http://wiki.eclipse.org/FAQ_for_CDO_and_Net4j#How_can_I_reac t_to_remote_changes_to_my_objects.3F
>>
>>
>> +
>>
>> CDOViewInvalidationEvent
>> - getDirtyObjects and getDetchedObject
>>
>> private IListener viewListener = new IListener()
>> {
>> public void notifyEvent(IEvent event)
>> {
>> if (event instanceof CDOViewInvalidationEvent)
>> {
>> CDOViewInvalidationEvent e = (CDOViewInvalidationEvent)event;
>> // Remove detached object from selection, could incur into
>> unwanted exceptions
>> e.getDirtyObjects();
>> }
>> }
>> }
>> Quick note:
>>
>> CDOViewInvalidationEvent will only include dirtyObjects that you have
>> in your views. CDOSessionInvalidationEvent will gives you ALL dirty
>> CDOID that happens passively.
>>
>> Is it helping you ?
>
> Yes, looks good. The problem is that I don't have the method
> CDOView.setInvalidationNotificationEnabled(boolean enabled);
> available. When I browse the source by hitting F3 on the class, I see
> it's there. But when I try to access it in the editor, it tells my
> that it is undefined ... strange.
> Most probably a setup problem. I will reinstall everything (I only
> updated for several Milestones and RCs now) and report back then. It's
> even a good time for reinstallation ... the new Galileo release ;-)
>
> Regards,
> Kai

--------------070700050902090805040103
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Kai,<br>
<br>
Please use:<br>
<br>
<pre>


Re: [CDO] Listen to passive updates. [message #431045 is a reply to message #431042] Thu, 25 June 2009 07:41 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Hello, Eike ...

> Please use:
>
> view.options().setInvalidationNotificationEnabled(*true*);

Thanks for the hint. I now receive CDOViewInvalidationEvent events.
But how would I get those other events/notifications mentioned in the FAQ
(CDOSessionInvalidationEvent, CDOInvalidationNotification and CDOChangeSubscriptionPolicy)?
For e.g. it is mentioned in the Javadoc comment of CDOInvalidationNotification that
setInvalidationNotificationEnabled(boolean) should lead to a CDOInvalidationNotification.
But I never receive such events (at least when I check with instanceof).
Re: [CDO] Listen to passive updates. [message #431046 is a reply to message #431045] Thu, 25 June 2009 07:46 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Kai Schlamp schrieb:
> Hello, Eike ...
>
>> Please use:
>>
>> view.options().setInvalidationNotificationEnabled(*true*);
>
> Thanks for the hint. I now receive CDOViewInvalidationEvent events.
> But how would I get those other events/notifications mentioned in the
> FAQ (CDOSessionInvalidationEvent,
session.addListener(new IListener() {...});

> CDOInvalidationNotification and CDOChangeSubscriptionPolicy)?
object.eAdapters().add(new AdapterImpl() {...});

> For e.g. it is mentioned in the Javadoc comment of
> CDOInvalidationNotification that
> setInvalidationNotificationEnabled(boolean) should lead to a
> CDOInvalidationNotification.
> But I never receive such events (at least when I check with instanceof).
These two methods achieve similar things:

- Add listeners to CDOSession or CDOView to receive IEvents
- Attach adapters to EObject to receive Notifications (either with or
without delta information)

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Listen to passive updates. [message #431070 is a reply to message #431046] Thu, 25 June 2009 16:21 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Thanks Eike for carifying this. One last question about those listeners.
Is it possible to only listen to passive updates that come from another session?
I am not interested in commits of the transactions of the "local" session. Just in those commits
that other
clients do by using their session.

Regards,
Kai

Eike Stepper wrote:
> Kai Schlamp schrieb:
>> Hello, Eike ...
>>
>>> Please use:
>>>
>>> view.options().setInvalidationNotificationEnabled(*true*);
>> Thanks for the hint. I now receive CDOViewInvalidationEvent events.
>> But how would I get those other events/notifications mentioned in the
>> FAQ (CDOSessionInvalidationEvent,
> session.addListener(new IListener() {...});
>
>> CDOInvalidationNotification and CDOChangeSubscriptionPolicy)?
> object.eAdapters().add(new AdapterImpl() {...});
>
>> For e.g. it is mentioned in the Javadoc comment of
>> CDOInvalidationNotification that
>> setInvalidationNotificationEnabled(boolean) should lead to a
>> CDOInvalidationNotification.
>> But I never receive such events (at least when I check with instanceof).
> These two methods achieve similar things:
>
> - Add listeners to CDOSession or CDOView to receive IEvents
> - Attach adapters to EObject to receive Notifications (either with or
> without delta information)
>
> Cheers
> /Eike
>
> ----
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
Re: [CDO] Listen to passive updates. [message #431071 is a reply to message #431070] Thu, 25 June 2009 16:24 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Kai,

The following method only returns null for changes from remote:

org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent.getV iew()

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Kai Schlamp schrieb:
> Thanks Eike for carifying this. One last question about those listeners.
> Is it possible to only listen to passive updates that come from
> another session?
> I am not interested in commits of the transactions of the "local"
> session. Just in those commits that other
> clients do by using their session.
>
> Regards,
> Kai
>
> Eike Stepper wrote:
>> Kai Schlamp schrieb:
>>> Hello, Eike ...
>>>
>>>> Please use:
>>>>
>>>> view.options().setInvalidationNotificationEnabled(*true*);
>>> Thanks for the hint. I now receive CDOViewInvalidationEvent events.
>>> But how would I get those other events/notifications mentioned in the
>>> FAQ (CDOSessionInvalidationEvent,
>> session.addListener(new IListener() {...});
>>
>>> CDOInvalidationNotification and CDOChangeSubscriptionPolicy)?
>> object.eAdapters().add(new AdapterImpl() {...});
>>
>>> For e.g. it is mentioned in the Javadoc comment of
>>> CDOInvalidationNotification that
>>> setInvalidationNotificationEnabled(boolean) should lead to a
>>> CDOInvalidationNotification.
>>> But I never receive such events (at least when I check with
>>> instanceof).
>> These two methods achieve similar things:
>>
>> - Add listeners to CDOSession or CDOView to receive IEvents
>> - Attach adapters to EObject to receive Notifications (either with or
>> without delta information)
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>


Re: [CDO] Listen to passive updates. [message #431076 is a reply to message #431071] Thu, 25 June 2009 18:27 Go to previous messageGo to next message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
Eike Stepper wrote:
> Kai,
>
> The following method only returns null for changes from remote:
>
> org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent.getV iew()
>

Thanks Eike. Perhaps a method like CDOSessionInvalidationEvent.isRemote() would be a nice feature to
have a clearer API. What do you think? Bug Report? ;-)
Re: [CDO] Listen to passive updates. [message #431078 is a reply to message #431076] Thu, 25 June 2009 18:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Kai Schlamp schrieb:
> Eike Stepper wrote:
>> Kai,
>>
>> The following method only returns null for changes from remote:
>>
>> org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent.getV iew()
>>
>
> Thanks Eike. Perhaps a method like
> CDOSessionInvalidationEvent.isRemote() would be a nice feature to have
> a clearer API. What do you think? Bug Report? ;-)
Yes, please ;-)

Cheers
/Eike

----
http://thegordian.blogspot.com
http://twitter.com/eikestepper


Re: [CDO] Listen to passive updates. [message #431083 is a reply to message #431078] Thu, 25 June 2009 19:36 Go to previous message
Kai Schlamp is currently offline Kai SchlampFriend
Messages: 344
Registered: July 2009
Senior Member
>>> The following method only returns null for changes from remote:
>>>
>>> org.eclipse.emf.cdo.session.CDOSessionInvalidationEvent.getV iew()
>>>
>> Thanks Eike. Perhaps a method like
>> CDOSessionInvalidationEvent.isRemote() would be a nice feature to have
>> a clearer API. What do you think? Bug Report? ;-)
> Yes, please ;-)
>

https://bugs.eclipse.org/bugs/show_bug.cgi?id=281566
Previous Topic:[CDO] CDO 2.0 RC2 on the EMF Milestones Update Site
Next Topic:Bug in deresolve URI?
Goto Forum:
  


Current Time: Fri Apr 19 14:37:20 GMT 2024

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

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

Back to the top