incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Sling Website > Jackrabbit Persistence
Date Mon, 14 Jun 2010 08:10:00 GMT
    <base href="">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="">Jackrabbit
    <h4>Page  <b>added</b> by             <a href="">Felix
    <div class="notificationGreySide">
         <h1><a name="JackrabbitPersistence-JackrabbitPersistence"></a>Jackrabbit

<p>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.</p>

<p>This page is based on the journey of Tony Giaccone to get Sling running with a PostgreSQL
based Jackrabbit instance.</p>

<h2><a name="JackrabbitPersistence-ManagementSummary"></a>Management Summary</h2>

<p>To replace Derby as the persistence manager for Jackrabbit the following steps are

	<li>Provide a JDBC driver for your database as an OSGi bundle</li>
	<li>Reconfigure Jackrabbit to use your database</li>
	<li>(Re-) Start the Embedded Jackrabbit bundle</li>

<p>When you are not using the Derby persistence manager, you may safely remove the Derby
bundle from your Sling instance.</p>

<h2><a name="JackrabbitPersistence-JDBCDriver"></a>JDBC Driver</h2>

<p>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 <a href=""
class="external-link" rel="nofollow"></a>.</p>

<p>Another option is to create the bundle on your own using Peter Kriens' <a href=""
class="external-link" rel="nofollow">BND Tool</a>:</p>

	<li>Get the JDBC driver for your database from the driver provider</li>
	<li>Wrap the JDBC driver library into an OSGi bundle:
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
# Example <span class="code-keyword">for</span> PostgreSQL JDBC 3 driver 8.4-701
$ java -jar bnd.jar wrap postgresql-8.4-701.jdbc3.jar
$ mv postgresql-8.4-701.jdbc3-bnd.jar
	<li>Deploy the driver to your local Maven 2 Repository (Required if adding the JDBC
driver to the Sling build)
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">
$ mvn install:install-file -DgroupId=postgresql -DartifactId=postgresql -Dversion=8.4.701.jdbc3
		-Dpackaging=jar -Dfile=postgresql-8.4-701.jdbc3-bnd.jar 

<p>Tony reports no success with the Spring Source bundle, whily the BND approach worked
for the PostgreSQL JDBC driver.</p>

<h2><a name="JackrabbitPersistence-ReplaceDerbyinarunningSlingInstance"></a>Replace
Derby in a running Sling Instance</h2>

<p>To replace Derby in a running Sling instance just uninstall the Derby bundle and
install the JDBC driver bundle through the Web Console (at <tt>/system/console</tt>.</p>

<h2><a name="JackrabbitPersistence-ReplaceDerbyintheSlingBuild"></a>Replace
Derby in the Sling Build</h2>

<p>To replace Derby (included with Sling by default) with the new JDBC driver, the bundle
list file <tt>src/main/bundles/list.xml</tt> of the Sling Launchpad Builder project
can be modified.</p>

<p>Look for the Derby database section:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">

<p>and replace this section by the Maven 2 reference to your JDBC driver.</p>

<p>For example, for the PostgreSQL JDBC driver bundle prepared in the prepared in the
previous step replace the Derby reference with this:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-java">

<h2><a name="JackrabbitPersistence-ReconfiguringJackrabbit"></a>Reconfiguring

<p>Two options:</p>
	<li>Reconfigure after first startup</li>
	<li>Reconfigure build</li>

<h2><a name="JackrabbitPersistence-Credits"></a>Credits</h2>

<p>This description is based on Tony Giaccone's description <a href=""
class="external-link" rel="nofollow">Swapping Postgres for Derby</a> sent to the
Sling Users mailing list.</p>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href=""
class="grey">Change Notification Preferences</a>
       <a href="">View
       <a href=";showCommentArea=true#addcomment">Add

View raw message