directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r607363 [1/3] - in /directory: apacheds/branches/bigbang/core-entry/ 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/c...
Date Sat, 29 Dec 2007 02:53:40 GMT
Author: elecharny
Date: Fri Dec 28 18:53:20 2007
New Revision: 607363

URL: http://svn.apache.org/viewvc?rev=607363&view=rev
Log:
o First replacement of Attribute(s) by ServerEntry and ServerAttribute : the Add operation has been modified.
o The KerberosAttribute class has been removed from protocl-shared, as it was already present in shared-ldap.
o Slight modifications in the ServrEntry API
o The PartitionFrame.java class won't work, due to the lack of a Registries instance available in this class.
o Updated the core-entry pom.xml to reference some missing schemas

Removed:
    directory/apacheds/branches/bigbang/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/store/KerberosAttribute.java
Modified:
    directory/apacheds/branches/bigbang/core-entry/pom.xml
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
    directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
    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/ServerEntry.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/DefaultServerEntryTest.java
    directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.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/authn/AuthenticationInterceptor.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/TupleCache.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/collective/CollectiveAttributesSchemaChecker.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/event/EventInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AbstractOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/AddOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/ModifyOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/normalization/ExpandingVisitor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/gui/PartitionFrame.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmPartition.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/SchemaInterceptor.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/schema/SchemaPartitionDao.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/schema/SchemaSubentryModifier.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/trigger/TriggerInterceptor.java
    directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
    directory/apacheds/branches/bigbang/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java
    directory/apacheds/branches/bigbang/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java
    directory/apacheds/branches/bigbang/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.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/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java
    directory/apacheds/branches/bigbang/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
    directory/apacheds/branches/bigbang/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java
    directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
    directory/apacheds/branches/bigbang/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java
    directory/apacheds/branches/bigbang/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java
    directory/apacheds/branches/bigbang/server-unit/src/test/java/org/apache/directory/server/KeyDerivationServiceITest.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractBinaryValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/AbstractStringValue.java
    directory/shared/branches/bigbang/ldap/src/main/java/org/apache/directory/shared/ldap/entry/Entry.java

Modified: directory/apacheds/branches/bigbang/core-entry/pom.xml
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/pom.xml?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/pom.xml (original)
+++ directory/apacheds/branches/bigbang/core-entry/pom.xml Fri Dec 28 18:53:20 2007
@@ -44,6 +44,12 @@
       <artifactId>apacheds-schema-bootstrap</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
+      <version>${pom.version}</version>
+      <artifactId>apacheds-schema-extras</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
   
 </project>

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/AbstractServerAttribute.java Fri Dec 28 18:53:20 2007
@@ -19,9 +19,7 @@
 package org.apache.directory.server.core.entry;
 
 
-import org.apache.directory.shared.ldap.entry.AbstractBinaryValue;
 import org.apache.directory.shared.ldap.entry.EntryAttribute;
-import org.apache.directory.shared.ldap.entry.AbstractStringValue;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -64,7 +62,7 @@
      */
     protected String logAssert( String message )
     {
-        LOG.error(  message );
+        LOG.error( message );
         return message;
     }
     
@@ -187,7 +185,7 @@
     {
         if ( attributeType.getSyntax().isHumanReadable() )
         {
-            if ( !( val instanceof AbstractStringValue ) )
+            if ( !( val instanceof ServerStringValue ) )
             {
                 String message = "The value must be a String, as its AttributeType is H/R";
                 LOG.error( message );
@@ -196,7 +194,7 @@
         }
         else
         {
-            if ( !( val instanceof AbstractBinaryValue ) )
+            if ( !( val instanceof ServerBinaryValue ) )
             {
                 String message = "The value must be a byte[], as its AttributeType is not H/R";
                 LOG.error( message );
@@ -204,7 +202,9 @@
             }
         }
         
-        return values.add( val );
+        boolean added = values.add( val );
+        
+        return added;
     }
 
 

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerAttribute.java Fri Dec 28 18:53:20 2007
@@ -78,12 +78,12 @@
      * attributeType.
      *
      * @param attributeType the attribute type according to the schema
-     * @param val an initial value for this attribute
+     * @param vals an initial set of values for this attribute
      * @throws NamingException if there are problems creating the new attribute
      */
-    public DefaultServerAttribute( AttributeType attributeType, ServerValue<?> val ) throws NamingException
+    public DefaultServerAttribute( AttributeType attributeType, ServerValue<?>... vals ) throws NamingException
     {
-        this( null, attributeType, val );
+        this( null, attributeType, vals );
     }
 
 
@@ -98,17 +98,17 @@
      *
      * @param upId
      * @param attributeType the attribute type according to the schema
-     * @param val an initial value for this attribute
+     * @param vals an initial set of values for this attribute
      * @throws NamingException if there are problems creating the new attribute
      */
-    public DefaultServerAttribute( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException
+    public DefaultServerAttribute( String upId, AttributeType attributeType, ServerValue<?>... vals ) throws NamingException
     {
         assert checkAttributeType( attributeType) == null : logAssert( checkAttributeType( attributeType ) );
         
         this.attributeType = attributeType;
         
         // The value can be null, this is a valid value.
-        if ( val == null )
+        if ( vals == null )
         {
             if ( attributeType.getSyntax().isHumanReadable() )
             {
@@ -121,25 +121,28 @@
         }
         else
         {
-            if ( attributeType.equals( val.getAttributeType() ) )
+            for ( ServerValue<?> val:vals )
             {
-                add( val );
-            }
-            else if ( val instanceof ServerStringValue )
-            {
-                ServerStringValue serverString = ( ServerStringValue ) val;
-                add( new ServerStringValue( attributeType, serverString.get() ) );
-            }
-            else if ( val instanceof ServerBinaryValue )
-            {
-                ServerBinaryValue serverBinary = ( ServerBinaryValue ) val;
-                add( new ServerBinaryValue( attributeType, serverBinary.getCopy() ) );
-            }
-            else
-            {
-                String message = "Unknown value type: " + val.getClass().getName();
-                LOG.error( message );
-                throw new IllegalStateException( message );
+                if ( attributeType.equals( val.getAttributeType() ) )
+                {
+                    add( val );
+                }
+                else if ( val instanceof ServerStringValue )
+                {
+                    ServerStringValue serverString = ( ServerStringValue ) val;
+                    add( new ServerStringValue( attributeType, serverString.get() ) );
+                }
+                else if ( val instanceof ServerBinaryValue )
+                {
+                    ServerBinaryValue serverBinary = ( ServerBinaryValue ) val;
+                    add( new ServerBinaryValue( attributeType, serverBinary.getCopy() ) );
+                }
+                else
+                {
+                    String message = "Unknown value type: " + val.getClass().getName();
+                    LOG.error( message );
+                    throw new IllegalStateException( message );
+                }
             }
         }
         
@@ -148,45 +151,45 @@
 
 
     /**
-     * Create a new instance of a EntryAttribute, withoiut ID but with a value.
+     * Create a new instance of a EntryAttribute, without ID but with some values.
      */
-    public DefaultServerAttribute( AttributeType attributeType, String val ) throws NamingException
+    public DefaultServerAttribute( AttributeType attributeType, String... vals ) throws NamingException
     {
-        this( null, attributeType, val );
+        this( null, attributeType, vals );
     }
 
 
     /**
      * Create a new instance of a EntryAttribute.
      */
-    public DefaultServerAttribute( String upId, AttributeType attributeType, String val ) throws NamingException
+    public DefaultServerAttribute( String upId, AttributeType attributeType, String... vals ) throws NamingException
     {
         assert checkAttributeType( attributeType) == null : logAssert( checkAttributeType( attributeType ) );
 
         this.attributeType = attributeType;
-        add( val );
+        add( vals );
         setUpId( upId, attributeType );
     }
 
 
     /**
-     * Create a new instance of a EntryAttribute, with a byte[] value.
+     * Create a new instance of a EntryAttribute, with some byte[] values.
      */
-    public DefaultServerAttribute( AttributeType attributeType, byte[] val ) throws NamingException
+    public DefaultServerAttribute( AttributeType attributeType, byte[]... vals ) throws NamingException
     {
-        this( null, attributeType, val );
+        this( null, attributeType, vals );
     }
 
 
     /**
-     * Create a new instance of a EntryAttribute, with a String value.
+     * Create a new instance of a EntryAttribute, with some byte[] values.
      */
-    public DefaultServerAttribute( String upId, AttributeType attributeType, byte[] val ) throws NamingException
+    public DefaultServerAttribute( String upId, AttributeType attributeType, byte[]... vals ) throws NamingException
     {
         assert checkAttributeType( attributeType) == null : logAssert( checkAttributeType( attributeType ) );
 
         this.attributeType = attributeType;
-        add( val );
+        add( vals );
         setUpId( upId, attributeType );
     }
 
@@ -621,4 +624,27 @@
     {
         return values.iterator();
     }
+    
+    /**
+     * @see Object#toString() 
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        if ( ( values != null ) && ( values.size() != 0 ) )
+        {
+            for ( ServerValue<?> value:values )
+            {
+                sb.append( upId ).append( ": " ).append( value ).append( '\n' );
+            }
+        }
+        else
+        {
+            sb.append( upId ).append( ": (null)\n" );
+        }
+        
+        return sb.toString();
+    }
+
 }

Modified: directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/main/java/org/apache/directory/server/core/entry/DefaultServerEntry.java Fri Dec 28 18:53:20 2007
@@ -27,10 +27,10 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
+import org.apache.directory.shared.ldap.entry.Value;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
@@ -60,14 +60,14 @@
     /** The objectClass container */
     private ObjectClassAttribute objectClassAttribute;
     
-    /** The registries */
+    /** The global registries */
     private final transient Registries registries;
     
-    /** The AttributeType registry */
-    private final transient AttributeTypeRegistry atRegistry;
-    
     /** A speedup to get the ObjectClass attribute */
-    private transient AttributeType objectClassAT;
+    private static transient AttributeType OBJECT_CLASS_AT;
+    
+    /** An object used to protect the OBJECT_CLASS_AT while initializing it */
+    private static final Object MUTEX = new Object();
     
     /** The DN for this entry */
     private LdapDN dn;
@@ -77,9 +77,15 @@
     {
         this.dn = dn;
         this.registries = registries;
-        atRegistry = registries.getAttributeTypeRegistry();
 
-        objectClassAT = atRegistry.lookup( SchemaConstants.OBJECT_CLASS_AT );
+        synchronized( MUTEX )
+        {
+            if ( OBJECT_CLASS_AT == null )
+            {
+                OBJECT_CLASS_AT = registries.getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASS_AT );
+            }
+        }
+        
         setObjectClassAttribute( new ObjectClassAttribute( registries ) );
     }
 
@@ -87,7 +93,7 @@
     private ServerAttribute setObjectClassAttribute( ServerAttribute objectClassAttribute ) throws NamingException
     {
         this.objectClassAttribute = (ObjectClassAttribute)objectClassAttribute;
-        return serverAttributeMap.put( objectClassAT, objectClassAttribute );
+        return serverAttributeMap.put( OBJECT_CLASS_AT, objectClassAttribute );
     }
 
 
@@ -95,7 +101,7 @@
     {
         this.objectClassAttribute = (ObjectClassAttribute)objectClassAttribute;
 
-        return serverAttributeMap.remove( objectClassAT );
+        return serverAttributeMap.remove( OBJECT_CLASS_AT );
     }
 
 
@@ -123,6 +129,20 @@
     }
 
 
+    public boolean hasObjectClass( String objectClass )
+    {
+        try
+        {
+            ObjectClass oc = registries.getObjectClassRegistry().lookup( objectClass );
+            return objectClassAttribute.hasObjectClass( oc );
+        }
+        catch ( NamingException ne )
+        {
+            return false;
+        }
+    }
+
+
     public Set<ObjectClass> getAbstractObjectClasses()
     {
         return objectClassAttribute.getAbstractObjectClasses();
@@ -197,7 +217,7 @@
      */
     public ServerAttribute get( String attributeType ) throws NamingException
     {
-        return get( atRegistry.lookup( attributeType ) );
+        return get( registries.getAttributeTypeRegistry().lookup( attributeType ) );
     }
 
 
@@ -207,7 +227,7 @@
         
         for ( ServerAttribute serverAttribute:serverAttributes )
         {
-            if ( serverAttribute.getType().equals( objectClassAT ) )
+            if ( serverAttribute.getType().equals( OBJECT_CLASS_AT ) )
             {
                 if ( serverAttribute instanceof ObjectClassAttribute )
                 {
@@ -219,7 +239,7 @@
                     
                     for ( ServerValue<?> val : serverAttribute )
                     {
-                        objectClassAttribute.add( val );
+                        objectClassAttribute.add( (ServerStringValue)val );
                     }
                     
                     setObjectClassAttribute( objectClassAttribute );
@@ -258,7 +278,7 @@
      */
     public ServerAttribute put( String upId, String... values ) throws NamingException
     {
-        AttributeType attributeType = atRegistry.lookup( upId );
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( upId );
         ServerAttribute existing = serverAttributeMap.get( attributeType );
 
         for ( String value:values )
@@ -282,7 +302,7 @@
      */
     public ServerAttribute put( String upId, byte[]... values ) throws NamingException
     {
-        AttributeType attributeType = atRegistry.lookup( upId );
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( upId );
         ServerAttribute existing = serverAttributeMap.get( attributeType );
 
         for ( byte[] value:values )
@@ -300,13 +320,19 @@
     }
 
 
+    public ServerAttribute put( String upId ) throws NamingException
+    {
+        throw new NotImplementedException();
+    }
+
+
     public List<ServerAttribute> remove( ServerAttribute... serverAttributes ) throws NamingException
     {
         List<ServerAttribute> removedAttributes = new ArrayList<ServerAttribute>();
         
         for ( ServerAttribute serverAttribute:serverAttributes )
         {
-            if ( serverAttribute.getType().equals( objectClassAT ) )
+            if ( serverAttribute.getType().equals( OBJECT_CLASS_AT ) )
             {
                 removeObjectClassAttribute( new ObjectClassAttribute( registries ) );
             }
@@ -322,71 +348,86 @@
     }
 
 
-    public ServerAttribute put( AttributeType attributeType, ServerValue<?> val ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType, ServerValue<?>... values ) throws NamingException
     {
         ServerAttribute existing = serverAttributeMap.get( attributeType );
 
         if ( existing != null )
         {
-            return put( existing.getUpId(), attributeType, val );
+            return put( existing.getUpId(), attributeType, values );
         }
         else
         {
-            return put( null, attributeType, val );
+            return put( null, attributeType, values );
+        }
+    }
+
+
+    public ServerAttribute put( String upId, AttributeType attributeType, ServerValue<?>... vals ) throws NamingException
+    {
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
+        {
+            return setObjectClassAttribute( new ObjectClassAttribute( registries, upId, vals ) );
         }
+
+        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, vals ) );
     }
 
 
-    public ServerAttribute put( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException
+    public ServerAttribute put( String upId, ServerValue<?>... vals ) throws NamingException
     {
-        if ( attributeType.equals( objectClassAT ) )
+        assert registries != null : "The AttributeType registry should not be null";
+        
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( upId );
+        
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
         {
-            return setObjectClassAttribute( new ObjectClassAttribute( upId, registries, val ) );
+            return setObjectClassAttribute( new ObjectClassAttribute( registries, upId, vals ) );
         }
 
-        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, val ) );
+        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, vals ) );
     }
 
 
-    public ServerAttribute put( AttributeType attributeType, String val ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType, String... vals ) throws NamingException
     {
         ServerAttribute existing = serverAttributeMap.get( attributeType );
 
-        if ( attributeType.equals( objectClassAT ) )
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
         {
             if ( existing != null )
             {
-                return setObjectClassAttribute( new ObjectClassAttribute( existing.getUpId(), registries, val ) );
+                return setObjectClassAttribute( new ObjectClassAttribute( registries, existing.getUpId(), vals ) );
             }
 
-            return setObjectClassAttribute( new ObjectClassAttribute( registries, val ) );
+            return setObjectClassAttribute( new ObjectClassAttribute( registries, OBJECT_CLASS_AT.getName(), vals ) );
         }
 
         if ( existing != null )
         {
-            return put( existing.getUpId(), attributeType, val );
+            return put( existing.getUpId(), attributeType, vals );
         }
         else
         {
-            return put( null, attributeType, val );
+            return put( null, attributeType, vals );
         }
     }
 
 
-    public ServerAttribute put( String upId, AttributeType attributeType, String val ) throws NamingException
+    public ServerAttribute put( String upId, AttributeType attributeType, String... values ) throws NamingException
     {
-        if ( attributeType.equals( objectClassAT ) )
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
         {
-            return setObjectClassAttribute( new ObjectClassAttribute( upId, registries, val ) );
+            return setObjectClassAttribute( new ObjectClassAttribute( registries, upId, values ) );
         }
 
-        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, val ) );
+        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, values ) );
     }
 
 
-    public ServerAttribute put( AttributeType attributeType, byte[] val ) throws NamingException
+    public ServerAttribute put( AttributeType attributeType, byte[]... vals ) throws NamingException
     {
-        if ( attributeType.equals( objectClassAT ) )
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
         {
             throw new UnsupportedOperationException( "Only String values supported for objectClass attribute" );
         }
@@ -395,36 +436,77 @@
 
         if ( existing != null )
         {
-            return put( existing.getUpId(), attributeType, val );
+            return put( existing.getUpId(), attributeType, vals );
         }
         else
         {
-            return put( null, attributeType, val );
+            return put( null, attributeType, vals );
         }
     }
 
 
-    public ServerAttribute put( String upId, AttributeType attributeType, byte[] val ) throws NamingException
+    public ServerAttribute put( String upId, AttributeType attributeType, byte[]... vals ) throws NamingException
     {
-        if ( attributeType.equals( objectClassAT ) )
+        if ( attributeType.equals( OBJECT_CLASS_AT ) )
         {
             throw new UnsupportedOperationException( "Only String values supported for objectClass attribute" );
         }
 
-        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, val ) );
+        return serverAttributeMap.put( attributeType, new DefaultServerAttribute( upId, attributeType, vals ) );
     }
 
 
-    public ServerAttribute remove( AttributeType attributeType ) throws NamingException
+    public List<ServerAttribute> remove( AttributeType... attributeTypes ) throws NamingException
     {
-        if ( attributeType.equals( objectClassAT ) )
+        if ( attributeTypes == null )
         {
-            return setObjectClassAttribute( new ObjectClassAttribute( registries ) );
+            return null;
         }
-        else
+        
+        List<ServerAttribute> attributes = new ArrayList<ServerAttribute>( attributeTypes.length );
+        
+        for ( AttributeType attributeType:attributeTypes )
         {
-            return serverAttributeMap.remove( attributeType );
+            if ( attributeType.equals( OBJECT_CLASS_AT ) )
+            {
+                attributes.add( setObjectClassAttribute( new ObjectClassAttribute( registries ) ) );
+            }
+            else
+            {
+                attributes.add( serverAttributeMap.remove( attributeType ) );
+            }
         }
+        
+        return attributes;
+    }
+
+
+    public List<ServerAttribute> remove( String... upIds ) throws NamingException
+    {
+        assert registries != null : "The AttributeType registry should not be null";
+
+        if ( upIds == null )
+        {
+            return null;
+        }
+        
+        List<ServerAttribute> attributes = new ArrayList<ServerAttribute>( upIds.length );
+        
+        for ( String upId:upIds )
+        {
+            AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( upId );
+    
+            if ( attributeType.equals( OBJECT_CLASS_AT ) )
+            {
+                attributes.add( setObjectClassAttribute( new ObjectClassAttribute( registries ) ) );
+            }
+            else
+            {
+                attributes.add( serverAttributeMap.remove( attributeType ) );
+            }
+        }
+        
+        return attributes;
     }
 
 
@@ -469,13 +551,182 @@
     }
     
     
+    public ServerEntry clone()
+    {
+        try
+        {
+            DefaultServerEntry clone = (DefaultServerEntry)super.clone();
+            
+            clone.dn = (LdapDN)dn.clone();
+            //clone.objectClassAttribute = objectClassAttribute.clone();
+            return clone;
+        }
+        catch ( CloneNotSupportedException cnse )
+        {
+            return null;
+        }
+    }
+    
+
     /**
-     * Gest all the attributes type (ObjectClasses, May and Must)
+     * Checks if an entry contains an attribute with a given value.
+     *
+     * @param attribute The Attribute we are looking for
+     * @param value The searched value
+     * @return <code>true</code> if the value is found within the attribute
+     * @throws NamingException If there is a problem
+     */
+    public boolean contains( ServerAttribute attribute, Value<?> value ) throws NamingException
+    {
+        if ( attribute == null )
+        {
+            return false;
+        }
+        
+        if ( serverAttributeMap.containsKey( attribute.getType() ) )
+        {
+            return serverAttributeMap.get( attribute.getType() ).contains( (ServerValue<?>)value );
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    
+    /**
+     * Checks if an entry contains an attribute with a given value.
+     *
+     * @param id The Attribute we are looking for
+     * @param value The searched value
+     * @return <code>true</code> if the value is found within the attribute
+     * @throws NamingException If the attribute does not exists
+     */
+    public boolean contains( String id, Value<?> value ) throws NamingException
+    {
+        if ( id == null )
+        {
+            return false;
+        }
+        
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( id );
+        
+        if ( attributeType == null )
+        {
+            return false;
+        }
+        else if ( serverAttributeMap.containsKey( attributeType ) )
+        {
+            return serverAttributeMap.get( attributeType ).contains( (ServerValue<?>)value );
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    
+    /**
+     * Checks if an entry contains an attribute with a given value.
+     *
+     * @param id The Attribute we are looking for
+     * @param value The searched value
+     * @return <code>true</code> if the value is found within the attribute
+     * @throws NamingException If the attribute does not exists
+     */
+    public boolean contains( String id, String value ) throws NamingException
+    {
+        if ( id == null )
+        {
+            return false;
+        }
+        
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( id );
+        
+        if ( attributeType == null )
+        {
+            return false;
+        }
+        else if ( serverAttributeMap.containsKey( attributeType ) )
+        {
+            return serverAttributeMap.get( attributeType ).contains( value );
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    
+    /**
+     * Checks if an entry contains an attribute with a given value.
+     *
+     * @param id The Attribute we are looking for
+     * @param value The searched value
+     * @return <code>true</code> if the value is found within the attribute
+     * @throws NamingException If the attribute does not exists
+     */
+    public boolean contains( String id, byte[] value ) throws NamingException
+    {
+        if ( id == null )
+        {
+            return false;
+        }
+        
+        AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( id );
+        
+        if ( attributeType == null )
+        {
+            return false;
+        }
+        else if ( serverAttributeMap.containsKey( attributeType ) )
+        {
+            return serverAttributeMap.get( attributeType ).contains( value );
+        }
+        else
+        {
+            return false;
+        }
+    }
+    
+    
+    /**
+     * Gets all the attributes type (ObjectClasses, May and Must)
      *
      * @return The combined set of all the attributes, including ObjectClass.
      */
     public Set<AttributeType> getAttributeTypes()
     {
         return serverAttributeMap.keySet();
+    }
+    
+    
+    /**
+     * @see Object#toString()
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        sb.append( "DefaultEntryServer\n" );
+        sb.append( "    dn: " ).append( dn ).append( '\n' );
+        
+        if ( objectClassAttribute != null )
+        {
+            sb.append( "    " ).append( objectClassAttribute );
+        }
+
+        if ( serverAttributeMap.size() != 0 )
+        {
+            for ( ServerAttribute attribute:serverAttributeMap.values() )
+            {
+                if ( !attribute.getType().equals( OBJECT_CLASS_AT ) )
+                {
+                    sb.append( "    " ).append( attribute );
+                }
+            }
+        }
+        
+        return sb.toString();
     }
 }

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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -26,6 +26,8 @@
 import org.slf4j.LoggerFactory;
 
 import javax.naming.NamingException;
+import javax.naming.directory.InvalidAttributeIdentifierException;
+
 import java.util.HashSet;
 import java.util.Set;
 import java.util.Collections;
@@ -50,6 +52,9 @@
 
     private Set<AttributeType> mayList = new HashSet<AttributeType>();
     private Set<AttributeType> mustList = new HashSet<AttributeType>();
+    
+    /** The global registries */
+    private Registries registries;
 
 
 
@@ -60,7 +65,7 @@
      */
     public ObjectClassAttribute( Registries registries ) throws NamingException
     {
-        this( null, registries );
+        this( registries, (String)null );
     }
 
 
@@ -68,11 +73,12 @@
      * Creates a new instance of ObjectClassAttribute.
      *
      * @param upId The ObjectClass ID
-     * @param registries The registries to use to initialize this object
+     * @param registries The atRegistry to use to initialize this object
      * @throws NamingException If something went wrong
      */
-    public ObjectClassAttribute( String upId, Registries registries ) throws NamingException
+    public ObjectClassAttribute( Registries registries, String upId ) throws NamingException
     {
+        this.registries = registries;
         attributeType = registries.getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASS_AT_OID );
         setUpId( upId, attributeType );
     }
@@ -81,13 +87,13 @@
     /**
      * Doc me more!
      *
-     * If the value does not correspond to the same attributeType, then it's
+     * If the values does not correspond to the same attributeType, then it's
      * wrapped value is copied into a new ServerValue which uses the specified
      * attributeType.
      */
-    public ObjectClassAttribute( Registries registries, ServerValue<?> val ) throws NamingException
+    public ObjectClassAttribute( Registries registries, ServerValue<?>... values ) throws NamingException
     {
-        this( null, registries, val );
+        this( registries, null, values );
     }
 
 
@@ -98,46 +104,51 @@
      * wrapped value is copied into a new ServerValue which uses the specified
      * attributeType.
      */
-    public ObjectClassAttribute( String upId, Registries registries, ServerValue<?> val ) throws NamingException
+    public ObjectClassAttribute( Registries registries, String upId, ServerValue<?>... vals ) throws NamingException
     {
+        this.registries = registries;
         attributeType = registries.getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASS_AT_OID );
 
-        if ( val == null )
+        if ( vals == null )
         {
             values.add( new ServerStringValue( attributeType ) );
         }
-        else if ( ! ( val instanceof ServerStringValue ) )
-        {
-            String message = "Only String values supported for objectClass attribute";
-            LOG.error( message );
-            throw new UnsupportedOperationException( message );
-        }
         else
         {
-            values.add( val );
+            for ( ServerValue<?> val:vals )
+            {
+                if ( ! ( val instanceof ServerStringValue ) )
+                {
+                    String message = "Only String values supported for objectClass attribute";
+                    LOG.error( message );
+                    throw new UnsupportedOperationException( message );
+                }
+                else
+                {
+                    values.add( val );
+                }
+            }
         }
 
         setUpId( upId, attributeType );
     }
 
 
-    public ObjectClassAttribute( Registries registries, String val ) throws NamingException
-    {
-        this( null, registries, val );
-    }
-
-
-    public ObjectClassAttribute( String upId, Registries registries, String val ) throws NamingException
+    public ObjectClassAttribute( Registries registries, String upId, String... vals ) throws NamingException
     {
+        this.registries = registries;
         attributeType = registries.getAttributeTypeRegistry().lookup( SchemaConstants.OBJECT_CLASS_AT_OID );
         
-        if ( val == null )
+        if ( vals == null )
         {
             values.add( new ServerStringValue( attributeType ) );
         }
         else
         {
-            values.add( new ServerStringValue( attributeType, val ) );
+            for ( String val:vals )
+            {
+                values.add( new ServerStringValue( attributeType, val ) );
+            }
         }
 
         setUpId( upId, attributeType );
@@ -207,6 +218,8 @@
                     throw new UnsupportedOperationException( message );
             }
 
+            allObjectClasses.add( oc );
+            
             // now go through all objectClassses to collect the must an may list attributes
             Collections.addAll( mayList, oc.getMayList() );
             Collections.addAll( mustList, oc.getMustList() );
@@ -235,6 +248,12 @@
     }
 
 
+    public boolean hasObjectClass( String objectClass )
+    {
+        return allObjectClasses.contains( objectClass );
+    }
+
+
     public Set<ObjectClass> getAbstractObjectClasses()
     {
         return Collections.unmodifiableSet( abstractObjectClasses );
@@ -289,6 +308,33 @@
     }
 
 
+    public boolean add( String val ) throws InvalidAttributeIdentifierException, NamingException
+    {
+        ObjectClass objectClass = registries.getObjectClassRegistry().lookup( val );
+        
+        return addObjectClass( objectClass );
+    }
+
+
+    public boolean add( ServerStringValue val ) throws InvalidAttributeIdentifierException, NamingException
+    {
+        //boolean added = super.add( val );
+        
+        ObjectClass objectClass = registries.getObjectClassRegistry().lookup( val.get() );
+        
+        if ( objectClass == null )
+        {
+            return false;
+        }
+        else
+        {
+            return addObjectClass( objectClass, val.get() );
+        }
+        
+        //return added;
+    }
+
+
     public boolean contains( byte[] val )
     {
         String message = "There are no binary values in an ObjectClass attribute.";
@@ -302,5 +348,43 @@
         String message = "There are no binary values in an ObjectClass attribute.";
         LOG.error( message );
         throw new UnsupportedOperationException( message );
+    }
+    
+    
+    /**
+     * @see Object#toString() 
+     */
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder();
+        
+        sb.append( "ObjectClass : " );
+        
+        if ( ( values != null ) && ( values.size() != 0 ) )
+        {
+            boolean isFirst = true;
+            
+            for ( ServerValue<?> objectClass:values )
+            {
+                if ( isFirst )
+                {
+                    isFirst = false;
+                }
+                else
+                {
+                    sb.append( ", " );
+                }
+                
+                sb.append( objectClass.get() );
+            }
+        }
+        else
+        {
+            sb.append( "(null)" );
+        }
+        
+        sb.append( '\n' );
+        
+        return sb.toString();
     }
 }

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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -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>
+public interface ServerEntry extends Entry<ServerAttribute>, Iterable<ServerAttribute>, Cloneable
 {
     // -----------------------------------------------------------------------
     // Schema Related Methods
@@ -78,6 +78,15 @@
 
 
     /**
+     * Checks to see if this entry is of the objectClass.
+     *
+     * @param objectClass the objectClass to check for in this ServerEntry
+     * @return true if this entry is of the objectClass, false otherwise
+     */
+    boolean hasObjectClass( String objectClass );
+
+
+    /**
      * Gets the first structural objectClass that it can find within the entry.
      * If the entry is inconsistent and contains no objectClass attribute then
      * null is returned.  If the entry is inconsistent and contains more than
@@ -196,6 +205,16 @@
 
 
     /**
+     * Returns the attribute with the specified ID. The return
+     * value is <code>null</code> if no match is found.
+     *
+     * @param upId the ID of the attribute
+     * @return the attribute of the specified ID
+     */
+    ServerAttribute get( String upId ) throws NamingException;
+
+
+    /**
      * Places non-null attributes in the attribute collection. If there is
      * already an attribute with the same OID as any of the new attributes, 
      * the old ones are removed from the collection and are returned by this 
@@ -208,9 +227,12 @@
      */
     List<ServerAttribute> put( ServerAttribute... attributes ) throws NamingException;
 
-    // no value put'ters
+    ServerAttribute put( String upId, String... values ) throws NamingException;
 
-    ServerAttribute put( String upId, AttributeType attributeType ) throws NamingException;
+    ServerAttribute put( String upId, byte[]... values ) throws NamingException;
+
+    // no value put'ters
+    ServerAttribute put( String upId ) throws NamingException;
 
     ServerAttribute put( AttributeType attributeType ) throws NamingException;
 
@@ -229,12 +251,12 @@
      * value: the value of <code>val</code> may be <code>null</code>.
      *
      * @param attributeType the type of the new attribute to be put
-     * @param val the value of the new attribute to be put
+     * @param values the values of the new attribute to be put
      * @return the old attribute of the same type, if exists; otherwise
      *         <code>null</code>
      * @throws NamingException if there are resolution issues
      */
-    ServerAttribute put( AttributeType attributeType, ServerValue<?> val ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType, ServerValue<?>... values ) throws NamingException;
 
     /**
      * Places a new attribute with the supplied attributeType and value into this
@@ -247,12 +269,12 @@
      *
      * @param upId the user provided identifier for the new attribute
      * @param attributeType the type of the new attribute to be put
-     * @param val the value of the new attribute to be put
+     * @param values the value of the new attribute to be put
      * @return the old attribute of the same type, if exists; otherwise
      *         <code>null</code>
      * @throws NamingException if there are failures
      */
-    ServerAttribute put( String upId, AttributeType attributeType, ServerValue<?> val ) throws NamingException;
+    ServerAttribute put( String upId, ServerValue<?>... values ) throws NamingException;
 
 
     /**
@@ -267,15 +289,12 @@
      * <code>null</code>.
      *
      * @param attributeType the type of the new attribute to be put
-     * @param val the value of the new attribute to be put
+     * @param values the values of the new attribute to be put
      * @return the old attribute with the same identifier, if exists; otherwise
      *         <code>null</code>
      * @throws NamingException if there are failures
      */
-    ServerAttribute put( AttributeType attributeType, String val ) throws NamingException;
-
-
-    ServerAttribute put( String upId, AttributeType attributeType, String val ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType, String... values ) throws NamingException;
 
 
     /**
@@ -290,15 +309,24 @@
      * <code>null</code>.
      *
      * @param attributeType the type of the new attribute to be put
-     * @param val the value of the new attribute to be put
+     * @param values the values of the new attribute to be put
      * @return the old attribute with the same identifier, if exists; otherwise
      *         <code>null</code>
      * @throws NamingException if there are failures
      */
-    ServerAttribute put( AttributeType attributeType, byte[] val ) throws NamingException;
+    ServerAttribute put( AttributeType attributeType, byte[]... values ) throws NamingException;
 
 
-    ServerAttribute put( String upId, AttributeType attributeType, byte[] val ) throws NamingException;
+    /**
+     * Removes the attribute with the specified alias. The removed attribute is
+     * returned by this method. If there is no attribute with the specified OID,
+     * the return value is <code>null</code>.
+     *
+     * @param attributeTypes the types of the attribute to be removed
+     * @return the removed attribute, if exists; otherwise <code>null</code>
+     * @throws NamingException if there are failures
+     */
+    List<ServerAttribute> remove( AttributeType... attributeTypes ) throws NamingException;
 
 
     /**
@@ -306,11 +334,11 @@
      * returned by this method. If there is no attribute with the specified OID,
      * the return value is <code>null</code>.
      *
-     * @param attributeType the type of the attribute to be removed
+     * @param ids the IDs of the attribute to be removed
      * @return the removed attribute, if exists; otherwise <code>null</code>
      * @throws NamingException if there are failures
      */
-    ServerAttribute remove( AttributeType attributeType ) throws NamingException;
+    List<ServerAttribute> remove( String... ids ) throws NamingException;
 
 
     /**
@@ -322,4 +350,9 @@
      * @return the removed attribute, if exists; otherwise <code>null</code>
      */
     List<ServerAttribute> remove( ServerAttribute... attributes ) throws NamingException;
+    
+    /**
+     * A clone method to produce a clone of the current object
+     */
+    public Object clone();
 }

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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -83,12 +83,12 @@
      * 
      * @throws InvalidAttributeIdentifierException If we had an incorrect attribute
      */
-    public static DefaultServerAttribute toServerAttribute( Attribute attribute, AttributeType attributeType )
+    public static ServerAttribute toServerAttribute( Attribute attribute, AttributeType attributeType )
             throws InvalidAttributeIdentifierException
     {
         try 
         {
-            DefaultServerAttribute serverAttribute = new DefaultServerAttribute( attributeType );
+            ServerAttribute serverAttribute = new DefaultServerAttribute( attributeType );
         
             for ( NamingEnumeration<?> values = attribute.getAll(); values.hasMoreElements(); )
             {
@@ -127,21 +127,21 @@
      * 
      * @throws InvalidAttributeIdentifierException If we get an invalid attribute
      */
-    public static DefaultServerEntry toServerEntry( Attributes attributes, LdapDN dn, Registries registries ) 
+    public static ServerEntry toServerEntry( Attributes attributes, LdapDN dn, Registries registries ) 
             throws InvalidAttributeIdentifierException
     {
         if ( ( attributes instanceof BasicAttributes ) || ( attributes instanceof AttributesImpl ) )
         {
             try 
             {
-                DefaultServerEntry entry = new DefaultServerEntry( dn, registries );
+                ServerEntry entry = new DefaultServerEntry( dn, registries );
     
                 for ( NamingEnumeration<? extends Attribute> attrs = attributes.getAll(); attrs.hasMoreElements(); )
                 {
                     Attribute attr = attrs.nextElement();
 
                     AttributeType attributeType = registries.getAttributeTypeRegistry().lookup( attr.getID() );
-                    DefaultServerAttribute serverAttribute = ServerEntryUtils.toServerAttribute( attr, attributeType );
+                    ServerAttribute serverAttribute = ServerEntryUtils.toServerAttribute( attr, attributeType );
                     
                     if ( serverAttribute != null )
                     {
@@ -220,7 +220,7 @@
      */
     public static Attribute toAttributeImpl( ServerAttribute attr )
     {
-        Attribute attribute = new AttributeImpl( attr.getUpId(), false );
+        Attribute attribute = new AttributeImpl( attr.getUpId() );
 
         for ( Iterator<ServerValue<?>> iter = attr.getAll(); iter.hasNext();)
         {

Modified: directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java (original)
+++ directory/apacheds/branches/bigbang/core-entry/src/test/java/org/apache/directory/server/core/entry/DefaultServerEntryTest.java Fri Dec 28 18:53:20 2007
@@ -32,6 +32,8 @@
 import org.apache.directory.server.schema.bootstrap.ApachemetaSchema;
 import org.apache.directory.server.schema.bootstrap.BootstrapSchemaLoader;
 import org.apache.directory.server.schema.bootstrap.CoreSchema;
+import org.apache.directory.server.schema.bootstrap.CosineSchema;
+import org.apache.directory.server.schema.bootstrap.InetorgpersonSchema;
 import org.apache.directory.server.schema.bootstrap.Schema;
 import org.apache.directory.server.schema.bootstrap.SystemSchema;
 import org.apache.directory.server.schema.registries.DefaultOidRegistry;
@@ -75,6 +77,8 @@
         bootstrapSchemas.add( new ApacheSchema() );
         bootstrapSchemas.add( new CoreSchema() );
         bootstrapSchemas.add( new SystemSchema() );
+        bootstrapSchemas.add( new InetorgpersonSchema() );
+        bootstrapSchemas.add( new CosineSchema() );
         loader.loadWithDependencies( bootstrapSchemas, registries );
     }
 

Modified: directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java (original)
+++ directory/apacheds/branches/bigbang/core-integ/src/test/java/org/apache/directory/server/core/authz/CompareAuthorizationIT.java Fri Dec 28 18:53:20 2007
@@ -177,11 +177,32 @@
         assertFalse( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );
 
         // now add a subentry that enables user billyd to compare an entry below ou=system
-        createAccessControlSubentry( "billydAdd", "{ " + "identificationTag \"addAci\", " + "precedence 14, "
-            + "authenticationLevel none, " + "itemOrUserFirst userFirst: { "
-            + "userClasses { name { \"uid=billyd,ou=users,ou=system\" } }, " + "userPermissions { { "
-            + "protectedItems {entry, allUserAttributeTypesAndValues}, "
-            + "grantsAndDenials { grantCompare, grantRead, grantBrowse } } } } }" );
+        createAccessControlSubentry( "billydAdd", 
+            "{ " +
+            "  identificationTag \"addAci\", precedence 14, authenticationLevel none, itemOrUserFirst userFirst: " + 
+            "  { " +
+            "    userClasses " +
+            "    { " +
+            "      name " +
+            "      { " +
+            "        \"uid=billyd,ou=users,ou=system\" " +
+            "      } " +
+            "    }, " +
+            "    userPermissions " +
+            "    { " +
+            "      { " +
+            "        protectedItems " +
+            "        {" +
+            "          entry, allUserAttributeTypesAndValues" +
+            "        }, " +
+            "        grantsAndDenials " +
+            "        { " +
+            "          grantCompare, grantRead, grantBrowse " +
+            "        } " +
+            "      } " +
+            "    } " +
+            "  } " +
+            "}" );
 
         // should work now that billyd is authorized by name
         assertTrue( checkCanCompareTelephoneNumberAs( "billyd", "billyd", "ou=testou", "867-5309" ) );

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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -32,6 +32,8 @@
 import org.apache.directory.server.core.changelog.Tag;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
 import org.apache.directory.server.core.cursor.Cursor;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.event.EventInterceptor;
 import org.apache.directory.server.core.exception.ExceptionInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
@@ -121,7 +123,7 @@
 
     /** the registries for system schema objects */
     private Registries registries;
-
+    
     /** the root nexus */
     private DefaultPartitionNexus partitionNexus;
 
@@ -940,8 +942,8 @@
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
             attributes.put( SchemaConstants.DISPLAY_NAME_AT, "Directory Superuser" );
 
-            partitionNexus.add( new AddOperationContext( PartitionNexus.getAdminName(),
-                attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, PartitionNexus.getAdminName(), registries );
+            partitionNexus.add( new AddOperationContext( registries, PartitionNexus.getAdminName(), entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -966,7 +968,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( userDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, userDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, userDn, entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -990,7 +993,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( groupDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, groupDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, groupDn, entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1014,7 +1018,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( name, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, name, registries );
+            partitionNexus.add( new AddOperationContext( registries, name, entry ) );
             
             Interceptor authzInterceptor = interceptorChain.get( AciAuthorizationInterceptor.class.getName() );
             
@@ -1058,7 +1063,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( configurationDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, configurationDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, configurationDn, entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1082,7 +1088,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( partitionsDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, partitionsDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, partitionsDn, entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1106,7 +1113,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( servicesDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, servicesDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, servicesDn, entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1130,7 +1138,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( interceptorsDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, interceptorsDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, interceptorsDn, entry ) );
         }
 
         // -------------------------------------------------------------------
@@ -1155,7 +1164,8 @@
             attributes.put( SchemaConstants.CREATORS_NAME_AT, ServerDNConstants.ADMIN_SYSTEM_DN_NORMALIZED );
             attributes.put( SchemaConstants.CREATE_TIMESTAMP_AT, DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( new AddOperationContext( sysPrefRootDn, attributes ) );
+            ServerEntry entry = ServerEntryUtils.toServerEntry( attributes, sysPrefRootDn, registries );
+            partitionNexus.add( new AddOperationContext( registries, sysPrefRootDn, entry ) );
         }
 
         return firstStart;

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java Fri Dec 28 18:53:20 2007
@@ -54,7 +54,6 @@
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.name.LdapDN;
-import org.apache.directory.shared.ldap.util.AttributeUtils;
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -197,7 +196,7 @@
         if ( IS_DEBUG )
         {
             LOG.debug( "Adding the entry " +
-                    AttributeUtils.toString( opContext.getEntry() ) +
+                    opContext.getEntry() +
                     " for DN = '" + opContext.getDn().getUpName() + "'" );
         }
 

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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -24,6 +24,8 @@
 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.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
@@ -50,6 +52,7 @@
 import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.aci.ACIItem;
 import org.apache.directory.shared.ldap.aci.ACIItemParser;
 import org.apache.directory.shared.ldap.aci.ACITuple;
@@ -166,8 +169,11 @@
     /** interceptor chain */
     private InterceptorChain chain;
     
+    /** Global registries */
+    private Registries registries;
+    
     /** attribute type registry */
-    private AttributeTypeRegistry attrRegistry;
+    private AttributeTypeRegistry atRegistry;
     
     /** whether or not this interceptor is activated */
     private boolean enabled;
@@ -201,20 +207,21 @@
 
         tupleCache = new TupleCache( directoryService );
         groupCache = new GroupCache( directoryService );
-        attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
-        OidRegistry oidRegistry = directoryService.getRegistries().getOidRegistry();
+        registries = directoryService.getRegistries();
+        atRegistry = registries.getAttributeTypeRegistry();
+        OidRegistry oidRegistry = registries.getOidRegistry();
         
         // look up some constant information
         String objectClassOid = oidRegistry.getOid( SchemaConstants.OBJECT_CLASS_AT );
         subentryOid = oidRegistry.getOid( SchemaConstants.SUBENTRY_OC );
         String acSubentryOid = oidRegistry.getOid( AC_SUBENTRY_ATTR );
-        objectClassType = attrRegistry.lookup( objectClassOid );
-        acSubentryType = attrRegistry.lookup( acSubentryOid );
-        entryAciType = attrRegistry.lookup( SchemaConstants.ENTRY_ACI_AT_OID ); 
-        subentryAciType = attrRegistry.lookup( SchemaConstants.SUBENTRY_ACI_AT_OID );
+        objectClassType = atRegistry.lookup( objectClassOid );
+        acSubentryType = atRegistry.lookup( acSubentryOid );
+        entryAciType = atRegistry.lookup( SchemaConstants.ENTRY_ACI_AT_OID ); 
+        subentryAciType = atRegistry.lookup( SchemaConstants.SUBENTRY_ACI_AT_OID );
         
-        aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( attrRegistry, oidRegistry ), attrRegistry.getNormalizerMapping() );
-        engine = new ACDFEngine( directoryService.getRegistries().getOidRegistry(), attrRegistry );
+        aciParser = new ACIItemParser( new ConcreteNameComponentNormalizer( atRegistry, oidRegistry ), atRegistry.getNormalizerMapping() );
+        engine = new ACDFEngine( registries.getOidRegistry(), atRegistry );
         chain = directoryService.getInterceptorChain();
         enabled = directoryService.isAccessControlEnabled();
 
@@ -223,7 +230,7 @@
         	( String ) directoryService.getPartitionNexus().getRootDSE( null ).
         		get( SchemaConstants.SUBSCHEMA_SUBENTRY_AT ).get();
         LdapDN subschemaSubentryDnName = new LdapDN( subschemaSubentry );
-        subschemaSubentryDnName.normalize( attrRegistry.getNormalizerMapping() );
+        subschemaSubentryDnName.normalize( atRegistry.getNormalizerMapping() );
         subschemaSubentryDn = subschemaSubentryDnName.toNormName();
     }
 
@@ -254,7 +261,7 @@
     private LdapDN parseNormalized( String name ) throws NamingException
     {
         LdapDN dn = new LdapDN( name );
-        dn.normalize( attrRegistry.getNormalizerMapping() );
+        dn.normalize( atRegistry.getNormalizerMapping() );
         return dn;
     }
 
@@ -430,7 +437,9 @@
         LdapPrincipal principal = ( ( ServerContext ) invocation.getCaller() ).getPrincipal();
         LdapDN principalDn = principal.getJndiName();
         
-        Attributes entry = addContext.getEntry();
+        ServerEntry serverEntry = addContext.getEntry(); 
+        Attributes entry = ServerEntryUtils.toAttributesImpl( serverEntry );
+
         LdapDN name = addContext.getDn();
 
         // bypass authz code if we are disabled
@@ -444,7 +453,7 @@
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
             next.add( addContext );
-            tupleCache.subentryAdded( name, entry );
+            tupleCache.subentryAdded( name, serverEntry );
             groupCache.groupAdded( name, entry );
             return;
         }
@@ -492,7 +501,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, entry );
+        tupleCache.subentryAdded( name, serverEntry );
         groupCache.groupAdded( name, entry );
     }
 
@@ -527,7 +536,7 @@
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
             next.delete( deleteContext );
-            tupleCache.subentryDeleted( name, entry );
+            tupleCache.subentryDeleted( name, ServerEntryUtils.toServerEntry( entry, name, registries ) );
             groupCache.groupDeleted( name, entry );
             return;
         }
@@ -542,7 +551,7 @@
             REMOVE_PERMS, tuples, entry, null );
 
         next.delete( deleteContext );
-        tupleCache.subentryDeleted( name, entry );
+        tupleCache.subentryDeleted( name, ServerEntryUtils.toServerEntry( entry, name, registries ) );
         groupCache.groupDeleted( name, entry );
     }
 
@@ -576,7 +585,7 @@
              * @TODO: A virtual entry can be created here for not hitting the backend again.
              */
             Attributes modifiedEntry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
-            tupleCache.subentryModified( name, mods, modifiedEntry );
+            tupleCache.subentryModified( name, mods, ServerEntryUtils.toServerEntry( modifiedEntry, name, registries ) );
             groupCache.groupModified( name, mods, entry );
             return;
         }
@@ -663,7 +672,7 @@
          * @TODO: A virtual entry can be created here for not hitting the backend again.
          */
         Attributes modifiedEntry = proxy.lookup( new LookupOperationContext( name ), PartitionNexusProxy.LOOKUP_BYPASS );
-        tupleCache.subentryModified( name, mods, modifiedEntry );
+        tupleCache.subentryModified( name, mods, ServerEntryUtils.toServerEntry( modifiedEntry, name, registries ) );
         groupCache.groupModified( name, mods, entry );
     }
 
@@ -753,7 +762,7 @@
         
         if ( !principalDn.isNormalized() )
         {
-        	principalDn.normalize( attrRegistry.getNormalizerMapping() );
+        	principalDn.normalize( atRegistry.getNormalizerMapping() );
         }
         
         if ( isPrincipalAnAdministrator( principalDn ) || !enabled )

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=607363&r1=607362&r2=607363&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 Fri Dec 28 18:53:20 2007
@@ -20,11 +20,17 @@
 package org.apache.directory.server.core.authz;
 
 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.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;
 import org.apache.directory.server.schema.ConcreteNameComponentNormalizer;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.server.schema.registries.OidRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.aci.ACIItem;
 import org.apache.directory.shared.ldap.aci.ACIItemParser;
 import org.apache.directory.shared.ldap.aci.ACITuple;
@@ -104,7 +110,7 @@
         NameComponentNormalizer ncn = new ConcreteNameComponentNormalizer( attributeTypeRegistry, oidRegistry );
         aciParser = new ACIItemParser( ncn, normalizerMap );
         prescriptiveAciAT = attributeTypeRegistry.lookup( SchemaConstants.PRESCRIPTIVE_ACI_AT );
-        initialize();
+        initialize( directoryService.getRegistries() );
     }
 
     
@@ -116,7 +122,7 @@
     }
 
 
-    private void initialize() throws NamingException
+    private void initialize( Registries registries ) throws NamingException
     {
         // search all naming contexts for access control subentenries
         // generate ACITuple Arrays for each subentry
@@ -148,7 +154,7 @@
                 }
 
                 LdapDN normName = parseNormalized( subentryDn );
-                subentryAdded( normName, result.getAttributes() );
+                subentryAdded( normName, ServerEntryUtils.toServerEntry( result.getAttributes(), normName, registries ) );
             }
             
             results.close();
@@ -156,15 +162,15 @@
     }
 
 
-    private boolean hasPrescriptiveACI( Attributes entry ) throws NamingException
+    private boolean hasPrescriptiveACI( ServerEntry entry ) throws NamingException
     {
         // only do something if the entry contains prescriptiveACI
-        Attribute aci = AttributeUtils.getAttribute( entry, prescriptiveAciAT );
+        ServerAttribute aci = entry.get( prescriptiveAciAT );
 
         if ( aci == null )
         {
-            if ( AttributeUtils.containsValueCaseIgnore( entry.get( SchemaConstants.OBJECT_CLASS_AT ), SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) ||
-                 AttributeUtils.containsValueCaseIgnore( entry.get( SchemaConstants.OBJECT_CLASS_AT ), SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC_OID ))
+            if ( entry.contains( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC ) ||
+                 entry.contains( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.ACCESS_CONTROL_SUBENTRY_OC_OID ) )
             {
                 // should not be necessary because of schema interceptor but schema checking
                 // can be turned off and in this case we must protect against being able to
@@ -181,10 +187,10 @@
     }
 
 
-    public void subentryAdded( LdapDN normName, Attributes entry ) throws NamingException
+    public void subentryAdded( LdapDN normName, ServerEntry entry ) throws NamingException
     {
         // only do something if the entry contains prescriptiveACI
-        Attribute aci = AttributeUtils.getAttribute( entry, prescriptiveAciAT );
+        ServerAttribute aciAttr = entry.get( prescriptiveAciAT );
         
         if ( !hasPrescriptiveACI( entry ) )
         {
@@ -193,14 +199,16 @@
 
         List<ACITuple> entryTuples = new ArrayList<ACITuple>();
         
-        for ( int ii = 0; ii < aci.size(); ii++ )
+        Iterator<ServerValue<?>> acis = aciAttr.getAll();
+        
+        while ( acis.hasNext() )
         {
+            String aci = ((ServerStringValue)acis.next()).get();
             ACIItem item = null;
-            String aciStr = ( String ) aci.get( ii ); 
 
             try
             {
-                item = aciParser.parse( aciStr );
+                item = aciParser.parse( aci );
                 entryTuples.addAll( item.toTuples() );
             }
             catch ( ParseException e )
@@ -220,9 +228,9 @@
     }
 
 
-    public void subentryDeleted( Name normName, Attributes entry ) throws NamingException
+    public void subentryDeleted( LdapDN normName, ServerEntry entry ) throws NamingException
     {
-        if ( !hasPrescriptiveACI( entry ) )
+        if ( !hasPrescriptiveACI(entry ) )
         {
             return;
         }
@@ -231,7 +239,7 @@
     }
 
 
-    public void subentryModified( LdapDN normName, List<ModificationItemImpl> mods, Attributes entry ) throws NamingException
+    public void subentryModified( LdapDN normName, List<ModificationItemImpl> mods, ServerEntry entry ) throws NamingException
     {
         if ( !hasPrescriptiveACI( entry ) )
         {
@@ -241,6 +249,7 @@
         for ( ModificationItemImpl mod : mods )
         {
             String attrID = mod.getAttribute().getID();
+            
             if ( attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT ) ||
                     attrID.equalsIgnoreCase( SchemaConstants.PRESCRIPTIVE_ACI_AT_OID ) )
             {
@@ -251,7 +260,7 @@
     }
 
 
-    public void subentryModified( LdapDN normName, Attributes mods, Attributes entry ) throws NamingException
+    public void subentryModified( LdapDN normName, Attributes mods, ServerEntry entry ) throws NamingException
     {
         if ( !hasPrescriptiveACI( entry ) )
         {

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/ChangeLogInterceptor.java Fri Dec 28 18:53:20 2007
@@ -23,7 +23,7 @@
 
 import org.apache.directory.server.constants.ApacheSchemaConstants;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -61,10 +61,13 @@
 {
     /** for debugging */
     private static final Logger LOG = LoggerFactory.getLogger( ChangeLogInterceptor.class );
+    
     /** used to ignore modify operations to tombstone entries */
     private AttributeType entryDeleted;
+    
     /** the changelog service to log changes to */
     private ChangeLog changeLog;
+    
     /** we need the schema service to deal with special conditions */
     private SchemaService schemaService;
 
@@ -101,7 +104,7 @@
         forward.setChangeType( ChangeType.Add );
         forward.setDn( opContext.getDn().getUpName() );
         
-        DefaultServerEntry addEntry = ServerEntryUtils.toServerEntry( opContext.getEntry(), opContext.getDn(), schemaService.getRegistries() );
+        ServerEntry addEntry = opContext.getEntry();
 
         Set<AttributeType> list = addEntry.getAttributeTypes();
         

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java?rev=607363&r1=607362&r2=607363&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/changelog/OriginalChangeLogInterceptor.java Fri Dec 28 18:53:20 2007
@@ -19,6 +19,7 @@
 package org.apache.directory.server.core.changelog;
 
 import org.apache.directory.server.core.DirectoryService;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
@@ -73,7 +74,7 @@
     private final Queue<StringBuilder> queue = new LinkedList<StringBuilder>();
     
     /** a handle on the attributeType registry to determine the binary nature of attributes */
-    private AttributeTypeRegistry registry;
+    private AttributeTypeRegistry atRegistry;
     
     /** determines if this service has been activated */
     private boolean isActive;
@@ -92,7 +93,7 @@
         super.init( directoryService );
 
         // Get a handle on the attribute registry to check if attributes are binary
-        registry = directoryService.getRegistries().getAttributeTypeRegistry();
+        atRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
 
         // Open a print stream to use for flushing LDIFs into
         File changes = new File( directoryService.getWorkingDirectory(), "changes.LOG" );
@@ -232,7 +233,7 @@
         buf.append( DateUtils.getGeneralizedTime() );
         
         // Append the LDIF entry now
-        buf.append( LdifUtils.convertToLdif( opContext.getEntry() ) );
+        buf.append( LdifUtils.convertToLdif( ServerEntryUtils.toAttributesImpl( opContext.getEntry() ) ) );
 
         // Enqueue the buffer onto a queue that is emptied by another thread asynchronously. 
         synchronized ( queue )
@@ -449,7 +450,7 @@
     {
         String id = attr.getID();
         int sz = attr.size();
-        boolean isBinary = ! registry.lookup( id ).getSyntax().isHumanReadable();
+        boolean isBinary = ! atRegistry.lookup( id ).getSyntax().isHumanReadable();
         
         if ( isBinary )
         {



Mime
View raw message