Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Connectiong to different jcr repositories Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Connectiong to different jcr repositories

    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:

    Code:
     <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:

    Code:
    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:

    Code:
    <!-- rmi client -->
    <bean id="rmiClientFactory" class="org.apache.jackrabbit.rmi.client.ClientRepositoryFactory"/>
    
    <bean id="rmiClient" factory-bean="rmiClientFactory" factory-method="getRepository" 
                       <b>depends-on="rmiServer"</b>>
      <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
Working...
X