You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/07/01 00:50:19 UTC

svn commit: r959469 - in /directory: apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/ apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/ shared/trunk/ldap-aci/src/main/antlr/ shared/trunk/...

Author: elecharny
Date: Wed Jun 30 22:50:18 2010
New Revision: 959469

URL: http://svn.apache.org/viewvc?rev=959469&view=rev
Log:
Moved some inner class out of the ProtectedItem class

Added:
    directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/RangeOfValuesItem.java
Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
    directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g
    directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
    directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RangeOfValuesTest.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java?rev=959469&r1=959468&r2=959469&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilter.java Wed Jun 30 22:50:18 2010
@@ -30,6 +30,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.aci.protectedItem.AllAttributeValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeTypeItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeValueItem;
+import org.apache.directory.shared.ldap.aci.protectedItem.RangeOfValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.SelfValueItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.entry.Entry;
@@ -107,7 +108,7 @@ public class MostSpecificProtectedItemFi
         {
             for ( ProtectedItem item:tuple.getProtectedItems() )
             {
-                if ( item instanceof ProtectedItem.RangeOfValues )
+                if ( item instanceof RangeOfValuesItem)
                 {
                     filteredTuples.add( tuple );
                 }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java?rev=959469&r1=959468&r2=959469&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.java Wed Jun 30 22:50:18 2010
@@ -36,6 +36,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeTypeItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeValueItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.ClassesItem;
+import org.apache.directory.shared.ldap.aci.protectedItem.RangeOfValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.SelfValueItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
@@ -246,9 +247,9 @@ public class RelatedProtectedItemFilter 
                     }
                 }
             }
-            else if ( item instanceof ProtectedItem.RangeOfValues )
+            else if ( item instanceof RangeOfValuesItem )
             {
-                ProtectedItem.RangeOfValues rov = ( ProtectedItem.RangeOfValues ) item;
+                RangeOfValuesItem rov = ( RangeOfValuesItem ) item;
                 
                 if ( entryEvaluator.evaluate( rov.getFilter(), entryName, entry ) )
                 {

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java?rev=959469&r1=959468&r2=959469&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java (original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authz/support/MostSpecificProtectedItemFilterTest.java Wed Jun 30 22:50:18 2010
@@ -39,6 +39,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.aci.protectedItem.AllAttributeValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeTypeItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AttributeValueItem;
+import org.apache.directory.shared.ldap.aci.protectedItem.RangeOfValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.SelfValueItem;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
@@ -94,7 +95,7 @@ public class MostSpecificProtectedItemFi
         allAttributeValues.add( new AllAttributeValuesItem( EMPTY_STRING_COLLECTION ) );
         selfValue.add( new SelfValueItem( EMPTY_STRING_COLLECTION ) );
         attributeValue.add( new AttributeValueItem( EMPTY_ATTRIBUTE_COLLECTION ) );
-        rangeOfValues.add( new ProtectedItem.RangeOfValues( new PresenceNode( "objectClass" ) ) );
+        rangeOfValues.add( new RangeOfValuesItem( new PresenceNode( "objectClass" ) ) );
         allUserAttributeTypes.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES );
         allUserAttributeTypesAndValues.add( ProtectedItem.ALL_USER_ATTRIBUTE_TYPES_AND_VALUES );
 

Modified: directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g?rev=959469&r1=959468&r2=959469&view=diff
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g (original)
+++ directory/shared/trunk/ldap-aci/src/main/antlr/ACIItem.g Wed Jun 30 22:50:18 2010
@@ -64,6 +64,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.aci.protectedItem.SelfValueItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.ClassesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.EntryItem;
+import org.apache.directory.shared.ldap.aci.protectedItem.RangeOfValuesItem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -535,7 +536,7 @@ rangeOfValues
     token:RANGE_OF_VALUES_CANDIDATE
     {
         protectedItemsMap.put( "rangeOfValues",
-                new ProtectedItem.RangeOfValues(
+                new RangeOfValuesItem(
                         FilterParser.parse( token.getText() ) ) );
         log.debug( "filterParser parsed " + token.getText() );
     }

Modified: directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java?rev=959469&r1=959468&r2=959469&view=diff
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java (original)
+++ directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/ProtectedItem.java Wed Jun 30 22:50:18 2010
@@ -27,7 +27,6 @@ import java.util.Set;
 import org.apache.directory.shared.ldap.aci.protectedItem.AllUserAttributeTypesAndValuesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.AllUserAttributeTypesItem;
 import org.apache.directory.shared.ldap.aci.protectedItem.EntryItem;
-import org.apache.directory.shared.ldap.filter.ExprNode;
 
 
 /**
@@ -171,84 +170,6 @@ public abstract class ProtectedItem
         }
     }
 
-    /**
-     * Any attribute value which matches the specified filter, i.e. for which
-     * the specified filter evaluated on that attribute value would return TRUE.
-     */
-    public static class RangeOfValues extends ProtectedItem
-    {
-        private final ExprNode filter;
-
-
-        /**
-         * Creates a new instance.
-         * 
-         * @param filter
-         *            the expression
-         */
-        public RangeOfValues( ExprNode filter )
-        {
-            if ( filter == null )
-            {
-                throw new IllegalArgumentException( "filter" );
-            }
-
-            this.filter = filter;
-        }
-
-
-        /**
-         * Returns the expression.
-         */
-        public ExprNode getFilter()
-        {
-            return filter;
-        }
-
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public int hashCode()
-        {
-            int hash = 37;
-            hash = hash * 17 + filter.hashCode();
-            return hash;
-        }
-
-
-        /**
-         * {@inheritDoc}
-         */
-        @Override
-        public boolean equals( Object o )
-        {
-            if ( this == o )
-            {
-                return true;
-            }
-
-            if ( o instanceof RangeOfValues )
-            {
-                RangeOfValues that = ( RangeOfValues ) o;
-                return this.filter.equals( that.filter );
-            }
-
-            return false;
-        }
-
-
-        public String toString()
-        {
-            StringBuilder buf = new StringBuilder();
-
-            buf.append( "rangeOfValues " );
-            buf.append( filter.toString() );
-
-            return buf.toString();
-        }
-    }
 
     /**
      * Restricts the maximum number of immediate subordinates of the superior

Added: directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/RangeOfValuesItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/RangeOfValuesItem.java?rev=959469&view=auto
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/RangeOfValuesItem.java (added)
+++ directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/RangeOfValuesItem.java Wed Jun 30 22:50:18 2010
@@ -0,0 +1,102 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.aci.protectedItem;
+
+import org.apache.directory.shared.ldap.aci.ProtectedItem;
+import org.apache.directory.shared.ldap.filter.ExprNode;
+
+/**
+ * Any attribute value which matches the specified filter, i.e. for which
+ * the specified filter evaluated on that attribute value would return TRUE.
+ */
+public class RangeOfValuesItem extends ProtectedItem
+{
+    private final ExprNode filter;
+
+
+    /**
+     * Creates a new instance.
+     * 
+     * @param filter
+     *            the expression
+     */
+    public RangeOfValuesItem( ExprNode filter )
+    {
+        if ( filter == null )
+        {
+            throw new IllegalArgumentException( "filter" );
+        }
+
+        this.filter = filter;
+    }
+
+
+    /**
+     * Returns the expression.
+     */
+    public ExprNode getFilter()
+    {
+        return filter;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public int hashCode()
+    {
+        int hash = 37;
+        hash = hash * 17 + filter.hashCode();
+        return hash;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean equals( Object o )
+    {
+        if ( this == o )
+        {
+            return true;
+        }
+
+        if ( o instanceof RangeOfValuesItem )
+        {
+            RangeOfValuesItem that = ( RangeOfValuesItem ) o;
+            return this.filter.equals( that.filter );
+        }
+
+        return false;
+    }
+
+
+    public String toString()
+    {
+        StringBuilder buf = new StringBuilder();
+
+        buf.append( "rangeOfValues " );
+        buf.append( filter.toString() );
+
+        return buf.toString();
+    }
+}

Modified: directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RangeOfValuesTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RangeOfValuesTest.java?rev=959469&r1=959468&r2=959469&view=diff
==============================================================================
--- directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RangeOfValuesTest.java (original)
+++ directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_RangeOfValuesTest.java Wed Jun 30 22:50:18 2010
@@ -25,7 +25,7 @@ import static org.junit.Assert.assertFal
 
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
-import org.apache.directory.shared.ldap.aci.ProtectedItem.RangeOfValues;
+import org.apache.directory.shared.ldap.aci.protectedItem.RangeOfValuesItem;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.filter.FilterParser;
 import org.junit.Before;
@@ -42,10 +42,10 @@ import org.junit.runner.RunWith;
 @Concurrent()
 public class ProtectedItem_RangeOfValuesTest
 {
-    RangeOfValues rangeOfValuesA;
-    RangeOfValues rangeOfValuesACopy;
-    RangeOfValues rangeOfValuesB;
-    RangeOfValues rangeOfValuesC;
+    RangeOfValuesItem rangeOfValuesA;
+    RangeOfValuesItem rangeOfValuesACopy;
+    RangeOfValuesItem rangeOfValuesB;
+    RangeOfValuesItem rangeOfValuesC;
 
 
     /**
@@ -59,10 +59,10 @@ public class ProtectedItem_RangeOfValues
         ExprNode filterB = FilterParser.parse( "(&(cn=test)(sn=test))" );
         ExprNode filterC = FilterParser.parse( "(&(cn=sample)(sn=sample))" );
 
-        rangeOfValuesA = new RangeOfValues( filterA );
-        rangeOfValuesACopy = new RangeOfValues( filterA );
-        rangeOfValuesB = new RangeOfValues( filterB );
-        rangeOfValuesC = new RangeOfValues( filterC );
+        rangeOfValuesA = new RangeOfValuesItem( filterA );
+        rangeOfValuesACopy = new RangeOfValuesItem( filterA );
+        rangeOfValuesB = new RangeOfValuesItem( filterB );
+        rangeOfValuesC = new RangeOfValuesItem( filterC );
     }