jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1502526 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/core/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/ oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/ oak-...
Date Fri, 12 Jul 2013 12:20:19 GMT
Author: mduerig
Date: Fri Jul 12 12:20:19 2013
New Revision: 1502526

URL: http://svn.apache.org/r1502526
Log:
OAK-144 Implement observation
Make IdentifierManager.getIdentifier static

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/IdentifierManagerTest.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java?rev=1502526&r1=1502525&r2=1502526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/core/IdentifierManager.java
Fri Jul 12 12:20:19 2013
@@ -93,7 +93,7 @@ public class IdentifierManager {
      * @return  identifier of {@code tree}
      */
     @Nonnull
-    public String getIdentifier(Tree tree) {
+    public static String getIdentifier(Tree tree) {
         if (tree instanceof AbstractTree) {
             return ((AbstractTree) tree).getIdentifier();
         } else {

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java?rev=1502526&r1=1502525&r2=1502526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/authentication/token/TokenProviderImpl.java
Fri Jul 12 12:20:19 2013
@@ -16,6 +16,9 @@
  */
 package org.apache.jackrabbit.oak.security.authentication.token;
 
+import static org.apache.jackrabbit.oak.api.Type.STRING;
+import static org.apache.jackrabbit.oak.core.IdentifierManager.getIdentifier;
+
 import java.io.UnsupportedEncodingException;
 import java.security.NoSuchAlgorithmException;
 import java.security.SecureRandom;
@@ -29,6 +32,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
+
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
 import javax.jcr.Credentials;
@@ -59,8 +63,6 @@ import org.apache.jackrabbit.util.Text;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.jackrabbit.oak.api.Type.STRING;
-
 /**
  * Default implementation of the {@code TokenProvider} interface that keeps login
  * tokens in the content repository. As a precondition the configured the user
@@ -215,7 +217,7 @@ public class TokenProviderImpl implement
                 tokenNode.setString(JcrConstants.JCR_UUID, IdentifierManager.generateUUID());
 
                 String key = generateKey(options.getConfigValue(PARAM_TOKEN_LENGTH, DEFAULT_KEY_SIZE));
-                String nodeId = identifierManager.getIdentifier(tokenNode.getTree());
+                String nodeId = getIdentifier(tokenNode.getTree());
                 String token = new StringBuilder(nodeId).append(DELIM).append(key).toString();
 
                 String keyHash = PasswordUtility.buildPasswordHash(key);

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java?rev=1502526&r1=1502525&r2=1502526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/user/AuthorizableBaseProvider.java
Fri Jul 12 12:20:19 2013
@@ -17,6 +17,8 @@
 package org.apache.jackrabbit.oak.security.user;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import static org.apache.jackrabbit.oak.core.IdentifierManager.generateUUID;
+import static org.apache.jackrabbit.oak.core.IdentifierManager.getIdentifier;
 
 import javax.annotation.CheckForNull;
 import javax.annotation.Nonnull;
@@ -66,11 +68,11 @@ abstract class AuthorizableBaseProvider 
 
     @Nonnull
     String getContentID(@Nonnull Tree authorizableTree) {
-        return identifierManager.getIdentifier(authorizableTree);
+        return getIdentifier(authorizableTree);
     }
 
     @Nonnull
     static String getContentID(@Nonnull String authorizableId) {
-        return IdentifierManager.generateUUID(authorizableId.toLowerCase());
+        return generateUUID(authorizableId.toLowerCase());
     }
 }
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/IdentifierManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/IdentifierManagerTest.java?rev=1502526&r1=1502525&r2=1502526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/IdentifierManagerTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/core/IdentifierManagerTest.java
Fri Jul 12 12:20:19 2013
@@ -18,6 +18,11 @@
  */
 package org.apache.jackrabbit.oak.core;
 
+import static org.apache.jackrabbit.oak.core.IdentifierManager.getIdentifier;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
 import org.apache.jackrabbit.JcrConstants;
 import org.apache.jackrabbit.oak.Oak;
 import org.apache.jackrabbit.oak.api.CommitFailedException;
@@ -31,10 +36,6 @@ import org.apache.jackrabbit.oak.spi.sec
 import org.junit.Before;
 import org.junit.Test;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
 public class IdentifierManagerTest {
     private static final String UUID_Y = IdentifierManager.generateUUID();
     private static final String UUID_Z1 = IdentifierManager.generateUUID();
@@ -74,16 +75,16 @@ public class IdentifierManagerTest {
     @Test
     public void getIdentifierTest() {
         Tree rootTree = root.getTree("/");
-        assertEquals(ID_ROOT, identifierManager.getIdentifier(rootTree));
+        assertEquals(ID_ROOT, getIdentifier(rootTree));
 
         Tree xx1 = root.getTree(PATH_X1);
-        assertEquals(ID_X1, identifierManager.getIdentifier(xx1));
+        assertEquals(ID_X1, getIdentifier(xx1));
 
         Tree yy1 = root.getTree(PATH_Y1);
-        assertEquals(ID_Y1, identifierManager.getIdentifier(yy1));
+        assertEquals(ID_Y1, getIdentifier(yy1));
 
         Tree zz1 = root.getTree(PATH_Z1);
-        assertEquals(ID_Z1, identifierManager.getIdentifier(zz1));
+        assertEquals(ID_Z1, getIdentifier(zz1));
     }
 
     @Test

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java?rev=1502526&r1=1502525&r2=1502526&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/delegate/NodeDelegate.java
Fri Jul 12 12:20:19 2013
@@ -80,7 +80,6 @@ import javax.jcr.nodetype.NoSuchNodeType
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;
-
 import org.apache.jackrabbit.oak.api.PropertyState;
 import org.apache.jackrabbit.oak.api.Tree;
 import org.apache.jackrabbit.oak.api.Tree.Status;
@@ -153,7 +152,7 @@ public class NodeDelegate extends ItemDe
 
     @Nonnull
     public String getIdentifier() throws InvalidItemStateException {
-        return sessionDelegate.getIdManager().getIdentifier(getTree());
+        return IdentifierManager.getIdentifier(getTree());
     }
 
     @Override



Mime
View raw message