jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shailesh Mangal <shailesh.man...@getzephyr.com>
Subject Re: db properties?
Date Thu, 25 Sep 2008 17:29:47 GMT
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






Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message