Notification Chain Capturing [message #429709] |
Thu, 30 April 2009 09:19 |
Eclipse User |
|
|
|
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 #429717 is a reply to message #429714] |
Thu, 30 April 2009 11:17 |
Eclipse User |
|
|
|
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 |
|
--=-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 "for free":
<UL>
<LI>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
<LI>automatic change recording: 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:
> 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
>
>
</PRE>
</BLOCKQUOTE>
</BODY>
</HTML>
--=-kUgdJ/w9y6cvVDXRO1I0--
|
|
|
Powered by
FUDForum. Page generated in 0.02431 seconds