On Tue, Jul 28, 2009 at 7:01 PM, Gadbury<[email protected]> wrote:
> I'm confused - please excuse me for being a novice.  All of my repository
> read / write code uses Interfaces form javax.jcr.* imports.  So I am
> importing the JCR spec Interfaces... but where is the Jackrabbit
> implementation?  I assume there is some magic that I cannot comprehend going
> on behind the scenes, driven by the Jackrabbit configuration file.

The trick is Java's interfaces ;-) Your code is written against the
JCR API Interfaces, but at runtime the underlying objects will be
Jackrabbits implementation classes.

You need a starting point, though. This is the Repository interface,
which can be retrieved in many ways. In simple standalone code, you
might explicitly get it by creating an instance of Jackrabbit's
TransientRepository. But in a webapp/J2EE container scenario it might
be provided globally through RMI or JNDI. Jackrabbit's default webapp
for example internally creates such a repository and registers it with
RMI or JNDI (depending on config). The client code, which might reside
in another webapp, will be using only the jcr-1.0.jar with the
interfaces for accessing that Repository object and all other
following stuff (Repository.login -> Session -> getRootNode -> Node
etc.).

Hope that helps,
Alex

-- 
Alexander Klimetschek
[email protected]

Reply via email to