On 11/10/2010 11:28 AM, Thomas Mortagne wrote:
On Wed, Nov 10, 2010 at 10:20, Thomas Mortagne
<thomas.mortagne(a)xwiki.com> wrote:
On Wed, Nov 10, 2010 at 09:08, Stefan
abageru<stefan.abageru(a)xwiki.com> wrote:
> Hi devs !
>
> I thought about adding some changes in Events and Activity Stream.
>
> First of all, I want to remove all the listeners from Activity Stream
> and make this class listen to AllEvent, making it capable of cathcing
> all events that occur in the wiki (and this way, when adding a new
> event, you wouldn't need any modifications to this class in order to
> catch it).
>
> Secondly, I would like to modify onEvent function in the class so that
> it uses the simpleClassName of the event occurred in order to log the
> event (the eventType would be this simpleClassName...for example
> DocumentSavedEvent, AnnotationAddedEvent and so on).
>
> And thirdly i thought about adding one field in AbstractFilterableEvent
> called /identifier/ and make all events extend directly this class. And
> that /identifier/ would be used in a different way by the events
> themselves. But it would be used to retrieve infos about that events.
> And so, when logging an event, we could use classname + identifier.
> For example
> AnnotationAddedEvent + "This is my annotation" .
> CommentAddedEvent + "This is my comment" or the number of the comment.
-1 for that, if you want data associated to the event you are supposed
to find them in the onEvent parameters. Having an unique identifier
will not always be enough whatever the event to know what happen (i
don't event find any event for which it will be true).
IMO, the class name + the identifier would be enough to understand what
happened.
A simple example would be:
CommentAddedEvent + "I think this is a nice document".
The need to do an instanceof at this moment is given by the fact that
there are different types of events and in each type there are different
fields which contain informations about events.
For example, for an Annotation event we have /identifier/ field, for a
Comment event we have a /message/ field and we cannot retrieve that
field unless we do the cast but after the check with instanceof.
It is however clear that there are some fields in your proposal that we
could add such as Date of the event.
However, if my solution isn't as generic as it should be, maybe you guys
can help with some ideas of design so that we can clean a little bit the
events and Activity Stream part :).
Thanks,
Stefan
Note that remote observation manager have pretty much
the same needs
and already define event converter (or handler like Vincent call it)
that extract from the event important parts in Serializable objects to
send them to cluster members so that we send only absolutely necessary
to know what happen. So it's exactly the same thing and we should use
the same mechanism for both IMO. BTW we started to work on general
event refactoring to have a common mechanism (and to improve ent API
that really needs it) with Jean-Vincent but because of a lack of time
I had to continue on my side with a remote observation only code but
the needs still remain, you can see
http://dev.xwiki.org/xwiki/bin/view/Design/ActivityComponent for the
last state of this work.
WDYT ?
Stefan
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Thomas Mortagne