Index: arch/deploy/howto-deploy.xml =================================================================== --- arch/deploy/howto-deploy.xml (revision 160889) +++ arch/deploy/howto-deploy.xml (working copy) @@ -17,9 +17,23 @@ --> - Jackrabbit Deployment Models - HOWTO + Jackrabbit Deployment Models - Tomcat 4.1.x HOWTO +
+

+ All the examples included in this page use JNDI to access the repository. + Please refer to + + Tomcat 4.1 JNDI resource HOWTO to find more details. +

+

+ Important: remember that two Jackrabbit instances should + never read from/write to the same physical storage. + This setup is not supported and will lead to corrupt data. +

+
+
  1. Place the jackrabbit jar file and all the dependencies @@ -40,7 +54,7 @@ RepositoryImpl.shutdown() (e.g. in the destroy() method of a servlet).

    -

    In server.xml under the "context" tag (steps #2)

    +

    In server.xml under the "context" tag (step #2)

    <Resource name="jcr/repositoryFactory" auth="Container" type="org.apache.jackrabbit.core.jndi.BindableRepository"/> @@ -65,7 +79,7 @@ </parameter> </ResourceParams> -

    In web.xml (steps #3)

    +

    In web.xml (step #3)

    <resource-env-ref> <description> @@ -87,6 +101,7 @@
+

Same as Model 1 with the following modifications. @@ -136,5 +151,71 @@

+ +
+

+ This example shows you how to connect to an already + running jcr-rmi server (see jcr-rmi javadocs). +

+
    +
  1. + Place jcr-rmi jar file and its dependencies + under [tomcat folder]/webapps/[your app]/WEB-INF/lib. + You can find the jcr-rmi implementation under the contrib + folder of the source distribution. +
  2. +
  3. + Register the client repository factory in the context scope. +
  4. +
  5. Declare the JNDI address under which you will request the + repository instance in the web application.
  6. +
  7. Code your application to use the resource.
  8. +
+ +

In server.xml under "context" tag. (step #2)

+ +<Resource name="jcr/repositoryFactory" auth="Container" + type="javax.jcr.Repository"/> +<ResourceParams name="jcr/repositoryFactory"> + <parameter> + <name>factory</name> + <value> + org.apache.jackrabbit.rmi.client.ClientRepositoryFactory + </value> + </parameter> + <parameter> + <name>url</name> + <value> + [The RMI URL of the repository] + </value> + </parameter> +</ResourceParams> + +

In web.xml (step #3)

+ +<resource-env-ref> + <description> + JCR RMI repository factory + </description> + <resource-env-ref-name> + jcr/repositoryFactory + </resource-env-ref-name> + <resource-env-ref-type> + javax.jcr.Repository + </resource-env-ref-type> +</resource-env-ref> + +

Java code (step #4)

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

+ You can find more detailed documentation + in the jcr-rmi library javadocs. +

+
\ No newline at end of file