jackalope/jackalope — Issue #62: Implement Chapter 12: Observation
Author: dbu
Created: 2011-12-28 12:39:45+00:00
State: open

JCR defines an observation interface. In php we would have to register all observers on every request, which is not realistic and potentially a huge performance issue. To work around that, we could implement an javax.jcr.observation.EventListener (in Java) that can be configured for events and calls an URL or php cli to let php developers react to the event.

http://www.day.com/maven/javax.jcr/javadocs/jcr-2.0/index.html > javax.jcr.observation

For the pure php backend, the same configuration could be used to launch events based on repository operations.

Fully implementing the javax.jcr.observation classes in PHPCR is probably not going to work, as we do not have a long running server instance. So the listener would have to be instantiated first and be able to bootstrap itselves and whatnot. Nonetheless ObservationManager.getEventJournal could be useful.
We could also re-use the EventListener interface to allow defined communication between the storage backend and the event listener.

the spi uses a poll model. that is, the server stores all registered events and the client can do a poll for events. we should build on this model.