You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by re...@apache.org on 2019/12/16 14:53:51 UTC

svn commit: r1871665 - in /jackrabbit/oak/trunk/oak-doc/src/site/markdown: nodestore/document/rdb-document-store.md osgi_config.md

Author: reschke
Date: Mon Dec 16 14:53:51 2019
New Revision: 1871665

URL: http://svn.apache.org/viewvc?rev=1871665&view=rev
Log:
OAK-8833: RDB*Store: improve OSGi related documentation

Modified:
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/document/rdb-document-store.md
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/osgi_config.md

Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/document/rdb-document-store.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/document/rdb-document-store.md?rev=1871665&r1=1871664&r2=1871665&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/document/rdb-document-store.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/nodestore/document/rdb-document-store.md Mon Dec 16 14:53:51 2019
@@ -57,6 +57,53 @@ will attempt to start anyway):
 ~~~
 
 
+## <a name="initialization"></a> Initialization
+
+The recommended method to initialize a `DocumentNodeStore` with an
+`RDBDocumentStore` is using an OSGi container and configure the
+`DocumentNodeStoreService`. See corresponding [Repository OSGi Configuration](../../osgi_config.html#document-node-store).
+
+This will also require deploying the [Sling DataSource provider](https://sling.apache.org/documentation/bundles/datasource-providers.html)
+and furthermore the associated JDBC driver as OSGi bundle. The details of the
+latter vary by database:
+
+1. If the JDBC driver already is an OSGI bundle, it can be deployed as is. This
+   is the case for Apache Derby, H2DB, IBM DB2, Microsoft SQL Server, MySQL,
+   and PostgreSQL. Some of these drivers also implement the [OSGi Data Service Specification for JDBC](https://osgi.org/specification/osgi.cmpn/7.0.0/service.jdbc.html) ,
+   in which case `org.osgi.service.jdbc-1.0.0.jar` needs to be deployed as well (this is the case for IBM DB2, Microsoft SQL Server, and PostgreSQL).
+2. Otherwise (e.g., Oracle), an OSGi wrapper needs to be built. See [below](#wrap-osgi).
+
+
+
+Alternatively an RDB based DocumentNodeStore can be created with the help of
+a `RDBDocumentNodeStoreBuilder`.
+
+    DataSource dataSource = RDBDataSourceFactory.forJdbcUrl(jdbcurl, user, pw);
+    DocumentNodeStore store = RDBDocumentNodeStoreBuilder().newRDBDocumentNodeStoreBuilder()
+        .setRDBConnection(dataSource).build();
+    // do something with the store
+    NodeState root = store.getRoot();
+
+    // dispose it when done
+    store.dispose();
+
+### <a name="wrap-osgi"></a> Example: Creating OSGi Bundle for Oracle JDBC driver
+
+1. Make sure to have a local copy of the JDBC driver, for instance `ojdbc8-12.2.0.1.jar`.
+2. Get BND command line tool from https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/4.3.1/biz.aQute.bnd-4.3.1.jar
+3. Create BND `ora.bnd` below:
+~~~
+ -classpath: ojdbc8-12.2.0.1.jar
+ Bundle-SymbolicName: com.oracle.jdbc.ojdbc8
+ ver: 12.2.0.1
+ -output: ${bsn}-${ver}.jar
+ Bundle-Version: ${ver}
+ Include-Resource: @ojdbc8-12.2.0.1.jar
+ Import-Package: *;resolution:=optional
+~~~
+Then run `java -jar biz.aQute.bnd-4.3.1.jar ora.bnd`; this should create the OSGi bundle `com.oracle.jdbc.ojdbc8-12.2.0.1.jar`.
+
+
 ## <a name="database-creation"></a> Database Creation
 
 `RDBDocumentStore` relies on JDBC, and thus, in general, can not create

Modified: jackrabbit/oak/trunk/oak-doc/src/site/markdown/osgi_config.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-doc/src/site/markdown/osgi_config.md?rev=1871665&r1=1871664&r2=1871665&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-doc/src/site/markdown/osgi_config.md (original)
+++ jackrabbit/oak/trunk/oak-doc/src/site/markdown/osgi_config.md Mon Dec 16 14:53:51 2019
@@ -262,12 +262,18 @@ sharedDSRepoId | "" | Custom SharedDataS
 blobTrackSnapshotIntervalInSecs | 43200 (12 hrs) | The blob ids cached/tracked locally are synchronized with the DataStore at this interval. Any additions and deletions will be visible to other cluster nodes or repositories connected to the shared DatStore after this. This should be less than the blobGcMaxAgeInSecs parameter above and the frequency of blob gc. See [Blob tracker][blobtracker]. | 1.5.6 
 updateLimit | 100000 | The number of updates kept in memory until changes are written to a branch in the DocumentStore | 1.7.0  
 leaseCheckMode | STRICT | The lease check mode. `STRICT` is the default and will stop the DocumentNodeStore as soon as the lease expires. `LENIENT` will give the background lease update a chance to renew the lease even when the lease expired. This mode is only recommended for development, e.g. when debugging an application and the lease may expire when the JVM is stopped at a breakpoint. | 1.9.6
+documentStoreType | MONGO | Set to "RDB" for `RDBDocumentStore`; will require a configured Sling DataSource called `oak`. | 1.0
 
-Example config file
+Example config file for `MongoDocumentStore`:
 
     mongouri=mongodb://localhost:27017
     db=oak
     
+Example config file for `RDBDocumentStore`:
+
+    documentStoreType=RDB
+    datasource.target=(datasource.name=oak)
+
 ##### Mongo Configuration
 
 All the configuration related to Mongo can be specified via [Mongo URI][1]
@@ -287,6 +293,14 @@ All the configuration related to Mongo c
 One can also specify the connection pool size, socket timeout etc. For complete details about various 
 possible option refer to [Mongo URI][1]  
 
+##### RDB Configuration
+
+The service operates on a JDBC `DataSource`. The configuration happens through
+the OSGi service that provides the data source, for instance the
+[Sling DataSource provider](https://sling.apache.org/documentation/bundles/datasource-providers.html).
+
+
+
 <a name="config-blobstore"></a>  
 ### Configuring DataStore/BlobStore
 BlobStores are used to store the binary content. Support for Jackrabbit 2 `DataStore` is also provided via