incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1521913 - in /sling/whiteboard/bdelacretaz: bdelacretaz-oak-server/ bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/ it-repository/ it-repository/src/test/java/org/apache/sling/jcr/repository/it/ oak-launchpad/src/main/bun...
Date Wed, 11 Sep 2013 15:48:17 GMT
Author: bdelacretaz
Date: Wed Sep 11 15:48:17 2013
New Revision: 1521913

URL: http://svn.apache.org/r1521913
Log:
SLING-2788 - loginAdministrative and Sling node types work now

Modified:
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/JcrRepositoryHacks.java
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/OakSlingRepository.java
    sling/whiteboard/bdelacretaz/it-repository/pom.xml
    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=1521913&r1=1521912&r2=1521913&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml (original)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml Wed Sep 11 15:48:17 2013
@@ -38,7 +38,7 @@
 
     <properties>
         <sling.java.version>6</sling.java.version>
-        <oak.version>0.8-r1520083</oak.version>
+        <oak.version>0.9-SNAPSHOT</oak.version>
     </properties>
 
     <build>

Modified: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/JcrRepositoryHacks.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/JcrRepositoryHacks.java?rev=1521913&r1=1521912&r2=1521913&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/JcrRepositoryHacks.java
(original)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/JcrRepositoryHacks.java
Wed Sep 11 15:48:17 2013
@@ -23,7 +23,7 @@ import javax.jcr.Session;
 
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.jcr.RepositoryImpl;
+import org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard;
 

Modified: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/OakSlingRepository.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/OakSlingRepository.java?rev=1521913&r1=1521912&r2=1521913&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/OakSlingRepository.java
(original)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/OakSlingRepository.java
Wed Sep 11 15:48:17 2013
@@ -17,7 +17,11 @@
  */
 package org.apache.sling.oak.server;
 
+import static com.google.common.collect.ImmutableSet.of;
+import static com.google.common.collect.Lists.newArrayList;
 import static java.util.Collections.singleton;
+import static org.apache.jackrabbit.oak.plugins.index.IndexConstants.INDEX_DEFINITIONS_NAME;
+import static org.apache.jackrabbit.oak.plugins.index.IndexUtils.createIndexDefinition;
 
 import java.security.Principal;
 import java.security.PrivilegedActionException;
@@ -44,10 +48,27 @@ import org.apache.felix.scr.annotations.
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.AuthInfo;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.jcr.RepositoryImpl;
+import org.apache.jackrabbit.oak.jcr.repository.RepositoryImpl;
+import org.apache.jackrabbit.oak.plugins.commit.ConflictValidatorProvider;
+import org.apache.jackrabbit.oak.plugins.commit.JcrConflictHandler;
+import org.apache.jackrabbit.oak.plugins.index.aggregate.AggregateIndexProvider;
+import org.apache.jackrabbit.oak.plugins.index.aggregate.NodeAggregator;
+import org.apache.jackrabbit.oak.plugins.index.aggregate.SimpleNodeAggregator;
 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.lucene.util.LuceneIndexHelper;
+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.security.SecurityProviderImpl;
+import org.apache.jackrabbit.oak.spi.commit.EditorHook;
+import org.apache.jackrabbit.oak.spi.lifecycle.RepositoryInitializer;
 import org.apache.jackrabbit.oak.spi.security.ConfigurationParameters;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.AuthInfoImpl;
@@ -57,6 +78,8 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.apache.jackrabbit.oak.spi.security.user.UserConfiguration;
 import org.apache.jackrabbit.oak.spi.security.user.UserConstants;
 import org.apache.jackrabbit.oak.spi.security.user.action.AccessControlAction;
+import org.apache.jackrabbit.oak.spi.state.NodeBuilder;
+import org.apache.jackrabbit.oak.spi.state.NodeState;
 import org.apache.jackrabbit.oak.spi.state.NodeStore;
 import org.apache.jackrabbit.oak.spi.whiteboard.OsgiWhiteboard;
 import org.apache.jackrabbit.oak.spi.whiteboard.Whiteboard;
@@ -89,11 +112,34 @@ public class OakSlingRepository extends 
         final Whiteboard whiteboard = new OsgiWhiteboard(ctx.getBundleContext());
         securityProvider = new SecurityProviderImpl(buildSecurityConfig());
         final Oak oak = new Oak(nodeStore)
+        .with(new InitialContent())
+        .with(new ExtraSlingContent())
+
+        .with(JcrConflictHandler.JCR_CONFLICT_HANDLER)
+        .with(new EditorHook(new VersionEditorProvider()))
+
         .with(securityProvider)
+
+        .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())
+        .with(AggregateIndexProvider.wrap(new LuceneIndexProvider()
+                .with(getNodeAggregator())))
+
+        .with(getDefaultWorkspace())
         .withAsyncIndexing()
-        .with(whiteboard);
+        .with(whiteboard)
+        ;
         
         final ContentRepository contentRepository = oak.createContentRepository();  
         jcrRepository = new JcrRepositoryHacks(contentRepository, whiteboard, securityProvider);
@@ -106,6 +152,12 @@ public class OakSlingRepository extends 
         tearDown();
     }
     
+    private static NodeAggregator getNodeAggregator() {
+        return new SimpleNodeAggregator()
+            .newRuleWithName("nt:file", newArrayList("jcr:content"))
+            ;
+    }
+    
     @Override
     public String getDescriptor(String key) {
         return jcrRepository.getDescriptor(key);
@@ -177,6 +229,59 @@ public class OakSlingRepository extends 
         return adminSession;
     }
     
+    private static final class ExtraSlingContent implements RepositoryInitializer {
+
+        @Override
+        public NodeState initialize(NodeState state) {
+            NodeBuilder root = state.builder();
+            if (root.hasChildNode(INDEX_DEFINITIONS_NAME)) {
+                NodeBuilder index = root.child(INDEX_DEFINITIONS_NAME);
+                
+                // jcr: 
+                property(index, "jcrLanguage", "jcr:language");
+                property(index, "jcrLockOwner", "jcr:lockOwner");
+                
+                // sling:
+                property(index, "slingAlias", "sling:alias");
+                property(index, "slingResource", "sling:resource");
+                property(index, "slingResourceType", "sling:resourceType");
+                property(index, "slingVanityPath", "sling:vanityPath");
+                
+                // various
+                property(index, "event.job.topic", "event.job.topic");
+                property(index, "extensionType", "extensionType");
+                property(index, "lockCreated", "lock.created");
+                property(index, "status", "status");
+                property(index, "type", "type");
+
+                // lucene full-text index
+                if (!index.hasChildNode("lucene")) {
+                    LuceneIndexHelper.newLuceneIndexDefinition(
+                            index, "lucene", LuceneIndexHelper.JR_PROPERTY_INCLUDES,
+                            of(
+                               "jcr:createdBy",
+                               "jcr:lastModifiedBy", 
+                               "sling:alias", 
+                               "sling:resourceType",
+                               "sling:vanityPath"),
+                            "async");
+                }
+                
+            }
+            return root.getNodeState();
+        }
+        
+        /**
+         * A convenience method to create a non-unique property index.
+         */
+        private static void property(NodeBuilder index, String indexName, String propertyName)
{
+            if (!index.hasChildNode(indexName)) {
+                createIndexDefinition(index, indexName, true, false, singleton(propertyName),
null);
+            }
+        }
+        
+    }
+    
     // TODO: use proper osgi configuration (once that works in oak)
     private static ConfigurationParameters buildSecurityConfig() {
         Map<String, Object> userConfig = new HashMap<String, Object>();

Modified: sling/whiteboard/bdelacretaz/it-repository/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-repository/pom.xml?rev=1521913&r1=1521912&r2=1521913&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/it-repository/pom.xml (original)
+++ sling/whiteboard/bdelacretaz/it-repository/pom.xml Wed Sep 11 15:48:17 2013
@@ -27,7 +27,7 @@
         <url.version>1.5.2</url.version>
         <org.ops4j.pax.logging.DefaultServiceLog.level>INFO</org.ops4j.pax.logging.DefaultServiceLog.level>
         <org.ops4j.pax.url.mvn.settings></org.ops4j.pax.url.mvn.settings>
-        <oak.version>0.8-r1520083</oak.version>
+        <oak.version>0.9-SNAPSHOT</oak.version>
     </properties>
 
     <build>

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=1521913&r1=1521912&r2=1521913&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
Wed Sep 11 15:48:17 2013
@@ -104,7 +104,7 @@ public class OakRepositoryIT extends Sli
                 mavenBundle("org.apache.jackrabbit", "jackrabbit-jcr-commons", "2.8-SNAPSHOT"),
                 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 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),

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=1521913&r1=1521912&r2=1521913&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
Wed Sep 11 15:48:17 2013
@@ -55,12 +55,19 @@ public abstract class SlingRepositoryITB
     }
     
     @Test
-    public void testLogin() throws RepositoryException {
+    public void testLoginAdministrative() throws RepositoryException {
         final Session s = repository.loginAdministrative(null);
         assertNotNull(s);
         s.logout();
     }
 
+    @Test
+    @Ignore("Fails on Oak: javax.security.auth.login.LoginException: unable to find LoginModule
class: org.apache.jackrabbit.oak.spi.security.authentication.GuestLoginModule")
+    public void testAdminLogin() throws RepositoryException {
+        final Credentials creds = new SimpleCredentials("admin", "admin".toCharArray());
+        repository.login(creds).logout();
+    }
+    
     @Test(expected=RepositoryException.class)
     public void testWrongLogin() throws RepositoryException {
         final Credentials creds = new SimpleCredentials("badName", "badPAssword".toCharArray());
@@ -93,7 +100,6 @@ public abstract class SlingRepositoryITB
     }
 
     @Test
-    @Ignore("doesn't seem to work with Oak 0.8")
     public void testCreateRetrieveSlingFolder() throws RepositoryException {
         assertCreateRetrieveNode("sling:Folder");
     }

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=1521913&r1=1521912&r2=1521913&view=diff
==============================================================================
--- sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml (original)
+++ sling/whiteboard/bdelacretaz/oak-launchpad/src/main/bundles/list.xml Wed Sep 11 15:48:17
2013
@@ -502,37 +502,39 @@
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-core</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
+<!-- embedded for now
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-jcr</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
+-->
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-commons</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-mk</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-mk-api</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-mk-remote</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.jackrabbit</groupId>
             <artifactId>oak-lucene</artifactId>
-            <version>0.8-r1520083</version>
+            <version>0.9-SNAPSHOT</version>
         </bundle>
         
         <!-- Jackrabbit bundles that Oak 0.8 needs -->



Mime
View raw message