jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Moseley <...@osafoundation.org>
Subject DavSession refactoring
Date Tue, 15 Mar 2005 23:14:44 GMT
i'm using jackrabbit, especially the jcr-server, to build a customized 
WebDAV server. so far it has been pretty straightforward. i was 
especially pleased to find BindableRepositoryFactory in the core that i 
could use to register a global naming resource in tomcat :)

now i'm running into an issue with WebdavServlet and how it acquires a 
DavSession. i'm subclassing WebdavServer, and i want to use my own logic 
for finding credentials in the request, logging into the repository and 
instantiating a DavSession.

here's the problem: WebdavServlet.getSession and its friend the inner 
class DavSessionImpl are declared private. i changed 
WebdavServlet.getSession to be protected so that i could override it, 
but even so, i have no access to DavSessionImpl, so for now, i've copied 
and pasted it as an inner class in my subclass. yuck.

here's a proposal for making jcr-server more extensible in this regard:

1) create the interface DavSessionProvider in 
org.apache.jackrabbit.server with these methods:

   public void acquireSession(WebdavRequest request);
   public void releaseSession(WebdavRequest request);

2) make JCRWebdavServer implement DavSessionProvider (it already 
includes the above methods)

3) move WebdavServlet$DavSessionImpl to SimpleDavSession in 
org.apache.jackrabbit.server.simple

4) create a SimpleDavSessionProvider in 
org.apache.jackrabbit.server.simple implementing DavSessionProvider 
which returns instances of SimpleDavSession

5) change WebdavServlet to use a DavSessionProvider rather than its own 
getSession method, and use a SimpleDavSessionProvider by default 
(subclasses can override)

how does this sound? the design adds minimal complexity with the benefit 
of making extensibility possible.

Mime
View raw message