jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexparvule...@apache.org
Subject svn commit: r1521770 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
Date Wed, 11 Sep 2013 09:29:05 GMT
Author: alexparvulescu
Date: Wed Sep 11 09:29:04 2013
New Revision: 1521770

URL: http://svn.apache.org/r1521770
Log:
OAK-1010 Unify the repository home config for the OSGi setup


Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java?rev=1521770&r1=1521769&r2=1521770&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/segment/SegmentNodeStoreService.java
Wed Sep 11 09:29:04 2013
@@ -53,7 +53,7 @@ public class SegmentNodeStoreService ext
     public static final String NAME = "name";
 
     @Property(description="TarMK directory (if unset, use MongoDB)")
-    public static final String DIRECTORY = "directory";
+    public static final String DIRECTORY = "repository.home";
 
     @Property(description="MongoDB host", value="localhost")
     public static final String HOST = "host";
@@ -90,8 +90,8 @@ public class SegmentNodeStoreService ext
         Dictionary<?, ?> properties = context.getProperties();
         name = "" + properties.get(NAME);
 
-        if (properties.get(DIRECTORY) != null) {
-            String directory = properties.get(DIRECTORY).toString();
+        String directory = readDirectory(context);
+        if (directory != null) {
 
             mongo = null;
             store = new FileStore(directory);
@@ -112,6 +112,16 @@ public class SegmentNodeStoreService ext
         delegate = new SegmentNodeStore(store);
     }
 
+    private static String readDirectory(ComponentContext context) {
+        if (context.getProperties().get(DIRECTORY) != null) {
+            return context.getProperties().get(DIRECTORY).toString();
+        }
+        if (context.getBundleContext().getProperty(DIRECTORY) != null) {
+            return context.getBundleContext().getProperty(DIRECTORY).toString();
+        }
+        return null;
+    }
+
     @Deactivate
     public synchronized void deactivate() {
         delegate = null;

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java?rev=1521770&r1=1521769&r2=1521770&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/osgi/MicroKernelService.java
Wed Sep 11 09:29:04 2013
@@ -34,7 +34,7 @@ public class MicroKernelService extends 
     public static final String NAME = "name";
 
     @Property(description="The home directory (in-memory if not set)")
-    public static final String HOME_DIR = "homeDir";
+    public static final String HOME_DIR = "repository.home";
 
     private String name;
 
@@ -45,13 +45,23 @@ public class MicroKernelService extends 
 
     @Activate
     public void activate(ComponentContext context) {
-        Object homeDir = context.getProperties().get(HOME_DIR);
         name = "" + context.getProperties().get(NAME);
+        String homeDir = readDirectory(context);
         if (homeDir != null) {
-            init(homeDir.toString());
+            init(homeDir);
         }
     }
 
+    private static String readDirectory(ComponentContext context) {
+        if (context.getProperties().get(HOME_DIR) != null) {
+            return context.getProperties().get(HOME_DIR).toString();
+        }
+        if (context.getBundleContext().getProperty(HOME_DIR) != null) {
+            return context.getBundleContext().getProperty(HOME_DIR).toString();
+        }
+        return null;
+    }
+
     @Deactivate
     public void deactivate() {
         dispose();



Mime
View raw message