I like the idea of creating an include file which can be specified on
the command line like this, although IMHO it would be more inline with
what already is there to not use a system property and add a command
line argument, like:
-i /etc/nakamura/setup-repository.properties

I'm not sure how this would/could work in the webapp case. Is Nakamura
standalone-only?

Justin

On 6/14/10 9:16 AM, Ian Boston wrote:
> We have a change to the bootstrap setup (iirc an include in one of the 
> properties files) that enables a new repository.xml to be used
> 
> doc is at [1], look towards the latter sections or search for repository.xml
> 
> If this looks like it makes sense for Sling I could patch ?
> Ian
> 
> 
> 1 
> http://confluence.sakaiproject.org/display/KERNDOC/KERN-692+Configuring+Nakamura
> On 14 Jun 2010, at 07:05, Justin Edelson wrote:
> 
>> I really don't think we should be *suggesting* that people modify the
>> Sling source tree.
>>
>> If it is too hard to build custom launchpad applications, let's fix
>> that. If it is too hard to provide a custom repository.xml file, let's
>> fix that.
>>
>> But it shouldn't be necessary or recommended to modify sources in order
>> to get either of these tasks done.
>>
>> Justin
>>
>> -------- Original Message --------
>> Subject:     [CONF] Apache Sling Website > Jackrabbit Persistence
>> Date:        Mon, 14 Jun 2010 08:58:00 -0400 (EDT)
>> From:        [email protected]
>> Reply-To:    [email protected]
>> To:  [email protected]
>>
>>
>>
>>    Jackrabbit Persistence
>>
>> <https://cwiki.apache.org/confluence/display/SLINGxSITE/Jackrabbit+Persistence>
>>
>>
>>        Page *edited* by Felix Meschberger
>>        <https://cwiki.apache.org/confluence/display/~fmeschbe>
>>
>>
>>        Changes (5)
>>
>> ...
>> h2. Replace Derby in a running Sling Instance
>>
>> To replace Derby in a running Sling instance just uninstall the Derby
>> bundle and install the JDBC driver bundle through the Web Console (at
>> {{/system/console}}).
>>
>>
>> ...
>> h2. Reconfiguring Jackrabbit
>>
>> Two options:
>> * Reconfigure after first startup
>> * Reconfigure build
>> To actually use a persistence manager other than the default (Derby)
>> persistence manager, you have to configure Jackrabbit to use it. There
>> are two options: You can modify the build or you can create a
>> {{repository.xml}} file in the {{sling/jackrabbit}} folder before
>> starting Sling for the first time.
>>
>> h3. Prepare repository.xml File
>>
>> To prepare a repository.xml file before first startup, use the
>> {{[repository.xml|http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml]}}
>> as a template and modify it by replacing the {{<PersistenceManager>}}
>> elements to refer to the selected persistence manager.
>>
>> For example to use PostgreSQL instead of Derby modify the
>> {{<PersistenceManager>}} elements as follows:
>>
>> {code}
>> <Repository>
>> ...
>> <Workspace name="${wsp.name}">
>> ...
>> <PersistenceManager
>> class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
>>
>> <param name="driver" value="org.postgresql.Driver"/>
>> <param name="url"
>> value="jdbc:postgresql://localhost:5432/YOUR_DB_NAME_HERE"/>
>> <param name="schema" value="postgresql"/>
>> <param name="user" value="YOUR_USER_HERE"/>
>> <param name="password" value="YOUR_PASSWORD_HERE"/>
>> <param name="schemaObjectPrefix" value="jcr_${wsp.name}_"/>
>> <param name="externalBLOBs" value="false"/>
>> </PersistenceManager>
>> ...
>> </Workspace>
>>
>> <Versioning rootPath="${rep.home}/version">
>> ...
>> <PersistenceManager
>> class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
>>
>> <param name="driver" value="org.postgresql.Driver"/>
>> <param name="url"
>> value="jdbc:postgresql://localhost:5432/YOUR_DB_NAME_HERE"/>
>> <param name="schema" value="postgresql"/>
>> <param name="user" value="YOUR_USER_HERE"/>
>> <param name="password" value="YOUR_PASSWORD_HERE"/>
>> <param name="schemaObjectPrefix" value="version_"/>
>> <param name="externalBLOBs" value="false"/>
>> </PersistenceManager>
>> </Versioning>
>> ...
>> </Repository>
>> {code}
>>
>> Modify the {{url}}, {{user}}, and {{password}} parameters to match your
>> database setup.
>>
>>
>> h3. Modify the Build
>>
>> To modify the build apply above changes directly to the
>> {{src/main/resources/repository.xml}} file in the Embedded Jackrabbit
>> Server bundle source.
>>
>>
>> h2. Credits
>>
>> ...
>>
>>
>>        Full Content
>>
>>
>>  Jackrabbit Persistence
>>
>> Out-of-the-box the embedded Jackrabbit repository used by Sling (the
>> Embedded Jackrabbit Repository bundle) uses Derby to persist the JCR
>> nodes and properties. For some applications or environments it may be
>> required or required to replace Derby with another backing store such as
>> PostgreSQL or Oracle.
>>
>> This page is based on the journey of Tony Giaccone to get Sling running
>> with a PostgreSQL based Jackrabbit instance.
>>
>>
>>    Management Summary
>>
>> To replace Derby as the persistence manager for Jackrabbit the following
>> steps are required:
>>
>>   1. Provide a JDBC driver for your database as an OSGi bundle
>>   2. Reconfigure Jackrabbit to use your database
>>   3. (Re-) Start the Embedded Jackrabbit bundle
>>
>> When you are not using the Derby persistence manager, you may safely
>> remove the Derby bundle from your Sling instance.
>>
>>
>>    JDBC Driver
>>
>> The hardest thing to do is probably getting the JDBC driver for your
>> database. One option is to look at the bundles provided by Spring Source
>> in their repository at http://www.springsource.com/repository/.
>>
>> Another option is to create the bundle on your own using Peter Kriens'
>> BND Tool <http://www.aqute.biz/Code/Bnd>:
>>
>>   1. Get the JDBC driver for your database from the driver provider
>>   2. Wrap the JDBC driver library into an OSGi bundle:
>>
>>      # Example for PostgreSQL JDBC 3 driver 8.4-701
>>      $ java -jar bnd.jar wrap postgresql-8.4-701.jdbc3.jar
>>      $ mv postgresql-8.4-701.jdbc3.bar postgresql-8.4-701.jdbc3-bnd.jar
>>
>>   3. Deploy the driver to your local Maven 2 Repository (Required if
>>      adding the JDBC driver to the Sling build)
>>
>>      $ mvn install:install-file -DgroupId=postgresql
>> -DartifactId=postgresql -Dversion=8.4.701.jdbc3 \
>>                      -Dpackaging=jar -Dfile=postgresql-8.4-701.jdbc3-bnd.jar
>>
>> Tony reports no success with the Spring Source bundle, whily the BND
>> approach worked for the PostgreSQL JDBC driver.
>>
>>
>>    Replace Derby in a running Sling Instance
>>
>> To replace Derby in a running Sling instance just uninstall the Derby
>> bundle and install the JDBC driver bundle through the Web Console (at
>> /system/console).
>>
>>
>>    Replace Derby in the Sling Build
>>
>> To replace Derby (included with Sling by default) with the new JDBC
>> driver, the bundle list file src/main/bundles/list.xml of the Sling
>> Launchpad Builder project can be modified.
>>
>> Look for the Derby database section:
>>
>> <bundle>
>>    <groupId>org.apache.derby</groupId>
>>    <artifactId>derby</artifactId>
>>    <version>10.5.3.0_1</version>
>> </bundle>
>>
>> and replace this section by the Maven 2 reference to your JDBC driver.
>>
>> For example, for the PostgreSQL JDBC driver bundle prepared in the
>> prepared in the previous step replace the Derby reference with this:
>>
>> <bundle>
>>    <groupId>postgresql</groupId>
>>    <artifactId>postgresql</artifactId>
>>    <version>8.4.701.jdbc3</version>
>> </bundle>
>>
>>
>>    Reconfiguring Jackrabbit
>>
>> To actually use a persistence manager other than the default (Derby)
>> persistence manager, you have to configure Jackrabbit to use it. There
>> are two options: You can modify the build or you can create a
>> repository.xml file in the sling/jackrabbit folder before starting Sling
>> for the first time.
>>
>>
>>      Prepare repository.xml File
>>
>> To prepare a repository.xml file before first startup, use the
>> repository.xml
>> <http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server/src/main/resources/repository.xml>
>> as a template and modify it by replacing the <PersistenceManager>
>> elements to refer to the selected persistence manager.
>>
>> For example to use PostgreSQL instead of Derby modify the
>> <PersistenceManager> elements as follows:
>>
>> <Repository>
>>    ...
>>    <Workspace name="${wsp.name}">
>>        ...
>>        <PersistenceManager
>> class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
>>            <param name="driver" value="org.postgresql.Driver"/>
>>            <param name="url"
>> value="jdbc:postgresql://localhost:5432/YOUR_DB_NAME_HERE"/>
>>            <param name="schema" value="postgresql"/>
>>            <param name="user" value="YOUR_USER_HERE"/>
>>            <param name="password" value="YOUR_PASSWORD_HERE"/>
>>            <param name="schemaObjectPrefix" value="jcr_${wsp.name}_"/>
>>            <param name="externalBLOBs" value="false"/>
>>        </PersistenceManager>
>>        ...
>>    </Workspace>
>>
>>    <Versioning rootPath="${rep.home}/version">
>>        ...
>>        <PersistenceManager
>> class="org.apache.jackrabbit.core.persistence.bundle.PostgreSQLPersistenceManager">
>>            <param name="driver" value="org.postgresql.Driver"/>
>>            <param name="url"
>> value="jdbc:postgresql://localhost:5432/YOUR_DB_NAME_HERE"/>
>>            <param name="schema" value="postgresql"/>
>>            <param name="user" value="YOUR_USER_HERE"/>
>>            <param name="password" value="YOUR_PASSWORD_HERE"/>
>>            <param name="schemaObjectPrefix" value="version_"/>
>>            <param name="externalBLOBs" value="false"/>
>>        </PersistenceManager>
>>    </Versioning>
>>    ...
>> </Repository>
>>
>> Modify the url, user, and password parameters to match your database setup.
>>
>>
>>      Modify the Build
>>
>> To modify the build apply above changes directly to the
>> src/main/resources/repository.xml file in the Embedded Jackrabbit Server
>> bundle source.
>>
>>
>>    Credits
>>
>> This description is based on Tony Giaccone's description Swapping
>> Postgres for Derby <http://markmail.org/message/wlbfrukmjjsl33hh> sent
>> to the Sling Users mailing list.
>>
>> Change Notification Preferences
>> <https://cwiki.apache.org/confluence/users/viewnotifications.action>
>> View Online
>> <https://cwiki.apache.org/confluence/display/SLINGxSITE/Jackrabbit+Persistence>
>> | View Changes
>> <https://cwiki.apache.org/confluence/pages/diffpagesbyversion.action?pageId=22315341&revisedVersion=2&originalVersion=1>
>> | Add Comment
>> <https://cwiki.apache.org/confluence/display/SLINGxSITE/Jackrabbit+Persistence?showComments=true&showCommentArea=true#addcomment>
>>
> 

Reply via email to