jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1368083 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Date Wed, 01 Aug 2012 16:01:45 GMT
Author: jukka
Date: Wed Aug  1 16:01:44 2012
New Revision: 1368083

URL: http://svn.apache.org/viewvc?rev=1368083&view=rev
Log:
OAK-50: Implement User Management

Allow Session.getPrincipalManager() and .getUserManager() to work in relaxed TODO mode

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java?rev=1368083&r1=1368082&r2=1368083&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/util/TODO.java Wed
Aug  1 16:01:44 2012
@@ -34,9 +34,14 @@ public class TODO {
 
     private static final String mode = System.getProperty("todo", "strict");
 
-    private static final boolean strict = "strict".equals(mode);
+    private static boolean strict = "strict".equals(mode);
 
-    private static final boolean log = "log".equals(mode);
+    private static boolean log = "log".equals(mode);
+
+    public static void relax() {
+        strict = false;
+        log = true;
+    }
 
     public static TODO unimplemented() {
         return new TODO("unimplemented");
@@ -76,6 +81,16 @@ public class TODO {
         }
     }
 
+    public <T> T returnValue(final T value)
+            throws UnsupportedRepositoryOperationException {
+        return call(new Callable<T>() {
+            @Override
+            public T call() {
+                return value;
+            }
+        });
+    }
+
     public <T> T call(Callable<T> callable)
             throws UnsupportedRepositoryOperationException {
         if (strict) {

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1368083&r1=1368082&r2=1368083&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Wed Aug  1 16:01:44 2012
@@ -41,8 +41,13 @@ import org.apache.jackrabbit.api.securit
 import org.apache.jackrabbit.api.security.user.UserManager;
 import org.apache.jackrabbit.commons.AbstractSession;
 import org.apache.jackrabbit.oak.commons.PathUtils;
+import org.apache.jackrabbit.oak.jcr.security.principal.PrincipalManagerImpl;
+import org.apache.jackrabbit.oak.jcr.security.user.UserManagerConfig;
+import org.apache.jackrabbit.oak.jcr.security.user.UserManagerImpl;
 import org.apache.jackrabbit.oak.jcr.xml.XmlImportHandler;
+import org.apache.jackrabbit.oak.security.principal.KernelPrincipalProvider;
 import org.apache.jackrabbit.oak.spi.security.authentication.ImpersonationCredentials;
+import org.apache.jackrabbit.oak.util.TODO;
 import org.apache.jackrabbit.util.XMLChar;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -411,15 +416,15 @@ public class SessionImpl extends Abstrac
     @Override
     @Nonnull
     public PrincipalManager getPrincipalManager() throws RepositoryException {
-        // TODO
-        throw new UnsupportedOperationException("Implementation missing");
+        return TODO.unimplemented().returnValue(new PrincipalManagerImpl(
+                new KernelPrincipalProvider()));
     }
 
     @Override
     @Nonnull
     public UserManager getUserManager() throws RepositoryException {
-        // TODO
-        throw new UnsupportedOperationException("Implementation missing");
+        return TODO.unimplemented().returnValue(new UserManagerImpl(
+                dlg, new UserManagerConfig("admin", null, null)));
     }
 
     //------------------------------------------------------------< private >---



Mime
View raw message