Hi all,

I'm trying to figure out the best way to abstract JSR-170 implementations for 
my J2EE apps (and maybe provide a patch for lenya ;-). My knowledge of the 
JSR-170 API is rather basic on this and i was hoping someone could comment on 
the approach below.

My understanding is that JSR-170 does not specify how a Repository should be 
obtained and thus related classes are implementation specific. My target 
deployment environment is J2EE appservers and Servlet Containers like Tomcat 
and Jetty, so the obvious tasks seem to be:

* During application/web context initialisation, obtain a repo in an 
implementation specific way
* put it under the JNDI tree for the rest of application to use

The solution i have in mind is:

* Come up with an interface (JSRRegistryHelper) or abstract class to hide 
implementation specific calls to initially obtain a repo and put it under 
JNDI, something like what jackrabbit.core.jndi.RegistryHelper does. In the 
case of jackrabbit this would boil down to something like the following:

 class JackRabbitRegistryHelper implements JSRRegistryHelper{
   // use jackrabbit.core.jndi.RegistryHelper to put a 
   // bindable repo under JNDI
 }

* Use a ServletContextListener to call the implementation based on some 
config, for example the implementation classname (JackRabbitRegistryHelper) 
could be in web.xml. 


Any advice welcome, i am especially interested in solutions that would make 
this topology-independent as well (clustering of the webapp comes in mind, 
plus jackrabbit will also become clusterable at some point).

Manos

Reply via email to