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/06/30 23:27:24 UTC
svn commit: r959440 - in /directory:
apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/
shared/trunk/ldap-aci/src/main/antlr/
shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/
shared/trunk/ldap-aci...
Author: elecharny
Date: Wed Jun 30 21:27:24 2010
New Revision: 959440
URL: http://svn.apache.org/viewvc?rev=959440&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/ClassesItem.java
directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/EntryItem.java
Modified:
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedProtectedItemFilter.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_ClassesTest.java
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=959440&r1=959439&r2=959440&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 21:27:24 2010
@@ -35,6 +35,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.ClassesItem;
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;
@@ -214,10 +215,11 @@ public class RelatedProtectedItemFilter
}
}
}
- else if ( item instanceof ProtectedItem.Classes )
+ else if ( item instanceof ClassesItem )
{
- ProtectedItem.Classes c = ( ProtectedItem.Classes ) item;
- if ( refinementEvaluator.evaluate( c.getClasses(), entry.get( SchemaConstants.OBJECT_CLASS_AT ) ) )
+ ClassesItem refinement = (ClassesItem ) item;
+
+ if ( refinementEvaluator.evaluate( refinement.getClasses(), entry.get( SchemaConstants.OBJECT_CLASS_AT ) ) )
{
return true;
}
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=959440&r1=959439&r2=959440&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 21:27:24 2010
@@ -62,6 +62,8 @@ 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.SelfValueItem;
+import org.apache.directory.shared.ldap.aci.protectedItem.ClassesItem;
+import org.apache.directory.shared.ldap.aci.protectedItem.EntryItem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -699,7 +701,7 @@ classes
:
ID_classes ( SP )+ classes=refinement
{
- protectedItemsMap.put( "classes", new ProtectedItem.Classes( classes ) );
+ protectedItemsMap.put( "classes", new ClassesItem( classes ) );
}
;
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=959440&r1=959439&r2=959440&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 21:27:24 2010
@@ -26,6 +26,7 @@ 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;
@@ -46,7 +47,7 @@ public abstract class ProtectedItem
* present, since this latter element selects protected entries (and
* subordinate family members) on the basis of their object class.
*/
- public static final Entry ENTRY = new Entry();
+ public static final EntryItem ENTRY = new EntryItem();
/**
* All user attribute type information associated with the entry, but not
@@ -68,105 +69,6 @@ public abstract class ProtectedItem
{
}
- /**
- * The contents of entries (possibly a family member) which are restricted
- * to those that have object class values that satisfy the predicate defined
- * by Refinement (see 12.3.5), together (in the case of an ancestor or other
- * family member) with the entry contents as a whole of each subordinate
- * family member entry; it does not necessarily include the information in
- * these entries.
- */
- public static class Classes extends ProtectedItem
- {
- private final ExprNode classes;
-
-
- /**
- * Creates a new instance.
- *
- * @param classes
- * refinement
- */
- public Classes( ExprNode classes )
- {
- this.classes = classes;
- }
-
-
- public ExprNode getClasses()
- {
- return classes;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public int hashCode()
- {
- int hash = 37;
- hash = hash * 17 + getClass().getName().hashCode();
- return hash;
- }
-
-
- /**
- * {@inheritDoc}
- */
- @Override
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( o instanceof Classes )
- {
- Classes that = ( Classes ) o;
- return this.classes.equals( that.classes );
- }
-
- return false;
- }
-
-
- /**
- * @see Object#toString()
- */
- public String toString()
- {
- StringBuilder buf = new StringBuilder();
-
- buf.append( "classes " );
- classes.printRefinementToBuffer( buf );
-
- return buf.toString();
- }
- }
-
- /**
- * The entry contents as a whole. In case of a family member, it also means
- * the entry content of each subordinate family member within the same
- * compound attribute. It does not necessarily include the information in
- * these entries. This element shall be ignored if the classes element is
- * present, since this latter element selects protected entries (and
- * subordinate family members) on the basis of their object class.
- */
- public static class Entry extends ProtectedItem
- {
- private Entry()
- {
- }
-
-
- public String toString()
- {
- return "entry";
- }
- }
-
/**
* Restricts the maximum number of attribute values allowed for a specified
Added: directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/ClassesItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/ClassesItem.java?rev=959440&view=auto
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/ClassesItem.java (added)
+++ directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/ClassesItem.java Wed Jun 30 21:27:24 2010
@@ -0,0 +1,101 @@
+/*
+ * 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;
+
+/**
+ * The contents of entries (possibly a family member) which are restricted
+ * to those that have object class values that satisfy the predicate defined
+ * by Refinement (see 12.3.5), together (in the case of an ancestor or other
+ * family member) with the entry contents as a whole of each subordinate
+ * family member entry; it does not necessarily include the information in
+ * these entries.
+ */
+public class ClassesItem extends ProtectedItem
+{
+ private final ExprNode classes;
+
+
+ /**
+ * Creates a new instance.
+ *
+ * @param classes refinement
+ */
+ public ClassesItem( ExprNode classes )
+ {
+ this.classes = classes;
+ }
+
+
+ public ExprNode getClasses()
+ {
+ return classes;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode()
+ {
+ int hash = 37;
+ hash = hash * 17 + getClass().getName().hashCode();
+ return hash;
+ }
+
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o instanceof ClassesItem )
+ {
+ ClassesItem that = ( ClassesItem ) o;
+ return this.classes.equals( that.classes );
+ }
+
+ return false;
+ }
+
+
+ /**
+ * @see Object#toString()
+ */
+ public String toString()
+ {
+ StringBuilder buf = new StringBuilder();
+
+ buf.append( "classes " );
+ classes.printRefinementToBuffer( buf );
+
+ return buf.toString();
+ }
+}
+
Added: directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/EntryItem.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/EntryItem.java?rev=959440&view=auto
==============================================================================
--- directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/EntryItem.java (added)
+++ directory/shared/trunk/ldap-aci/src/main/java/org/apache/directory/shared/ldap/aci/protectedItem/EntryItem.java Wed Jun 30 21:27:24 2010
@@ -0,0 +1,43 @@
+/*
+ * 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;
+
+/**
+ * The entry contents as a whole. In case of a family member, it also means
+ * the entry content of each subordinate family member within the same
+ * compound attribute. It does not necessarily include the information in
+ * these entries. This element shall be ignored if the classes element is
+ * present, since this latter element selects protected entries (and
+ * subordinate family members) on the basis of their object class.
+ */
+public class EntryItem extends ProtectedItem
+{
+ public EntryItem()
+ {
+ }
+
+
+ public String toString()
+ {
+ return "entry";
+ }
+}
Modified: directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_ClassesTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_ClassesTest.java?rev=959440&r1=959439&r2=959440&view=diff
==============================================================================
--- directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_ClassesTest.java (original)
+++ directory/shared/trunk/ldap-aci/src/test/java/org/apache/directory/shared/ldap/aci/ProtectedItem_ClassesTest.java Wed Jun 30 21:27:24 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.Classes;
+import org.apache.directory.shared.ldap.aci.protectedItem.ClassesItem;
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_ClassesTest
{
- Classes classesA;
- Classes classesACopy;
- Classes classesB;
- Classes classesC;
+ ClassesItem classesA;
+ ClassesItem classesACopy;
+ ClassesItem classesB;
+ ClassesItem classesC;
/**
@@ -57,10 +57,10 @@ public class ProtectedItem_ClassesTest
ExprNode filterA = FilterParser.parse( "(&(cn=test)(sn=test))" );
ExprNode filterB = FilterParser.parse( "(&(cn=test)(sn=test))" );
ExprNode filterC = FilterParser.parse( "(&(cn=sample)(sn=sample))" );
- classesA = new Classes( filterA );
- classesACopy = new Classes( filterA );
- classesB = new Classes( filterB );
- classesC = new Classes( filterC );
+ classesA = new ClassesItem( filterA );
+ classesACopy = new ClassesItem( filterA );
+ classesB = new ClassesItem( filterB );
+ classesC = new ClassesItem( filterC );
}