incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Sling Website > Jackrabbit Persistence
Date Mon, 14 Jun 2010 08:10:00 GMT
<html>
<head>
    <base href="https://cwiki.apache.org/confluence">
            <link rel="stylesheet" href="/confluence/s/1810/9/1/_/styles/combined.css?spaceKey=SLINGxSITE&amp;forWysiwyg=true"
type="text/css">
    </head>
<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="https://cwiki.apache.org/confluence/display/SLINGxSITE/Jackrabbit+Persistence">Jackrabbit
Persistence</a></h2>
    <h4>Page  <b>added</b> by             <a href="https://cwiki.apache.org/confluence/display/~fmeschbe">Felix
Meschberger</a>
    </h4>
         <br/>
    <div class="notificationGreySide">
         <h1><a name="JackrabbitPersistence-JackrabbitPersistence"></a>Jackrabbit
Persistence</h1>

<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
required:</p>

<ol>
	<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>
</ol>


<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="http://www.springsource.com/repository/"
class="external-link" rel="nofollow">http://www.springsource.com/repository/</a>.</p>

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

<ol>
	<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.bar postgresql-8.4-701.jdbc3-bnd.jar
</pre>
</div></div></li>
	<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 
</pre>
</div></div></li>
</ol>


<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">
&lt;bundle&gt;
    &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
    &lt;artifactId&gt;derby&lt;/artifactId&gt;
    &lt;version&gt;10.5.3.0_1&lt;/version&gt;
&lt;/bundle&gt;
</pre>
</div></div>

<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">
&lt;bundle&gt;
    &lt;groupId&gt;postgresql&lt;/groupId&gt;
    &lt;artifactId&gt;postgresql&lt;/artifactId&gt;
    &lt;version&gt;8.4.701.jdbc3&lt;/version&gt;
&lt;/bundle&gt;
</pre>
</div></div>


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

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



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

<p>This description is based on Tony Giaccone's description <a href="http://markmail.org/message/wlbfrukmjjsl33hh"
class="external-link" rel="nofollow">Swapping Postgres for Derby</a> sent to the
Sling Users mailing list.</p>
    </div>
    <div id="commentsSection" class="wiki-content pageSection">
       <div style="float: right;">
            <a href="https://cwiki.apache.org/confluence/users/viewnotifications.action"
class="grey">Change Notification Preferences</a>
       </div>
       <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Jackrabbit+Persistence">View
Online</a>
              |
       <a href="https://cwiki.apache.org/confluence/display/SLINGxSITE/Jackrabbit+Persistence?showComments=true&amp;showCommentArea=true#addcomment">Add
Comment</a>
           </div>
</div>
</div>
</div>
</div>
</body>
</html>

Mime
View raw message