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 2014/04/14 21:09:16 UTC

svn commit: r1587286 - in /jackrabbit/oak/trunk: oak-core/pom.xml oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java oak-parent/pom.xml

Author: reschke
Date: Mon Apr 14 19:09:15 2014
New Revision: 1587286

URL: http://svn.apache.org/r1587286
Log:
OAK-1708 - hack DocumentNodeStoreService to support RDBDocumentStore (WIP)

Modified:
    jackrabbit/oak/trunk/oak-core/pom.xml
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
    jackrabbit/oak/trunk/oak-parent/pom.xml

Modified: jackrabbit/oak/trunk/oak-core/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/pom.xml?rev=1587286&r1=1587285&r2=1587286&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-core/pom.xml Mon Apr 14 19:09:15 2014
@@ -38,13 +38,10 @@
         <artifactId>maven-bundle-plugin</artifactId>
         <configuration>
           <instructions>
-            <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple</Embed-Dependency>
+            <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple,postgresql,db2,db2-license</Embed-Dependency>
             <Embed-Transitive>true</Embed-Transitive>
             <Import-Package>
-              org.apache.lucene.*;resolution:=optional,
-              org.osgi.service.jdbc.*;resolution:=optional,
-              com.vividsolutions.jts.*;resolution:=optional,
-              *
+              *;resolution:=optional
             </Import-Package>
             <Export-Package>
               org.apache.jackrabbit.oak,

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java?rev=1587286&r1=1587285&r2=1587286&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java Mon Apr 14 19:09:15 2014
@@ -196,8 +196,6 @@ public class DocumentNodeStoreService {
 
         String jdbcuri = System.getProperty("oak.jdbc.connection.uri", "");
 
-        log.info("jdbcuri {}", jdbcuri);
-
         if (!jdbcuri.isEmpty()) {
             // FIXME
             String username = System.getProperty("oak.jdbc.username", "");
@@ -205,11 +203,12 @@ public class DocumentNodeStoreService {
             String driver = System.getProperty("oak.jdbc.driver.class", "");
 
             if (driver.length() > 0) {
+                log.info("trying to load {}", driver);
+
                 try {
                     Class.forName(driver);
-                } catch (ClassNotFoundException e) {
-                    // TODO Auto-generated catch block
-                    e.printStackTrace();
+                } catch (ClassNotFoundException ex) {
+                    log.error("driver not loaded", ex);
                 }
             }
 

Modified: jackrabbit/oak/trunk/oak-parent/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-parent/pom.xml?rev=1587286&r1=1587285&r2=1587286&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-parent/pom.xml (original)
+++ jackrabbit/oak/trunk/oak-parent/pom.xml Mon Apr 14 19:09:15 2014
@@ -459,14 +459,14 @@
       <id>rdb-db2</id>
       <dependencies>
         <dependency>
-          <groupId>org.example</groupId>
+          <groupId>com.ibm.db2.jcc</groupId>
           <artifactId>db2</artifactId>
           <version>1.0</version>
           <scope>system</scope>
           <systemPath>${db2.jdbc}/db2jcc4.jar</systemPath>
         </dependency>
         <dependency>
-          <groupId>org.example</groupId>
+          <groupId>com.ibm.db2.jcc</groupId>
           <artifactId>db2-license</artifactId>
           <version>1.0</version>
           <scope>system</scope>



Re: svn commit: r1587286 - in /jackrabbit/oak/trunk: oak-core/pom.xml oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java oak-parent/pom.xml

Posted by Chetan Mehrotra <ch...@gmail.com>.
For the record I have implemented a DataSource provider bundle [2]
(based on above flow) as part of SLING-3574. That bundle can be used
to configure a DataSource in OSGi env

Chetan Mehrotra
[1] https://issues.apache.org/jira/browse/SLING-3574
[2] https://github.com/chetanmeh/sling-datasource

On Tue, Apr 15, 2014 at 12:30 PM, Chetan Mehrotra
<ch...@gmail.com> wrote:
>> Register a DataSource where?
>
> DataSource would be registered with OSGi ServiceRegistery
>
>> Does this work in an OSGi context?
>
> Yes it should work in OSGi context. Would try to implement the
> approach by end of week if time permits
>
>> How does it get the DataSource? Per JNDI?
>
> The DataSource would be obtained from OSGi service registry just like
> it currently obtains the BlobStore instance
> Chetan Mehrotra
>
>
> On Tue, Apr 15, 2014 at 12:00 PM, Julian Reschke <ju...@gmx.de> wrote:
>> On 2014-04-15 06:10, Chetan Mehrotra wrote:
>>>
>>> Hi Julian,
>>>
>>> On Tue, Apr 15, 2014 at 12:39 AM,  <re...@apache.org> wrote:
>>>>
>>>> -
>>>> <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple</Embed-Dependency>
>>>> +
>>>> <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple,postgresql,db2,db2-license</Embed-Dependency>
>>>>               <Embed-Transitive>true</Embed-Transitive>
>>>
>>>
>>> I believe this is a temporary change and would not be required for
>>> final implementation? Would be helpful if we add a TODO/FIXME there
>>> such that we remember to remove this later
>>
>>
>> OK.
>>
>>
>>> Instead of embedding all such types of drivers/dbcp/pool etc within
>>> oak-core it would be better to decouple them. For example one approach
>>> can be
>>>
>>> 1. Have a bundle which embeds common-dbcp and required dependencies.
>>> It would be responsible for registering a DataSource
>>
>>
>> Register a DataSource where?
>>
>>
>>> 2. Driver bundle would be fragments to the bundle #1 as host. With
>>> JDBC 4.0 the Driver classes are provided as part of
>>> META-INF/services/java.sql.Driver [1]. For such cases fragment bundles
>>> can be avoided by having #1 monitor for such drivers and register them
>>> programatically
>>
>>
>> Does this work in an OSGi context?
>>
>>
>>> 3. DocumentNodeStoreService should only have a reference to DataSource
>>> and use that
>>
>>
>> How does it get the DataSource? Per JNDI?
>>
>> Best regards, Julian
>>

Re: svn commit: r1587286 - in /jackrabbit/oak/trunk: oak-core/pom.xml oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java oak-parent/pom.xml

Posted by Chetan Mehrotra <ch...@gmail.com>.
> Register a DataSource where?

DataSource would be registered with OSGi ServiceRegistery

> Does this work in an OSGi context?

Yes it should work in OSGi context. Would try to implement the
approach by end of week if time permits

> How does it get the DataSource? Per JNDI?

The DataSource would be obtained from OSGi service registry just like
it currently obtains the BlobStore instance
Chetan Mehrotra


On Tue, Apr 15, 2014 at 12:00 PM, Julian Reschke <ju...@gmx.de> wrote:
> On 2014-04-15 06:10, Chetan Mehrotra wrote:
>>
>> Hi Julian,
>>
>> On Tue, Apr 15, 2014 at 12:39 AM,  <re...@apache.org> wrote:
>>>
>>> -
>>> <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple</Embed-Dependency>
>>> +
>>> <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple,postgresql,db2,db2-license</Embed-Dependency>
>>>               <Embed-Transitive>true</Embed-Transitive>
>>
>>
>> I believe this is a temporary change and would not be required for
>> final implementation? Would be helpful if we add a TODO/FIXME there
>> such that we remember to remove this later
>
>
> OK.
>
>
>> Instead of embedding all such types of drivers/dbcp/pool etc within
>> oak-core it would be better to decouple them. For example one approach
>> can be
>>
>> 1. Have a bundle which embeds common-dbcp and required dependencies.
>> It would be responsible for registering a DataSource
>
>
> Register a DataSource where?
>
>
>> 2. Driver bundle would be fragments to the bundle #1 as host. With
>> JDBC 4.0 the Driver classes are provided as part of
>> META-INF/services/java.sql.Driver [1]. For such cases fragment bundles
>> can be avoided by having #1 monitor for such drivers and register them
>> programatically
>
>
> Does this work in an OSGi context?
>
>
>> 3. DocumentNodeStoreService should only have a reference to DataSource
>> and use that
>
>
> How does it get the DataSource? Per JNDI?
>
> Best regards, Julian
>

Re: svn commit: r1587286 - in /jackrabbit/oak/trunk: oak-core/pom.xml oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java oak-parent/pom.xml

Posted by Julian Reschke <ju...@gmx.de>.
On 2014-04-15 06:10, Chetan Mehrotra wrote:
> Hi Julian,
>
> On Tue, Apr 15, 2014 at 12:39 AM,  <re...@apache.org> wrote:
>> -            <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple</Embed-Dependency>
>> +            <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple,postgresql,db2,db2-license</Embed-Dependency>
>>               <Embed-Transitive>true</Embed-Transitive>
>
> I believe this is a temporary change and would not be required for
> final implementation? Would be helpful if we add a TODO/FIXME there
> such that we remember to remove this later

OK.

> Instead of embedding all such types of drivers/dbcp/pool etc within
> oak-core it would be better to decouple them. For example one approach
> can be
>
> 1. Have a bundle which embeds common-dbcp and required dependencies.
> It would be responsible for registering a DataSource

Register a DataSource where?

> 2. Driver bundle would be fragments to the bundle #1 as host. With
> JDBC 4.0 the Driver classes are provided as part of
> META-INF/services/java.sql.Driver [1]. For such cases fragment bundles
> can be avoided by having #1 monitor for such drivers and register them
> programatically

Does this work in an OSGi context?

> 3. DocumentNodeStoreService should only have a reference to DataSource
> and use that

How does it get the DataSource? Per JNDI?

Best regards, Julian


Re: svn commit: r1587286 - in /jackrabbit/oak/trunk: oak-core/pom.xml oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/DocumentNodeStoreService.java oak-parent/pom.xml

Posted by Chetan Mehrotra <ch...@gmail.com>.
Hi Julian,

On Tue, Apr 15, 2014 at 12:39 AM,  <re...@apache.org> wrote:
> -            <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple</Embed-Dependency>
> +            <Embed-Dependency>commons-dbcp,commons-pool,h2,json-simple,postgresql,db2,db2-license</Embed-Dependency>
>              <Embed-Transitive>true</Embed-Transitive>

I believe this is a temporary change and would not be required for
final implementation? Would be helpful if we add a TODO/FIXME there
such that we remember to remove this later

Instead of embedding all such types of drivers/dbcp/pool etc within
oak-core it would be better to decouple them. For example one approach
can be

1. Have a bundle which embeds common-dbcp and required dependencies.
It would be responsible for registering a DataSource
2. Driver bundle would be fragments to the bundle #1 as host. With
JDBC 4.0 the Driver classes are provided as part of
META-INF/services/java.sql.Driver [1]. For such cases fragment bundles
can be avoided by having #1 monitor for such drivers and register them
programatically
3. DocumentNodeStoreService should only have a reference to DataSource
and use that

Chetan Mehrotra
[1] http://docs.oracle.com/javase/7/docs/api/java/sql/DriverManager.html