This seems like a big hoop to jump through for such a 'simple' requirement, and would require my application to fully cooperate. I'm looking for something a bit more cross-cutting.
Have looked at wrapping Session and Node to intercept changes, eg. Node.remove(). This is possible but there are other ways nodes can be deleted. For example an import with IMPORT_UUID_COLLISION_REMOVE_EXISTING might end up removing nodes which would not be caught by this approach. Regards, Alfie. -----Original Message----- From: Alessandro Bologna [mailto:[email protected]] Sent: 01 May 2009 13:24 To: [email protected] Cc: <[email protected]> Subject: Re: Observation before node delete We had a similar use case, and we decided to simply flag the node with a "remove" property, and let the listener remove it. In this way you can of course access the node... Alessandro On May 1, 2009, at 6:25 AM, "Alfie Kirkpatrick" <[email protected] > wrote: > Hi, am wondering if it's possible to hook into change events <before> > they get persisted? In particular we want to access information > about a > node before it is deleted, for example its node type or property > values. > In some scenarios we may even want to prevent a delete operation if > certain criteria about the node are met/not met, for example by > throwing > an exception in the event handler. > > > > The observation API only gives a path and, in Jackrabbit's > implementation, even using a SynchronousEventListener the node is gone > by the time the delete event gets fired. Are there any other hooks > available/feasible? > > > > An alternative solution might be to somehow get access to the > session's > change list before calling save, and then access the deleted node in > another session. But there is no obvious place to get this information > outside the observation framework. > > > > Is anyone else interested in this problem? > > > > Many thanks! > > Alfie. > > > > >
