jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1547439 - in /jackrabbit/oak/trunk: oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java
Date Tue, 03 Dec 2013 15:36:05 GMT
Author: jukka
Date: Tue Dec  3 15:36:05 2013
New Revision: 1547439

URL: http://svn.apache.org/r1547439
Log:
OAK-795: OSGi init issues

Make the JCR Repository available in OSGi again. Note the TODOs

Modified:
    jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java

Modified: jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java?rev=1547439&r1=1547438&r2=1547439&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
(original)
+++ jackrabbit/oak/trunk/oak-it/osgi/src/test/java/org/apache/jackrabbit/oak/osgi/OSGiIT.java
Tue Dec  3 15:36:05 2013
@@ -27,6 +27,8 @@ import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 
 import javax.inject.Inject;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
 
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.junit.Test;
@@ -97,7 +99,16 @@ public class OSGiIT {
     @Test
     public void testNodeStore() {
         System.out.println(store);
-        // System.out.println(store.getRoot());
+        System.out.println(store.getRoot());
+    }
+
+    @Inject
+    private Repository repository;
+
+    @Test
+    public void testRepository() throws RepositoryException {
+        System.out.println(repository);
+        System.out.println(repository.login().getRootNode());
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java?rev=1547439&r1=1547438&r2=1547439&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java
Tue Dec  3 15:36:05 2013
@@ -22,9 +22,25 @@ import java.util.Properties;
 
 import javax.jcr.Repository;
 
+import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.plugins.commit.ConflictValidatorProvider;
+import org.apache.jackrabbit.oak.plugins.commit.JcrConflictHandler;
+import org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider;
+import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider;
+import org.apache.jackrabbit.oak.plugins.index.reference.ReferenceEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.reference.ReferenceIndexProvider;
+import org.apache.jackrabbit.oak.plugins.name.NameValidatorProvider;
+import org.apache.jackrabbit.oak.plugins.name.NamespaceEditorProvider;
+import org.apache.jackrabbit.oak.plugins.nodetype.RegistrationEditorProvider;
+import org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider;
+import org.apache.jackrabbit.oak.plugins.nodetype.write.InitialContent;
+import org.apache.jackrabbit.oak.plugins.version.VersionEditorProvider;
+import org.apache.jackrabbit.oak.spi.commit.EditorHook;
 import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
+import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.whiteboard.OsgiWhiteboard;
 import org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard;
 import org.osgi.framework.BundleActivator;
@@ -53,8 +69,7 @@ public class Activator implements Bundle
     public void start(BundleContext bundleContext) throws Exception {
         context = bundleContext;
         whiteboard = new OsgiWhiteboard(context);
-        tracker = new ServiceTracker(
-                context, ContentRepository.class.getName(), this);
+        tracker = new ServiceTracker(context, NodeStore.class.getName(), this);
         tracker.open();
     }
 
@@ -68,11 +83,30 @@ public class Activator implements Bundle
     @Override
     public Object addingService(ServiceReference reference) {
         Object service = context.getService(reference);
-        if (service instanceof ContentRepository) {
-            ContentRepository repository = (ContentRepository) service;
+        if (service instanceof NodeStore) {
+            // FIXME: get most of these plugins through OSGi
+            ContentRepository cr = new Oak((NodeStore) service)
+                .with(new InitialContent())
+                .with(JcrConflictHandler.JCR_CONFLICT_HANDLER)
+                .with(new EditorHook(new VersionEditorProvider()))
+                .with(whiteboard)
+                .with(securityProvider)
+                .with(new NameValidatorProvider())
+                .with(new NamespaceEditorProvider())
+                .with(new TypeEditorProvider())
+                .with(new RegistrationEditorProvider())
+                .with(new ConflictValidatorProvider())
+                .with(new ReferenceEditorProvider())
+                .with(new ReferenceIndexProvider())
+                .with(new PropertyIndexEditorProvider())
+                .with(new PropertyIndexProvider())
+                .with(new NodeTypeIndexProvider())
+                .withAsyncIndexing()
+                .createContentRepository();
+
             services.put(reference, context.registerService(
                     Repository.class.getName(),
-                    new OsgiRepository(repository, whiteboard, securityProvider),
+                    new OsgiRepository(cr, whiteboard, securityProvider),
                     new Properties()));
             return service;
         } else {



Mime
View raw message