That is true, but we have multiple run-time properties files for all of our projects. That would be my preferred method of doing this then I can deploy the same build to either production or to staging without having to specially rebuild it (as this would require me to do).

-warner

On Sep 25, 2008, at 10:29 AM, Shailesh Mangal wrote:

This can easily be done in your build tool. We use maven and we replace properties during compile time. Here is an example

repository.xml
...
<PersistenceManager class ="org.apache.jackrabbit.core.state.db.SimpleDbPersistenceManager">
      <param name="driver" value="com.mysql.jdbc.Driver"/>
<param name="url" value="jdbc:mysql://${database.server}:$ {database.port}/dversion? createDatabaseIfNotExist =true&amp;useUnicode=true&amp;characterEncoding=utf-8"/>
      <param name="user" value="root"/>
      <param name="password" value="root"/>
      <param name="schema" value="mysql"/>
      <param name="schemaObjectPrefix" value="JACKRABBIT_TheD_" />
      <param name="externalBLOBs" value="false"/>
  </PersistenceManager>
...
pom.xml
                <profile>
                        <id>staging</id>
                        <activation>
<property> <name>environment</name> <value>staging</value> </ property>
                        </activation>
                        <properties>
                                
<database.server>198.168.100.206</database.server>  
                                <database.port>3306</database.port>             
    
                        </properties>
                </profile>        
                <profile>
                        <id>dev</id>
                        <activation>
                                <property> <name>environment</name> 
<value>dev</value> </property>
                        </activation>
                        <properties>
                                <database.server>localhost</database.server>    
    
                                <database.port>3306</database.port>             
    
                        </properties>
                </profile>        



Another alternative is to make spring inject these values in run time by using bean propertyConfigurer bean <bean id="propertyConfigurer" class = "org .springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
           <list>
               <value>classpath:quartz-scheduler.properties</value>
               <value>classpath:jdbc.properties</value>
               <value>classpath:mail.properties</value>
               <value>classpath:repository.properties</value>
               <value>classpath:jtrac-init.properties</value>
               <value>classpath:jtrac.properties</value>
          </list>
       </property>
   </bean>


Shailesh Mangal
Zephyr
Now, Test Management, is a breeze


On Sep 25, 2008, at 9:00 AM, Warner Onstine wrote:

Hi all,
We are currently using Spring modules Jackrabbit support to configure our repository on application startup. Since we use multiple dbs (one for local testing, one for staging, and another for deployment) all of our db connection information is stored as java properties. I'm not finding an easy way to specify this in the repository.xml. Has anyone done this? Could this be added to the wiki?

Thanks!

-warner






Reply via email to