You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Michael Wechner <mi...@wyona.com> on 2005/09/06 14:37:16 UTC
implementation independent repository lookup
Hi
I would like to test various JCR implementations (Jackrabbit, eXo JCR,
Jeiceira, ...) with a specific application and hence would like to have
bindRepository()
getRepository()
independent of the implementation.
Any pointers are very welcome.
Thanks
Michi
--
Michael Wechner
Wyona - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
michael.wechner@wyona.com michi@apache.org
Re: implementation independent repository lookup
Posted by Jukka Zitting <jz...@yukatan.fi>.
Hi,
Michael Wechner wrote:
>> Are you looking for something like the DriverManager in JDBC?
>
> yes, I guess something like
>
> jcr.drivers=org.apache.jackrabbit.Driver:com.jeceira.Driver
>
> but I assume that JCR would have to enhance the API, right? Also
> I guess the various implementations would have to find consensus on
> how the configuration is being loaded or rather the API would impose
> that on them I guess.
Yes. Either extend the API or create some other de facto repository
instantiation standard. However I think that this issue is better
handled by the various component frameworks than a JCR-specific API.
>> I was thinking about proposing such a mechanism sometime ago, but I've
>> since settled on using JNDI in container environments and Spring (or
>> another component framework) in standalone applications.
>
> do you have some code snippets how this can be done without using for
> instance the jackrabbit specific RegistryHelper?
I've been using something like the following with the Spring framework
to avoid a direct Jackrabbit dependency in standalone applications:
ApplicationContext context = ...;
Repository repository = (Repository)
context.getBean("repository", Repository.class);
The current Jackrabbit core classes are not very Spring-friendly, but
the following sample bean configuration should give you a configured
Jackrabbit Repository instance as the "repository" bean:
<bean id="repository-config"
class="org.apache.jackrabbit.core.config.RepositoryConfig"
factory-method="create">
<constructor-arg type="java.lang.String" index="0">
<value>/path/to/repository.xml</value>
</constructor-arg>
<constructor-arg type="java.lang.String" index="1">
<value>/path/to/repository</value>
</constructor-arg>
</bean>
<bean id="repository"
class="org.apache.jackrabbit.core.RepositoryImpl">
<constructor-arg>
<ref local="repository-config"/>
</constructor-arg>
</bean>
It should be possible to create similar configuration snippets for other
JCR implementations as well.
BR,
Jukka Zitting
Re: implementation independent repository lookup
Posted by Michael Wechner <mi...@wyona.com>.
Jukka Zitting wrote:
> Hi,
>
> Michael Wechner wrote:
>
>> I would like to test various JCR implementations (Jackrabbit, eXo
>> JCR, Jeiceira, ...) with a specific application and hence would like
>> to have
>>
>> bindRepository()
>> getRepository()
>>
>> independent of the implementation.
>
>
> Are you looking for something like the DriverManager in JDBC?
yes, I guess something like
jcr.drivers=org.apache.jackrabbit.Driver:com.jeceira.Driver
but I assume that JCR would have to enhance the API, right? Also
I guess the various implementations would have to find consensus on
how the configuration is being loaded or rather the API would impose
that on them I guess.
> I was thinking about proposing such a mechanism sometime ago, but I've
> since settled on using JNDI in container environments and Spring (or
> another component framework) in standalone applications.
do you have some code snippets how this can be done without using for
instance
the jackrabbit specific RegistryHelper?
Thanks
Michi
>
> BR,
>
> Jukka Zitting
>
--
Michael Wechner
Wyona - Open Source Content Management - Apache Lenya
http://www.wyona.com http://lenya.apache.org
michael.wechner@wyona.com michi@apache.org
Re: implementation independent repository lookup
Posted by Jukka Zitting <jz...@yukatan.fi>.
Hi,
Michael Wechner wrote:
> I would like to test various JCR implementations (Jackrabbit, eXo JCR,
> Jeiceira, ...) with a specific application and hence would like to have
>
> bindRepository()
> getRepository()
>
> independent of the implementation.
Are you looking for something like the DriverManager in JDBC? I was
thinking about proposing such a mechanism sometime ago, but I've since
settled on using JNDI in container environments and Spring (or another
component framework) in standalone applications.
BR,
Jukka Zitting