Hi,

Ok, I removed all text referring to modifying the builds now and just
describe how to change an existing setup.

Regards
Felix

On 14.06.2010 16:18, Justin Edelson wrote:
> On 6/14/10 9:31 AM, Felix Meschberger wrote:
>> Hi,
>>
>> On 14.06.2010 15:05, Justin Edelson wrote:
>>> I really don't think we should be *suggesting* that people modify the
>>> Sling source tree.
>>
>> Well, yes and no.
>>
>> But basically you are right, the primary way is to just remove the derby
>> bundle, add the JDBC bundle and provide the fixed configuration.
>>
>>>
>>> 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.
>>
>> We don't exactly modify the source. We modify the list of bundles to be
>> included. I think this is somewhat different.
> And if people want to use a customized set of bundles, they should be
> creating their own projects to do that, not hacking on
> launchpad.builder. But this page describes modifying the bundle list in
> launchpad.builder and repository.xml in the jcr.jackrabbit-server. Both
> of which IMHO count as modifying the source.
> 
>>
>> For proving a different Jackrabbit Persistence Manager setup: IMHO
>> configuration of Jackrabbit is a problem in its own scope and should be
>> fixed in one way or the other -- but I don't have a clue what these ways
>> really are given the current way Jackrabbit is to be configured.
>>
>> So, maybe just being able to provide a fixed repository.xml during build
>> time may help.
> So the goal is to have a custom repository.xml file in the JAR/WAR? This
> can't be (easily?) done today, but I can imagine doing it. Something like...
> 
> if a repository.xml exists at a well-known location (/repository.xml for
> JAR, /WEB-INF/repository.xml for WAR), unpack that file to sling.home
> and set the sling.repository.config.file.url framework property to the
> location.
> 
> This adds some Jackrabbit-specific logic to Launchpad, but in a way that
> is not overly problematic. We just have to watch out for this becoming a
> slippery slope.
> 
>>
>> Maybe we can provide prepared bundle lists (as build profiles) together
>> with prefabricated repository.xml for a number of persistences managers ?
> With respect to the drivers, what I think might be effective is to add a
> configuration property to the maven-launchpad-plugin like this:
> 
> <dbName>mysql</dbName>
> 
> or
> 
> <dbDriver>
>  <groupId>...</groupId>
>  <artifactId>...</artifactId>
>  <version>...</version>
> </dbDriver>
> 
> (the former being an shortcut for some well-known values for the latter)
> 
> and this would automatically add the appropriate bundle JAR to the JAR
> or WAR produced by the project. This is, however, contingent upon having
> valid OSGi bundles for the drivers. The SpringSource one appears to be
> fine for MySQL, but I can't speak for any of the others.
> 
> I'm not sure about providing prefab repository.xml for other PMs. That
> just seems like a support problem waiting to happen.
> 
> Justin
> 
>>
>> Regards
>> Felix
>>
>>>
>>> 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