Merge "Bug 1029: Remove dead code: sal-schema-repository-api"
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / NetconfServerDispatcher.java
index bd39049c562fe8300fcccb053ec168adc02ad6f5..de3dee14437b804fd18819bb20302a962fd213e2 100644 (file)
@@ -12,11 +12,9 @@ import io.netty.channel.ChannelFuture;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.Promise;
-
 import java.net.InetSocketAddress;
-
 import org.opendaylight.controller.netconf.impl.util.DeserializerExceptionHandler;
-import org.opendaylight.controller.netconf.util.AbstractChannelInitializer;
+import org.opendaylight.controller.netconf.nettyutil.AbstractChannelInitializer;
 import org.opendaylight.protocol.framework.AbstractDispatcher;
 
 public class NetconfServerDispatcher extends AbstractDispatcher<NetconfServerSession, NetconfServerSessionListener> {
@@ -41,19 +39,26 @@ public class NetconfServerDispatcher extends AbstractDispatcher<NetconfServerSes
 
     public static class ServerChannelInitializer extends AbstractChannelInitializer<NetconfServerSession> {
 
+        public static final String DESERIALIZER_EX_HANDLER_KEY = "deserializerExHandler";
+
         private final NetconfServerSessionNegotiatorFactory negotiatorFactory;
-        private final NetconfServerSessionListenerFactory listenerFactory;
 
-        public ServerChannelInitializer(NetconfServerSessionNegotiatorFactory negotiatorFactory,
-                                            NetconfServerSessionListenerFactory listenerFactory) {
+
+        public ServerChannelInitializer(NetconfServerSessionNegotiatorFactory negotiatorFactory) {
             this.negotiatorFactory = negotiatorFactory;
-            this.listenerFactory = listenerFactory;
+
+        }
+
+        @Override
+        protected void initializeMessageDecoder(SocketChannel ch) {
+            super.initializeMessageDecoder(ch);
+            ch.pipeline().addLast(DESERIALIZER_EX_HANDLER_KEY, new DeserializerExceptionHandler());
         }
 
         @Override
-        protected void initializeAfterDecoder(SocketChannel ch, Promise<NetconfServerSession> promise) {
-            ch.pipeline().addLast("deserializerExHandler", new DeserializerExceptionHandler());
-            ch.pipeline().addLast("negotiator", negotiatorFactory.getSessionNegotiator(listenerFactory, ch, promise));
+        protected void initializeSessionNegotiator(SocketChannel ch, Promise<NetconfServerSession> promise) {
+            ch.pipeline().addAfter(DESERIALIZER_EX_HANDLER_KEY, AbstractChannelInitializer.NETCONF_SESSION_NEGOTIATOR,
+                    negotiatorFactory.getSessionNegotiator(null, ch, promise));
         }
     }