directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r612866 [1/2] - in /directory: apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ apacheds/branches/bigbang/c...
Date Thu, 17 Jan 2008 16:57:49 GMT
Author: elecharny
Date: Thu Jan 17 08:57:36 2008
New Revision: 612866

URL: http://svn.apache.org/viewvc?rev=612866&view=rev
Log:
o Removed 206 references to [Basic]Attribute[s][Impl]
o Cleaned some useless imports

Modified:
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttributeSerializerUtils.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializerUtils.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
    directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/PartitionSchemaLoader.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaEntityFactory.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaOperationControl.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubentryInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/subtree/SubtreeEvaluator.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/trigger/TriggerInterceptor.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/schema/PartitionSchemaLoaderTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/subtree/SubtreeEvaluatorTest.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
    directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
    directory/apacheds/branches/bigbang/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/jndi/ServerContextFactoryTest.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Value.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/AbstractClientAttribute.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientAttribute.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientBinaryValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientStringValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/ClientValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/client/DefaultClientAttribute.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/schema/SchemaUtils.java

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ObjectClassAttribute.java Thu Jan 17 08:57:36 2008
@@ -30,7 +30,6 @@
 import javax.naming.directory.InvalidAttributeValueException;
 
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 import java.util.Collections;
 
@@ -138,10 +137,8 @@
             {
                 // Iterate through the attribute values and store them in the ObjectClass,
                 // if they are valid.
-                for ( Iterator<ServerValue<?>> values = serverAttribute.getAll(); values.hasNext(); )
+                for ( ServerValue<?> value:serverAttribute )
                 {
-                    ServerValue<?> value = values.next();
-                    
                     if ( value instanceof ServerStringValue )
                     {
                         String objectClassName = ((ServerStringValue)value).get();

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttributeSerializerUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttributeSerializerUtils.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttributeSerializerUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerAttributeSerializerUtils.java Thu Jan 17 08:57:36 2008
@@ -20,21 +20,6 @@
 package org.apache.directory.server.core.entry;
 
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Iterator;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-
-import org.apache.directory.shared.asn1.codec.DecoderException;
-import org.apache.directory.shared.asn1.primitives.OID;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.util.StringTools;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Attr;
 
 /**
  * Serializes a ServerAttribute object using a custom serialization mechanism

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntry.java Thu Jan 17 08:57:36 2008
@@ -35,7 +35,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public interface ServerEntry extends Entry<ServerAttribute>, Iterable<ServerAttribute>, Cloneable
+public interface ServerEntry extends Entry<ServerAttribute>, Cloneable
 {
     // -----------------------------------------------------------------------
     // Schema Related Methods

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializerUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializerUtils.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializerUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntrySerializerUtils.java Thu Jan 17 08:57:36 2008
@@ -20,16 +20,6 @@
 package org.apache.directory.server.core.entry;
 
 
-import java.io.IOException;
-
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
-
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
-
 /**
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/ServerEntryUtils.java Thu Jan 17 08:57:36 2008
@@ -26,12 +26,13 @@
 import javax.naming.directory.Attributes;
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
+import javax.naming.directory.DirContext;
 import javax.naming.directory.InvalidAttributeIdentifierException;
 
 import org.apache.directory.server.schema.registries.Registries;
-import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 
@@ -52,6 +53,11 @@
      */
     public static Attributes toAttributesImpl( ServerEntry entry )
     {
+        if ( entry == null )
+        {
+            return null;
+        }
+        
         Attributes attributes = new AttributesImpl();
 
         for ( AttributeType attributeType:entry.getAttributeTypes() )
@@ -207,10 +213,8 @@
     {
         Attribute attribute = new BasicAttribute( attr.getUpId(), false );
 
-        for ( Iterator<ServerValue<?>> iter = attr.getAll(); iter.hasNext();)
+        for ( ServerValue<?> value:attr )
         {
-            Value<?> value = iter.next();
-            
             attribute.add( value.get() );
         }
         
@@ -227,13 +231,83 @@
     {
         Attribute attribute = new AttributeImpl( attr.getUpId() );
 
-        for ( Iterator<ServerValue<?>> iter = attr.getAll(); iter.hasNext();)
+        for ( ServerValue<?> value:attr )
         {
-            Value<?> value = iter.next();
-            
             attribute.add( value.get() );
         }
         
         return attribute;
+    }
+
+
+    /**
+     * Gets the target entry as it would look after a modification operation 
+     * was performed on it.
+     * 
+     * @param mod the modification
+     * @param entry the source entry that is modified
+     * @return the resultant entry after the modification has taken place
+     * @throws NamingException if there are problems accessing attributes
+     */
+    public static ServerEntry getTargetEntry( ModificationItemImpl mod, ServerEntry entry, Registries registries ) throws NamingException
+    {
+        ServerEntry targetEntry = ( ServerEntry ) entry.clone();
+        int modOp = mod.getModificationOp();
+        String id = mod.getAttribute().getID();
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( id );
+        
+        switch ( modOp )
+        {
+            case ( DirContext.REPLACE_ATTRIBUTE  ):
+                targetEntry.put( toServerAttribute( mod.getAttribute(), attributeType ) );
+                break;
+                
+            case ( DirContext.REMOVE_ATTRIBUTE  ):
+                ServerAttribute toBeRemoved = toServerAttribute( mod.getAttribute(), attributeType );
+
+                if ( toBeRemoved.size() == 0 )
+                {
+                    targetEntry.remove( id );
+                }
+                else
+                {
+                    ServerAttribute existing = targetEntry.get( id );
+
+                    if ( existing != null )
+                    {
+                        for ( ServerValue<?> value:toBeRemoved )
+                        {
+                            existing.remove( value );
+                        }
+                    }
+                }
+                break;
+                
+            case ( DirContext.ADD_ATTRIBUTE  ):
+                ServerAttribute combined = new DefaultServerAttribute( id, attributeType );
+                ServerAttribute toBeAdded = toServerAttribute( mod.getAttribute(), attributeType );
+                ServerAttribute existing = entry.get( id );
+
+                if ( existing != null )
+                {
+                    for ( ServerValue<?> value:existing )
+                    {
+                        combined.add( value );
+                    }
+                }
+
+                for ( ServerValue<?> value:toBeAdded )
+                {
+                    combined.add( value );
+                }
+                
+                targetEntry.put( combined );
+                break;
+                
+            default:
+                throw new IllegalStateException( "undefined modification type: " + modOp );
+        }
+
+        return targetEntry;
     }
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerAttributeTest.java Thu Jan 17 08:57:36 2008
@@ -21,7 +21,6 @@
 
 import java.util.Comparator;
 import java.util.HashSet;
-import java.util.Iterator;
 import java.util.Set;
 
 import javax.naming.NamingException;
@@ -391,10 +390,8 @@
         expected.add( "test" );
         expected.add( "test2" );
         
-        for ( Iterator<ServerValue<?>> iter = attr.getAll(); iter.hasNext(); )
+        for ( ServerValue<?> val:attr )
         {
-            ServerStringValue val = (ServerStringValue)iter.next();
-            
             if ( expected.contains( val.get() ) )
             {
                 expected.remove( val.get() );
@@ -427,10 +424,8 @@
         expected.add( "test" );
         expected.add( "test2" );
         
-        for ( Iterator<ServerValue<?>> iter = attr.getAll(); iter.hasNext(); )
+        for ( ServerValue<?> val:attr )
         {
-            ServerStringValue val = (ServerStringValue)iter.next();
-            
             if ( expected.contains( val.get() ) )
             {
                 expected.remove( val.get() );

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/ServerBinaryValueTest.java Thu Jan 17 08:57:36 2008
@@ -20,15 +20,11 @@
 package org.apache.directory.server.core.entry;
 
 
-import org.apache.directory.server.core.entry.ServerStringValueTest.AT;
-import org.apache.directory.server.core.entry.ServerStringValueTest.MR;
-import org.apache.directory.server.core.entry.ServerStringValueTest.S;
 import org.apache.directory.shared.ldap.schema.AbstractAttributeType;
 import org.apache.directory.shared.ldap.schema.AbstractMatchingRule;
 import org.apache.directory.shared.ldap.schema.AbstractSyntax;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.ByteArrayComparator;
-import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.Normalizer;
 import org.apache.directory.shared.ldap.schema.Syntax;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Thu Jan 17 08:57:36 2008
@@ -979,25 +979,24 @@
         {
             firstStart = true;
 
-            Attributes attributes = new AttributesImpl();
-            Attribute objectClass = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-            objectClass.add( SchemaConstants.TOP_OC );
-            objectClass.add( SchemaConstants.PERSON_OC );
-            objectClass.add( SchemaConstants.ORGANIZATIONAL_PERSON_OC );
-            objectClass.add( SchemaConstants.INET_ORG_PERSON_OC );
-            attributes.put( objectClass );
-
-            attributes.put( SchemaConstants.UID_AT, PartitionNexus.ADMIN_UID );
-            attributes.put( SchemaConstants.USER_PASSWORD_AT, PartitionNexus.ADMIN_PASSWORD );
-            attributes.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
-            attributes.put( SchemaConstants.CN_AT, "system administrator" );
-            attributes.put( SchemaConstants.SN_AT, "administrator" );
-            attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-            attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
-            attributes.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
+            ServerEntry serverEntry = new DefaultServerEntry( registries, PartitionNexus.getAdminName() );
+            
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
+                                SchemaConstants.TOP_OC,
+                                SchemaConstants.PERSON_OC,
+                                SchemaConstants.ORGANIZATIONAL_PERSON_OC,
+                                SchemaConstants.INET_ORG_PERSON_OC );
+
+            serverEntry.put( SchemaConstants.UID_AT, PartitionNexus.ADMIN_UID );
+            serverEntry.put( SchemaConstants.USER_PASSWORD_AT, PartitionNexus.ADMIN_PASSWORD );
+            serverEntry.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
+            serverEntry.put( SchemaConstants.CN_AT, "system administrator" );
+            serverEntry.put( SchemaConstants.SN_AT, "administrator" );
+            serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+            serverEntry.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
 
-            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, PartitionNexus.getAdminName(), registries );
-            partitionNexus.add( new AddOperationContext( registries, PartitionNexus.getAdminName(), entry ) );
+            partitionNexus.add( new AddOperationContext( registries, PartitionNexus.getAdminName(), serverEntry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1012,18 +1011,17 @@
         {
             firstStart = true;
 
-            Attributes attributes = new AttributesImpl();
-            Attribute objectClass = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-            objectClass.add( SchemaConstants.TOP_OC );
-            objectClass.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-            attributes.put( objectClass );
-
-            attributes.put( SchemaConstants.OU_AT, "users" );
-            attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-            attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+            ServerEntry serverEntry = new DefaultServerEntry( registries, userDn );
+            
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
+                                SchemaConstants.TOP_OC,
+                                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+
+            serverEntry.put( SchemaConstants.OU_AT, "users" );
+            serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, userDn, registries );
-            partitionNexus.add( new AddOperationContext( registries, userDn, entry ) );
+            partitionNexus.add( new AddOperationContext( registries, userDn, serverEntry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1037,18 +1035,17 @@
         {
             firstStart = true;
 
-            Attributes attributes = new AttributesImpl();
-            Attribute objectClass = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-            objectClass.add( SchemaConstants.TOP_OC );
-            objectClass.add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-            attributes.put( objectClass );
-
-            attributes.put( SchemaConstants.OU_AT, "groups" );
-            attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-            attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+            ServerEntry serverEntry = new DefaultServerEntry( registries, userDn );
+            
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
+                                SchemaConstants.TOP_OC,
+                                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+
+            serverEntry.put( SchemaConstants.OU_AT, "groups" );
+            serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, groupDn, registries );
-            partitionNexus.add( new AddOperationContext( registries, groupDn, entry ) );
+            partitionNexus.add( new AddOperationContext( registries, groupDn, serverEntry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1062,18 +1059,18 @@
         {
             firstStart = true;
 
-            Attributes attributes = new AttributesImpl();
-            Attribute objectClass = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-            objectClass.add( SchemaConstants.TOP_OC );
-            objectClass.add( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC );
-            attributes.put( objectClass );
-            attributes.put( SchemaConstants.CN_AT, "Administrators" );
-            attributes.put( SchemaConstants.UNIQUE_MEMBER_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-            attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
-            attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
+            ServerEntry serverEntry = new DefaultServerEntry( registries, userDn );
+            
+            serverEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
+                                SchemaConstants.TOP_OC,
+                                SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC );
+
+            serverEntry.put( SchemaConstants.CN_AT, "Administrators" );
+            serverEntry.put( SchemaConstants.UNIQUE_MEMBER_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            serverEntry.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
+            serverEntry.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, name, registries );
-            partitionNexus.add( new AddOperationContext( registries, name, entry ) );
+            partitionNexus.add( new AddOperationContext( registries, name, serverEntry ) );
             
             Interceptor authzInterceptor = interceptorChain.get( AciAuthorizationInterceptor.class.getName() );
             
@@ -1092,7 +1089,7 @@
             }
 
             AciAuthorizationInterceptor authzSrvc = ( AciAuthorizationInterceptor ) authzInterceptor;
-            authzSrvc.cacheNewGroup( name, attributes );
+            authzSrvc.cacheNewGroup( name, serverEntry );
 
         }
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java Thu Jan 17 08:57:36 2008
@@ -24,6 +24,7 @@
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.authn.LdapPrincipal;
 import org.apache.directory.server.core.authz.support.ACDFEngine;
+import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.entry.ServerValue;
@@ -65,8 +66,6 @@
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
-import org.apache.directory.shared.ldap.schema.SchemaUtils;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -80,6 +79,7 @@
 import javax.naming.directory.SearchResult;
 
 import java.text.ParseException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
@@ -282,9 +282,9 @@
      * @param proxy the partition nexus proxy object
      */
     private void addPerscriptiveAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn,
-        Attributes entry ) throws NamingException
+        ServerEntry entry ) throws NamingException
     {
-        Attribute oc = AttributeUtils.getAttribute( entry, objectClassType );
+        ServerAttribute oc = entry.get( objectClassType );
         
         /*
          * If the protected entry is a subentry, then the entry being evaluated
@@ -295,24 +295,26 @@
          * to be in the same naming context as their access point so the subentries
          * effecting their parent entry applies to them as well.
          */
-        if ( AttributeUtils.containsValue( oc, SchemaConstants.SUBENTRY_OC, objectClassType ) || 
-             AttributeUtils.containsValue( oc, subentryOid, objectClassType ) )
+        if ( oc.contains( SchemaConstants.SUBENTRY_OC ) || oc.contains( subentryOid ) )
         {
             LdapDN parentDn = ( LdapDN ) dn.clone();
             parentDn.remove( dn.size() - 1 );
-            entry = proxy.lookup( new LookupOperationContext( registries, parentDn), PartitionNexusProxy.LOOKUP_BYPASS );
+            entry = ServerEntryUtils.toServerEntry( 
+                proxy.lookup( new LookupOperationContext( registries, parentDn), PartitionNexusProxy.LOOKUP_BYPASS ),
+                parentDn,
+                registries );
         }
 
-        Attribute subentries = AttributeUtils.getAttribute( entry, acSubentryType );
+        ServerAttribute subentries = entry.get( acSubentryType );
         
         if ( subentries == null )
         {
             return;
         }
         
-        for ( int ii = 0; ii < subentries.size(); ii++ )
+        for ( ServerValue<?> value:subentries )
         {
-            String subentryDn = ( String ) subentries.get( ii );
+            String subentryDn = ( String ) value.get();
             tuples.addAll( tupleCache.getACITuples( subentryDn ) );
         }
     }
@@ -326,18 +328,18 @@
      * @param entry the target entry that access to is being regulated
      * @throws NamingException if there are problems accessing attribute values
      */
-    private void addEntryAciTuples( Collection<ACITuple> tuples, Attributes entry ) throws NamingException
+    private void addEntryAciTuples( Collection<ACITuple> tuples, ServerEntry entry ) throws NamingException
     {
-        Attribute entryAci = AttributeUtils.getAttribute( entry, entryAciType );
+        ServerAttribute entryAci = entry.get( entryAciType );
         
         if ( entryAci == null )
         {
             return;
         }
 
-        for ( int ii = 0; ii < entryAci.size(); ii++ )
+        for ( ServerValue<?> value:entryAci )
         {
-            String aciString = ( String ) entryAci.get( ii );
+            String aciString = ( String ) value.get();
             ACIItem item;
 
             try
@@ -366,11 +368,11 @@
      * @throws NamingException if there are problems accessing attribute values
      * @param proxy the partition nexus proxy object
      */
-    private void addSubentryAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn, Attributes entry )
+    private void addSubentryAciTuples( PartitionNexusProxy proxy, Collection<ACITuple> tuples, LdapDN dn, ServerEntry entry )
         throws NamingException
     {
         // only perform this for subentries
-        if ( !AttributeUtils.containsValueCaseIgnore( entry.get( SchemaConstants.OBJECT_CLASS_AT ), SchemaConstants.SUBENTRY_OC ) )
+        if ( !entry.contains( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.SUBENTRY_OC ) )
         {
             return;
         }
@@ -379,19 +381,23 @@
         // will contain the subentryACI attributes that effect subentries
         LdapDN parentDn = ( LdapDN ) dn.clone();
         parentDn.remove( dn.size() - 1 );
-        Attributes administrativeEntry = proxy.lookup( 
+        ServerEntry administrativeEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( 
         		new LookupOperationContext( registries, parentDn, new String[]
-            { SchemaConstants.SUBENTRY_ACI_AT }) , PartitionNexusProxy.LOOKUP_BYPASS );
-        Attribute subentryAci = AttributeUtils.getAttribute( administrativeEntry, subentryAciType );
+            { SchemaConstants.SUBENTRY_ACI_AT }) , PartitionNexusProxy.LOOKUP_BYPASS ),
+            parentDn,
+            registries );
+        
+        ServerAttribute subentryAci = administrativeEntry.get( subentryAciType );
 
         if ( subentryAci == null )
         {
             return;
         }
 
-        for ( int ii = 0; ii < subentryAci.size(); ii++ )
+        for ( ServerValue<?> value:subentryAci )
         {
-            String aciString = ( String ) subentryAci.get( ii );
+            String aciString = ( String ) value.get();
             ACIItem item;
 
             try
@@ -439,7 +445,7 @@
         LdapDN principalDn = principal.getJndiName();
         
         ServerEntry serverEntry = addContext.getEntry(); 
-        Attributes entry = ServerEntryUtils.toAttributesImpl( serverEntry );
+        //Attributes entry = ServerEntryUtils.toAttributesImpl( serverEntry );
 
         LdapDN name = addContext.getDn();
 
@@ -455,18 +461,17 @@
         {
             next.add( addContext );
             tupleCache.subentryAdded( name, serverEntry );
-            groupCache.groupAdded( name, entry );
+            groupCache.groupAdded( name, serverEntry );
             return;
         }
 
         // perform checks below here for all non-admin users
         SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class.getName() );
-        Attributes subentryAttrs = subentryInterceptor.getSubentryAttributes( name, entry );
-        NamingEnumeration<? extends Attribute> attrList = entry.getAll();
+        ServerEntry subentryAttrs = subentryInterceptor.getSubentryAttributes( name, serverEntry );
         
-        while ( attrList.hasMore() )
+        for ( ServerAttribute attribute:serverEntry )
         {
-            subentryAttrs.put( attrList.next() );
+            subentryAttrs.put( attribute );
         }
 
         // Assemble all the information required to make an access control decision
@@ -484,16 +489,12 @@
             ADD_PERMS, tuples, subentryAttrs, null );
 
         // now we must check if attribute type and value scope permission is granted
-        NamingEnumeration<? extends Attribute> attributeList = entry.getAll();
-        
-        while ( attributeList.hasMore() )
+        for ( ServerAttribute attribute:serverEntry )
         {
-            Attribute attr = attributeList.next();
-        
-            for ( int ii = 0; ii < attr.size(); ii++ )
+            for ( ServerValue<?> value:attribute )
             {
-                engine.checkPermission( registries, proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, attr
-                    .getID(), attr.get( ii ), ADD_PERMS, tuples, entry, null );
+                engine.checkPermission( registries, proxy, userGroups, principalDn, principal.getAuthenticationLevel(), name, attribute
+                    .getUpId(), value.get(), ADD_PERMS, tuples, serverEntry, null );
             }
         }
 
@@ -503,7 +504,7 @@
         // if the entry added is a subentry or a groupOf[Unique]Names we must
         // update the ACITuple cache and the groups cache to keep them in sync
         tupleCache.subentryAdded( name, serverEntry );
-        groupCache.groupAdded( name, entry );
+        groupCache.groupAdded( name, serverEntry );
     }
 
 
@@ -520,7 +521,11 @@
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( new LookupOperationContext( registries, name ) , PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, name ) , PartitionNexusProxy.LOOKUP_BYPASS ),
+            name,
+            registries );
+
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
 
@@ -537,7 +542,7 @@
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
             next.delete( deleteContext );
-            tupleCache.subentryDeleted( name, ServerEntryUtils.toServerEntry( entry, name, registries ) );
+            tupleCache.subentryDeleted( name, entry );
             groupCache.groupDeleted( name, entry );
             return;
         }
@@ -552,7 +557,7 @@
             REMOVE_PERMS, tuples, entry, null );
 
         next.delete( deleteContext );
-        tupleCache.subentryDeleted( name, ServerEntryUtils.toServerEntry( entry, name, registries ) );
+        tupleCache.subentryDeleted( name, entry );
         groupCache.groupDeleted( name, entry );
     }
 
@@ -565,7 +570,11 @@
         LdapDN name = opContext.getDn();
 
         // Access the principal requesting the operation, and bypass checks if it is the admin
-        Attributes entry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS ),
+            name,
+            registries );
+        
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
 
@@ -587,7 +596,7 @@
              */
             Attributes modifiedEntry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
             tupleCache.subentryModified( name, mods, ServerEntryUtils.toServerEntry( modifiedEntry, name, registries ) );
-            groupCache.groupModified( name, mods, entry );
+            groupCache.groupModified( name, mods, entry, registries );
             return;
         }
 
@@ -601,7 +610,7 @@
             Collections.singleton( MicroOperation.MODIFY ), tuples, entry, null );
 
         Collection<MicroOperation> perms = null;
-        Attributes entryView = ( Attributes ) entry.clone();
+        ServerEntry entryView = ( ServerEntry ) entry.clone();
         
         for ( ModificationItemImpl mod : mods )
         {
@@ -624,7 +633,7 @@
 
                 case ( DirContext.REMOVE_ATTRIBUTE ):
                     perms = REMOVE_PERMS;
-                    Attribute entryAttr = entry.get( attr.getID() );
+                    ServerAttribute entryAttr = entry.get( attr.getID() );
 
                     if ( entryAttr != null )
                     {
@@ -657,7 +666,7 @@
              * not the individual Value Additions) we just handle this when the first value of an
              * attribute is being checked for relevant permissions below. 
              */
-            entryView = SchemaUtils.getTargetEntry( mod, entryView );
+            entryView = ServerEntryUtils.getTargetEntry( mod, entryView, registries );
             
             for ( int jj = 0; jj < attr.size(); jj++ )
             {                
@@ -674,7 +683,7 @@
          */
         Attributes modifiedEntry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
         tupleCache.subentryModified( name, mods, ServerEntryUtils.toServerEntry( modifiedEntry, name, registries ) );
-        groupCache.groupModified( name, mods, entry );
+        groupCache.groupModified( name, mods, entry, registries );
     }
 
     public boolean hasEntry( NextInterceptor next, EntryOperationContext entryContext ) throws NamingException
@@ -682,7 +691,12 @@
         LdapDN name = entryContext.getDn();
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
+        
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS ),
+            name,
+            registries );
+        
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
 
@@ -721,7 +735,7 @@
      * @param entry the raw entry pulled from the nexus
      * @throws NamingException if undlying access to the DIT fails
      */
-    private void checkLookupAccess( LdapPrincipal principal, LdapDN dn, Attributes entry ) throws NamingException
+    private void checkLookupAccess( LdapPrincipal principal, LdapDN dn, ServerEntry entry ) throws NamingException
     {
         // no permissions checks on the RootDSE
         if ( dn.toString().trim().equals( "" ) )
@@ -742,14 +756,24 @@
             LOOKUP_PERMS, tuples, entry, null );
 
         // check that we have read access to every attribute type and value
-        NamingEnumeration<? extends Attribute> attributeList = entry.getAll();
-        while ( attributeList.hasMore() )
+        for ( ServerAttribute attribute:entry )
         {
-            Attribute attr = attributeList.next();
-            for ( int ii = 0; ii < attr.size(); ii++ )
+            
+            for ( ServerValue<?> value:attribute )
             {
-                engine.checkPermission( registries, proxy, userGroups, userName, principal.getAuthenticationLevel(), dn, attr
-                    .getID(), attr.get( ii ), READ_PERMS, tuples, entry, null );
+                engine.checkPermission( 
+                    registries, 
+                    proxy, 
+                    userGroups, 
+                    userName, 
+                    principal.getAuthenticationLevel(), 
+                    dn, 
+                    attribute.getUpId(), 
+                    value.get(), 
+                    READ_PERMS, 
+                    tuples, 
+                    entry, 
+                    null );
             }
         }
     }
@@ -772,7 +796,10 @@
         }
 
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( lookupContext, PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( lookupContext, PartitionNexusProxy.LOOKUP_BYPASS ),
+            lookupContext.getDn(),
+            registries );
         checkLookupAccess( principal, lookupContext.getDn(), entry );
         return next.lookup( lookupContext );
     }
@@ -784,7 +811,12 @@
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS );
+        
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, name ), PartitionNexusProxy.LOOKUP_BYPASS ),
+            name,
+            registries );
+        
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
         LdapDN newName = ( LdapDN ) name.clone();
@@ -837,8 +869,13 @@
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
-        LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
+        
+        ServerEntry entry = ServerEntryUtils.toServerEntry(
+            proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS ),
+            oriChildName,
+            registries );
+        
+            LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
         LdapDN newName = ( LdapDN ) newParentName.clone();
         newName.add( moveAndRenameContext.getNewRdn().getUpName() );
@@ -875,8 +912,12 @@
         // will not be valid at the new location.
         // This will certainly be fixed by the SubentryInterceptor,
         // but after this service.
-        Attributes importedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), 
-            PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+        ServerEntry importedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, oriChildName ), 
+                PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ),
+            oriChildName,
+            registries );
+            
         
         // As the target entry does not exist yet and so
         // its subentry operational attributes are not there,
@@ -884,12 +925,11 @@
         // at least with minimal requirements which are object class
         // and access control subentry operational attributes.
         SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class.getName() );
-        Attributes subentryAttrs = subentryInterceptor.getSubentryAttributes( newName, importedEntry );
-        NamingEnumeration<? extends Attribute> attrList = importedEntry.getAll();
+        ServerEntry subentryAttrs = subentryInterceptor.getSubentryAttributes( newName, importedEntry );
         
-        while ( attrList.hasMore() )
+        for ( ServerAttribute attribute:importedEntry )
         {
-            subentryAttrs.put( attrList.next() );
+            subentryAttrs.put( attribute );
         }
         
         Collection<ACITuple> destTuples = new HashSet<ACITuple>();
@@ -915,7 +955,11 @@
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, oriChildName ), PartitionNexusProxy.LOOKUP_BYPASS ),
+            oriChildName,
+            registries );
+        
         LdapDN newName = ( LdapDN ) newParentName.clone();
         newName.add( oriChildName.get( oriChildName.size() - 1 ) );
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
@@ -953,20 +997,23 @@
         // will not be valid at the new location.
         // This will certainly be fixed by the SubentryInterceptor,
         // but after this service.
-        Attributes importedEntry = proxy.lookup( new LookupOperationContext( registries, oriChildName ), 
-            PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS );
+        ServerEntry importedEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, oriChildName ), 
+                PartitionNexusProxy.LOOKUP_EXCLUDING_OPR_ATTRS_BYPASS ),
+            oriChildName,
+            registries );
+            
         // As the target entry does not exist yet and so
         // its subentry operational attributes are not there,
         // we need to construct an entry to represent it
         // at least with minimal requirements which are object class
         // and access control subentry operational attributes.
         SubentryInterceptor subentryInterceptor = ( SubentryInterceptor ) chain.get( SubentryInterceptor.class.getName() );
-        Attributes subentryAttrs = subentryInterceptor.getSubentryAttributes( newName, importedEntry );
-        NamingEnumeration<? extends Attribute> attrList = importedEntry.getAll();
+        ServerEntry subentryAttrs = subentryInterceptor.getSubentryAttributes( newName, importedEntry );
         
-        while ( attrList.hasMore() )
+        for ( ServerAttribute attribute:importedEntry )
         {
-            subentryAttrs.put( attrList.next() );
+            subentryAttrs.put( attribute );
         }
         
         Collection<ACITuple> destTuples = new HashSet<ACITuple>();
@@ -1037,9 +1084,12 @@
         // Access the principal requesting the operation, and bypass checks if it is the admin
         Invocation invocation = InvocationStack.getInstance().peek();
         PartitionNexusProxy proxy = invocation.getProxy();
-        Attributes entry = proxy.lookup( 
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( 
         		new LookupOperationContext( registries, name ), 
-        		PartitionNexusProxy.LOOKUP_BYPASS );
+        		PartitionNexusProxy.LOOKUP_BYPASS ),
+        	name,
+        	registries );
 
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
@@ -1078,7 +1128,7 @@
         }
 
         // get the present matched name
-        Attributes entry;
+        ServerEntry entry;
         LdapDN matched = next.getMatchedName( opContext );
 
         // check if we have disclose on error permission for the entry at the matched dn
@@ -1086,7 +1136,11 @@
         // that but if permission is granted then short the process and return the dn
         while ( matched.size() > 0 )
         {
-            entry = proxy.lookup( new LookupOperationContext( registries, matched ), PartitionNexusProxy.GETMATCHEDDN_BYPASS );
+            entry = ServerEntryUtils.toServerEntry( 
+                proxy.lookup( new LookupOperationContext( registries, matched ), PartitionNexusProxy.GETMATCHEDDN_BYPASS ),
+                matched,
+                registries );
+            
             Set<Name> userGroups = groupCache.getGroups( principalDn.toString() );
             Collection<ACITuple> tuples = new HashSet<ACITuple>();
             addPerscriptiveAciTuples( proxy, tuples, matched, entry );
@@ -1106,7 +1160,7 @@
     }
 
 
-    public void cacheNewGroup( LdapDN name, Attributes entry ) throws NamingException
+    public void cacheNewGroup( LdapDN name, ServerEntry entry ) throws NamingException
     {
         groupCache.groupAdded( name, entry );
     }
@@ -1114,12 +1168,19 @@
 
     private boolean filter( Invocation invocation, LdapDN normName, SearchResult result ) throws NamingException
     {
+        ServerEntry resultEntry = ServerEntryUtils.toServerEntry( result.getAttributes(), new LdapDN( result.getName() ) , registries );
+
         /*
          * First call hasPermission() for entry level "Browse" and "ReturnDN" perm
          * tests.  If we hasPermission() returns false we immediately short the
          * process and return false.
          */
-        Attributes entry = invocation.getProxy().lookup( new LookupOperationContext( registries, normName ), PartitionNexusProxy.LOOKUP_BYPASS );
+        ServerEntry entry = ServerEntryUtils.toServerEntry( 
+            invocation.getProxy().lookup( 
+                new LookupOperationContext( registries, normName ), PartitionNexusProxy.LOOKUP_BYPASS ),
+            normName,
+            registries );
+        
         ServerLdapContext ctx = ( ServerLdapContext ) invocation.getCaller();
         LdapDN userDn = ctx.getPrincipal().getJndiName();
         Set<Name> userGroups = groupCache.getGroups( userDn.toNormName() );
@@ -1128,8 +1189,19 @@
         addEntryAciTuples( tuples, entry );
         addSubentryAciTuples( invocation.getProxy(), tuples, normName, entry );
 
-        if ( !engine.hasPermission( registries, invocation.getProxy(), userGroups, userDn, ctx.getPrincipal()
-            .getAuthenticationLevel(), normName, null, null, SEARCH_ENTRY_PERMS, tuples, entry, null ) )
+        if ( !engine.hasPermission( 
+                        registries, 
+                        invocation.getProxy(), 
+                        userGroups, 
+                        userDn, 
+                        ctx.getPrincipal().getAuthenticationLevel(), 
+                        normName, 
+                        null, 
+                        null, 
+                        SEARCH_ENTRY_PERMS, 
+                        tuples, 
+                        entry, 
+                        null ) )
         {
             return false;
         }
@@ -1141,43 +1213,74 @@
          * not allowed are removed from the attribute.  If the attribute has no more
          * values remaining then the entire attribute is removed.
          */
-        NamingEnumeration<String> idList = result.getAttributes().getIDs();
-
-        while ( idList.hasMore() )
+        //NamingEnumeration<String> idList = result.getAttributes().getIDs();
+        List<AttributeType> attributeToRemove = new ArrayList<AttributeType>();
+        
+        for ( AttributeType attributeType:resultEntry.getAttributeTypes() )
         {
             // if attribute type scope access is not allowed then remove the attribute and continue
-            String id = idList.next();
-            Attribute attr = result.getAttributes().get( id );
+            String id = attributeType.getName();
+            ServerAttribute attr = resultEntry.get( attributeType );
         
-            if ( !engine.hasPermission( registries, invocation.getProxy(), userGroups, userDn, ctx.getPrincipal()
-                .getAuthenticationLevel(), normName, attr.getID(), null, SEARCH_ATTRVAL_PERMS, tuples, entry, null ) )
+            if ( !engine.hasPermission( 
+                        registries, 
+                        invocation.getProxy(), 
+                        userGroups, 
+                        userDn,
+                        ctx.getPrincipal().getAuthenticationLevel(), 
+                        normName, 
+                        id, 
+                        null, 
+                        SEARCH_ATTRVAL_PERMS, 
+                        tuples, 
+                        entry, 
+                        null ) )
             {
-                result.getAttributes().remove( attr.getID() );
-
-                if ( attr.size() == 0 )
-                {
-                    result.getAttributes().remove( attr.getID() );
-                }
+                attributeToRemove.add( attributeType );
+                
                 continue;
             }
 
+            List<ServerValue<?>> valueToRemove = new ArrayList<ServerValue<?>>();
+            
             // attribute type scope is ok now let's determine value level scope
-            for ( int ii = 0; ii < attr.size(); ii++ )
+            for ( ServerValue<?> value:attr )
             {
-                if ( !engine.hasPermission( registries, invocation.getProxy(), userGroups, userDn, ctx.getPrincipal()
-                    .getAuthenticationLevel(), normName, attr.getID(), attr.get( ii ), SEARCH_ATTRVAL_PERMS, tuples,
-                    entry, null ) )
+                if ( !engine.hasPermission( 
+                        registries, 
+                        invocation.getProxy(), 
+                        userGroups, 
+                        userDn, 
+                        ctx.getPrincipal().getAuthenticationLevel(), 
+                        normName, 
+                        attr.getUpId(), 
+                        value.get(), 
+                        SEARCH_ATTRVAL_PERMS, 
+                        tuples,
+                        entry, 
+                        null ) )
                 {
-                    attr.remove( ii );
-
-                    if ( ii > 0 )
-                    {
-                        ii--;
-                    }
+                    valueToRemove.add( value );
                 }
             }
+            
+            for ( ServerValue<?> value:valueToRemove )
+            {
+                attr.remove( value );
+            }
+            
+            if ( attr.size() == 0 )
+            {
+                attributeToRemove.add( attributeType );
+            }
+        }
+        
+        for ( AttributeType attributeType:attributeToRemove )
+        {
+            resultEntry.remove( attributeType );
         }
 
+        result.setAttributes( ServerEntryUtils.toAttributesImpl( resultEntry ) );
         return true;
     }
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/GroupCache.java Thu Jan 17 08:57:36 2008
@@ -28,6 +28,10 @@
 
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -41,15 +45,13 @@
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
+//import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import javax.naming.directory.SearchControls;
@@ -146,7 +148,8 @@
             {
                 SearchResult result = results.next();
                 LdapDN groupDn = parseNormalized( result.getName() );
-                Attribute members = getMemberAttribute( result.getAttributes() );
+                ServerAttribute members = getMemberAttribute( 
+                    ServerEntryUtils.toServerEntry( result.getAttributes(), groupDn, registries ) );
 
                 if ( members != null )
                 {
@@ -177,20 +180,20 @@
      * @param entry the entry inspected for member attributes
      * @return the member attribute
      */
-    private Attribute getMemberAttribute( Attributes entry )
+    private ServerAttribute getMemberAttribute( ServerEntry entry ) throws NamingException
     {
-        Attribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
+        ServerAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
 
         if ( oc == null )
         {
-        	Attribute member = AttributeUtils.getAttribute( entry, memberAT );
+            ServerAttribute member = entry.get( memberAT );
         	
             if ( member != null )
             {
                 return member;
             }
 
-            Attribute uniqueMember = AttributeUtils.getAttribute(entry, uniqueMemberAT );
+            ServerAttribute uniqueMember = entry.get( uniqueMemberAT );
             
             if ( uniqueMember != null )
             {
@@ -200,16 +203,16 @@
             return null;
         }
 
-        if ( AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_NAMES_OC ) ||
-        		AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_NAMES_OC_OID )	)
+        if ( oc.contains( SchemaConstants.GROUP_OF_NAMES_OC ) ||
+             oc.contains( SchemaConstants.GROUP_OF_NAMES_OC_OID ) )
         {
-            return AttributeUtils.getAttribute( entry, memberAT );
+            return entry.get( memberAT );
         }
 
-        if ( AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) || 
-        		AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC_OID ))
+        if ( oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) || 
+             oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC_OID ))
         {
-            return AttributeUtils.getAttribute(entry, uniqueMemberAT );
+            return entry.get( uniqueMemberAT );
         }
 
         return null;
@@ -223,12 +226,13 @@
      * @param members the member attribute values being added
      * @throws NamingException if there are problems accessing the attr values
      */
-    private void addMembers( Set<String> memberSet, Attribute members ) throws NamingException
+    private void addMembers( Set<String> memberSet, ServerAttribute members ) throws NamingException
     {
-        for ( int ii = 0; ii < members.size(); ii++ )
+        for ( ServerValue<?> value:members )
         {
+
             // get and normalize the DN of the member
-            String memberDn = ( String ) members.get( ii );
+            String memberDn = (String)value.get();
 
             try
             {
@@ -251,12 +255,12 @@
      * @param members the set of member values
      * @throws NamingException if there are problems accessing the attr values
      */
-    private void removeMembers( Set<String> memberSet, Attribute members ) throws NamingException
+    private void removeMembers( Set<String> memberSet, ServerAttribute members ) throws NamingException
     {
-        for ( int ii = 0; ii < members.size(); ii++ )
+        for ( ServerValue<?> value:members )
         {
             // get and normalize the DN of the member
-            String memberDn = ( String ) members.get( ii );
+            String memberDn = (String)value.get();
 
             try
             {
@@ -280,9 +284,9 @@
      * @param entry the group entry's attributes
      * @throws NamingException if there are problems accessing the attr values
      */
-    public void groupAdded( LdapDN name, Attributes entry ) throws NamingException
+    public void groupAdded( LdapDN name, ServerEntry entry ) throws NamingException
     {
-        Attribute members = getMemberAttribute( entry );
+        ServerAttribute members = getMemberAttribute( entry );
 
         if ( members == null )
         {
@@ -307,9 +311,9 @@
      * @param name the normalized DN of the group entry
      * @param entry the attributes of entry being deleted
      */
-    public void groupDeleted( LdapDN name, Attributes entry )
+    public void groupDeleted( LdapDN name, ServerEntry entry ) throws NamingException
     {
-        Attribute members = getMemberAttribute( entry );
+        ServerAttribute members = getMemberAttribute( entry );
 
         if ( members == null )
         {
@@ -334,7 +338,7 @@
      * @param members the members being added, removed or replaced
      * @throws NamingException if there are problems accessing attribute values
      */
-    private void modify( Set<String> memberSet, int modOp, Attribute members ) throws NamingException
+    private void modify( Set<String> memberSet, int modOp, ServerAttribute members ) throws NamingException
     {
 
         switch ( modOp )
@@ -371,23 +375,23 @@
      * @param entry the group entry being modified
      * @throws NamingException if there are problems accessing attribute  values
      */
-    public void groupModified( LdapDN name, List<ModificationItemImpl> mods, Attributes entry ) throws NamingException
+    public void groupModified( LdapDN name, List<ModificationItemImpl> mods, ServerEntry entry, Registries registries ) throws NamingException
     {
-        Attribute members = null;
+        ServerAttribute members = null;
         String memberAttrId = null;
-        Attribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
+        ServerAttribute oc = entry.get( SchemaConstants.OBJECT_CLASS_AT );
 
-        if ( AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_NAMES_OC ) ||
-        		AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_NAMES_OC_OID ))
+        if ( oc.contains( SchemaConstants.GROUP_OF_NAMES_OC ) ||
+             oc.contains( SchemaConstants.GROUP_OF_NAMES_OC_OID ))
         {
-            members = AttributeUtils.getAttribute( entry, memberAT );
+            members = entry.get( memberAT );
             memberAttrId = SchemaConstants.MEMBER_AT;
         }
 
-        if ( AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ||
-        		AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC_OID ) )
+        if ( oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC ) ||
+             oc.contains( SchemaConstants.GROUP_OF_UNIQUE_NAMES_OC_OID ) )
         {
-            members = AttributeUtils.getAttribute(entry, uniqueMemberAT );
+            members = entry.get( uniqueMemberAT );
             memberAttrId = SchemaConstants.UNIQUE_MEMBER_AT;
         }
 
@@ -404,7 +408,12 @@
                 
                 if ( memberSet != null )
                 {
-                    modify( memberSet, modification.getModificationOp(), modification.getAttribute() );
+                    modify( 
+                        memberSet, 
+                        modification.getModificationOp(), 
+                        ServerEntryUtils.toServerAttribute( 
+                            modification.getAttribute(),
+                            registries.getAttributeTypeRegistry().lookup( modification.getAttribute().getID() ) ) );
                 }
                 
                 break;
@@ -427,9 +436,9 @@
      * @param mods the modifications being performed
      * @throws NamingException if there are problems accessing attribute  values
      */
-    public void groupModified( LdapDN name, int modOp, Attributes mods ) throws NamingException
+    public void groupModified( LdapDN name, int modOp, ServerEntry mods ) throws NamingException
     {
-        Attribute members = getMemberAttribute( mods );
+        ServerAttribute members = getMemberAttribute( mods );
 
         if ( members == null )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Thu Jan 17 08:57:36 2008
@@ -23,7 +23,6 @@
 import org.apache.directory.server.core.entry.ServerAttribute;
 import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
-import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
@@ -200,11 +199,9 @@
 
         List<ACITuple> entryTuples = new ArrayList<ACITuple>();
         
-        Iterator<ServerValue<?>> acis = aciAttr.getAll();
-        
-        while ( acis.hasNext() )
+        for ( ServerValue<?> value:aciAttr )
         {
-            String aci = ((ServerStringValue)acis.next()).get();
+            String aci = (String)value.get();
             ACIItem item = null;
 
             try

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/ACDFEngine.java Thu Jan 17 08:57:36 2008
@@ -27,11 +27,12 @@
 
 import javax.naming.Name;
 import javax.naming.NamingException;
-import javax.naming.directory.Attributes;
 
 import org.apache.directory.server.core.authn.AuthenticationInterceptor;
 import org.apache.directory.server.core.authz.AciAuthorizationInterceptor;
 import org.apache.directory.server.core.authz.DefaultAuthorizationInterceptor;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.event.Evaluator;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.event.ExpressionEvaluator;
@@ -139,8 +140,8 @@
         Object attrValue, 
         Collection<MicroOperation> microOperations, 
         Collection<ACITuple> aciTuples, 
-        Attributes entry, 
-        Attributes entryView ) throws NamingException
+        ServerEntry entry, 
+        ServerEntry entryView ) throws NamingException
     {
         if ( !hasPermission( registries, proxy, userGroupNames, username, authenticationLevel, entryName, attrId, attrValue,
             microOperations, aciTuples, entry, entryView ) )
@@ -197,15 +198,18 @@
         Object attrValue, 
         Collection<MicroOperation> microOperations, 
         Collection<ACITuple> aciTuples, 
-        Attributes entry, 
-        Attributes entryView ) throws NamingException
+        ServerEntry entry, 
+        ServerEntry entryView ) throws NamingException
     {
         if ( entryName == null )
         {
             throw new NullPointerException( "entryName" );
         }
 
-        Attributes userEntry = proxy.lookup( new LookupOperationContext( registries, userName ), USER_LOOKUP_BYPASS );
+        ServerEntry userEntry = ServerEntryUtils.toServerEntry( 
+            proxy.lookup( new LookupOperationContext( registries, userName ), USER_LOOKUP_BYPASS ),
+            userName, 
+            registries );
 
         // Determine the scope of the requested operation.
         OperationScope scope;
@@ -229,8 +233,21 @@
         // Filter unrelated and invalid tuples
         for ( ACITupleFilter filter : filters )
         {
-            aciTuples = filter.filter( registries, aciTuples, scope, proxy, userGroupNames, userName, userEntry,
-                authenticationLevel, entryName, attrId, attrValue, entry, microOperations, entryView );
+            aciTuples = filter.filter( 
+                registries, 
+                aciTuples, 
+                scope, 
+                proxy, 
+                userGroupNames, 
+                userName, 
+                ServerEntryUtils.toAttributesImpl( userEntry ),
+                authenticationLevel, 
+                entryName, 
+                attrId, 
+                attrValue, 
+                ServerEntryUtils.toAttributesImpl( entry ), 
+                microOperations, 
+                ServerEntryUtils.toAttributesImpl( entryView ) );
         }
 
         // Deny access if no tuples left.

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authz/support/RelatedUserClassFilter.java Thu Jan 17 08:57:36 2008
@@ -27,6 +27,8 @@
 import javax.naming.NamingException;
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.partition.PartitionNexusProxy;
 import org.apache.directory.server.core.subtree.SubtreeEvaluator;
 import org.apache.directory.server.schema.registries.Registries;
@@ -86,7 +88,11 @@
             
             if ( tuple.isGrant() )
             {
-                if ( !isRelated( userGroupNames, userName, userEntry, entryName, tuple.getUserClasses() )
+                if ( !isRelated( userGroupNames, 
+                                 userName, 
+                                 ServerEntryUtils.toServerEntry( userEntry, userName, registries ), 
+                                 entryName, 
+                                 tuple.getUserClasses() )
                     || authenticationLevel.compareTo( tuple.getAuthenticationLevel() ) < 0 )
                 {
                     ii.remove();
@@ -95,7 +101,11 @@
             else
             // Denials
             {
-                if ( !isRelated( userGroupNames, userName, userEntry, entryName, tuple.getUserClasses() )
+                if ( !isRelated( userGroupNames, 
+                                 userName, 
+                                 ServerEntryUtils.toServerEntry( userEntry, userName, registries ), 
+                                 entryName, 
+                                 tuple.getUserClasses() )
                     && authenticationLevel.compareTo( tuple.getAuthenticationLevel() ) >= 0 )
                 {
                     ii.remove();
@@ -107,7 +117,7 @@
     }
 
 
-    private boolean isRelated( Collection<Name> userGroupNames, LdapDN userName, Attributes userEntry, 
+    private boolean isRelated( Collection<Name> userGroupNames, LdapDN userName, ServerEntry userEntry, 
         LdapDN entryName, Collection<UserClass> userClasses ) throws NamingException
     {
         for ( UserClass userClass : userClasses )
@@ -161,7 +171,7 @@
     }
 
 
-    private boolean matchUserClassSubtree( LdapDN userName, Attributes userEntry, UserClass.Subtree subtree )
+    private boolean matchUserClassSubtree( LdapDN userName, ServerEntry userEntry, UserClass.Subtree subtree )
         throws NamingException
     {
         for ( SubtreeSpecification subtreeSpec : subtree.getSubtreeSpecifications() )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Thu Jan 17 08:57:36 2008
@@ -1419,6 +1419,7 @@
 
     private static void throwInterceptorException( Interceptor interceptor, Throwable e ) throws InterceptorException
     {
+        e.printStackTrace();
         throw new InterceptorException( interceptor, "Unexpected exception.", e );
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/DefaultPartitionNexus.java Thu Jan 17 08:57:36 2008
@@ -981,12 +981,10 @@
                 
                 ServerEntry serverEntry = new DefaultServerEntry( registries, opContext.getDn() );
                 
-                Iterator<ServerAttribute> attributes = getRootDSE( new GetRootDSEOperationContext( registries ) ).iterator();
+                ServerEntry rootDSE = getRootDSE( new GetRootDSEOperationContext( registries ) );
                 
-                while ( attributes.hasNext() )
+                for ( ServerAttribute attribute:rootDSE )
                 {
-                    ServerAttribute attribute = attributes.next();
-                    
                     AttributeType type = atRegistry.lookup( attribute.getUpId() );
                     
                     if ( realIds.contains( type.getOid() ) )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Thu Jan 17 08:57:36 2008
@@ -199,11 +199,9 @@
                 throw new NamingException( message );
             }
             
-            Iterator<ServerValue<?>> refs = refAttr.getAll();
-            
-            while ( refs.hasNext() )
+            for ( ServerValue<?> value:refAttr )
             {
-                ServerStringValue ref = (ServerStringValue)refs.next(); 
+                ServerStringValue ref = (ServerStringValue)value; 
                 
                 String refVal = ref.get();
                 
@@ -302,10 +300,9 @@
         // handle referral here
         List<String> list = new ArrayList<String>( refs.size() );
         
-        Iterator<ServerValue<?>> refUrls = refs.getAll();
-        while ( refUrls.hasNext() )
+        for ( ServerValue<?> value:refs )
         {
-            String val = (String)(refUrls.next().get());
+            String val = (String)value.get();
 
             // need to add non-ldap URLs as-is
             if ( !val.startsWith( "ldap" ) )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/DescriptionParsers.java Thu Jan 17 08:57:36 2008
@@ -21,7 +21,6 @@
 
 
 import java.text.ParseException;
-import java.util.Iterator;
 import java.util.List;
 
 import javax.naming.NamingException;
@@ -143,17 +142,14 @@
         
         SyntaxCheckerDescription[] syntaxCheckerDescriptions = new SyntaxCheckerDescription[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while ( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            String value = (String)values.next().get();
-            
             try
             {
                 syntaxCheckerDescriptions[pos++] = 
-                    syntaxCheckerParser.parseSyntaxCheckerDescription( value );
+                    syntaxCheckerParser.parseSyntaxCheckerDescription( (String)value.get() );
             }
             catch ( ParseException e )
             {
@@ -178,13 +174,10 @@
         
         NormalizerDescription[] normalizerDescriptions = new NormalizerDescription[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
-        
             try
             {
                 normalizerDescriptions[pos++] = normalizerParser.parseNormalizerDescription( (String)value.get() );
@@ -212,13 +205,10 @@
         
         ComparatorDescription[] comparatorDescriptions = new ComparatorDescription[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
-
             try
             {
                 comparatorDescriptions[pos++] = comparatorParser.parseComparatorDescription( ( String ) value.get() );
@@ -254,13 +244,10 @@
         
         AttributeType[] attributeTypes = new AttributeType[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
-        
             AttributeTypeDescription desc = null;
             
             try
@@ -392,13 +379,10 @@
         
         ObjectClass[] objectClasses = new ObjectClass[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
-
             ObjectClassDescription desc = null;
             
             try
@@ -496,13 +480,10 @@
         
         MatchingRuleUse[] matchingRuleUses = new MatchingRuleUse[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
-
             MatchingRuleUseDescription desc = null;
             
             try
@@ -546,12 +527,10 @@
         
         Syntax[] syntaxes = new Syntax[attr.size()];
 
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
             LdapSyntaxDescription desc = null;
             
             try
@@ -602,13 +581,10 @@
         
         MatchingRule[] matchingRules = new MatchingRule[attr.size()];
 
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
-
             MatchingRuleDescription desc = null;
 
             try
@@ -658,12 +634,10 @@
         
         DITStructureRule[] ditStructureRules = new DITStructureRule[attr.size()];
         
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
             DITStructureRuleDescription desc = null;
      
             try
@@ -709,12 +683,10 @@
         
         DITContentRule[] ditContentRules = new DITContentRule[attr.size()];
 
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
             DITContentRuleDescription desc = null;
      
             try
@@ -762,12 +734,10 @@
         
         NameForm[] nameForms = new NameForm[attr.size()];
 
-        Iterator<ServerValue<?>> values = attr.getAll();
         int pos = 0;
         
-        while( values.hasNext() )
+        for ( ServerValue<?> value:attr )
         {
-            ServerValue<?> value = values.next();
             NameFormDescription desc = null;
             
             try

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java?rev=612866&r1=612865&r2=612866&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/MetaSchemaHandler.java Thu Jan 17 08:57:36 2008
@@ -499,11 +499,9 @@
             // check to make sure all the dependencies are also enabled
             Map<String,Schema> loaded = globalRegistries.getLoadedSchemas();
             
-            Iterator<ServerValue<?>> values = dependencies.getAll();
-            
-            while ( values.hasNext() )
+            for ( ServerValue<?> value:dependencies )
             {
-                String dependency = ( String ) values.next().get();
+                String dependency = ( String ) value.get();
                 
                 if ( ! loaded.containsKey( dependency ) )
                 {
@@ -517,11 +515,9 @@
         {
             Set<String> allSchemas = loader.getSchemaNames();
             
-            Iterator<ServerValue<?>> values = dependencies.getAll();
-            
-            while ( values.hasNext() )
+            for ( ServerValue<?> value:dependencies )
             {
-                String dependency = ( String ) values.next().get();
+                String dependency = ( String ) value.get();
                 
                 if ( ! allSchemas.contains( dependency ) )
                 {



Mime
View raw message