Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Notification Chain Capturing
Notification Chain Capturing [message #429709] Thu, 30 April 2009 09:19 Go to next message
Eclipse UserFriend
Originally posted by: slawomir'dot'chodnicki.mytum.de

Hi everybody,

I got a question regarding notification chains. In our project we listen to
all notifications happening in the object graph. We record these
notifications to create a local history of "operations". These operations are
higher level (still reversible, though) descriptions of the change in the
graph i.e. "user x deleted element y". Each notification chain constitutes an
operation for us, as for example in a delete multiple subobjects could be
affected.

Now the question: Currently we are inspecting a notification using reflection
features and read the "next" field of the NotificationImpl in order to find
out whether the chain is complete or more notifications will follow.
Obviously I am not happy with that solution. Is there a more elegant way to
do this? Can I maybe listen to a "Notifcation Chain Begin" and a
"Notification Chain End" event?

Regards

Slawo
Re: Notification Chain Capturing [message #429714 is a reply to message #429709] Thu, 30 April 2009 10:54 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Slawo,

Comments below.

Slawomir Chodnicki wrote:
> Hi everybody,
>
> I got a question regarding notification chains. In our project we listen to
> all notifications happening in the object graph. We record these
> notifications to create a local history of "operations". These operations are
> higher level (still reversible, though) descriptions of the change in the
> graph i.e. "user x deleted element y". Each notification chain constitutes an
> operation for us, as for example in a delete multiple subobjects could be
> affected.
>
> Now the question: Currently we are inspecting a notification using reflection
> features and read the "next" field of the NotificationImpl in order to find
> out whether the chain is complete or more notifications will follow.
>
Ouch. There's no guarantee with that approach.
> Obviously I am not happy with that solution.
No.
> Is there a more elegant way to
> do this?
No because the events are all sent to different objects so as far as
each object is concerned, that's all that's happened to it.
> Can I maybe listen to a "Notifcation Chain Begin" and a
> "Notification Chain End" event?
>
Probably at a higher level you ought to provide such begin/end
"events". For example, in the generated editor there's a command stack
and all changes happen by virtue of executing a command. The command
stack notifies when the command has been executed thereby providing the
ability to demarcate the boundaries between high level operations...
> Regards
>
> Slawo
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Notification Chain Capturing [message #429717 is a reply to message #429714] Thu, 30 April 2009 11:17 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: slawomir'dot'chodnicki.mytum.de

> Probably at a higher level you ought to provide such begin/end
> "events". For example, in the generated editor there's a command stack
> and all changes happen by virtue of executing a command. The command
> stack notifies when the command has been executed thereby providing the
> ability to demarcate the boundaries between high level operations...

Thanks for the suggestion Ed, we will try to look into the command stack for
a better solution

Best Regards

Slawo
Re: Notification Chain Capturing [message #429719 is a reply to message #429714] Thu, 30 April 2009 12:25 Go to previous message
Christian Damus is currently offline Christian DamusFriend
Messages: 1270
Registered: July 2009
Location: Canada
Senior Member

--=-kUgdJ/w9y6cvVDXRO1I0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,

It may be worth noting that the EMF Transaction component provides
several of these requirements "for free":

* global notification listening: ResourceSetListeners receive an
ordered list of all Notifications sent in the context of a
ResourceSet within the scope of a Transaction (generally
corresponding to command execution). The beginning and end of
the sequence is delineated for you
* automatic change recording: every Transaction records an
undoable/redoable ChangeDescription, possibly even encapsulating
non-EObject changes, depending on installed trigger listeners
* new in the 1.3 release is a listener API that explicitly
notifies of Transaction start and finish (commit or roll-back)
events, for specialized situations where this is useful

Of course, there's more to it than just this ...

Cheers,

Christian

On Thu, 2009-04-30 at 06:54 -0400, Ed Merks wrote:

> Slawo,
>
> Comments below.
>
> Slawomir Chodnicki wrote:
> > Hi everybody,
> >
> > I got a question regarding notification chains. In our project we listen to
> > all notifications happening in the object graph. We record these
> > notifications to create a local history of "operations". These operations are
> > higher level (still reversible, though) descriptions of the change in the
> > graph i.e. "user x deleted element y". Each notification chain constitutes an
> > operation for us, as for example in a delete multiple subobjects could be
> > affected.
> >
> > Now the question: Currently we are inspecting a notification using reflection
> > features and read the "next" field of the NotificationImpl in order to find
> > out whether the chain is complete or more notifications will follow.
> >
> Ouch. There's no guarantee with that approach.
> > Obviously I am not happy with that solution.
> No.
> > Is there a more elegant way to
> > do this?
> No because the events are all sent to different objects so as far as
> each object is concerned, that's all that's happened to it.
> > Can I maybe listen to a "Notifcation Chain Begin" and a
> > "Notification Chain End" event?
> >
> Probably at a higher level you ought to provide such begin/end
> "events". For example, in the generated editor there's a command stack
> and all changes happen by virtue of executing a command. The command
> stack notifies when the command has been executed thereby providing the
> ability to demarcate the boundaries between high level operations...
> > Regards
> >
> > Slawo
> >
> >

--=-kUgdJ/w9y6cvVDXRO1I0
Content-Type: text/html; charset="utf-8"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.24.1.1">
</HEAD>
<BODY>
Hi,<BR>
<BR>
It may be worth noting that the EMF Transaction component provides several of these requirements &quot;for free&quot;:
<UL>
<LI>global notification listening:&nbsp; ResourceSetListeners receive an ordered list of all Notifications sent in the context of a ResourceSet within the scope of a Transaction (generally corresponding to command execution).&nbsp; The beginning and end of the sequence is delineated for you
<LI>automatic change recording:&nbsp; every Transaction records an undoable/redoable ChangeDescription, possibly even encapsulating non-EObject changes, depending on installed trigger listeners
<LI>new in the 1.3 release is a listener API that explicitly notifies of Transaction start and finish (commit or roll-back) events, for specialized situations where this is useful
</UL>
Of course, there's more to it than just this ...<BR>
<BR>
Cheers,<BR>
<BR>
Christian<BR>
<BR>
On Thu, 2009-04-30 at 06:54 -0400, Ed Merks wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Slawo,

Comments below.

Slawomir Chodnicki wrote:
&gt; Hi everybody,
&gt;
&gt; I got a question regarding notification chains. In our project we listen to
&gt; all notifications happening in the object graph. We record these
&gt; notifications to create a local history of &quot;operations&quot;. These operations are
&gt; higher level (still reversible, though) descriptions of the change in the
&gt; graph i.e. &quot;user x deleted element y&quot;. Each notification chain constitutes an
&gt; operation for us, as for example in a delete multiple subobjects could be
&gt; affected.
&gt;
&gt; Now the question: Currently we are inspecting a notification using reflection
&gt; features and read the &quot;next&quot; field of the NotificationImpl in order to find
&gt; out whether the chain is complete or more notifications will follow.
&gt;
Ouch. There's no guarantee with that approach.
&gt; Obviously I am not happy with that solution.
No.
&gt; Is there a more elegant way to
&gt; do this?
No because the events are all sent to different objects so as far as
each object is concerned, that's all that's happened to it.
&gt; Can I maybe listen to a &quot;Notifcation Chain Begin&quot; and a
&gt; &quot;Notification Chain End&quot; event?
&gt;
Probably at a higher level you ought to provide such begin/end
&quot;events&quot;. For example, in the generated editor there's a command stack
and all changes happen by virtue of executing a command. The command
stack notifies when the command has been executed thereby providing the
ability to demarcate the boundaries between high level operations...
&gt; Regards
&gt;
&gt; Slawo
&gt;
&gt;
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>

--=-kUgdJ/w9y6cvVDXRO1I0--
Previous Topic:EMF and Oracle Coherence (& Teneo)
Next Topic:ecore model with package dependency
Goto Forum:
  


Current Time: Fri Mar 29 15:25:18 GMT 2024

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

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

Back to the top