directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r613608 [13/15] - in /directory/sandbox/akarasulu/bigbang/apacheds: ./ bootstrap-plugin/ bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/ core-entry/ core-entry/src/main/java/org/apache/directory/server/core...
Date Sun, 20 Jan 2008 16:59:36 GMT
Modified: directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/KeyDerivationInterceptor.java Sun Jan 20 08:59:10 2008
@@ -55,6 +55,12 @@
 import org.apache.directory.server.core.schema.SchemaInterceptor;
 import org.apache.directory.server.core.subtree.SubentryInterceptor;
 import org.apache.directory.server.core.collective.CollectiveAttributeInterceptor;
+import org.apache.directory.server.core.entry.DefaultServerAttribute;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerBinaryValue;
+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.event.EventInterceptor;
 import org.apache.directory.server.core.trigger.TriggerInterceptor;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
@@ -64,6 +70,7 @@
 import org.apache.directory.server.kerberos.shared.io.encoder.EncryptionKeyEncoder;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
@@ -127,47 +134,39 @@
     {
         LdapDN normName = addContext.getDn();
 
-        Attributes entry = addContext.getEntry();
+        ServerEntry entry = addContext.getEntry();
 
-        if ( entry.get( "userPassword" ) != null && entry.get( KerberosAttribute.PRINCIPAL ) != null )
+        if ( ( entry.get( SchemaConstants.USER_PASSWORD_AT ) != null ) && 
+            ( entry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) != null ) )
         {
-            log.debug( "Adding the entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName.getUpName() );
+            log.debug( "Adding the entry '{}' for DN '{}'.", entry, normName.getUpName() );
 
-            Object firstValue = entry.get( "userPassword" ).get();
+            ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+            String strUserPassword = StringTools.utf8ToString( userPassword.get() );
 
-            if ( firstValue instanceof String )
+            if ( log.isDebugEnabled() )
             {
-                log.debug( "Adding Attribute id : 'userPassword',  Values : [ '{}' ]", firstValue );
+                StringBuffer sb = new StringBuffer();
+                sb.append( "'" + strUserPassword + "' ( " );
+                sb.append( userPassword );
+                sb.append( " )" );
+                log.debug( "Adding Attribute id : 'userPassword',  Values : [ {} ]", sb.toString() );
             }
-            else if ( firstValue instanceof byte[] )
-            {
-                String string = StringTools.utf8ToString( ( byte[] ) firstValue );
 
-                if ( log.isDebugEnabled() )
-                {
-                    StringBuffer sb = new StringBuffer();
-                    sb.append( "'" + string + "' ( " );
-                    sb.append( StringTools.dumpBytes( ( byte[] ) firstValue ).trim() );
-                    sb.append( " )" );
-                    log.debug( "Adding Attribute id : 'userPassword',  Values : [ {} ]", sb.toString() );
-                }
+            ServerValue<?> principalNameValue = entry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
+            
+            String principalName = (String)principalNameValue.get();
 
-                firstValue = string;
-            }
+            log.debug( "Got principal '{}' with userPassword '{}'.", principalName, strUserPassword );
 
-            String userPassword = ( String ) firstValue;
-            String principalName = ( String ) entry.get( KerberosAttribute.PRINCIPAL ).get();
+            Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, strUserPassword );
 
-            log.debug( "Got principal '{}' with userPassword '{}'.", principalName, userPassword );
+            entry.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalName );
+            entry.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
 
-            Map<EncryptionType, EncryptionKey> keys = generateKeys( principalName, userPassword );
+            entry.put( getKeyAttribute( addContext.getRegistries(), keys ) );
 
-            entry.put( KerberosAttribute.PRINCIPAL, principalName );
-            entry.put( KerberosAttribute.VERSION, Integer.toString( 0 ) );
-
-            entry.put( getKeyAttribute( keys ) );
-
-            log.debug( "Adding modified entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName
+            log.debug( "Adding modified entry '{}' for DN '{}'.", entry, normName
                 .getUpName() );
         }
 
@@ -245,7 +244,7 @@
             Attribute attr = mod.getAttribute();
             String attrId = attr.getID();
 
-            if ( attrId.equalsIgnoreCase( "userPassword" ) )
+            if ( attrId.equalsIgnoreCase( SchemaConstants.USER_PASSWORD_AT ) )
             {
                 Object firstValue = attr.get();
 
@@ -273,7 +272,7 @@
                 log.debug( "Got userPassword '{}'.", subContext.getUserPassword() );
             }
 
-            if ( attrId.equalsIgnoreCase( KerberosAttribute.PRINCIPAL ) )
+            if ( attrId.equalsIgnoreCase( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ) )
             {
                 subContext.setPrincipalName( ( String ) attr.get() );
                 log.debug( "Got principal '{}'.", subContext.getPrincipalName() );
@@ -298,8 +297,15 @@
         PartitionNexusProxy proxy = invocation.getProxy();
         Attributes userEntry;
 
-        LookupOperationContext lookupContext = new LookupOperationContext( new String[]
-            { SchemaConstants.OBJECT_CLASS_AT, KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION } );
+        LookupOperationContext lookupContext = 
+            new LookupOperationContext( modContext.getRegistries(),
+                new String[]
+                           { 
+                            SchemaConstants.OBJECT_CLASS_AT, 
+                            KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, 
+                            KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT 
+                           } );
+        
         lookupContext.setDn( principalDn );
 
         userEntry = proxy.lookup( lookupContext, USERLOOKUP_BYPASS );
@@ -323,13 +329,13 @@
 
         if ( subContext.getPrincipalName() == null )
         {
-            Attribute principalAttribute = userEntry.get( KerberosAttribute.PRINCIPAL );
+            Attribute principalAttribute = userEntry.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT );
             String principalName = ( String ) principalAttribute.get();
             subContext.setPrincipalName( principalName );
             log.debug( "Found principal '{}' from lookup.", principalName );
         }
 
-        Attribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.VERSION );
+        Attribute keyVersionNumberAttr = userEntry.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT );
 
         if ( keyVersionNumberAttr == null )
         {
@@ -354,7 +360,7 @@
      * @param modContext
      * @param subContext
      */
-    void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext )
+    void deriveKeys( ModifyOperationContext modContext, ModifySubContext subContext ) throws NamingException
     {
         List<ModificationItemImpl> mods = modContext.getModItems();
 
@@ -376,18 +382,22 @@
 
         // Add our modification items.
         newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
-            KerberosAttribute.PRINCIPAL, principalName ) ) );
+            KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principalName ) ) );
         newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, new AttributeImpl(
-            KerberosAttribute.VERSION, Integer.toString( kvno ) ) ) );
-        newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, getKeyAttribute( keys ) ) );
+            KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, Integer.toString( kvno ) ) ) );
+        
+        Attribute attribute = ServerEntryUtils.toAttributeImpl( getKeyAttribute( modContext.getRegistries(), keys ) );
+        newModsList.add( new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, attribute ) );
 
         modContext.setModItems( newModsList );
     }
 
 
-    private Attribute getKeyAttribute( Map<EncryptionType, EncryptionKey> keys )
+    private ServerAttribute getKeyAttribute( Registries registries, Map<EncryptionType, EncryptionKey> keys ) throws NamingException
     {
-        Attribute keyAttribute = new AttributeImpl( KerberosAttribute.KEY );
+        ServerAttribute keyAttribute = 
+            new DefaultServerAttribute( KerberosAttribute.KRB5_KEY_AT, 
+                registries.getAttributeTypeRegistry().lookup( KerberosAttribute.KRB5_KEY_AT ) );
 
         Iterator<EncryptionKey> it = keys.values().iterator();
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/interceptor-kerberos/src/main/java/org/apache/directory/server/core/kerberos/PasswordPolicyInterceptor.java Sun Jan 20 08:59:10 2008
@@ -20,6 +20,9 @@
 package org.apache.directory.server.core.kerberos;
 
 
+import org.apache.directory.server.core.entry.ServerBinaryValue;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerStringValue;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
@@ -28,14 +31,12 @@
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 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;
 
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem;
 import java.util.ArrayList;
@@ -70,48 +71,36 @@
     {
         LdapDN normName = addContext.getDn();
 
-        Attributes entry = addContext.getEntry();
+        ServerEntry entry = addContext.getEntry();
 
-        log.debug( "Adding the entry '{}' for DN '{}'.", AttributeUtils.toString( entry ), normName.getUpName() );
-
-        Object attr = null;
+        log.debug( "Adding the entry '{}' for DN '{}'.", entry, normName.getUpName() );
 
         if ( entry.get( SchemaConstants.USER_PASSWORD_AT ) != null )
         {
-            String userPassword = "";
-            String username = "";
-
-            attr = entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+            String username = null;
 
-            if ( attr instanceof String )
-            {
-                log.debug( "Adding Attribute id : 'userPassword',  Values : [ '{}' ]", attr );
-                userPassword = ( String ) attr;
-            }
-            else if ( attr instanceof byte[] )
-            {
-                String string = StringTools.utf8ToString( ( byte[] ) attr );
+            ServerBinaryValue userPassword = (ServerBinaryValue)entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
 
-                if ( log.isDebugEnabled() )
-                {
-                    StringBuffer sb = new StringBuffer();
-                    sb.append( "'" + string + "' ( " );
-                    sb.append( StringTools.dumpBytes( ( byte[] ) attr ).trim() );
-                    sb.append( " )" );
-                    log.debug( "Adding Attribute id : 'userPassword',  Values : [ {} ]", sb.toString() );
-                }
+            // The password is stored in a non H/R attribute, but it's a String
+            String strUserPassword = StringTools.utf8ToString( userPassword.get() );
 
-                userPassword = string;
+            if ( log.isDebugEnabled() )
+            {
+                StringBuffer sb = new StringBuffer();
+                sb.append( "'" + strUserPassword + "' ( " );
+                sb.append( userPassword );
+                sb.append( " )" );
+                log.debug( "Adding Attribute id : 'userPassword',  Values : [ {} ]", sb.toString() );
             }
 
             if ( entry.get( SchemaConstants.CN_AT ) != null )
             {
-                attr = entry.get( SchemaConstants.CN_AT ).get();
-                username = ( String ) attr;
+                ServerStringValue attr = (ServerStringValue)entry.get( SchemaConstants.CN_AT ).get();
+                username = attr.get();
             }
 
             // If userPassword fails checks, throw new NamingException.
-            check( username, userPassword );
+            check( username, strUserPassword );
         }
 
         next.add( addContext );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/pom.xml?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/pom.xml (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/pom.xml Sun Jan 20 08:59:10 2008
@@ -57,6 +57,12 @@
 
     <dependency>
       <groupId>${pom.groupId}</groupId>
+      <artifactId>apacheds-core-entry</artifactId>
+      <version>${pom.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${pom.groupId}</groupId>
       <artifactId>apacheds-btree-base</artifactId>
       <version>${pom.version}</version>
     </dependency>

Modified: directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/jdbm-store/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmStore.java Sun Jan 20 08:59:10 2008
@@ -24,6 +24,9 @@
 import jdbm.helper.MRU;
 import jdbm.recman.BaseRecordManager;
 import jdbm.recman.CacheRecordManager;
+
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.partition.Oid;
 import org.apache.directory.server.core.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.IndexAssertion;
@@ -136,7 +139,7 @@
     // -----------------------------------------------------------------------
 
 
-    private Attributes contextEntry;
+    private ServerEntry contextEntry;
     private String suffixDn;
     private boolean enableOptimizer;
     private int cacheSize = DEFAULT_CACHE_SIZE;
@@ -181,14 +184,14 @@
     }
 
 
-    public void setContextEntry( Attributes contextEntry )
+    public void setContextEntry( ServerEntry contextEntry )
     {
         protect( "contextEntry" );
         this.contextEntry = contextEntry;
     }
 
 
-    public Attributes getContextEntry()
+    public ServerEntry getContextEntry()
     {
         return contextEntry;
     }
@@ -428,7 +431,7 @@
      * @throws NamingException on failre to add the root entry
      * @throws Exception failure to access btrees
      */
-    protected void initSuffixEntry3( String suffix, Attributes entry ) throws Exception
+    protected void initSuffixEntry3( String suffix, ServerEntry entry ) throws Exception
     {
         // add entry for context, if it does not exist
         Attributes suffixOnDisk = getSuffixEntry();
@@ -437,7 +440,10 @@
         {
             LdapDN dn = new LdapDN( suffix );
             LdapDN normalizedSuffix = LdapDN.normalize( dn, attributeTypeRegistry.getNormalizerMapping() );
-            add( normalizedSuffix, entry );
+            
+            //add( normalizedSuffix, entry );
+            // TODO just start using ServerEntry here!!!!
+            add( normalizedSuffix, ServerEntryUtils.toAttributesImpl( entry ) );
         }
     }
 
@@ -518,7 +524,7 @@
         try
         {
             recMan.close();
-            LOG.debug( "Cloased record manager for {} partition.",  suffixDn );
+            LOG.debug( "Closed record manager for {} partition.",  suffixDn );
         }
         catch ( Throwable t )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Checksum.java Sun Jan 20 08:59:10 2008
@@ -98,7 +98,7 @@
             return true;
         }
 
-        if ( ( o != null ) || !( o instanceof Checksum ) )
+        if ( !( o instanceof Checksum ) )
         {
             return false;
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/flags/AbstractKerberosFlags.java Sun Jan 20 08:59:10 2008
@@ -33,6 +33,11 @@
  */
 public abstract class AbstractKerberosFlags extends BitString implements KerberosFlags
 {
+    /**
+     * The maximum size of the BitString as specified for Kerberos flags.
+     */
+    public static final int MAX_SIZE = 32;
+
     /** The associated value */
     protected int value;
     
@@ -42,7 +47,7 @@
      */
     public AbstractKerberosFlags()
     {
-        super( 32 );
+        super( MAX_SIZE );
     }
 
     

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosAttribute.java Sun Jan 20 08:59:10 2008
@@ -29,19 +29,33 @@
     // ------------------------------------------------------------------------
     // Krb5 Schema Attributes
     // ------------------------------------------------------------------------
-
-    /** the krb5kdc schema key for a krb5KDCEntry */
-    public static final String KEY = "krb5Key";
     /** the krb5kdc schema principal name for a krb5KDCEntry */
-    public static final String PRINCIPAL = "krb5PrincipalName";
+    public static final String KRB5_PRINCIPAL_NAME_AT = "krb5PrincipalName";
+    public static final String KRB5_PRINCIPAL_NAME_AT_OID = "1.3.6.1.4.1.5322.10.1.1";
+    
+    /** the krb5kdc schema key for a krb5KDCEntry */
+    public static final String KRB5_KEY_AT = "krb5Key";
+    public static final String KRB5_KEY_AT_OID = "1.3.6.1.4.1.5322.10.1.10";
+    
     /** the krb5kdc schema key version identifier for a krb5KDCEntry */
-    public static final String VERSION = "krb5KeyVersionNumber";
-    /** the Apache specific SAM type attribute */
-    public static final String SAM_TYPE = "apacheSamType";
+    public static final String KRB5_KEY_VERSION_NUMBER_AT = "krb5KeyVersionNumber";
+    public static final String KRB5_KEY_VERSION_NUMBER_AT_OID = "1.3.6.1.4.1.5322.10.1.2";
+    
     /** the disabled boolean LDAP attribute for a Kerberos account */
-    public static final String ACCOUNT_DISABLED = "krb5AccountDisabled";
+    public static final String KRB5_ACCOUNT_DISABLED_AT = "krb5AccountDisabled";
+    public static final String KRB5_ACCOUNT_DISABLED_AT_OID = "1.3.6.1.4.1.5322.10.1.13";
+    
     /** the lockedout boolean LDAP attribute for a Kerberos account */
-    public static final String ACCOUNT_LOCKEDOUT = "krb5AccountLockedOut";
+    public static final String KRB5_ACCOUNT_LOCKEDOUT_AT = "krb5AccountLockedOut";
+    public static final String KRB5_ACCOUNT_LOCKEDOUT_AT_OID = "1.3.6.1.4.1.5322.10.1.14";
+    
     /** the expiration time attribute LDAP attribute for a Kerberos account */
-    public static final String ACCOUNT_EXPIRATION_TIME = "krb5AccountExpirationTime";
+    public static final String KRB5_ACCOUNT_EXPIRATION_TIME_AT = "krb5AccountExpirationTime";
+    public static final String KRB5_ACCOUNT_EXPIRATION_TIME_AT_OID = "1.3.6.1.4.1.5322.10.1.15";
+
+
+    /** the Apache specific SAM type attribute */
+    public static final String APACHE_SAM_TYPE_AT = "apacheSamType";
+    public static final String APACHE_SAM_TYPE_AT_OID = "1.3.6.1.4.1.18060.0.4.1.2.9";
+    
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/SingleBaseSearch.java Sun Jan 20 08:59:10 2008
@@ -22,7 +22,11 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.kerberos.shared.store.operations.*;
+import org.apache.directory.server.kerberos.shared.store.operations.AddPrincipal;
+import org.apache.directory.server.kerberos.shared.store.operations.ChangePassword;
+import org.apache.directory.server.kerberos.shared.store.operations.DeletePrincipal;
+import org.apache.directory.server.kerberos.shared.store.operations.GetAllPrincipals;
+import org.apache.directory.server.kerberos.shared.store.operations.GetPrincipal;
 import org.apache.directory.server.protocol.shared.ServiceConfigurationException;
 
 import javax.naming.directory.DirContext;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/ChangePassword.java Sun Jan 20 08:59:10 2008
@@ -34,6 +34,7 @@
 
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
 import org.apache.directory.server.protocol.shared.store.ContextOperation;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
@@ -76,7 +77,7 @@
         }
 
         ModificationItemImpl[] mods = new ModificationItemImpl[2];
-        Attribute newPasswordAttribute = new AttributeImpl( "userPassword", newPassword );
+        Attribute newPasswordAttribute = new AttributeImpl( SchemaConstants.USER_PASSWORD_AT, newPassword );
         mods[0] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, newPasswordAttribute );
         Attribute principalAttribute = new AttributeImpl( "krb5PrincipalName", principal.getName() );
         mods[1] = new ModificationItemImpl( DirContext.REPLACE_ATTRIBUTE, principalAttribute );
@@ -94,16 +95,16 @@
     private String search( DirContext ctx, String principal ) throws NamingException
     {
         String[] attrIDs =
-            { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION, KerberosAttribute.KEY };
+            { KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, KerberosAttribute.KRB5_KEY_AT };
 
         Attributes matchAttrs = new AttributesImpl( true );
-        matchAttrs.put( new AttributeImpl( KerberosAttribute.PRINCIPAL, principal ) );
+        matchAttrs.put( new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal ) );
 
-        NamingEnumeration answer = ctx.search( "", matchAttrs, attrIDs );
+        NamingEnumeration<SearchResult> answer = ctx.search( "", matchAttrs, attrIDs );
 
         if ( answer.hasMore() )
         {
-            SearchResult sr = ( SearchResult ) answer.next();
+            SearchResult sr = answer.next();
             if ( sr != null )
             {
                 return sr.getName();

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/DeletePrincipal.java Sun Jan 20 08:59:10 2008
@@ -91,17 +91,17 @@
     private String search( DirContext ctx, Name searchBaseDn, String principal ) throws NamingException
     {
         String[] attrIDs =
-            { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION, KerberosAttribute.KEY };
+            { KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, KerberosAttribute.KRB5_KEY_AT };
 
         Attributes matchAttrs = new AttributesImpl( true );
-        matchAttrs.put( new AttributeImpl( KerberosAttribute.PRINCIPAL, principal ) );
+        matchAttrs.put( new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal ) );
 
         // Search for objects that have those matching attributes
-        NamingEnumeration answer = ctx.search( searchBaseDn, matchAttrs, attrIDs );
+        NamingEnumeration<SearchResult> answer = ctx.search( searchBaseDn, matchAttrs, attrIDs );
 
         if ( answer.hasMore() )
         {
-            SearchResult sr = ( SearchResult ) answer.next();
+            SearchResult sr = answer.next();
             if ( sr != null )
             {
                 return sr.getName();

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetAllPrincipals.java Sun Jan 20 08:59:10 2008
@@ -70,11 +70,11 @@
         {
             Attributes attrs = null;
 
-            NamingEnumeration answer = ctx.search( searchBaseDn, filter, controls );
+            NamingEnumeration<SearchResult> answer = ctx.search( searchBaseDn, filter, controls );
 
             while ( answer.hasMore() )
             {
-                SearchResult result = ( SearchResult ) answer.next();
+                SearchResult result = answer.next();
                 attrs = result.getAttributes();
                 PrincipalStoreEntry entry = getEntry( attrs );
                 answers.add( entry );
@@ -106,21 +106,21 @@
     {
         PrincipalStoreEntryModifier modifier = new PrincipalStoreEntryModifier();
 
-        String principal = ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get();
-        String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.VERSION ).get();
+        String principal = ( String ) attrs.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
+        String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get();
 
         String commonName = ( String ) attrs.get( SchemaConstants.CN_AT ).get();
 
-        if ( attrs.get( "apacheSamType" ) != null )
+        if ( attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ) != null )
         {
-            String samType = ( String ) attrs.get( "apacheSamType" ).get();
+            String samType = ( String ) attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ).get();
 
             modifier.setSamType( SamType.getTypeByOrdinal( Integer.parseInt( samType ) ) );
         }
 
-        if ( attrs.get( KerberosAttribute.KEY ) != null )
+        if ( attrs.get( KerberosAttribute.KRB5_KEY_AT ) != null )
         {
-            Attribute krb5key = attrs.get( KerberosAttribute.KEY );
+            Attribute krb5key = attrs.get( KerberosAttribute.KRB5_KEY_AT );
             try
             {
                 Map<EncryptionType, EncryptionKey> keyMap = modifier.reconstituteKeyMap( krb5key );
@@ -128,7 +128,7 @@
             }
             catch ( IOException ioe )
             {
-                throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KEY
+                throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KRB5_KEY_AT
                     + "' contained an invalid value for krb5key." );
             }
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/GetPrincipal.java Sun Jan 20 08:59:10 2008
@@ -83,22 +83,26 @@
         }
 
         String[] attrIDs =
-            { KerberosAttribute.PRINCIPAL, KerberosAttribute.VERSION, KerberosAttribute.KEY,
-                KerberosAttribute.SAM_TYPE, KerberosAttribute.ACCOUNT_DISABLED,
-                KerberosAttribute.ACCOUNT_EXPIRATION_TIME, KerberosAttribute.ACCOUNT_LOCKEDOUT };
+            {   KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, 
+                KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, 
+                KerberosAttribute.KRB5_KEY_AT,
+                KerberosAttribute.APACHE_SAM_TYPE_AT, 
+                KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT,
+                KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT, 
+                KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT };
 
         Attributes matchAttrs = new AttributesImpl( true );
-        matchAttrs.put( new AttributeImpl( KerberosAttribute.PRINCIPAL, principal.getName() ) );
+        matchAttrs.put( new AttributeImpl( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal.getName() ) );
 
         PrincipalStoreEntry entry = null;
 
         try
         {
-            NamingEnumeration answer = ctx.search( "", matchAttrs, attrIDs );
+            NamingEnumeration<SearchResult> answer = ctx.search( "", matchAttrs, attrIDs );
 
             if ( answer.hasMore() )
             {
-                SearchResult result = ( SearchResult ) answer.next();
+                SearchResult result = answer.next();
 
                 Attributes attrs = result.getAttributes();
 
@@ -134,27 +138,27 @@
 
         modifier.setDistinguishedName( distinguishedName );
 
-        String principal = ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get();
+        String principal = ( String ) attrs.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get();
         modifier.setPrincipal( new KerberosPrincipal( principal ) );
 
-        String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.VERSION ).get();
+        String keyVersionNumber = ( String ) attrs.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get();
         modifier.setKeyVersionNumber( Integer.parseInt( keyVersionNumber ) );
 
-        if ( attrs.get( KerberosAttribute.ACCOUNT_DISABLED ) != null )
+        if ( attrs.get( KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT ) != null )
         {
-            String val = ( String ) attrs.get( KerberosAttribute.ACCOUNT_DISABLED ).get();
+            String val = ( String ) attrs.get( KerberosAttribute.KRB5_ACCOUNT_DISABLED_AT ).get();
             modifier.setDisabled( "true".equalsIgnoreCase( val ) );
         }
 
-        if ( attrs.get( KerberosAttribute.ACCOUNT_LOCKEDOUT ) != null )
+        if ( attrs.get( KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT ) != null )
         {
-            String val = ( String ) attrs.get( KerberosAttribute.ACCOUNT_LOCKEDOUT ).get();
+            String val = ( String ) attrs.get( KerberosAttribute.KRB5_ACCOUNT_LOCKEDOUT_AT ).get();
             modifier.setLockedOut( "true".equalsIgnoreCase( val ) );
         }
 
-        if ( attrs.get( KerberosAttribute.ACCOUNT_EXPIRATION_TIME ) != null )
+        if ( attrs.get( KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT ) != null )
         {
-            String val = ( String ) attrs.get( KerberosAttribute.ACCOUNT_EXPIRATION_TIME ).get();
+            String val = ( String ) attrs.get( KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT ).get();
             try
             {
                 modifier.setExpiration( KerberosTime.getTime( val ) );
@@ -162,20 +166,20 @@
             catch ( ParseException e )
             {
                 throw new InvalidAttributeValueException( "Account expiration attribute "
-                    + KerberosAttribute.ACCOUNT_EXPIRATION_TIME + " contained an invalid value for generalizedTime: "
+                    + KerberosAttribute.KRB5_ACCOUNT_EXPIRATION_TIME_AT + " contained an invalid value for generalizedTime: "
                     + val );
             }
         }
 
-        if ( attrs.get( KerberosAttribute.SAM_TYPE ) != null )
+        if ( attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ) != null )
         {
-            String samType = ( String ) attrs.get( KerberosAttribute.SAM_TYPE ).get();
+            String samType = ( String ) attrs.get( KerberosAttribute.APACHE_SAM_TYPE_AT ).get();
             modifier.setSamType( SamType.getTypeByOrdinal( Integer.parseInt( samType ) ) );
         }
 
-        if ( attrs.get( KerberosAttribute.KEY ) != null )
+        if ( attrs.get( KerberosAttribute.KRB5_KEY_AT ) != null )
         {
-            Attribute krb5key = attrs.get( KerberosAttribute.KEY );
+            Attribute krb5key = attrs.get( KerberosAttribute.KRB5_KEY_AT );
             try
             {
                 Map<EncryptionType, EncryptionKey> keyMap = modifier.reconstituteKeyMap( krb5key );
@@ -183,7 +187,7 @@
             }
             catch ( IOException ioe )
             {
-                throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KEY
+                throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KRB5_KEY_AT
                     + "' contained an invalid value for krb5key." );
             }
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalObjectFactory.java Sun Jan 20 08:59:10 2008
@@ -62,12 +62,12 @@
         modifier.setUserId( ( String ) attrs.get( SchemaConstants.UID_AT ).get() );
         modifier.setCommonName( ( String ) attrs.get( SchemaConstants.CN_AT ).get() );
 
-        KerberosPrincipal principal = new KerberosPrincipal( ( String ) attrs.get( KerberosAttribute.PRINCIPAL ).get() );
+        KerberosPrincipal principal = new KerberosPrincipal( ( String ) attrs.get( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT ).get() );
         modifier.setPrincipal( principal );
 
-        if ( attrs.get( KerberosAttribute.KEY ) != null )
+        if ( attrs.get( KerberosAttribute.KRB5_KEY_AT ) != null )
         {
-            Attribute krb5key = attrs.get( KerberosAttribute.KEY );
+            Attribute krb5key = attrs.get( KerberosAttribute.KRB5_KEY_AT );
             try
             {
                 Map<EncryptionType, EncryptionKey> keyMap = modifier.reconstituteKeyMap( krb5key );
@@ -75,12 +75,12 @@
             }
             catch ( IOException ioe )
             {
-                throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KEY
+                throw new InvalidAttributeValueException( "Account Kerberos key attribute '" + KerberosAttribute.KRB5_KEY_AT
                     + "' contained an invalid value for krb5key." );
             }
         }
 
-        modifier.setKeyVersionNumber( Integer.parseInt( ( String ) attrs.get( KerberosAttribute.VERSION ).get() ) );
+        modifier.setKeyVersionNumber( Integer.parseInt( ( String ) attrs.get( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT ).get() ) );
 
         return modifier.getEntry();
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/operations/PrincipalStateFactory.java Sun Jan 20 08:59:10 2008
@@ -101,7 +101,7 @@
             if ( !AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.EXTENSIBLE_OBJECT_OC ) )
             {
                 oc.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
-                outAttrs.put( "apacheSamType", "7" );
+                outAttrs.put( KerberosAttribute.APACHE_SAM_TYPE_AT, "7" );
             }
 
             if ( !( AttributeUtils.containsValueCaseIgnore( oc, SchemaConstants.PERSON_OC ) || oc
@@ -141,7 +141,7 @@
 
                 try
                 {
-                    outAttrs.put( KerberosAttribute.KEY, EncryptionKeyEncoder.encode( encryptionKey ) );
+                    outAttrs.put( KerberosAttribute.KRB5_KEY_AT, EncryptionKeyEncoder.encode( encryptionKey ) );
                 }
                 catch ( IOException ioe )
                 {
@@ -150,8 +150,8 @@
 
                 int keyVersion = encryptionKey.getKeyVersion();
 
-                outAttrs.put( KerberosAttribute.PRINCIPAL, principal );
-                outAttrs.put( KerberosAttribute.VERSION, Integer.toString( keyVersion ) );
+                outAttrs.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal );
+                outAttrs.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, Integer.toString( keyVersion ) );
             }
 
             Result r = new Result( obj, outAttrs );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/kerberos-shared/src/test/java/org/apache/directory/server/kerberos/shared/messages/value/ChecksumTest.java Sun Jan 20 08:59:10 2008
@@ -78,4 +78,20 @@
 
         assertTrue( Arrays.equals( expectedResult, encoded.array() ) );
     }
+
+
+    /**
+     * Tests that two Checksums are equal if both their type and value are equal.
+     */
+    public void testEquality()
+    {
+        byte[] checksumValue =
+            { ( byte ) 0x30, ( byte ) 0x1A, ( byte ) 0xA0, ( byte ) 0x11, ( byte ) 0x18, ( byte ) 0x0F, ( byte ) 0x32,
+                ( byte ) 0x30 };
+
+        Checksum expected = new Checksum( ChecksumType.RSA_MD5, checksumValue );
+        Checksum provided = new Checksum( ChecksumType.RSA_MD5, checksumValue );
+
+        assertTrue( "Checksum equality", expected.equals( provided ) );
+    }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddAttributeOperation.java Sun Jan 20 08:59:10 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -61,11 +62,11 @@
     }
 
 
-    protected void execute1( PartitionNexus nexus ) throws NamingException
+    protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
         List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.ADD_ATTRIBUTE );
-        nexus.modify( new ModifyOperationContext( getName(), items ) );
+        nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AddEntryOperation.java Sun Jan 20 08:59:10 2008
@@ -28,12 +28,14 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.operation.support.EntryUtil;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.DeleteOperationContext;
 import org.apache.directory.server.core.interceptor.context.ListOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -55,7 +57,7 @@
      * 
      * @param entry an entry
      */
-    public AddEntryOperation( CSN csn, LdapDN normalizedName, Attributes entry )
+    public AddEntryOperation( CSN csn, LdapDN normalizedName, ServerEntry entry )
     {
         super( csn );
 
@@ -63,7 +65,7 @@
         assert entry != null;
 
         this.normalizedName = normalizedName;
-        this.entry = ( Attributes ) entry.clone();
+        this.entry = ServerEntryUtils.toAttributesImpl( entry );
     }
 
 
@@ -73,36 +75,35 @@
     }
 
 
-    protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry )
+    protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries )
         throws NamingException
     {
-        if ( !EntryUtil.isEntryUpdatable( nexus, normalizedName, getCSN() ) )
+        if ( !EntryUtil.isEntryUpdatable( registries, nexus, normalizedName, getCSN() ) )
         {
             return;
         }
         
-        EntryUtil.createGlueEntries( nexus, normalizedName, false );
+        EntryUtil.createGlueEntries( registries, nexus, normalizedName, false );
 
         // Replace the entry if an entry with the same name exists.
-        Attributes oldEntry = nexus.lookup( new LookupOperationContext( normalizedName ) );
-        
-        if ( oldEntry != null )
+        if ( nexus.lookup( new LookupOperationContext( registries, normalizedName ) ) != null )
         {
-            recursiveDelete( nexus, normalizedName, registry );
+            recursiveDelete( nexus, normalizedName, registries );
         }
 
-        nexus.add( new AddOperationContext( normalizedName, entry ) );
+        nexus.add( new AddOperationContext( registries, normalizedName, ServerEntryUtils.toServerEntry( entry, normalizedName, registries ) ) );
     }
 
 
     @SuppressWarnings("unchecked")
-    private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, AttributeTypeRegistry registry )
+    private void recursiveDelete( PartitionNexus nexus, LdapDN normalizedName, Registries registries )
         throws NamingException
     {
-        NamingEnumeration<SearchResult> ne = nexus.list( new ListOperationContext( normalizedName ) );
+        NamingEnumeration<SearchResult> ne = nexus.list( new ListOperationContext( registries, normalizedName ) );
+        
         if ( !ne.hasMore() )
         {
-            nexus.delete( new DeleteOperationContext( normalizedName ) );
+            nexus.delete( new DeleteOperationContext( registries, normalizedName ) );
             return;
         }
 
@@ -110,10 +111,10 @@
         {
             SearchResult sr = ne.next();
             LdapDN dn = new LdapDN( sr.getName() );
-            dn.normalize( registry.getNormalizerMapping() );
-            recursiveDelete( nexus, dn, registry );
+            dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+            recursiveDelete( nexus, dn, registries );
         }
         
-        nexus.delete( new DeleteOperationContext( normalizedName ) );
+        nexus.delete( new DeleteOperationContext( registries, normalizedName ) );
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/AttributeOperation.java Sun Jan 20 08:59:10 2008
@@ -24,7 +24,7 @@
 import javax.naming.directory.Attribute;
 
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.operation.support.EntryUtil;
@@ -78,20 +78,20 @@
     }
 
 
-    protected final void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry ) 
+    protected final void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries ) 
         throws NamingException
     {
-        if ( !EntryUtil.isEntryUpdatable( nexus, name, getCSN() ) )
+        if ( !EntryUtil.isEntryUpdatable( registries, nexus, name, getCSN() ) )
         {
             return;
         }
-        EntryUtil.createGlueEntries( nexus, name, true );
+        EntryUtil.createGlueEntries( registries, nexus, name, true );
 
-        execute1( nexus );
+        execute1( nexus, registries );
     }
 
 
-    protected abstract void execute1( PartitionNexus nexus ) throws NamingException;
+    protected abstract void execute1( PartitionNexus nexus, Registries registries ) throws NamingException;
 
 
     /**

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java Sun Jan 20 08:59:10 2008
@@ -29,7 +29,7 @@
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 
 import javax.naming.Name;
 import javax.naming.NamingException;
@@ -160,12 +160,12 @@
     }
 
 
-    protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry ) 
+    protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries ) 
         throws NamingException
     {
         for ( Operation op : children )
         {
-            op.execute( nexus, DUMMY_STORE, registry );
+            op.execute( nexus, DUMMY_STORE, registries );
         }
     }
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/DeleteAttributeOperation.java Sun Jan 20 08:59:10 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -61,12 +62,12 @@
     }
 
 
-    protected void execute1( PartitionNexus nexus ) throws NamingException
+    protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
         List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.REMOVE_ATTRIBUTE );
 
-        nexus.modify( new ModifyOperationContext( getName(), items ) );
+        nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/Operation.java Sun Jan 20 08:59:10 2008
@@ -30,7 +30,7 @@
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
-import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
 
@@ -100,18 +100,18 @@
     /**
      * Exeutes this operation on the specified nexus.
      */
-    public final void execute( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry ) 
+    public final void execute( PartitionNexus nexus, ReplicationStore store, Registries registries ) 
         throws NamingException
     {
         synchronized ( nexus )
         {
-            execute0( nexus, store, registry );
+            execute0( nexus, store, registries );
             store.putLog( this );
         }
     }
 
     @SuppressWarnings("unused")
-    protected void execute0( PartitionNexus nexus, ReplicationStore store, AttributeTypeRegistry registry ) 
+    protected void execute0( PartitionNexus nexus, ReplicationStore store, Registries registries ) 
         throws NamingException
     {
         throw new OperationNotSupportedException( nexus.getSuffixDn().toString() );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationCodec.java Sun Jan 20 08:59:10 2008
@@ -69,6 +69,7 @@
     public Operation decode( byte[] data )
     {
         ObjectInputStream in;
+        
         try
         {
             in = new ObjectInputStream( new ByteArrayInputStream( data ) );
@@ -76,6 +77,7 @@
         }
         catch ( IOException e )
         {
+            e.printStackTrace();
             throw ( InternalError ) new InternalError().initCause( e );
         }
         catch ( ClassNotFoundException e )

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java Sun Jan 20 08:59:10 2008
@@ -19,9 +19,16 @@
  */
 package org.apache.directory.mitosis.operation;
 
-import org.apache.directory.mitosis.common.*;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.mitosis.common.CSNFactory;
+import org.apache.directory.mitosis.common.Constants;
+import org.apache.directory.mitosis.common.ReplicaId;
+import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 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.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
@@ -29,6 +36,7 @@
 import org.apache.directory.server.core.partition.Partition;
 import org.apache.directory.server.core.partition.PartitionNexus;
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
@@ -36,12 +44,17 @@
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.name.Rdn;
-import org.apache.directory.shared.ldap.util.NamespaceTools;
 
 import javax.naming.NameAlreadyBoundException;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.*;
+import javax.naming.directory.Attribute;
+import javax.naming.directory.Attributes;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.ModificationItem;
+import javax.naming.directory.SearchControls;
+import javax.naming.directory.SearchResult;
+
 import java.util.List;
 
 
@@ -75,16 +88,21 @@
     private final PartitionNexus nexus;
     private final UUIDFactory uuidFactory;
     private final CSNFactory csnFactory;
+    
+    /** The attributeType registry */
     private final AttributeTypeRegistry attributeRegistry;
 
+    /** The global registries */
+    private Registries registries;
 
     public OperationFactory( DirectoryService directoryService, ReplicationConfiguration cfg )
     {
-        this.replicaId = cfg.getReplicaId();
-        this.nexus = directoryService.getPartitionNexus();
-        this.uuidFactory = cfg.getUuidFactory();
-        this.csnFactory = cfg.getCsnFactory();
-        this.attributeRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
+        replicaId = cfg.getReplicaId();
+        nexus = directoryService.getPartitionNexus();
+        uuidFactory = cfg.getUuidFactory();
+        csnFactory = cfg.getCsnFactory();
+        registries = directoryService.getRegistries();
+        attributeRegistry = registries.getAttributeTypeRegistry();
     }
 
 
@@ -92,7 +110,7 @@
      * Creates a new {@link Operation} that performs LDAP "add" operation
      * with a newly generated {@link CSN}.
      */
-    public Operation newAdd( LdapDN normalizedName, Attributes entry ) throws NamingException
+    public Operation newAdd( LdapDN normalizedName, ServerEntry entry ) throws NamingException
     {
         return newAdd( newCSN(), normalizedName, entry );
     }
@@ -104,24 +122,24 @@
      * additional attributes; {@link Constants#ENTRY_CSN} ({@link CSN}),
      * {@link Constants#ENTRY_UUID}, and {@link Constants#ENTRY_DELETED}.
      */
-    private Operation newAdd( CSN csn, LdapDN normalizedName, Attributes entry ) throws NamingException
+    private Operation newAdd( CSN csn, LdapDN normalizedName, ServerEntry entry ) throws NamingException
     {
         // Check an entry already exists.
         checkBeforeAdd( normalizedName );
 
         // Insert 'entryUUID' and 'entryDeleted'.
-        entry = ( Attributes ) entry.clone();
-        entry.remove( Constants.ENTRY_UUID );
-        entry.remove( Constants.ENTRY_DELETED );
-        entry.put( Constants.ENTRY_UUID, uuidFactory.newInstance().toOctetString() );
-        entry.put( Constants.ENTRY_DELETED, "FALSE" );
+        ServerEntry cloneEntry = ( ServerEntry ) entry.clone();
+        cloneEntry.remove( Constants.ENTRY_UUID );
+        cloneEntry.remove( Constants.ENTRY_DELETED );
+        cloneEntry.put( Constants.ENTRY_UUID, uuidFactory.newInstance().toOctetString() );
+        cloneEntry.put( Constants.ENTRY_DELETED, "FALSE" );
 
         // NOTE: We inlined addDefaultOperations() because ApacheDS currently
         // creates an index entry only for ADD operation (and not for
         // MODIFY operation)
-        entry.put( Constants.ENTRY_CSN, csn.toOctetString() );
+        cloneEntry.put( Constants.ENTRY_CSN, csn.toOctetString() );
 
-        return new AddEntryOperation( csn, normalizedName, entry );
+        return new AddEntryOperation( csn, normalizedName, cloneEntry );
     }
 
 
@@ -238,8 +256,9 @@
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
+        
         NamingEnumeration<SearchResult> e = nexus.search( 
-            new SearchOperationContext( oldName, AliasDerefMode.DEREF_ALWAYS,
+            new SearchOperationContext( registries, oldName, AliasDerefMode.DEREF_ALWAYS,
                     new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), ctrl ) );
 
         while ( e.hasMore() )
@@ -255,17 +274,21 @@
                 "TRUE" ) ) );
 
             // Get the old entry attributes and replace RDN if required
-            Attributes entry = sr.getAttributes();
+            LdapDN entryName = new LdapDN( sr.getName() ); 
+            ServerEntry entry = ServerEntryUtils.toServerEntry( sr.getAttributes(), entryName, registries );
+            
             if ( oldEntryName.size() == oldName.size() )
             {
                 if ( deleteOldRn )
                 {
                     // Delete the old RDN attribute value
                     String oldRDNAttributeID = oldName.getRdn().getUpType();
-                    Attribute oldRDNAttribute = entry.get( oldRDNAttributeID );
+                    ServerAttribute oldRDNAttribute = entry.get( oldRDNAttributeID );
+                    
                     if ( oldRDNAttribute != null )
                     {
-                        boolean removed = oldRDNAttribute.remove( oldName.getRdn().getUpValue() );
+                        boolean removed = oldRDNAttribute.remove( (String)oldName.getRdn().getUpValue() );
+                        
                         if ( removed && oldRDNAttribute.size() == 0 )
                         {
                             // Now an empty attribute, remove it.
@@ -273,10 +296,12 @@
                         }
                     }
                 }
+                
                 // Add the new RDN attribute value.
                 String newRDNAttributeID = newRdn.getUpType();
                 String newRDNAttributeValue = ( String ) newRdn.getUpValue();
-                Attribute newRDNAttribute = entry.get( newRDNAttributeID );
+                ServerAttribute newRDNAttribute = entry.get( newRDNAttributeID );
+                
                 if ( newRDNAttribute != null )
                 {
                     newRDNAttribute.add( newRDNAttributeValue );
@@ -290,10 +315,12 @@
             // Calculate new name from newParentName, oldEntryName, and newRdn.
             LdapDN newEntryName = ( LdapDN ) newParentName.clone();
             newEntryName.add( newRdn );
+            
             for ( int i = oldEntryName.size() - newEntryName.size(); i > 0; i-- )
             {
                 newEntryName.add( oldEntryName.get( oldEntryName.size() - i ) );
             }
+            
             newEntryName.normalize( attributeRegistry.getNormalizerMapping() );
 
             // Add the new entry
@@ -318,9 +345,9 @@
      */
     private void checkBeforeAdd( LdapDN newEntryName ) throws NamingException
     {
-        if ( nexus.hasEntry( new EntryOperationContext( newEntryName ) ) )
+        if ( nexus.hasEntry( new EntryOperationContext( registries, newEntryName ) ) )
         {
-            Attributes entry = nexus.lookup( new LookupOperationContext( newEntryName ) );
+            Attributes entry = nexus.lookup( new LookupOperationContext( registries, newEntryName ) );
             Attribute deleted = entry.get( Constants.ENTRY_DELETED );
             Object value = deleted == null ? null : deleted.get();
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/ReplaceAttributeOperation.java Sun Jan 20 08:59:10 2008
@@ -23,6 +23,7 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
@@ -63,12 +64,12 @@
     }
 
 
-    protected void execute1( PartitionNexus nexus ) throws NamingException
+    protected void execute1( PartitionNexus nexus, Registries registries ) throws NamingException
     {
         Attributes attrs = new AttributesImpl( true );
         attrs.put( getAttribute() );
         List<ModificationItemImpl> items = ModifyOperationContext.createModItems( attrs, DirContext.REPLACE_ATTRIBUTE );
 
-        nexus.modify( new ModifyOperationContext( getName(), items ) );
+        nexus.modify( new ModifyOperationContext( registries, getName(), items ) );
     }
 }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/operation/support/EntryUtil.java Sun Jan 20 08:59:10 2008
@@ -25,15 +25,17 @@
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 
+import org.apache.directory.server.core.entry.DefaultServerEntry;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.interceptor.context.AddOperationContext;
 import org.apache.directory.server.core.interceptor.context.EntryOperationContext;
 import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
 import org.apache.directory.server.core.partition.PartitionNexus;
+import org.apache.directory.server.schema.registries.Registries;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.message.AttributeImpl;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.NamespaceTools;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.Constants;
 import org.apache.directory.mitosis.common.DefaultCSN;
@@ -42,9 +44,9 @@
 public class EntryUtil
 {
     @SuppressWarnings("unchecked")
-    public static boolean isEntryUpdatable( PartitionNexus nexus, LdapDN name, CSN newCSN ) throws NamingException
+    public static boolean isEntryUpdatable( Registries registries, PartitionNexus nexus, LdapDN name, CSN newCSN ) throws NamingException
     {
-        Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
+        Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
 
         if ( entry == null )
         {
@@ -63,7 +65,16 @@
 
             try
             {
-                oldCSN = new DefaultCSN( String.valueOf( entryCSNAttr.get() ) );
+                Object val = entryCSNAttr.get();
+                
+                if ( val instanceof byte[] )
+                {
+                    oldCSN = new DefaultCSN( StringTools.utf8ToString( (byte[])val ) );
+                }
+                else
+                {
+                    oldCSN = new DefaultCSN( (String)val );
+                }
             }
             catch ( IllegalArgumentException e )
             {
@@ -75,28 +86,28 @@
     }
 
 
-    public static void createGlueEntries( PartitionNexus nexus, LdapDN name, boolean includeLeaf )
+    public static void createGlueEntries( Registries registries, PartitionNexus nexus, LdapDN name, boolean includeLeaf )
         throws NamingException
     {
         assert name.size() > 0;
 
         for ( int i = name.size() - 1; i > 0; i-- )
         {
-            createGlueEntry( nexus, ( LdapDN ) name.getSuffix( i ) );
+            createGlueEntry( registries, nexus, ( LdapDN ) name.getSuffix( i ) );
         }
 
         if ( includeLeaf )
         {
-            createGlueEntry( nexus, name );
+            createGlueEntry( registries, nexus, name );
         }
     }
 
 
-    private static void createGlueEntry( PartitionNexus nexus, LdapDN name ) throws NamingException
+    private static void createGlueEntry( Registries registries, PartitionNexus nexus, LdapDN name ) throws NamingException
     {
         try
         {
-            if ( nexus.hasEntry( new EntryOperationContext( name ) ) )
+            if ( nexus.hasEntry( new EntryOperationContext( registries, name ) ) )
             {
                 return;
             }
@@ -108,7 +119,7 @@
         }
 
         // Create a glue entry.
-        Attributes entry = new AttributesImpl( true );
+        ServerEntry entry = new DefaultServerEntry( registries, name );
         
         //// Add RDN attribute. 
         String rdn = name.get( name.size() - 1 );
@@ -117,13 +128,10 @@
         entry.put( rdnAttribute, rdnValue );
         
         //// Add objectClass attribute. 
-        Attribute objectClassAttr = new AttributeImpl( SchemaConstants.OBJECT_CLASS_AT );
-        objectClassAttr.add( SchemaConstants.TOP_OC );
-        objectClassAttr.add( SchemaConstants.EXTENSIBLE_OBJECT_OC );
-        entry.put( objectClassAttr );
+        entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC, SchemaConstants.EXTENSIBLE_OBJECT_OC );
 
         // And add it to the nexus.
-        nexus.add( new AddOperationContext( name, entry ) );
+        nexus.add( new AddOperationContext( registries, name, entry ) );
     }
 
 



Mime
View raw message