jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1560429 - /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/AbstractRestrictionProvider.java
Date Wed, 22 Jan 2014 17:21:51 GMT
Author: angela
Date: Wed Jan 22 17:21:50 2014
New Revision: 1560429

URL: http://svn.apache.org/r1560429
Log:
minor improvement (simplify subclassing)

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/AbstractRestrictionProvider.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/AbstractRestrictionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/AbstractRestrictionProvider.java?rev=1560429&r1=1560428&r2=1560429&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/AbstractRestrictionProvider.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/authorization/restriction/AbstractRestrictionProvider.java
Wed Jan 22 17:21:50 2014
@@ -160,6 +160,36 @@ public abstract class AbstractRestrictio
         }
     }
 
+    //----------------------------------------------------------< protected >---
+    /**
+     * Returns {@code true} if the specified path is {@code null}. Subclasses may
+     * change the default behavior.
+     *
+     * @param oakPath The path for which a restriction is being created.
+     * @return {@code true} if this implementation can create restrictions for
+     * the specified {@code oakPath}; {@code false} otherwise.
+     */
+    protected boolean isUnsupportedPath(@Nullable String oakPath) {
+        return oakPath == null;
+    }
+
+    /**
+     * Returns the tree that contains the restriction of the specified
+     * ACE tree.
+     *
+     * @param aceTree The ACE tree for which the restrictions are being read.
+     * @return The tree storing the restriction information.
+     */
+    @Nonnull
+    protected Tree getRestrictionsTree(@Nonnull Tree aceTree) {
+        Tree restrictions = aceTree.getChild(REP_RESTRICTIONS);
+        if (!restrictions.exists()) {
+            // no rep:restrictions tree -> read from aceTree for backwards compatibility
+            restrictions = aceTree;
+        }
+        return restrictions;
+    }
+
     //------------------------------------------------------------< private >---
     @Nonnull
     private RestrictionDefinition getDefinition(@Nullable String oakPath, @Nonnull String
oakName) throws AccessControlException {
@@ -179,16 +209,6 @@ public abstract class AbstractRestrictio
     }
 
     @Nonnull
-    private Tree getRestrictionsTree(Tree aceTree) {
-        Tree restrictions = aceTree.getChild(REP_RESTRICTIONS);
-        if (!restrictions.exists()) {
-            // no rep:restrictions tree -> read from aceTree for backwards compatibility
-            restrictions = aceTree;
-        }
-        return restrictions;
-    }
-
-    @Nonnull
     private Map<String, PropertyState> getRestrictionProperties(Tree aceTree) {
         Tree rTree = getRestrictionsTree(aceTree);
         Map<String, PropertyState> restrictionProperties = new HashMap<String, PropertyState>();
@@ -205,8 +225,4 @@ public abstract class AbstractRestrictio
         return !AccessControlConstants.ACE_PROPERTY_NAMES.contains(propertyName) &&
                 !NamespaceRegistry.PREFIX_JCR.equals(Text.getNamespacePrefix(propertyName));
     }
-
-    private static boolean isUnsupportedPath(String oakPath) {
-        return oakPath == null;
-    }
 }



Mime
View raw message