Hi all,
I am trying to integrate JCR into an existing java application deployed within
Tomcat, and I am struggling to find docs that describe how to do this.
We want to follow the JCR architecture and not hardcode the implementation into
the app, and so we try pick up a JCR implementation from JNDI, like so (snip
error handling):
InitialContext context = new InitialContext();
Object obj = context.lookup("java:comp/env");
javax.naming.Context environment =
javax.naming.Context.class.cast(obj);
obj = environment.lookup("jcr/repository");
Repository repository = Repository.class.cast(obj);
Now we go to tomcat, and we set up a resourcelink:
<ResourceLink global="jcr/GlobalRepository" name=“jcr/AppRepository"
type="javax.jcr.Repository"/>
which points to a resource:
<Resource
name="jcr/GlobalRepository"
auth="Container"
type="javax.jcr.Repository"
factory=“[Something undocumented goes here]"
url="[The RMI URL of the repository]"
I am stuck at "Something undocumented goes here”.
Most specifically, I need a factory that will allow me to set an URL, pointing
at the WebDav interface of the repository, but I'm hitting a wall. A local
repository is available for testing purposes which is nice, but that doesn’t
help for an actual implementation.
This question was raised a long time ago, which led to this ticket
https://issues.apache.org/jira/browse/JCR-1877 marked fixed, but it’s not clear
what the fix was, or where the fix was documented.
This factory comes close:
https://jackrabbit.apache.org/api/trunk/index.html?org/apache/jackrabbit/jcr2dav/package-summary.html
- but it documents three possible different URLs to be provided, which doesn't
map to the resource element, which only has the option to provide one url.
Are there any complete examples of a JCR implementation using JNDI and
Jackrabbit as a client?
All I can find are references to people hard coding Jackrabbit into their app,
which breaks the architecture: org.apache.jackrabbit.commons.JcrUtils
Regards,
Graham
—