jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1398710 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/ oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/ oak-core/...
Date Tue, 16 Oct 2012 09:39:49 GMT
Author: angela
Date: Tue Oct 16 09:39:48 2012
New Revision: 1398710

URL: http://svn.apache.org/viewvc?rev=1398710&view=rev
Log:
- remove hardcoded SecurityProvider in RepositoryImpl and ContentRepositoryImpl
- remove unused constructors in RepositoryImpl and ContentRepositoryImpl

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryFactory.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/Activator.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/OsgiRepository.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
    jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/CustomPrivilegeTest.java
    jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/Activator.java
    jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/SlingRepositoryImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/ContentRepositoryImpl.java
Tue Oct 16 09:39:48 2012
@@ -22,18 +22,13 @@ import javax.jcr.NoSuchWorkspaceExceptio
 import javax.security.auth.login.LoginException;
 
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
 import org.apache.jackrabbit.oak.kernel.KernelNodeStore;
 import org.apache.jackrabbit.oak.plugins.commit.AnnotatingConflictHandlerProvider;
-import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.spi.commit.CommitHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.ConflictHandlerProvider;
-import org.apache.jackrabbit.oak.spi.commit.DefaultValidatorProvider;
-import org.apache.jackrabbit.oak.spi.commit.ValidatingHook;
-import org.apache.jackrabbit.oak.spi.commit.ValidatorProvider;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
 import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
@@ -64,44 +59,6 @@ public class ContentRepositoryImpl imple
     private final NodeStore nodeStore;
 
     /**
-     * Utility constructor that creates a new in-memory repository with default
-     * query index provider. This constructor is intended to be used within
-     * test cases only.
-     */
-    public ContentRepositoryImpl() {
-        this(new CompositeHook());
-    }
-
-    public ContentRepositoryImpl(CommitHook hook) {
-        this(new MicroKernelImpl(), new CompositeQueryIndexProvider(), hook, null);
-    }
-
-    /**
-     * Utility constructor, intended to be used within test cases only.
-     *
-     * Creates an Oak repository instance based on the given, already
-     * initialized components.
-     *
-     * @param microKernel
-     *            underlying kernel instance
-     * @param indexProvider
-     *            index provider
-     * @param validatorProvider
-     *            the validation provider
-     */
-    public ContentRepositoryImpl(
-            MicroKernel microKernel, QueryIndexProvider indexProvider,
-            ValidatorProvider validatorProvider) {
-        this(microKernel, indexProvider,
-                new ValidatingHook(validatorProvider != null ? validatorProvider : DefaultValidatorProvider.INSTANCE),
-                null);
-    }
-
-    public ContentRepositoryImpl(MicroKernel microKernel, ValidatorProvider validatorProvider)
{
-        this(microKernel, null, validatorProvider);
-    }
-
-    /**
      * Creates an content repository instance based on the given, already
      * initialized components.
      *
@@ -132,11 +89,7 @@ public class ContentRepositoryImpl imple
                                  SecurityProvider securityProvider) {
         this.nodeStore = nodeStore;
         this.indexProvider = indexProvider != null ? indexProvider : new CompositeQueryIndexProvider();
-
-        // TODO: in order not to having failing tests we use SecurityProviderImpl as default
-        //       - review if passing a security provider should be mandatory
-        //       - review if another default (not enforcing any security constraint) was
more appropriate.
-        this.securityProvider = (securityProvider == null) ? new SecurityProviderImpl() :
securityProvider;
+        this.securityProvider = securityProvider;
     }
 
     @Nonnull

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/LuceneIndexQueryTest.java
Tue Oct 16 09:39:48 2012
@@ -50,7 +50,7 @@ public class LuceneIndexQueryTest extend
                         TEST_INDEX_HOME));
         MicroKernel mk = new MicroKernelImpl();
         createDefaultKernelTracker().available(mk);
-        return new Oak(mk).with(qip).with(ch).createContentRepository();
+        return new Oak(mk).with(qip).with(ch).with(getSecurityProvider()).createContentRepository();
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/old/QueryTest.java
Tue Oct 16 09:39:48 2012
@@ -17,7 +17,6 @@ import org.apache.jackrabbit.mk.core.Mic
 import org.apache.jackrabbit.mk.index.IndexWrapper;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
-import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.query.AbstractQueryTest;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider;
@@ -45,7 +44,7 @@ public class QueryTest extends AbstractQ
         QueryIndexProvider qip = new CompositeQueryIndexProvider(pi);
         CompositeHook hook = new CompositeHook(pi);
         createDefaultKernelTracker().available(mk);
-        return new Oak(mk).with(qip).with(hook).createContentRepository();
+        return new Oak(mk).with(qip).with(hook).with(getSecurityProvider()).createContentRepository();
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/plugins/index/property/PropertyIndexQueryTest.java
Tue Oct 16 09:39:48 2012
@@ -39,7 +39,7 @@ public class PropertyIndexQueryTest exte
         CommitHook ch = new CompositeHook(new PropertyIndexHook());
         MicroKernel mk = new MicroKernelImpl();
         createDefaultKernelTracker().available(mk);
-        return new Oak(mk).with(qip).with(ch).createContentRepository();
+        return new Oak(mk).with(qip).with(ch).with(getSecurityProvider()).createContentRepository();
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/AbstractQueryTest.java
Tue Oct 16 09:39:48 2012
@@ -43,7 +43,9 @@ import org.apache.jackrabbit.oak.api.Tre
 import org.apache.jackrabbit.oak.api.Type;
 import org.apache.jackrabbit.oak.commons.PathUtils;
 import org.apache.jackrabbit.oak.plugins.index.IndexConstants;
+import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.spi.query.PropertyValues;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -112,6 +114,10 @@ public abstract class AbstractQueryTest 
                 session.getLatestRoot(), null);
     }
 
+    protected SecurityProvider getSecurityProvider() {
+        return new SecurityProviderImpl();
+    }
+
     @Test
     public void sql1() throws Exception {
         test("sql1.txt");

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/query/index/TraversingIndexQueryTest.java
Tue Oct 16 09:39:48 2012
@@ -29,7 +29,7 @@ public class TraversingIndexQueryTest ex
     protected ContentRepository createRepository() {
         MicroKernel mk = new MicroKernelImpl();
         createDefaultKernelTracker().available(mk);
-        return new Oak(mk).createContentRepository();
+        return new Oak(mk).with(getSecurityProvider()).createContentRepository();
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryFactory.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/OakRepositoryFactory.java
Tue Oct 16 09:39:48 2012
@@ -16,18 +16,20 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Map;
+import java.util.concurrent.Executors;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.RepositoryFactory;
 
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Map;
+import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 
 public class OakRepositoryFactory implements RepositoryFactory {
 
-    private static final String REPOSITORY_URI =
-            "org.apache.jackrabbit.repository.uri";
+    private static final String REPOSITORY_URI = "org.apache.jackrabbit.repository.uri";
 
     @SuppressWarnings({"rawtypes", "unchecked"})
     @Override
@@ -49,7 +51,7 @@ public class OakRepositoryFactory implem
             URI uri, Map<String, String> parameters)
             throws RepositoryException {
         // TODO correctly interpret uri
-        return new RepositoryImpl();
+        return new RepositoryImpl(new MicroKernelImpl(), Executors.newScheduledThreadPool(0),
new SecurityProviderImpl());
     }
 
 }

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/RepositoryImpl.java
Tue Oct 16 09:39:48 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
-import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import javax.jcr.Credentials;
 import javax.jcr.Repository;
@@ -27,7 +26,6 @@ import javax.security.auth.login.LoginEx
 
 import org.apache.jackrabbit.commons.SimpleValueFactory;
 import org.apache.jackrabbit.mk.api.MicroKernel;
-import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.api.ContentSession;
@@ -37,7 +35,6 @@ import org.apache.jackrabbit.oak.plugins
 import org.apache.jackrabbit.oak.plugins.name.NamespaceValidatorProvider;
 import org.apache.jackrabbit.oak.plugins.nodetype.InitialContent;
 import org.apache.jackrabbit.oak.plugins.nodetype.TypeValidatorProvider;
-import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeValidatorProvider;
 import org.apache.jackrabbit.oak.spi.commit.CompositeHook;
 import org.apache.jackrabbit.oak.spi.commit.CompositeValidatorProvider;
@@ -77,23 +74,8 @@ public class RepositoryImpl implements R
 
     private final SecurityProvider securityProvider;
 
-    /**
-     * Utility constructor that creates a new in-memory repository for use
-     * mostly in test cases. The executor service is initialized with an
-     * empty thread pool, so things like observation won't work by default.
-     * Use the other constructor with a properly managed executor service
-     * if such features are needed.
-     */
-    public RepositoryImpl() {
-        this(new MicroKernelImpl(), Executors.newScheduledThreadPool(0));
-    }
-
-    public RepositoryImpl(MicroKernel kernel, ScheduledExecutorService executor) {
-        this(kernel, executor, new SecurityProviderImpl());
-    }
-
     public RepositoryImpl(MicroKernel kernel, ScheduledExecutorService executor,
-                           SecurityProvider securityProvider) {
+                          SecurityProvider securityProvider) {
         this(new Oak(setupInitialContent(kernel))
                 .with(DEFAULT_COMMIT_HOOK).with(securityProvider)
                 .createContentRepository(),

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=1398710&r1=1398709&r2=1398710&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 Oct 16 09:39:48 2012
@@ -25,6 +25,7 @@ import java.util.concurrent.ScheduledExe
 import javax.jcr.Repository;
 
 import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -38,6 +39,8 @@ public class Activator implements Bundle
 
     private ScheduledExecutorService executor;
 
+    private SecurityProvider securityProvider; // TODO
+
     private ServiceTracker tracker;
 
     private final Map<ServiceReference, ServiceRegistration> services =
@@ -69,7 +72,7 @@ public class Activator implements Bundle
             ContentRepository repository = (ContentRepository) service;
             services.put(reference, context.registerService(
                     Repository.class.getName(),
-                    new OsgiRepository(repository, executor),
+                    new OsgiRepository(repository, executor, securityProvider),
                     new Properties()));
             return service;
         } else {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/OsgiRepository.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/OsgiRepository.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/OsgiRepository.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/osgi/OsgiRepository.java
Tue Oct 16 09:39:48 2012
@@ -25,6 +25,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.spi.security.SecurityProvider;
 
 /**
  * Workaround to a JAAS class loading issue in OSGi environments.
@@ -33,9 +34,10 @@ import org.apache.jackrabbit.oak.jcr.Rep
  */
 public class OsgiRepository extends RepositoryImpl {
 
-    public OsgiRepository(
-            ContentRepository repository, ScheduledExecutorService executor) {
-        super(repository, executor, null); // FIXME pass security provider
+    public OsgiRepository(ContentRepository repository,
+                          ScheduledExecutorService executor,
+                          SecurityProvider securityProvider) {
+        super(repository, executor, securityProvider);
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/AbstractRepositoryTest.java
Tue Oct 16 09:39:48 2012
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.oak.jcr;
 
+import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 
 import javax.jcr.GuestCredentials;
@@ -24,7 +25,10 @@ import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 
+import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.junit.After;
 
 /**
@@ -59,15 +63,18 @@ public abstract class AbstractRepository
 
     protected Repository getRepository() throws RepositoryException {
         if (repository == null) {
-            if (executor != null) {
-                repository = new RepositoryImpl(new MicroKernelImpl(), executor);
-            } else {
-                repository = new RepositoryImpl();
-            }
+            MicroKernel mk = new MicroKernelImpl();
+            ScheduledExecutorService executorService = getExecutor();
+            SecurityProvider securityProvider = new SecurityProviderImpl();
+            repository  = new RepositoryImpl(mk, executorService, securityProvider);
         }
         return repository;
     }
 
+    private ScheduledExecutorService getExecutor() {
+        return (executor == null) ? Executors.newScheduledThreadPool(0) : executor;
+    }
+
     protected Session getAdminSession() throws RepositoryException {
         if (adminSession == null) {
             adminSession = createAdminSession();

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/OakRepositoryStub.java
Tue Oct 16 09:39:48 2012
@@ -28,6 +28,7 @@ import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
+import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.test.NotExecutableException;
 import org.apache.jackrabbit.test.RepositoryStub;
 
@@ -47,7 +48,8 @@ public class OakRepositoryStub extends R
         String dir = "target/mk-tck-" + System.currentTimeMillis();
         repository = new RepositoryImpl(
                 new MicroKernelImpl(dir),
-                Executors.newScheduledThreadPool(1));
+                Executors.newScheduledThreadPool(1),
+                new SecurityProviderImpl());
 
         Session session = repository.login(superuser);
         try {

Modified: jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/CustomPrivilegeTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/CustomPrivilegeTest.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/CustomPrivilegeTest.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/test/java/org/apache/jackrabbit/oak/jcr/security/privilege/CustomPrivilegeTest.java
Tue Oct 16 09:39:48 2012
@@ -35,6 +35,7 @@ import javax.jcr.security.Privilege;
 import org.apache.jackrabbit.api.security.authorization.PrivilegeManager;
 import org.apache.jackrabbit.mk.core.MicroKernelImpl;
 import org.apache.jackrabbit.oak.jcr.RepositoryImpl;
+import org.apache.jackrabbit.oak.security.SecurityProviderImpl;
 import org.apache.jackrabbit.oak.security.privilege.PrivilegeConstants;
 import org.junit.After;
 import org.junit.Before;
@@ -57,7 +58,9 @@ public class CustomPrivilegeTest extends
 
         // create a separate repository in order to be able to remove registered privileges.
         String dir = "target/mk-tck-" + System.currentTimeMillis();
-        repository = new RepositoryImpl(new MicroKernelImpl(dir), Executors.newScheduledThreadPool(1));
+        repository = new RepositoryImpl(new MicroKernelImpl(dir),
+                Executors.newScheduledThreadPool(1),
+                new SecurityProviderImpl());
         session = getAdminSession();
         privilegeManager = getPrivilegeManager(session);
 

Modified: jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/Activator.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/Activator.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/Activator.java
(original)
+++ jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/Activator.java
Tue Oct 16 09:39:48 2012
@@ -25,6 +25,7 @@ import java.util.concurrent.ScheduledExe
 import javax.jcr.Repository;
 
 import org.apache.jackrabbit.oak.api.ContentRepository;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.sling.jcr.api.SlingRepository;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
@@ -39,6 +40,8 @@ public class Activator implements Bundle
 
     private ScheduledExecutorService executor;
 
+    private SecurityProvider securityProvider;
+
     private ServiceTracker tracker;
 
     private final Map<ServiceReference, ServiceRegistration> jcrRepositories =
@@ -53,6 +56,7 @@ public class Activator implements Bundle
     public void start(BundleContext bundleContext) throws Exception {
         context = bundleContext;
         executor = Executors.newScheduledThreadPool(1);
+        securityProvider = null; // TODO
         tracker = new ServiceTracker(
                 context, ContentRepository.class.getName(), this);
         tracker.open();
@@ -71,7 +75,7 @@ public class Activator implements Bundle
         Object service = context.getService(reference);
         if (service instanceof ContentRepository) {
             SlingRepository repository = new SlingRepositoryImpl(
-                    (ContentRepository) service, executor);
+                    (ContentRepository) service, executor, securityProvider);
             jcrRepositories.put(reference, context.registerService(
                     Repository.class.getName(),
                     repository, new Properties()));

Modified: jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/SlingRepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/SlingRepositoryImpl.java?rev=1398710&r1=1398709&r2=1398710&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/SlingRepositoryImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-sling/src/main/java/org/apache/jackrabbit/oak/sling/SlingRepositoryImpl.java
Tue Oct 16 09:39:48 2012
@@ -23,14 +23,16 @@ import javax.jcr.Session;
 
 import org.apache.jackrabbit.oak.api.ContentRepository;
 import org.apache.jackrabbit.oak.jcr.osgi.OsgiRepository;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
 import org.apache.sling.jcr.api.SlingRepository;
 
 public class SlingRepositoryImpl
         extends OsgiRepository implements SlingRepository {
 
-    public SlingRepositoryImpl(
-            ContentRepository repository, ScheduledExecutorService executor) {
-        super(repository, executor);
+    public SlingRepositoryImpl(ContentRepository repository,
+                               ScheduledExecutorService executor,
+                               SecurityProvider securityProvider) {
+        super(repository, executor, securityProvider);
     }
 
     @Override



Mime
View raw message