jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edgar Poce <edgarp...@gmail.com>
Subject Re: How to call RepositoryImpl.shutdown() when using RegistryHelper
Date Thu, 17 Feb 2005 14:50:30 GMT
Hi francis

> I use Jackrabbit API from JSPs under Tomcat 5.5.7 and
> i don't know if hooks are called when processing JSPs
> (i don't know how hooks work). I'll google the web but
> if someone have the solution, it would be nice to post
> it here.
You can delegate on the container the jackrabbit lifecycle through j2ee 
JNDI Resources. Tomcat will take care of jackrabbit startup and the hook 
will take care of shutting it down when you stop tomcat.
Just don't kill the jvm process and it should work ok.

You have to register jackrabbit in the JNDI env.

   <Resource
	name="jcr/repositoryFactory"
	auth="Container"
	type="org.apache.jackrabbit.core.jndi.BindableRepository"/>

   <ResourceParams name="jcr/repositoryFactory">
     <parameter>
       <name>factory</name>
 
<value>org.apache.jackrabbit.core.jndi.BindableRepositoryFactory</value>
     </parameter>
     <parameter>
       <name>configFilePath</name>
       <value>[path to repository.xml]</value>
     </parameter>
     <parameter>
       <name>repHomeDir</name>
       <value>[path to repository folder]</value>
     </parameter>
   </ResourceParams>

and you will be able to get the repository with this code

   InitialContext ctx = new InitialContext();
   Context env = (Context) ctx.lookup("java:comp/env");
   Repository o = (Repository) env.lookup("jcr/repositoryFactory");

regards
Edgar

Mime
View raw message