incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1514742 - in /sling/whiteboard/bdelacretaz: bdelacretaz-oak-server/ bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/ it-repository/src/test/java/org/apache/sling/jcr/repository/it/ oak-launchpad/src/main/bundles/
Date Fri, 16 Aug 2013 14:48:57 GMT
Author: bdelacretaz
Date: Fri Aug 16 14:48:56 2013
New Revision: 1514742

URL: http://svn.apache.org/r1514742
Log:
SLING-2788 - enable Oak search functionality and add a few other Oak components

Modified:
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
    sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
    sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
    sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml

Modified: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml?rev=1514742&r1=1514741&r2=1514742&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml (original)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml Fri Aug 16 14:48:56 2013
@@ -95,6 +95,12 @@
             <version>${oak.version}</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-lucene</artifactId>
+            <version>${oak.version}</version>
+            <scope>provided</scope>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.sling</groupId>

Modified: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java?rev=1514742&r1=1514741&r2=1514742&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
(original)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
Fri Aug 16 14:48:56 2013
@@ -31,6 +31,20 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Service;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.plugins.commit.ConflictValidatorProvider;
+import org.apache.jackrabbit.oak.plugins.commit.JcrConflictHandler;
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider;
+import org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider;
+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.name.NameValidatorProvider;
+import org.apache.jackrabbit.oak.plugins.name.NamespaceValidatorProvider;
+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;
@@ -54,10 +68,35 @@ public class SlingRepositoryImpl extends
     
     @Activate
     protected void activate(ComponentContext ctx) {
+        // TODO OpenSecurityProvider does not check anything, should use 
+        // at least a SecurityProviderImpl, but that doesn't work with oak 0.8
+        // (LoginModule class not found)
         final SecurityProvider sp = new OpenSecurityProvider();
-        // TODO barebones setup for now...might not provide much functionality.
-        // TODO for a simple config (tar persistence) we could use the SegmentNodeStoreService
-        oakRepository = new Jcr(new Oak(nodeStore)).with(sp).createRepository();
+        
+        oakRepository = new Jcr(new Oak(nodeStore))
+        .with(sp)
+        .with(new InitialContent())
+
+        .with(JcrConflictHandler.JCR_CONFLICT_HANDLER)
+        .with(new EditorHook(new VersionEditorProvider()))
+
+        .with(new NameValidatorProvider())
+        .with(new NamespaceValidatorProvider())
+        .with(new TypeEditorProvider())
+        .with(new RegistrationEditorProvider())
+        .with(new ConflictValidatorProvider())
+
+        // index stuff
+        .with(new PropertyIndexEditorProvider())
+
+        .with(new PropertyIndexProvider())
+        .with(new NodeTypeIndexProvider())
+
+        .with(new LuceneIndexEditorProvider())
+        .with(new LuceneIndexProvider())
+
+        //.withAsyncIndexing() // TODO oak 0.9?
+        .createRepository();
     }
     
     @Override

Modified: sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java?rev=1514742&r1=1514741&r2=1514742&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
(original)
+++ sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
Fri Aug 16 14:48:56 2013
@@ -104,11 +104,12 @@ public class OakRepositoryIT extends Sli
                 mavenBundle("org.apache.jackrabbit", "jackrabbit-jcr-commons", "2.7.0"),
                 mavenBundle("org.apache.jackrabbit", "jackrabbit-jcr-rmi", "2.4.2"),
                 mavenBundle("org.apache.jackrabbit", "oak-core", oakVersion),
-                //mavenBundle("org.apache.jackrabbit", "oak-jcr", oakVersion),
+                //embedded in server bundle for now mavenBundle("org.apache.jackrabbit",
"oak-jcr", oakVersion),
                 mavenBundle("org.apache.jackrabbit", "oak-commons", oakVersion),
                 mavenBundle("org.apache.jackrabbit", "oak-mk", oakVersion),
                 mavenBundle("org.apache.jackrabbit", "oak-mk-api", oakVersion),
                 mavenBundle("org.apache.jackrabbit", "oak-mk-remote", oakVersion),
+                mavenBundle("org.apache.jackrabbit", "oak-lucene", oakVersion),
 
                 // Testing
                 mavenBundle("org.apache.sling", "org.apache.sling.testing.tools", "1.0.6"),

Modified: sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java?rev=1514742&r1=1514741&r2=1514742&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
(original)
+++ sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/SlingRepositoryITBase.java
Fri Aug 16 14:48:56 2013
@@ -23,9 +23,11 @@ import static org.junit.Assert.assertNot
 import javax.inject.Inject;
 import javax.jcr.Credentials;
 import javax.jcr.Node;
+import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
+import javax.jcr.query.Query;
 
 import org.apache.sling.jcr.api.SlingRepository;
 import org.junit.Ignore;
@@ -87,6 +89,34 @@ public abstract class SlingRepositoryITB
     }
 
     @Test
+    public void testQuery() throws RepositoryException {
+        final Session s = repository.loginAdministrative(null);
+        final String id = "ID_" + System.currentTimeMillis();
+        final String propName = "PROP_" + id;
+        final String value = "VALUE_" + id;
+        try {
+            final int N_NODES = 100;
+            for(int i=0 ; i < N_NODES; i++) {
+                final Node root = s.getRootNode();
+                root.addNode(id + i).setProperty(propName, value);
+            }
+            s.save();
+            
+            final String stmt = "SELECT * FROM nt:base WHERE " + propName + " IS NOT NULL";
+            final Query q = s.getWorkspace().getQueryManager().createQuery(stmt, Query.SQL);
+            final NodeIterator it = q.execute().getNodes();
+            int count = 0;
+            while(it.hasNext()) {
+                it.next();
+                count++;
+            }
+            assertEquals("Expected " + N_NODES + " result for query " + stmt, N_NODES, count);
+        } finally {
+            s.logout();
+        }
+    }
+    
+    @Test
     public final void checkRepositoryDescriptors() {
         doCheckRepositoryDescriptors();
     }

Modified: sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml?rev=1514742&r1=1514741&r2=1514742&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml (original)
+++ sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml Fri Aug 16 14:48:56
2013
@@ -526,6 +526,11 @@
             <artifactId>oak-mk-remote</artifactId>
             <version>0.8</version>
         </bundle>
+        <bundle>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-lucene</artifactId>
+            <version>0.8</version>
+        </bundle>
         
         <!-- Jackrabbit bundles that Oak 0.8 needs -->
         <bundle>



Mime
View raw message