jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chet...@apache.org
Subject svn commit: r1577474 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/AbstractDataStoreService.java
Date Fri, 14 Mar 2014 10:29:39 GMT
Author: chetanm
Date: Fri Mar 14 10:29:39 2014
New Revision: 1577474

URL: http://svn.apache.org/r1577474
Log:
OAK-805 - Support for existing Jackrabbit 2.x DataStores

Closing the DataStore in deactivate

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/AbstractDataStoreService.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/AbstractDataStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/AbstractDataStoreService.java?rev=1577474&r1=1577473&r2=1577474&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/AbstractDataStoreService.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/AbstractDataStoreService.java
Fri Mar 14 10:29:39 2014
@@ -27,6 +27,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
 import org.apache.jackrabbit.core.data.DataStore;
+import org.apache.jackrabbit.core.data.DataStoreException;
 import org.apache.jackrabbit.oak.commons.PropertiesUtil;
 import org.apache.jackrabbit.oak.spi.blob.BlobStore;
 import org.apache.jackrabbit.oak.spi.blob.GarbageCollectableBlobStore;
@@ -43,28 +44,33 @@ public abstract class AbstractDataStoreS
 
     private Logger log = LoggerFactory.getLogger(getClass());
 
+    private DataStore dataStore;
+
     @Activate
     protected void activate(ComponentContext context, Map<String, Object> config) throws
RepositoryException {
-        DataStore dataStore = createDataStore(context, config);
+        DataStore ds = createDataStore(context, config);
 
         String homeDir = lookup(context, PROP_HOME);
         if (homeDir != null) {
             log.debug("Initializing the DataStore with homeDir [{}]", homeDir);
         }
-        PropertiesUtil.populate(dataStore, config, false);
-        dataStore.init(lookup(context, PROP_HOME));
+        PropertiesUtil.populate(ds, config, false);
+        ds.init(lookup(context, PROP_HOME));
+        this.dataStore = new DataStoreBlobStore(ds);
         reg = context.getBundleContext().registerService(new String[]{
                 DataStore.class.getName(),
                 BlobStore.class.getName(),
                 GarbageCollectableBlobStore.class.getName()
-        }, new DataStoreBlobStore(dataStore), null);
+        }, ds , null);
     }
 
     @Deactivate
-    protected void deactivate() {
+    protected void deactivate() throws DataStoreException {
         if (reg != null) {
             reg.unregister();
         }
+
+        dataStore.close();
     }
 
     protected abstract DataStore createDataStore(ComponentContext context, Map<String,
Object> config);
@@ -72,7 +78,7 @@ public abstract class AbstractDataStoreS
     protected static String lookup(ComponentContext context, String property) {
         //Prefer property from BundleContext first
         if (context.getBundleContext().getProperty(property) != null) {
-            return context.getBundleContext().getProperty(property).toString();
+            return context.getBundleContext().getProperty(property);
         }
 
         if (context.getProperties().get(property) != null) {



Mime
View raw message