You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Aleksandar Pecanov <pe...@mt.net.mk> on 2005/11/04 23:20:31 UTC

Observation manager

I have a little bit of problem. Maybe I'm misusing something.
When adding an event listener to the observation manager, no exceptions
are throwen, everything seems fine. But no events are delivered to the
event listeners and when I get the event listener iterator from the
manager, it's empty.
Does observation work in jackrabbit? 

Thank you

Re: Observation manager

Posted by Tobias Bocanegra <to...@day.com>.
> > You want me to provide
>
> getObservationManager().addEventListener ?
but with what
> arguments? are you sure you select the correct events to listen to

if you
> want to listen to all events
> do:
wsp.getObservationManager().addEventListener(listener,
 Event.NODE_ADDED
> | Event.NODE_REMOVED
 | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED,
 "/",
> true, null, null, false);

> There is nothing to it.
> After that I use
>
> session.getWorkspace(),getObser...getEventListenerIterator,
>
> and it's empty.
please note, that the event listener is bound to the session
> you
retrieve the workspace from. once you close/logout the session,
> the
listener is removed.

> Quote from JCR spec:
>
> "Additionally, if noLocal is true, then events generated by the session
> through which the listener was registered are ignored. Otherwise, they are
> not ignored."
>
> It seems that if the last parameter is true, the session is ignored.
> Combined with the above statement, it means that no events will be sent,
> which does not make much sense, does it?
> The event listener is bound (or should be) to Workspace, according to spec.

well it's a bit more complicated. the listener is bound to the
workspace, but the workspace object is bound to the session that
logged on that workspace.

so, if you do a Repository.login(), a new Workspace and a new Session
object is created. if you do a session.logout, both are discarded. and
so are the eventlisteners. the 'noLocal' flag referrs to the session
that registers the listener (via it's local workspace object).

regards, toby

ps: please reply to jackrabbit-dev@incubator.apache.org insted to me
personally, so all list members can profit from this discussion.

--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Observation manager

Posted by Tobias Bocanegra <to...@day.com>.
> You want me to provide
> getObservationManager().addEventListener ?
but with what arguments? are you sure you select the correct events to listen to

if you want to listen to all events do:
wsp.getObservationManager().addEventListener(listener,
                Event.NODE_ADDED | Event.NODE_REMOVED
                | Event.PROPERTY_ADDED | Event.PROPERTY_REMOVED,
                "/", true, null, null, false);

> There is nothing to it.
> After that I use
> session.getWorkspace(),getObser...getEventListenerIterator,
> and it's empty.
please note, that the event listener is bound to the session you
retrieve the workspace from. once you close/logout the session, the
listener is removed.

regards, toby


On 11/4/05, Aleksandar Pecanov <pe...@mt.net.mk> wrote:
> I have a little bit of problem. Maybe I'm misusing something.
> When adding an event listener to the observation manager, no exceptions
> are throwen, everything seems fine. But no events are delivered to the
> event listeners and when I get the event listener iterator from the
> manager, it's empty.
> Does observation work in jackrabbit?
>
> Thank you
>
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: Observation manager

Posted by Tobias Bocanegra <to...@day.com>.
can you provide your code example?

On 11/4/05, Aleksandar Pecanov <pe...@mt.net.mk> wrote:
> I have a little bit of problem. Maybe I'm misusing something.
> When adding an event listener to the observation manager, no exceptions
> are throwen, everything seems fine. But no events are delivered to the
> event listeners and when I get the event listener iterator from the
> manager, it's empty.
> Does observation work in jackrabbit?
>
> Thank you
>
>


--
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---