jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Short <...@benshort.co.uk>
Subject Re: Jackrabbit Observation with Spring
Date Thu, 04 Feb 2010 19:15:40 GMT
Here is the code.....

/**
 * @see org.springmodules.jcr.SessionFactory#getSession()
 */
public Session getSession() throws RepositoryException {
return addListeners(repository.login(credentials, workspaceName));
}


/**
 * Hook for adding listeners to the newly returned session. We have to treat
 * exceptions manually and can't reply on the template.
 *
 * @param session JCR session
 * @return the listened session
 */
protected Session addListeners(Session session) throws RepositoryException {
if (eventListeners != null && eventListeners.length > 0) {
Workspace ws = session.getWorkspace();
ObservationManager manager = ws.getObservationManager();
if (log.isDebugEnabled())
log.debug("adding listeners " + Arrays.asList(eventListeners).toString() + "
for session " + session);

for (int i = 0; i < eventListeners.length; i++) {
manager.addEventListener(eventListeners[i].getListener(),
eventListeners[i].getEventTypes(),
eventListeners[i].getAbsPath(), eventListeners[i].isDeep(),
eventListeners[i].getUuid(),
eventListeners[i].getNodeTypeName(), eventListeners[i].isNoLocal());
}
}
return session;
}

Seems odd that it adds the listeners to the OM every time a session is
requested.




On 4 February 2010 16:22, <AElshereay@idc.com> wrote:

> will do. Thank you once more for your help.
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message