directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r613608 [14/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/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationInterceptor.java Sun Jan 20 08:59:10 2008
@@ -20,7 +20,10 @@
 package org.apache.directory.mitosis.service;
 
 
-import org.apache.directory.mitosis.common.*;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.mitosis.common.Constants;
+import org.apache.directory.mitosis.common.DefaultCSN;
+import org.apache.directory.mitosis.common.ReplicaId;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.mitosis.operation.OperationFactory;
@@ -30,14 +33,28 @@
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerProtocolHandler;
 import org.apache.directory.mitosis.store.ReplicationStore;
 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.ServerValue;
 import org.apache.directory.server.core.enumeration.SearchResultFilteringEnumeration;
 import org.apache.directory.server.core.interceptor.BaseInterceptor;
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.interceptor.NextInterceptor;
-import org.apache.directory.server.core.interceptor.context.*;
+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.EntryOperationContext;
+import org.apache.directory.server.core.interceptor.context.GetMatchedNameOperationContext;
+import org.apache.directory.server.core.interceptor.context.ListOperationContext;
+import org.apache.directory.server.core.interceptor.context.LookupOperationContext;
+import org.apache.directory.server.core.interceptor.context.ModifyOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveAndRenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.MoveOperationContext;
+import org.apache.directory.server.core.interceptor.context.RenameOperationContext;
+import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.server.core.invocation.InvocationStack;
 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.exception.LdapNameNotFoundException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
@@ -56,7 +73,12 @@
 import javax.naming.NameNotFoundException;
 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.SearchControls;
+import javax.naming.directory.SearchResult;
+
 import java.net.InetSocketAddress;
 import java.text.ParseException;
 import java.util.ArrayList;
@@ -145,7 +167,7 @@
     private ReplicationStore store;
     private IoAcceptor registry;
     private final ClientConnectionManager clientConnectionManager = new ClientConnectionManager( this );
-    private AttributeTypeRegistry attrRegistry;
+    private Registries registries;
 
 
     public ReplicationInterceptor()
@@ -180,10 +202,10 @@
         configuration.validate();
         // and then preserve frequently used ones
         this.directoryService = directoryService;
+        registries = directoryService.getRegistries();
         nexus = directoryService.getPartitionNexus();
         store = configuration.getStore();
         operationFactory = new OperationFactory( directoryService, configuration );
-        attrRegistry = directoryService.getRegistries().getAttributeTypeRegistry();
 
         // Initialize store and service
         store.open( directoryService, configuration );
@@ -283,9 +305,10 @@
      */
     public void purgeAgedData() throws NamingException
     {
-        Attributes rootDSE = nexus.getRootDSE( null );
-        Attribute namingContextsAttr = rootDSE.get( "namingContexts" );
-        if ( namingContextsAttr == null || namingContextsAttr.size() == 0 )
+        ServerEntry rootDSE = nexus.getRootDSE( null );
+        ServerAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
+        
+        if ( ( namingContextsAttr == null ) || ( namingContextsAttr.size() == 0 ) )
         {
             throw new NamingException( "No namingContexts attributes in rootDSE." );
         }
@@ -306,22 +329,14 @@
         }
 
         // Iterate all context partitions to send all entries of them.
-        NamingEnumeration e = namingContextsAttr.getAll();
-        while ( e.hasMore() )
+        for ( ServerValue<?> namingContext:namingContextsAttr )
         {
-            Object value = e.next();
             // Convert attribute value to JNDI name.
             LdapDN contextName;
-            if ( value instanceof LdapDN )
-            {
-                contextName = ( LdapDN ) value;
-            }
-            else
-            {
-                contextName = new LdapDN( String.valueOf( value ) );
-            }
+            
+            contextName = new LdapDN( (String)namingContext.get() );
 
-            contextName.normalize( attrRegistry.getNormalizerMapping() );
+            contextName.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
             LOG.info( "[Replica-{}] Purging aged data under '{}'", configuration.getReplicaId(), contextName );
             purgeAgedData( contextName, filter );
         }
@@ -337,7 +352,7 @@
         ctrl.setReturningAttributes( new String[] { "entryCSN", "entryDeleted" } );
 
         NamingEnumeration<SearchResult> e = nexus.search(
-            new SearchOperationContext( contextName, AliasDerefMode.DEREF_ALWAYS, filter, ctrl ) );
+            new SearchOperationContext( registries, contextName, AliasDerefMode.DEREF_ALWAYS, filter, ctrl ) );
 
         List<LdapDN> names = new ArrayList<LdapDN>();
         try
@@ -346,6 +361,7 @@
             {
                 SearchResult sr = e.next();
                 LdapDN name = new LdapDN( sr.getName() );
+                
                 if ( name.size() > contextName.size() )
                 {
                     names.add( new LdapDN( sr.getName() ) );
@@ -361,10 +377,10 @@
         {
             try
             {
-                name.normalize( attrRegistry.getNormalizerMapping() );
-                Attributes entry = nexus.lookup( new LookupOperationContext( name ) );
+                name.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
+                Attributes entry = nexus.lookup( new LookupOperationContext( registries, name ) );
                 LOG.info( "[Replica-{}] Purge: " + name + " (" + entry + ')', configuration.getReplicaId() );
-                nexus.delete( new DeleteOperationContext( name ) );
+                nexus.delete( new DeleteOperationContext( registries, name ) );
             }
             catch ( NamingException ex )
             {
@@ -376,8 +392,9 @@
 
     public void add( NextInterceptor nextInterceptor, AddOperationContext addContext ) throws NamingException
     {
-        Operation op = operationFactory.newAdd( addContext.getDn(), addContext.getEntry() );
-        op.execute( nexus, store, attrRegistry );
+        Operation op = operationFactory.newAdd( 
+            addContext.getDn(), addContext.getEntry() );
+        op.execute( nexus, store, registries );
     }
 
 
@@ -385,14 +402,14 @@
     public void delete( NextInterceptor next, DeleteOperationContext opContext ) throws NamingException
     {
         Operation op = operationFactory.newDelete( opContext.getDn() );
-        op.execute( nexus, store, attrRegistry );
+        op.execute( nexus, store, registries );
     }
 
 
     public void modify( NextInterceptor next, ModifyOperationContext modifyContext ) throws NamingException
     {
         Operation op = operationFactory.newModify( modifyContext );
-        op.execute( nexus, store, attrRegistry );
+        op.execute( nexus, store, registries );
     }
 
 
@@ -400,7 +417,7 @@
     public void move( NextInterceptor next, MoveOperationContext moveOpContext ) throws NamingException
     {
         Operation op = operationFactory.newMove( moveOpContext.getDn(), moveOpContext.getParent() );
-        op.execute( nexus, store, attrRegistry );
+        op.execute( nexus, store, registries );
     }
 
 
@@ -410,7 +427,7 @@
         Operation op = operationFactory.newMove( moveAndRenameOpContext.getDn(),
                 moveAndRenameOpContext.getParent(), moveAndRenameOpContext.getNewRdn(),
                 moveAndRenameOpContext.getDelOldDn() );
-        op.execute( nexus, store, attrRegistry );
+        op.execute( nexus, store, registries );
     }
 
 
@@ -418,7 +435,7 @@
     public void rename( NextInterceptor next, RenameOperationContext renameOpContext ) throws NamingException
     {
         Operation op = operationFactory.newModifyRn( renameOpContext.getDn(), renameOpContext.getNewRdn(), renameOpContext.getDelOldDn() );
-        op.execute( nexus, store, attrRegistry );
+        op.execute( nexus, store, registries );
     }
 
 
@@ -433,7 +450,7 @@
             // Check DELETED attribute.
             try
             {
-                Attributes entry = nextInterceptor.lookup( new LookupOperationContext( entryContext.getDn() ) );
+                Attributes entry = nextInterceptor.lookup( new LookupOperationContext( registries, entryContext.getDn() ) );
                 hasEntry = !isDeleted( entry );
             }
             catch ( NameNotFoundException e )
@@ -488,7 +505,7 @@
 
     	NamingEnumeration<SearchResult> result = nextInterceptor.search(
 	            new SearchOperationContext(
-	                opContext.getDn(), opContext.getAliasDerefMode(),
+	                registries, opContext.getDn(), opContext.getAliasDerefMode(),
 	                new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ),
 	                new SearchControls() ) );
 
@@ -512,7 +529,7 @@
         }
 
     	NamingEnumeration<SearchResult> result = nextInterceptor.search(
-            new SearchOperationContext( opContext.getDn(), opContext.getAliasDerefMode(), opContext.getFilter(), searchControls ) );
+            new SearchOperationContext( registries, opContext.getDn(), opContext.getAliasDerefMode(), opContext.getFilter(), searchControls ) );
         return new SearchResultFilteringEnumeration( result, searchControls, InvocationStack.getInstance().peek(),
             Constants.DELETED_ENTRIES_FILTER, "Search Replication filter" );
     }
@@ -522,7 +539,7 @@
         if ( isDeleted( entry ) )
         {
             LdapNameNotFoundException e = new LdapNameNotFoundException( "Deleted entry: " + name.getUpName() );
-            e.setResolvedName( nexus.getMatchedName( new GetMatchedNameOperationContext( name ) ) );
+            e.setResolvedName( nexus.getMatchedName( new GetMatchedNameOperationContext( registries, name ) ) );
             throw e;
         }
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java Sun Jan 20 08:59:10 2008
@@ -20,30 +20,45 @@
 package org.apache.directory.mitosis.service.protocol.handler;
 
 
-import org.apache.directory.mitosis.common.*;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.mitosis.common.CSNVector;
+import org.apache.directory.mitosis.common.DefaultCSN;
+import org.apache.directory.mitosis.common.Replica;
+import org.apache.directory.mitosis.common.ReplicaId;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.AddEntryOperation;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.mitosis.service.ReplicationContext;
 import org.apache.directory.mitosis.service.ReplicationContext.State;
 import org.apache.directory.mitosis.service.protocol.Constants;
-import org.apache.directory.mitosis.service.protocol.message.*;
+import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
+import org.apache.directory.mitosis.service.protocol.message.BeginLogEntriesAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.BeginLogEntriesMessage;
+import org.apache.directory.mitosis.service.protocol.message.EndLogEntriesAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.EndLogEntriesMessage;
+import org.apache.directory.mitosis.service.protocol.message.LogEntryAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.LogEntryMessage;
+import org.apache.directory.mitosis.service.protocol.message.LoginAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.LoginMessage;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStore;
+import org.apache.directory.server.core.entry.ServerAttribute;
+import org.apache.directory.server.core.entry.ServerEntry;
+import org.apache.directory.server.core.entry.ServerEntryUtils;
+import org.apache.directory.server.core.entry.ServerValue;
 import org.apache.directory.server.core.interceptor.context.SearchOperationContext;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.filter.PresenceNode;
 import org.apache.directory.shared.ldap.message.AliasDerefMode;
 import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.OidNormalizer;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.WriteFuture;
 import org.apache.mina.util.SessionLog;
 
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
-import javax.naming.directory.Attribute;
-import javax.naming.directory.Attributes;
 import javax.naming.directory.SearchControls;
 import javax.naming.directory.SearchResult;
 import java.net.InetSocketAddress;
@@ -334,9 +349,10 @@
 
     private void sendAllEntries( ReplicationContext ctx ) throws NamingException
     {
-        Attributes rootDSE = ctx.getDirectoryService().getPartitionNexus().getRootDSE( null );
+        ServerEntry rootDSE = ctx.getDirectoryService().getPartitionNexus().getRootDSE( null );
 
-        Attribute namingContextsAttr = rootDSE.get( "namingContexts" );
+        ServerAttribute namingContextsAttr = rootDSE.get( SchemaConstants.NAMING_CONTEXTS_AT );
+        
         if ( namingContextsAttr == null || namingContextsAttr.size() == 0 )
         {
             SessionLog.warn( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
@@ -345,21 +361,12 @@
         }
 
         // Iterate all context partitions to send all entries of them.
-        NamingEnumeration e = namingContextsAttr.getAll();
-        while ( e.hasMore() )
+        for ( ServerValue<?> namingContext:namingContextsAttr )
         {
-            Object value = e.next();
-
             // Convert attribute value to JNDI name.
             LdapDN contextName;
-            if ( value instanceof LdapDN )
-            {
-                contextName = ( LdapDN ) value;
-            }
-            else
-            {
-                contextName = new LdapDN( String.valueOf( value ) );
-            }
+
+            contextName = new LdapDN( (String)namingContext.get() );
 
             SessionLog.info( ctx.getSession(), "[Replica-"+ ctx.getConfiguration().getReplicaId() +
                     "] Sending entries under '" + contextName + '\'' );
@@ -377,19 +384,23 @@
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE );
-        NamingEnumeration e = ctx.getDirectoryService().getPartitionNexus().search(
-            new SearchOperationContext( contextName, AliasDerefMode.DEREF_ALWAYS,
+        NamingEnumeration<SearchResult> e = ctx.getDirectoryService().getPartitionNexus().search(
+            new SearchOperationContext( ctx.getDirectoryService().getRegistries(), contextName, AliasDerefMode.DEREF_ALWAYS,
             new PresenceNode( SchemaConstants.OBJECT_CLASS_AT_OID ), ctrl ) );
 
         try
         {
             while ( e.hasMore() )
             {
-                SearchResult sr = ( SearchResult ) e.next();
-                Attributes attrs = sr.getAttributes();
+                SearchResult sr = e.next();
+                ServerEntry attrs = ServerEntryUtils.toServerEntry( 
+                    sr.getAttributes(), 
+                    new LdapDN( sr.getName() ), 
+                    ctx.getDirectoryService().getRegistries() ) ;
 
                 // Skip entries without entryCSN attribute.
-                Attribute entryCSNAttr = attrs.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN );
+                ServerAttribute entryCSNAttr = attrs.get( org.apache.directory.mitosis.common.Constants.ENTRY_CSN );
+                
                 if ( entryCSNAttr == null )
                 {
                     continue;
@@ -397,9 +408,19 @@
 
                 // Get entryCSN of the entry.  Skip if entryCSN value is invalid. 
                 CSN csn;
+                
                 try
                 {
-                    csn = new DefaultCSN( String.valueOf( entryCSNAttr.get() ) );
+                    Object val = entryCSNAttr.get();
+                    
+                    if ( val instanceof byte[] )
+                    {
+                        csn = new DefaultCSN( StringTools.utf8ToString( (byte[])val ) );
+                    }
+                    else
+                    {
+                        csn = new DefaultCSN( (String)val );
+                    }
                 }
                 catch ( IllegalArgumentException ex )
                 {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerContextHandler.java Sun Jan 20 08:59:10 2008
@@ -26,7 +26,14 @@
 import org.apache.directory.mitosis.service.ReplicationContext;
 import org.apache.directory.mitosis.service.ReplicationContext.State;
 import org.apache.directory.mitosis.service.protocol.Constants;
-import org.apache.directory.mitosis.service.protocol.message.*;
+import org.apache.directory.mitosis.service.protocol.message.BeginLogEntriesAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.BeginLogEntriesMessage;
+import org.apache.directory.mitosis.service.protocol.message.EndLogEntriesAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.EndLogEntriesMessage;
+import org.apache.directory.mitosis.service.protocol.message.LogEntryAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.LogEntryMessage;
+import org.apache.directory.mitosis.service.protocol.message.LoginAckMessage;
+import org.apache.directory.mitosis.service.protocol.message.LoginMessage;
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.util.SessionLog;
@@ -185,7 +192,7 @@
         try
         {
             op.execute( ctx.getDirectoryService().getPartitionNexus(), ctx.getConfiguration().getStore(),
-                ctx.getDirectoryService().getRegistries().getAttributeTypeRegistry() );
+                ctx.getDirectoryService().getRegistries() );
             ack = new LogEntryAckMessage( message.getSequence(), Constants.OK );
         }
         catch ( Exception e )

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java Sun Jan 20 08:59:10 2008
@@ -20,7 +20,10 @@
 package org.apache.directory.mitosis.store;
 
 
-import org.apache.directory.mitosis.common.*;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.mitosis.common.CSNVector;
+import org.apache.directory.mitosis.common.ReplicaId;
+import org.apache.directory.mitosis.common.UUID;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.server.core.DirectoryService;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java Sun Jan 20 08:59:10 2008
@@ -21,7 +21,11 @@
 
 
 import org.apache.commons.dbcp.BasicDataSource;
-import org.apache.directory.mitosis.common.*;
+import org.apache.directory.mitosis.common.CSN;
+import org.apache.directory.mitosis.common.CSNVector;
+import org.apache.directory.mitosis.common.DefaultCSN;
+import org.apache.directory.mitosis.common.ReplicaId;
+import org.apache.directory.mitosis.common.UUID;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.mitosis.operation.OperationCodec;
@@ -35,7 +39,12 @@
 import javax.naming.Name;
 import javax.naming.ldap.LdapName;
 import java.io.File;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
@@ -511,11 +520,12 @@
             // Check if the specified uuid already exists
             ps = con.prepareStatement( query );
 
-            Iterator i = updateVector.getReplicaIds().iterator();
+            Iterator<ReplicaId> i = updateVector.getReplicaIds().iterator();
             int paramIdx = 1;
+            
             while ( i.hasNext() )
             {
-                ReplicaId replicaId = ( ReplicaId ) i.next();
+                ReplicaId replicaId = i.next();
                 CSN csn = updateVector.getCSN( replicaId );
                 ps.setString( paramIdx++, replicaId.getId() );
                 ps.setLong( paramIdx++, csn.getTimestamp() );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java Sun Jan 20 08:59:10 2008
@@ -20,7 +20,6 @@
 
 package org.apache.directory.mitosis.service;
 
-import junit.framework.TestCase;
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.mitosis.common.Replica;
 import org.apache.directory.mitosis.common.ReplicaId;
@@ -31,6 +30,8 @@
 import org.apache.directory.server.core.interceptor.Interceptor;
 import org.apache.directory.server.core.jndi.CoreContextFactory;
 import org.apache.mina.util.AvailablePortFinder;
+import org.junit.After;
+import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -53,7 +54,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$, $Date$
  */
-public abstract class AbstractReplicationServiceTestCase extends TestCase
+public abstract class AbstractReplicationServiceTestCase
 {
     private static final Logger LOG = LoggerFactory.getLogger( AbstractReplicationServiceTestCase.class );
     protected Map<String, LdapContext> contexts = new HashMap<String, LdapContext>();
@@ -61,13 +62,13 @@
     protected Map<String, ReplicationInterceptor> replicationServices = new HashMap<String, ReplicationInterceptor>();
 
 
-    protected void setUp() throws Exception
+    @Before public void setUp() throws Exception
     {
         createReplicas( new String[] { "A", "B", "C" } );
     }
 
 
-    protected void tearDown() throws Exception
+    @After public void tearDown() throws Exception
     {
         destroyAllReplicas();
     }
@@ -78,6 +79,7 @@
         int lastAvailablePort = 1024;
 
         Replica[] replicas = new Replica[ names.length ];
+        
         for( int i = 0; i < names.length; i++ )
         {
             int replicationPort = AvailablePortFinder.getNextAvailable( lastAvailablePort );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/DIRSERVER1013ITest.java Sun Jan 20 08:59:10 2008
@@ -24,6 +24,10 @@
 
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNull;
 
 
 /**
@@ -39,14 +43,14 @@
  */
 public class DIRSERVER1013ITest extends AbstractReplicationServiceTestCase
 {
-    protected void setUp() throws Exception
+    @Before public void setUp() throws Exception
     {
         // Create two replicas as we currently can't have the
         // replication service enabled without more than one.
         createReplicas( new String[] { "A", "B" } );
     }
     
-    public void testNoRDNOID () throws Exception
+    @Test public void testNoRDNOID () throws Exception
     {
         LdapContext ctxA = getReplicaContext( "A" );
         

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/ReplicationServiceITest.java Sun Jan 20 08:59:10 2008
@@ -19,6 +19,9 @@
  */
 package org.apache.directory.mitosis.service;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -34,6 +37,11 @@
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
 
 /**
  * A test case for {@link ReplicationServiceITest}
@@ -43,12 +51,26 @@
  */
 public class ReplicationServiceITest extends AbstractReplicationServiceTestCase
 {
-    protected void setUp() throws Exception
+    private Map<String, OidNormalizer> oids;
+    
+    @Before public void setUp() throws Exception
     {
         createReplicas( new String[] { "A", "B", "C" } );
+
+        
+        // Initialize OIDs maps for normalization
+        oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "cn", new OidNormalizer( "cn", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "commonName", new OidNormalizer( "cn", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "2.5.4.3", new OidNormalizer( "cn", new DeepTrimToLowerNormalizer() ) );
     }
 
-    public void testOneWay() throws Exception
+    @Ignore
+    @Test public void testOneWay() throws Exception
     {
         String dn1 = "cn=test,ou=system";
         String dn2 = "cn=test2,ou=system";

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java Sun Jan 20 08:59:10 2008
@@ -21,7 +21,6 @@
 
 
 import junit.framework.Assert;
-import junit.framework.TestCase;
 
 import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
 import org.apache.mina.common.ByteBuffer;
@@ -30,11 +29,12 @@
 import org.apache.mina.filter.codec.demux.MessageDecoder;
 import org.apache.mina.filter.codec.demux.MessageEncoder;
 import org.apache.mina.filter.codec.support.SimpleProtocolEncoderOutput;
+import org.junit.Test;
 
 import sun.misc.Queue;
 
 
-public abstract class AbstractMessageCodecTest extends TestCase
+public abstract class AbstractMessageCodecTest
 {
     private final BaseMessage message;
     private final MessageEncoder encoder;
@@ -62,7 +62,7 @@
     }
 
 
-    public void testMessageCodec() throws Exception
+    @Test public void testMessageCodec() throws Exception
     {
         SimpleProtocolEncoderOutput encoderOut = new SimpleProtocolEncoderOutput()
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java Sun Jan 20 08:59:10 2008
@@ -20,7 +20,11 @@
 package org.apache.directory.mitosis.service.protocol.codec;
 
 
+import java.util.HashMap;
+import java.util.Map;
+
 import javax.naming.InvalidNameException;
+import javax.naming.NamingException;
 
 import org.apache.directory.mitosis.common.ReplicaId;
 import org.apache.directory.mitosis.common.DefaultCSN;
@@ -31,17 +35,42 @@
 import org.apache.directory.mitosis.service.protocol.message.LogEntryMessage;
 import org.apache.directory.shared.ldap.message.AttributeImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
+import org.apache.directory.shared.ldap.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 
 
 public class LogEntryMessageCodecTest extends AbstractMessageCodecTest
 {
+    private static Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
+
+    static 
+    {
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+    }
+    
 
-    public LogEntryMessageCodecTest() throws InvalidNameException
+    public LogEntryMessageCodecTest() throws InvalidNameException, NamingException
     {
+        // Initialize OIDs maps for normalization
+        /*Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+         */
+        
         super(
-            new LogEntryMessage( 1234, new AddAttributeOperation( new DefaultCSN( System.currentTimeMillis(),
-                new ReplicaId( "testReplica0" ), 1234 ), new LdapDN( "ou=system" ),
-                new AttributeImpl( "Hello", "Test" ) ) ), new LogEntryMessageEncoder(), new LogEntryMessageDecoder() );
+            new LogEntryMessage( 
+                1234, 
+                new AddAttributeOperation( 
+                    new DefaultCSN( System.currentTimeMillis(),
+                        new ReplicaId( "testReplica0" ), 1234 ), 
+                    new LdapDN( "ou=system" ).normalize( oids ),
+                    new AttributeImpl( "Hello", "Test" ) ) ), 
+            new LogEntryMessageEncoder(), 
+            new LogEntryMessageDecoder() );
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java Sun Jan 20 08:59:10 2008
@@ -23,9 +23,11 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import javax.naming.Name;
@@ -36,9 +38,11 @@
 
 import org.apache.commons.io.FileUtils;
 import org.apache.directory.server.core.DefaultDirectoryService;
+import org.apache.directory.server.core.entry.DefaultServerEntry;
 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.schema.DeepTrimToLowerNormalizer;
+import org.apache.directory.shared.ldap.schema.OidNormalizer;
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.CSNVector;
@@ -71,6 +75,7 @@
     private DerbyReplicationStore store;
     private int testCount;
     private long startTime;
+    private DefaultDirectoryService service;
 
 
     public void setUp() throws Exception
@@ -90,7 +95,7 @@
         // Open store
         store = new DerbyReplicationStore();
         store.setTablePrefix( "TEST_" );
-        DefaultDirectoryService service = new DefaultDirectoryService();
+        service = new DefaultDirectoryService();
         service.setWorkingDirectory( DB_PATH );
         store.open( service, cfg );
     }
@@ -181,22 +186,29 @@
 
     private void subTestWriteLog() throws Exception
     {
+        Map<String, OidNormalizer> oids = new HashMap<String, OidNormalizer>();
+
+        oids.put( "ou", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "organizationalUnitName", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        oids.put( "2.5.4.11", new OidNormalizer( "ou", new DeepTrimToLowerNormalizer() ) );
+        
         CSN csn = csnFactory.newInstance( REPLICA_ID );
         CompositeOperation op1 = new CompositeOperation( csn );
-        op1.add( new AddEntryOperation( csn, new LdapDN( "ou=a" ), new AttributesImpl( true ) ) );
-        op1.add( new AddAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl( "id", "valie" ) ) );
-        op1.add( new ReplaceAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl( "id", "valie" ) ) );
-        op1.add( new DeleteAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl( "id", "valie" ) ) );
+        LdapDN ouA =  new LdapDN( "ou=a" ).normalize( oids );
+        op1.add( new AddEntryOperation( csn, ouA, new DefaultServerEntry( service.getRegistries(), ouA ) ) );
+        op1.add( new AddAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" ) ) );
+        op1.add( new ReplaceAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" ) ) );
+        op1.add( new DeleteAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" ) ) );
 
         store.putLog( op1 );
         testGetLogs( csn, op1 );
 
         csn = csnFactory.newInstance( OTHER_REPLICA_ID );
         CompositeOperation op2 = new CompositeOperation( csn );
-        op2.add( new AddEntryOperation( csn, new LdapDN( "ou=a" ), new AttributesImpl( true ) ) );
-        op2.add( new AddAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl( "id", "valie" ) ) );
-        op2.add( new ReplaceAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl( "id", "valie" ) ) );
-        op2.add( new DeleteAttributeOperation( csn, new LdapDN( "ou=a" ), new AttributeImpl( "id", "valie" ) ) );
+        op2.add( new AddEntryOperation( csn, ouA, new DefaultServerEntry( service.getRegistries(), ouA ) ) );
+        op2.add( new AddAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" ) ) );
+        op2.add( new ReplaceAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" ) ) );
+        op2.add( new DeleteAttributeOperation( csn, ouA, new AttributeImpl( "id", "valie" ) ) );
 
         store.putLog( op2 );
         testGetLogs( csn, op2 );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/Main.java Sun Jan 20 08:59:10 2008
@@ -22,6 +22,8 @@
 
 import java.io.IOException;
 
+import javax.naming.NamingException;
+
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.protocol.shared.DatagramAcceptor;
@@ -56,7 +58,7 @@
     /**
      * Start an instance of the DNS server.
      */
-    public void go() throws IOException
+    public void go() throws IOException, NamingException
     {
         LOG.debug( "Starting the DNS server" );
         

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/io/decoder/DnsMessageDecoder.java Sun Jan 20 08:59:10 2008
@@ -163,7 +163,7 @@
             String domainName = getDomainName( byteBuffer );
 
             RecordType recordType = RecordType.convert( byteBuffer.getShort() );
-            RecordClass recordClass = RecordClass.convert( ( byte ) byteBuffer.getShort() );
+            RecordClass recordClass = RecordClass.convert( byteBuffer.getShort() );
 
             questions.add( new QuestionRecord( domainName, recordType, recordClass ) );
         }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-dns/src/main/java/org/apache/directory/server/dns/messages/RecordClass.java Sun Jan 20 08:59:10 2008
@@ -56,7 +56,7 @@
 
     private RecordClass( int value )
     {
-        this.value = ( byte ) value;
+        this.value = ( short ) value;
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/kdc/KdcServer.java Sun Jan 20 08:59:10 2008
@@ -422,8 +422,16 @@
      */
     public void start() throws IOException
     {
-        PrincipalStore store = new JndiPrincipalStoreImpl( getSearchBaseDn(),
-                getSearchBaseDn(), getDirectoryService() );
+        PrincipalStore store;
+
+        if ( isCatelogBased() )
+        {
+            store = new JndiPrincipalStoreImpl( getSearchBaseDn(), null, getDirectoryService() );
+        }
+        else
+        {
+            store = new JndiPrincipalStoreImpl( null, getSearchBaseDn(), getDirectoryService() );
+        }
 
         if ( getDatagramAcceptor() != null )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/kdc/SaslGssapiBindITest.java Sun Jan 20 08:59:10 2008
@@ -21,6 +21,8 @@
 
 
 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.interceptor.Interceptor;
 import org.apache.directory.server.core.kerberos.KeyDerivationInterceptor;
 import org.apache.directory.server.core.partition.Partition;
@@ -29,11 +31,14 @@
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmPartition;
 import org.apache.directory.server.kerberos.shared.store.KerberosAttribute;
 import org.apache.directory.server.unit.AbstractServerTest;
+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;
+import org.apache.directory.shared.ldap.name.LdapDN;
 
 import javax.naming.Context;
+import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
 import javax.naming.directory.DirContext;
@@ -143,9 +148,8 @@
         users.createSubcontext( "uid=ldap", attrs );
     }
 
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
-        Attributes attrs;
         Set<Partition> partitions = new HashSet<Partition>();
 
         // Add partition 'example'
@@ -159,15 +163,10 @@
         indexedAttrs.add( new JdbmIndex( "objectClass" ) );
         partition.setIndexedAttributes( indexedAttrs );
 
-        attrs = new AttributesImpl( true );
-        Attribute attr = new AttributeImpl( "objectClass" );
-        attr.add( "top" );
-        attr.add( "domain" );
-        attrs.put( attr );
-        attr = new AttributeImpl( "dc" );
-        attr.add( "example" );
-        attrs.put( attr );
-        partition.setContextEntry( attrs );
+        ServerEntry serverEntry = new DefaultServerEntry( directoryService.getRegistries(), new LdapDN( "dc=example, dc=com" ) );
+        serverEntry.put( "objectClass", "top", "domain" );
+        serverEntry.put( "dc", "example" );
+        partition.setContextEntry( serverEntry );
 
         partitions.add( partition );
         directoryService.setPartitions( partitions );
@@ -201,9 +200,9 @@
         attrs.put( "cn", cn );
         attrs.put( "sn", sn );
         attrs.put( "uid", uid );
-        attrs.put( "userPassword", userPassword );
-        attrs.put( KerberosAttribute.PRINCIPAL, principal );
-        attrs.put( KerberosAttribute.VERSION, "0" );
+        attrs.put( SchemaConstants.USER_PASSWORD_AT, userPassword );
+        attrs.put( KerberosAttribute.KRB5_PRINCIPAL_NAME_AT, principal );
+        attrs.put( KerberosAttribute.KRB5_KEY_VERSION_NUMBER_AT, "0" );
 
         return attrs;
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Sun Jan 20 08:59:10 2008
@@ -402,7 +402,7 @@
 
 
     private void startLDAP0( int port, IoFilterChainBuilder chainBuilder )
-        throws LdapNamingException, LdapConfigurationException
+        throws LdapNamingException, LdapConfigurationException, NamingException
     {
         for ( ExtendedOperationHandler h : getExtendedOperationHandlers() )
         {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/BindHandler.java Sun Jan 20 08:59:10 2008
@@ -21,7 +21,7 @@
 
 
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.BindRequest;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.handler.demux.MessageHandler;
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/DefaultBindHandler.java Sun Jan 20 08:59:10 2008
@@ -68,6 +68,7 @@
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -481,14 +482,22 @@
             throw new ServiceConfigurationException( message );
         }
 
-        EncryptionKey key = entry.getKeyMap().get( EncryptionType.DES_CBC_MD5 );
-        byte[] keyBytes = key.getKeyValue();
-        int type = key.getKeyType().getOrdinal();
-        int kvno = key.getKeyVersion();
-
-        KerberosKey serviceKey = new KerberosKey( servicePrincipal, keyBytes, type, kvno );
         Subject subject = new Subject();
-        subject.getPrivateCredentials().add( serviceKey );
+
+        Iterator<EncryptionType> it = entry.getKeyMap().keySet().iterator();
+
+        while ( it.hasNext() )
+        {
+            EncryptionKey key = entry.getKeyMap().get( it.next() );
+
+            byte[] keyBytes = key.getKeyValue();
+            int type = key.getKeyType().getOrdinal();
+            int kvno = key.getKeyVersion();
+
+            KerberosKey serviceKey = new KerberosKey( servicePrincipal, keyBytes, type, kvno );
+
+            subject.getPrivateCredentials().add( serviceKey );
+        }
 
         return subject;
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/ExtendedHandler.java Sun Jan 20 08:59:10 2008
@@ -24,6 +24,7 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.ldap.ExtendedOperationHandler;
 import org.apache.directory.shared.ldap.message.ExtendedRequest;
 import org.apache.mina.common.IoSession;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/bind/GetBindDn.java Sun Jan 20 08:59:10 2008
@@ -29,6 +29,7 @@
 import javax.naming.directory.SearchResult;
 
 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.util.StringTools;
@@ -96,7 +97,7 @@
         }
 
         String[] attrIDs =
-            { "userPassword" };
+            { SchemaConstants.USER_PASSWORD_AT };
 
         Attributes matchAttrs = new AttributesImpl( true );
         matchAttrs.put( new AttributeImpl( "uid", username ) );
@@ -120,7 +121,7 @@
                 }
 
                 Object userPassword;
-                Attribute userPasswordAttr = attrs.get( "userPassword" );
+                Attribute userPasswordAttr = attrs.get( SchemaConstants.USER_PASSWORD_AT );
 
                 if ( userPasswordAttr == null )
                 {

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/LaunchDiagnosticUiHandler.java Sun Jan 20 08:59:10 2008
@@ -97,7 +97,7 @@
             requestor.write( new LaunchDiagnosticUiResponse( req.getMessageId() ) );
 
             PartitionNexus nexus = service.getPartitionNexus();
-            Iterator<String> list = nexus.listSuffixes( new ListSuffixOperationContext() );
+            Iterator<String> list = nexus.listSuffixes( new ListSuffixOperationContext( service.getRegistries() ) );
             int launchedWindowCount = 0;
             
             while ( list.hasNext() )

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/StoredProcedureExtendedOperationHandler.java Sun Jan 20 08:59:10 2008
@@ -31,11 +31,11 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.naming.directory.Attributes;
 import javax.naming.ldap.Control;
 import javax.naming.ldap.LdapContext;
 
 import org.apache.commons.lang.SerializationUtils;
+import org.apache.directory.server.core.entry.ServerEntry;
 import org.apache.directory.server.core.jndi.ServerLdapContext;
 import org.apache.directory.server.core.sp.StoredProcEngine;
 import org.apache.directory.server.core.sp.StoredProcEngineConfig;
@@ -100,7 +100,7 @@
         StoredProcedure spBean = decodeBean( req.getPayload() );
         
         String procedure = StringTools.utf8ToString( spBean.getProcedure() );
-        Attributes spUnit = manager.findStoredProcUnit( ctx, procedure );
+        ServerEntry spUnit = manager.findStoredProcUnit( ctx, procedure, ctx.getService().getRegistries() );
         StoredProcEngine engine = manager.getStoredProcEngineInstance( spUnit );
         
         List<Object> valueList = new ArrayList<Object>( spBean.getParameters().size() );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/protocol-ldap/src/test/java/org/apache/directory/server/ldap/LdapServerTest.java Sun Jan 20 08:59:10 2008
@@ -23,11 +23,27 @@
 import junit.framework.TestCase;
 import org.apache.directory.server.core.DefaultDirectoryService;
 import org.apache.directory.server.core.DirectoryService;
-import org.apache.directory.server.ldap.support.*;
+import org.apache.directory.server.ldap.support.AbandonHandler;
+import org.apache.directory.server.ldap.support.AddHandler;
+import org.apache.directory.server.ldap.support.BindHandler;
+import org.apache.directory.server.ldap.support.CompareHandler;
+import org.apache.directory.server.ldap.support.DeleteHandler;
+import org.apache.directory.server.ldap.support.ModifyDnHandler;
+import org.apache.directory.server.ldap.support.ModifyHandler;
+import org.apache.directory.server.ldap.support.SearchHandler;
+import org.apache.directory.server.ldap.support.UnbindHandler;
 import org.apache.directory.server.protocol.shared.SocketAcceptor;
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
-import org.apache.directory.shared.ldap.message.*;
+import org.apache.directory.shared.ldap.message.AbandonRequest;
+import org.apache.directory.shared.ldap.message.AddRequest;
+import org.apache.directory.shared.ldap.message.BindRequest;
+import org.apache.directory.shared.ldap.message.CompareRequest;
+import org.apache.directory.shared.ldap.message.DeleteRequest;
+import org.apache.directory.shared.ldap.message.ModifyDnRequest;
+import org.apache.directory.shared.ldap.message.ModifyRequest;
+import org.apache.directory.shared.ldap.message.SearchRequest;
+import org.apache.directory.shared.ldap.message.UnbindRequest;
 import org.apache.mina.common.ByteBuffer;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.SimpleByteBufferAllocator;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/ConcreteNameComponentNormalizer.java Sun Jan 20 08:59:10 2008
@@ -20,6 +20,8 @@
 package org.apache.directory.server.schema;
 
 
+import java.io.UnsupportedEncodingException;
+
 import javax.naming.NamingException;
 
 import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
@@ -29,6 +31,9 @@
 import org.apache.directory.shared.ldap.schema.MatchingRule;
 import org.apache.directory.shared.ldap.schema.NoOpNormalizer;
 import org.apache.directory.shared.ldap.schema.Normalizer;
+import org.apache.directory.shared.ldap.util.StringTools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 
 /**
@@ -41,8 +46,12 @@
  */
 public class ConcreteNameComponentNormalizer implements NameComponentNormalizer
 {
+    /** The LoggerFactory used by this Interceptor */
+    private static Logger LOG = LoggerFactory.getLogger( ConcreteNameComponentNormalizer.class );
+
     /** the at registry used to dynamically resolve Normalizers */
     private final AttributeTypeRegistry attributeRegistry;
+    
     /** the oid registry used to dynamically resolve aliases to OIDs */
     private final OidRegistry oidRegistry;
 
@@ -60,13 +69,75 @@
         this.oidRegistry = oidRegistry;
     }
 
+    
+    private String unescape( String value )
+    {
+        char[] newVal = new char[value.length()];
+        int escaped = 0;
+        char high = 0;
+        char low = 0;
+        int pos = 0;
+        
+        for ( char c:value.toCharArray() )
+        {
+            switch ( escaped )
+            {
+                case 0 :
+                    if ( c == '\\' )
+                    {
+                        escaped = 1;
+                    }
+                    else
+                    {
+                        newVal[pos++] = c;
+                    }
+                    
+                    break;
+
+                case 1 :
+                    escaped++;
+                    high = c;
+                    break;
+                    
+                case 2 :
+                    escaped=0;
+                    low = c;
+                    newVal[pos++] = (char)StringTools.getHexValue( high, low );
+                    
+            }
+        }
+        
+        return new String( newVal, 0, pos );
+    }
 
     /**
      * @see NameComponentNormalizer#normalizeByName(String, String)
      */
     public Object normalizeByName( String name, String value ) throws NamingException
     {
-        return lookup( name ).normalize( value );
+        AttributeType attributeType = attributeRegistry.lookup( name );
+        
+        if ( attributeType.getSyntax().isHumanReadable() )
+        {
+            return lookup( name ).normalize( value );
+        }
+        else
+        {
+            try
+            {
+                String unescaped = unescape( value );
+                byte[] valBytes = unescaped.getBytes( "UTF-8" );
+                
+                return lookup( name ).normalize( valBytes ); 
+            }
+            catch ( UnsupportedEncodingException uee )
+            {
+                String message = "The value stored in a non Human Readable attribute as a String should be convertible to a byte[]";
+                LOG.error( message );
+                throw new NamingException( message );
+            }
+        }
+        
     }
 
 
@@ -75,7 +146,26 @@
      */
     public Object normalizeByName( String name, byte[] value ) throws NamingException
     {
-        return lookup( name ).normalize( value );
+        AttributeType attributeType = attributeRegistry.lookup( name );
+        
+        if ( !attributeType.getSyntax().isHumanReadable() )
+        {
+            return lookup( name ).normalize( value );
+        }
+        else
+        {
+            try
+            {
+                String valStr = new String( value, "UTF-8" );
+                return lookup( name ).normalize( valStr ); 
+            }
+            catch ( UnsupportedEncodingException uee )
+            {
+                String message = "The value stored in an Human Readable attribute as a byte[] should be convertible to a String";
+                LOG.error( message );
+                throw new NamingException( message );
+            }
+        }
     }
 
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultAttributeTypeRegistry.java Sun Jan 20 08:59:10 2008
@@ -190,18 +190,18 @@
 
     public AttributeType lookup( String id ) throws NamingException
     {
-        id = oidRegistry.getOid( id );
+        String oid = oidRegistry.getOid( id );
 
-        if ( !byOid.containsKey( id ) )
+        if ( !byOid.containsKey( oid ) )
         {
-            throw new NamingException( "attributeType w/ OID " + id + " not registered!" );
+            throw new NamingException( "attributeType w/ OID " + oid + " not registered!" );
         }
 
-        AttributeType attributeType = byOid.get( id );
+        AttributeType attributeType = byOid.get( oid );
         
         if ( IS_DEBUG )
         {
-            LOG.debug( "lookup with id" + id + "' of attributeType: " + attributeType );
+            LOG.debug( "lookup with id" + oid + "' of attributeType: " + attributeType );
         }
         
         return attributeType;

Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultObjectClassRegistry.java Sun Jan 20 08:59:10 2008
@@ -27,6 +27,7 @@
 import javax.naming.NamingException;
 
 import org.apache.directory.shared.ldap.schema.ObjectClass;
+import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -101,18 +102,23 @@
 
     public ObjectClass lookup( String id ) throws NamingException
     {
-        id = oidRegistry.getOid( id );
+        if ( StringTools.isEmpty( id ) )
+        {
+            throw new NamingException( "name should not be empty" );
+        }
+        
+        String oid = oidRegistry.getOid( id.toLowerCase() );
 
-        if ( !byOid.containsKey( id ) )
+        if ( !byOid.containsKey( oid ) )
         {
-            throw new NamingException( "objectClass w/ OID " + id + " not registered!" );
+            throw new NamingException( "objectClass w/ OID " + oid + " not registered!" );
         }
 
-        ObjectClass objectClass = byOid.get( id );
+        ObjectClass objectClass = byOid.get( oid );
         
         if ( IS_DEBUG )
         {
-            LOG.debug( "looked objectClass with OID '" + id + "' and got back " + objectClass );
+            LOG.debug( "looked objectClass with OID '" + oid + "' and got back " + objectClass );
         }
         return objectClass;
     }

Modified: directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/schema-registries/src/main/java/org/apache/directory/server/schema/registries/DefaultRegistries.java Sun Jan 20 08:59:10 2008
@@ -500,6 +500,7 @@
     public void load( String schemaName, Properties schemaProperties ) throws NamingException
     {
         Schema schema = schemaLoader.getSchema( schemaName, schemaProperties );
+        
         if ( schema.isDisabled() )
         {
             throw new NamingException( "Disabled schemas cannot be loaded into registries." );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Sun Jan 20 08:59:10 2008
@@ -29,6 +29,7 @@
 import org.apache.directory.server.ldap.LdapServer;
 import org.apache.directory.server.protocol.shared.store.LdifFileLoader;
 import org.apache.directory.server.protocol.shared.store.LdifLoadFilter;
+import org.apache.directory.server.schema.registries.AttributeTypeRegistry;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
@@ -76,7 +77,14 @@
 
     public ApacheDS( DirectoryService directoryService, LdapServer ldapServer, LdapServer ldapsServer )
     {
-        this.directoryService = directoryService == null? new DefaultDirectoryService(): directoryService;
+        LOG.info(  "Starting the Apache Directory Server" );
+        this.directoryService = directoryService;
+        
+        if ( this.directoryService == null )
+        {
+            directoryService = new DefaultDirectoryService();
+        }
+        
         this.ldapServer = ldapServer;
         this.ldapsServer = ldapsServer;
         ByteBuffer.setAllocator( new SimpleByteBufferAllocator() );
@@ -160,6 +168,7 @@
 
     public void setSynchPeriodMillis( long synchPeriodMillis )
     {
+        LOG.info( "Set the synchPeriodMillis to {}", synchPeriodMillis );
         this.synchPeriodMillis = synchPeriodMillis;
     }
 
@@ -183,20 +192,25 @@
 
     public void setAllowAnonymousAccess( boolean allowAnonymousAccess )
     {
-        this.directoryService.setAllowAnonymousAccess( allowAnonymousAccess );
+        LOG.info( "Set the allowAnonymousAccess flag to {}", allowAnonymousAccess );
+        
+        directoryService.setAllowAnonymousAccess( allowAnonymousAccess );
+        
         if ( ldapServer != null )
         {
-            this.ldapServer.setAllowAnonymousAccess( allowAnonymousAccess );
+            ldapServer.setAllowAnonymousAccess( allowAnonymousAccess );
         }
+        
         if ( ldapsServer != null )
         {
-            this.ldapsServer.setAllowAnonymousAccess( allowAnonymousAccess );
+            ldapsServer.setAllowAnonymousAccess( allowAnonymousAccess );
         }
     }
 
 
     public void setLdifDirectory( File ldifDirectory )
     {
+        LOG.info( "The LDIF directory file is {}", ldifDirectory.getAbsolutePath() );
         this.ldifDirectory = ldifDirectory;
     }
 
@@ -207,10 +221,20 @@
     }
 
 
-    protected void setLdifFilters( List<LdifLoadFilter> filters )
+    public void setLdifFilters( List<LdifLoadFilter> filters )
     {
-        this.ldifFilters.clear();
-        this.ldifFilters.addAll( filters );
+        if ( LOG.isInfoEnabled() )
+        {
+            LOG.info( "Set the ldif filters :" );
+            
+            for ( LdifLoadFilter filter:filters )
+            {
+                LOG.info( "    Ldif Filter {}", filter );
+            }
+        }
+        
+        ldifFilters.clear();
+        ldifFilters.addAll( filters );
     }
 
 
@@ -318,8 +342,15 @@
         }
 
 
-        LdapPrincipal admin = new LdapPrincipal( new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN ),
-                AuthenticationLevel.STRONG );
+        LdapDN dn = new LdapDN( ServerDNConstants.ADMIN_SYSTEM_DN );
+        
+        // Must normailize the dn or - IllegalStateException!
+        AttributeTypeRegistry reg = directoryService.getRegistries().getAttributeTypeRegistry();
+            dn.normalize( reg.getNormalizerMapping() );
+        
+        LdapPrincipal admin = new LdapPrincipal( dn, AuthenticationLevel.STRONG );
+        
+        
         DirContext root = directoryService.getJndiContext( admin );
         ensureLdifFileBase( root );
 

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/CapacityTestCommand.java Sun Jan 20 08:59:10 2008
@@ -36,6 +36,7 @@
 import org.apache.directory.daemon.AvailablePortFinder;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.shared.ldap.constants.JndiPropertyConstants;
+import org.apache.directory.shared.ldap.constants.SchemaConstants;
 import org.apache.directory.shared.ldap.message.AttributesImpl;
 
 
@@ -143,7 +144,7 @@
         attrs.put( "cn", RandomStringUtils.randomAlphabetic( 15 ) );
         attrs.put( "initials", RandomStringUtils.randomAlphabetic( 2 ) );
         attrs.put( "mail", RandomStringUtils.randomAlphabetic( 15 ) );
-        attrs.put( "userPassword", "password" );
+        attrs.put( SchemaConstants.USER_PASSWORD_AT, "password" );
         attrs.put( "telephoneNumber", RandomStringUtils.randomNumeric( 10 ) );
         attrs.put( "homePhone", RandomStringUtils.randomNumeric( 10 ) );
         attrs.put( "pager", RandomStringUtils.randomNumeric( 10 ) );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/dumpcmd/DumpCommandExecutor.java Sun Jan 20 08:59:10 2008
@@ -27,6 +27,8 @@
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.DefaultDirectoryService;
 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.partition.impl.btree.Index;
 import org.apache.directory.server.core.partition.impl.btree.Tuple;
 import org.apache.directory.server.core.partition.impl.btree.jdbm.JdbmIndex;
@@ -55,8 +57,8 @@
 import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
 import org.apache.directory.shared.ldap.ldif.LdifUtils;
-import org.apache.directory.shared.ldap.message.AttributesImpl;
 import org.apache.directory.shared.ldap.message.ResultCodeEnum;
+import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.shared.ldap.util.Base64;
@@ -215,18 +217,21 @@
         }
 
         Set<Index> indexedAttributes = new HashSet<Index>();
+        
         for ( String attributeId : listing.getIndexedAttributes() )
         {
             indexedAttributes.add( new JdbmIndex( attributeId ) );
         }
+        
         schemaPartition.setIndexedAttributes( indexedAttributes );
         schemaPartition.setSuffix( ServerDNConstants.OU_SCHEMA_DN );
         
-        Attributes entry = new AttributesImpl();
-        entry.put( SchemaConstants.OBJECT_CLASS_AT, SchemaConstants.TOP_OC );
-        entry.get( SchemaConstants.OBJECT_CLASS_AT ).add( SchemaConstants.ORGANIZATIONAL_UNIT_OC );
-        entry.put( SchemaConstants.OU_AT, "schema" );
-        schemaPartition.setContextEntry( entry );
+        ServerEntry systemEntry = new DefaultServerEntry( registries, new LdapDN( "ou=schema" ) );
+        systemEntry.put( SchemaConstants.OBJECT_CLASS_AT, 
+            SchemaConstants.TOP_OC,
+            SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+        systemEntry.put( SchemaConstants.OU_AT, "schema" );
+        schemaPartition.setContextEntry( systemEntry );
 
         DirectoryService directoryService = new DefaultDirectoryService();
         schemaPartition.init( directoryService );

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-tools/src/main/java/org/apache/directory/server/tools/commands/importcmd/ImportCommandExecutor.java Sun Jan 20 08:59:10 2008
@@ -31,7 +31,11 @@
 import org.apache.directory.shared.asn1.ber.tlv.TLVStateEnum;
 import org.apache.directory.shared.asn1.codec.DecoderException;
 import org.apache.directory.shared.asn1.codec.EncoderException;
-import org.apache.directory.shared.ldap.codec.*;
+import org.apache.directory.shared.ldap.codec.LdapConstants;
+import org.apache.directory.shared.ldap.codec.LdapDecoder;
+import org.apache.directory.shared.ldap.codec.LdapMessage;
+import org.apache.directory.shared.ldap.codec.LdapMessageContainer;
+import org.apache.directory.shared.ldap.codec.LdapResult;
 import org.apache.directory.shared.ldap.codec.add.AddRequest;
 import org.apache.directory.shared.ldap.codec.bind.BindRequest;
 import org.apache.directory.shared.ldap.codec.bind.BindResponse;
@@ -62,7 +66,10 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.Serializable;
-import java.net.*;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.SocketAddress;
+import java.net.URL;
 import java.nio.ByteBuffer;
 import java.nio.channels.SocketChannel;
 import java.util.HashMap;
@@ -225,13 +232,13 @@
         // Copy the attributes
         addRequest.initAttributes();
 
-        for ( NamingEnumeration attrs = attributes.getAll(); attrs.hasMoreElements(); )
+        for ( NamingEnumeration<? extends Attribute> attrs = attributes.getAll(); attrs.hasMoreElements(); )
         {
-            Attribute attribute = ( Attribute ) attrs.nextElement();
+            Attribute attribute = attrs.nextElement();
 
             addRequest.addAttributeType( attribute.getID() );
 
-            for ( NamingEnumeration values = attribute.getAll(); values.hasMoreElements(); )
+            for ( NamingEnumeration<?> values = attribute.getAll(); values.hasMoreElements(); )
             {
                 Object value = values.nextElement();
                 addRequest.addAttributeValue( value );
@@ -455,7 +462,7 @@
 
             modifyRequest.addAttributeTypeAndValues( modificationItem.getAttribute().getID() );
 
-            for ( NamingEnumeration values = modificationItem.getAttribute().getAll(); values.hasMoreElements(); )
+            for ( NamingEnumeration<?> values = modificationItem.getAttribute().getAll(); values.hasMoreElements(); )
             {
                 Object value = values.nextElement();
                 modifyRequest.addAttributeValue( value );
@@ -835,13 +842,13 @@
         if ( ldifReader.containsEntries() )
         {
             // Parse the file and inject every entry
-            Iterator entries = ldifReader.iterator();
+            Iterator<Entry> entries = ldifReader.iterator();
             long t0 = System.currentTimeMillis();
             int nbAdd = 0;
 
             while ( entries.hasNext() )
             {
-                Entry entry = ( Entry ) entries.next();
+                Entry entry = entries.next();
 
                 // Check if we have had some error, has next() does not throw any exception
                 if ( ldifReader.hasError() )
@@ -900,13 +907,13 @@
         else
         {
             // Parse the file and inject every modification
-            Iterator entries = ldifReader.iterator();
+            Iterator<Entry> entries = ldifReader.iterator();
             long t0 = System.currentTimeMillis();
             int nbMod = 0;
 
             while ( entries.hasNext() )
             {
-                Entry entry = ( Entry ) entries.next();
+                Entry entry = entries.next();
 
                 // Check if we have had some error, has next() does not throw any exception
                 if ( ldifReader.hasError() )

Modified: directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?rev=613608&r1=613607&r2=613608&view=diff
==============================================================================
--- directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/sandbox/akarasulu/bigbang/apacheds/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Sun Jan 20 08:59:10 2008
@@ -239,7 +239,7 @@
         setContexts( ServerDNConstants.ADMIN_SYSTEM_DN, "secret" );
     }
 
-    protected void configureDirectoryService()
+    protected void configureDirectoryService() throws NamingException
     {
     }
 



Mime
View raw message