jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Bergöö <jacob.ber...@gmail.com>
Subject Connecting to different repositories
Date Fri, 24 Apr 2009 13:25:54 GMT

Hi,
I am working with Spring 2.5.6, spring-modules-jcr 0.8a, jcrom 1.3.2.

In my application I have the need of be able to connect to different
repositories depending on if I am in development, test or production mode.

The way it is setup now I have a repository.xml configuration in my
src/main/resources folder where I setup a local derby repository, but I want
to be able to create a "test" build that will connect to a repository that
is on another machine. Therefor I cant use the way I have configured it now
in spring.

This is my configuration:

 <bean id="jcrom" class="org.jcrom.Jcrom">
        <constructor-arg type="boolean" value="true"/>
        <constructor-arg type="boolean" value="true"/>
        <constructor-arg type="java.util.Set">
            <set>
                <value type="java.lang.Class">org.jcrom.JcrFile</value>
                <value
type="java.lang.Class">com.xxx.domain.composition.urltree.URLNode</value>
                <value
type="java.lang.Class">com.xxx.domain.composition.urltree.URLTree</value>
                <value
type="java.lang.Class">com.xxx.domain.composition.page.ViewPage</value>
                <value
type="java.lang.Class">com.xxx.domain.composition.template.TemplateNode</value>
                <value
type="java.lang.Class">com.xxx.domain.composition.template.ChildArea</value>
            </set>
        </constructor-arg>
    </bean>

    <bean id="jcrSessionFactory"
class="org.springmodules.jcr.JcrSessionFactory">
        <property name="repository" ref="repository"/>
        <property name="credentials">
            <bean class="javax.jcr.SimpleCredentials">
                <constructor-arg index="0" value="user"/>
                <constructor-arg index="1">
                    <bean factory-bean="password"
factory-method="toCharArray"/>
                </constructor-arg>
            </bean>
        </property>
    </bean>

    <bean id="password" class="java.lang.String">
        <constructor-arg index="0" value="password"/>
    </bean>

    <bean id="transactionManager"
class="org.springmodules.jcr.jackrabbit.LocalTransactionManager">
        <property name="sessionFactory" ref="jcrSessionFactory"/>
    </bean>

    <bean id="rmiRegistry"
class="org.springframework.remoting.rmi.RmiRegistryFactoryBean"/>
    <bean id="rmiServer"
class="org.springmodules.jcr.jackrabbit.RmiServerRepositoryFactoryBean">
        <property name="repository" ref="repository"/>
        <property name="remoteAdapterFactory">
            <bean
class="org.apache.jackrabbit.rmi.server.ServerAdapterFactory"/>
        </property>
        <property name="registry" ref="rmiRegistry"/>
        <property name="rmiName" value="jackrabbit"/>
    </bean>

   <bean id="jcrPropertyPlaceholder"
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location"
value="classpath:jcr-persistence-config.properties"/>
    </bean>

    <bean id="repository"
class="org.springmodules.jcr.jackrabbit.RepositoryFactoryBean">
        <property name="configuration"
value="${jcr.repository.config.file}"/>
        <property name="homeDir" value="${jcr.repository.home.dir}"/>
    </bean>

    <!-- DAO classes -->

    <bean id="urlTreeDao" class="com.xxx.persistence.urltree.URLTreeDao">
        <constructor-arg index="0" ref="jcrom"/>
    </bean>



and the property file:

jcr.repository.config.file=classpath:repository.xml
jcr.repository.home.dir=file:./target/trex_jcr_repo

So I am guessing I need to be able to connect to the other machine with some
rmi connection but when I looked on the documentation for spring-modules-jcr
is states:

<!-- rmi client -->
<bean id="rmiClientFactory"
class="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"/>

<bean id="rmiClient" factory-bean="rmiClientFactory"
factory-method="getRepository" 
                   depends-on="rmiServer">
  <constructor-arg value="rmi://localhost:1099/jackrabbit"/>
</bean>

and that means that depends-on="rmiServer" needs a rmiServer that needs a
repository that needs to read a repository.xml file.... this clearly does
not work... I would have expected that I should be able to create a
repository bean where I provide a URI and username, password...

How have this been solve for you guys?

Thanks in advance,
Jacob


-- 
View this message in context: http://www.nabble.com/Connecting-to-different-repositories-tp23216439p23216439.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message