directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r471209 - in /directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service: ./ protocol/handler/
Date Sat, 04 Nov 2006 15:00:38 GMT
Author: akarasulu
Date: Sat Nov  4 07:00:37 2006
New Revision: 471209

URL: http://svn.apache.org/viewvc?view=rev&rev=471209
Log:
couple bug fixes ...

 o fixed issue with MINA where multiple codecs were being used causing an 
   exception
 o fixed issue with normalization where we were not using proper normalized
   DN when making calls to the nexus.


Modified:
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientProtocolHandler.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationProtocolHandler.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerProtocolHandler.java

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java?view=diff&rev=471209&r1=471208&r2=471209
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/ClientConnectionManager.java
Sat Nov  4 07:00:37 2006
@@ -25,6 +25,7 @@
 
 import org.apache.directory.mitosis.common.Replica;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.mitosis.service.protocol.codec.ReplicationClientProtocolCodecFactory;
 import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientProtocolHandler;
 import org.apache.mina.common.ConnectFuture;
 import org.apache.mina.common.ExecutorThreadModel;
@@ -33,6 +34,7 @@
 import org.apache.mina.common.IoSession;
 import org.apache.mina.common.RuntimeIOException;
 import org.apache.mina.filter.LoggingFilter;
+import org.apache.mina.filter.codec.ProtocolCodecFilter;
 import org.apache.mina.transport.socket.nio.SocketConnector;
 import org.apache.mina.transport.socket.nio.SocketConnectorConfig;
 import org.slf4j.Logger;
@@ -68,6 +70,10 @@
         threadModel.setExecutor(
                 new ThreadPoolExecutor(16, 16, 60, TimeUnit.SECONDS, new LinkedBlockingQueue()
));
         connectorConfig.setThreadModel(threadModel);
+
+        //// add codec
+        connectorConfig.getFilterChain().addLast( "protocol",
+                new ProtocolCodecFilter( new ReplicationClientProtocolCodecFactory() ) );
 
         //// add logger
         connectorConfig.getFilterChain().addLast( "logger", new LoggingFilter() );

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java?view=diff&rev=471209&r1=471208&r2=471209
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientContextHandler.java
Sat Nov  4 07:00:37 2006
@@ -21,8 +21,8 @@
 
 import java.net.InetSocketAddress;
 import java.util.Iterator;
+import java.util.Map;
 
-import javax.naming.Name;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
@@ -267,15 +267,12 @@
     
     private void sendAllEntries( ReplicationContext ctx ) throws NamingException
     {
-        Attributes rootDSE =
-            ctx.getServiceConfiguration().getPartitionNexus().getRootDSE();
+        Attributes rootDSE = ctx.getServiceConfiguration().getPartitionNexus().getRootDSE();
         
         Attribute namingContextsAttr = rootDSE.get( "namingContexts" );
         if( namingContextsAttr == null || namingContextsAttr.size() == 0 )
         {
-            SessionLog.warn(
-                    ctx.getSession(),
-                    "No namingContexts attributes in rootDSE." );
+            SessionLog.warn( ctx.getSession(), "No namingContexts attributes in rootDSE."
);
             return;
         }
         
@@ -284,31 +281,34 @@
         while( e.hasMore() )
         {
             Object value = e.next();
+            
             // Convert attribute value to JNDI name.
-            Name contextName;
-            if( value instanceof Name )
+            LdapDN contextName;
+            if( value instanceof LdapDN )
             {
-                contextName = ( Name ) value;
+                contextName = ( LdapDN ) value;
             }
             else
             {
                 contextName = new LdapDN( String.valueOf( value ) );
             }
             
-            SessionLog.info(
-                    ctx.getSession(),
-                    "Sending entries under '" + contextName + '\'' );
+            SessionLog.info( ctx.getSession(), "Sending entries under '" + contextName +
'\'' );
+
+            Map mapping = ctx.getServiceConfiguration().getGlobalRegistries()
+                .getAttributeTypeRegistry().getNormalizerMapping();
+            contextName.normalize( mapping );
             sendAllEntries( ctx, contextName );
         }
     }
 
-    private void sendAllEntries( ReplicationContext ctx, Name contextName ) throws NamingException
+    private void sendAllEntries( ReplicationContext ctx, LdapDN contextName ) throws NamingException
     {
         // Retrieve all subtree including the base entry
         SearchControls ctrl = new SearchControls();
         ctrl.setSearchScope( SearchControls.SUBTREE_SCOPE ); 
         NamingEnumeration e = ctx.getServiceConfiguration().getPartitionNexus().search(
-                (LdapDN)contextName,
+                contextName,
                 ctx.getServiceConfiguration().getEnvironment(),
                 new PresenceNode( "objectClass" ), ctrl );
         
@@ -341,9 +341,7 @@
                 }
                 
                 // Convert the entry into AddEntryOperation log.
-                Operation op = new AddEntryOperation(
-                        csn,
-                        new LdapDN( sr.getName() ), attrs );
+                Operation op = new AddEntryOperation( csn, new LdapDN( sr.getName() ), attrs
);
                 
                 // Send a LogEntry message for the entry.
                 ctx.getSession().write( new LogEntryMessage( ctx.getNextSequence(), op )
);

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientProtocolHandler.java?view=diff&rev=471209&r1=471208&r2=471209
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientProtocolHandler.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientProtocolHandler.java
Sat Nov  4 07:00:37 2006
@@ -20,13 +20,12 @@
 package org.apache.directory.mitosis.service.protocol.handler;
 
 import org.apache.directory.mitosis.service.ReplicationService;
-import org.apache.directory.mitosis.service.protocol.codec.ReplicationClientProtocolCodecFactory;
 
 public class ReplicationClientProtocolHandler extends
         ReplicationProtocolHandler
 {
     public ReplicationClientProtocolHandler( ReplicationService service )
     {
-        super( service, new ReplicationClientContextHandler(), new ReplicationClientProtocolCodecFactory()
);
+        super( service, new ReplicationClientContextHandler() );
     }
 }

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationProtocolHandler.java?view=diff&rev=471209&r1=471208&r2=471209
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationProtocolHandler.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationProtocolHandler.java
Sat Nov  4 07:00:37 2006
@@ -27,9 +27,6 @@
 import org.apache.mina.common.IdleStatus;
 import org.apache.mina.common.IoHandler;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.filter.LoggingFilter;
-import org.apache.mina.filter.codec.ProtocolCodecFactory;
-import org.apache.mina.filter.codec.ProtocolCodecFilter;
 
 public class ReplicationProtocolHandler implements IoHandler
 {
@@ -39,22 +36,19 @@
     private final ReplicationConfiguration configuration;
     private final DirectoryServiceConfiguration serviceCfg;
     private final ReplicationContextHandler contextHandler;
-    private final ProtocolCodecFactory codecFactory;
+
 
     public ReplicationProtocolHandler(
             ReplicationService service,
-            ReplicationContextHandler contextHandler,
-            ProtocolCodecFactory codecFactory )
+            ReplicationContextHandler contextHandler )
     {
         assert service != null;
         assert contextHandler != null;
-        assert codecFactory != null;
 
         this.service = service;
         this.configuration = service.getConfiguration();
         this.serviceCfg = service.getFactoryConfiguration();
         this.contextHandler = contextHandler;
-        this.codecFactory = codecFactory;
     }
     
     private ReplicationContext getContext( IoSession session )
@@ -65,10 +59,6 @@
     public void sessionCreated( IoSession session ) throws Exception
     {
         session.setAttribute( CONTEXT, new SimpleReplicationContext( service, serviceCfg,
configuration, session ) );
-        session.getFilterChain().addLast(
-                "codec", new ProtocolCodecFilter( codecFactory ) );
-        session.getFilterChain().addLast(
-                "log", new LoggingFilter() );
     }
 
     public void exceptionCaught( IoSession session, Throwable cause ) throws Exception

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerProtocolHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerProtocolHandler.java?view=diff&rev=471209&r1=471208&r2=471209
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerProtocolHandler.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerProtocolHandler.java
Sat Nov  4 07:00:37 2006
@@ -20,13 +20,12 @@
 package org.apache.directory.mitosis.service.protocol.handler;
 
 import org.apache.directory.mitosis.service.ReplicationService;
-import org.apache.directory.mitosis.service.protocol.codec.ReplicationClientProtocolCodecFactory;
 
 public class ReplicationServerProtocolHandler extends
         ReplicationProtocolHandler
 {
     public ReplicationServerProtocolHandler( ReplicationService service )
     {
-        super( service, new ReplicationClientContextHandler(), new ReplicationClientProtocolCodecFactory()
);
+        super( service, new ReplicationServerContextHandler() );
     }
 }



Mime
View raw message