X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2FNetconfServerDispatcher.java;h=4dfb7498184af4e7a71f7c40744821e258e00966;hb=48814d6a264b8f13e5db1422336d9ef25cb05fa9;hp=ee9009762e8cda9d3f2ac8896f2df8bced568f83;hpb=082d7ba433b85d5810c50f624d2691088336e66a;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java index ee9009762e..4dfb749818 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerDispatcher.java @@ -8,15 +8,18 @@ package org.opendaylight.controller.netconf.impl; +import com.google.common.annotations.VisibleForTesting; +import io.netty.channel.Channel; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; +import io.netty.channel.local.LocalAddress; +import io.netty.channel.local.LocalChannel; +import io.netty.channel.local.LocalServerChannel; 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 { @@ -29,6 +32,7 @@ public class NetconfServerDispatcher extends AbstractDispatcher() { @@ -39,29 +43,37 @@ public class NetconfServerDispatcher extends AbstractDispatcher() { + @Override + public void initializeChannel(final LocalChannel ch, final Promise promise) { + initializer.initialize(ch, promise); + } + }); + } + public static class ServerChannelInitializer extends AbstractChannelInitializer { 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) { + protected void initializeMessageDecoder(Channel ch) { super.initializeMessageDecoder(ch); ch.pipeline().addLast(DESERIALIZER_EX_HANDLER_KEY, new DeserializerExceptionHandler()); } @Override - protected void initializeSessionNegotiator(SocketChannel ch, Promise promise) { - ch.pipeline().addAfter(DESERIALIZER_EX_HANDLER_KEY, AbstractChannelInitializer.NETCONF_SESSION_NEGOTIATOR, negotiatorFactory.getSessionNegotiator(listenerFactory, ch, promise)); + protected void initializeSessionNegotiator(Channel ch, Promise promise) { + ch.pipeline().addAfter(DESERIALIZER_EX_HANDLER_KEY, AbstractChannelInitializer.NETCONF_SESSION_NEGOTIATOR, + negotiatorFactory.getSessionNegotiator(null, ch, promise)); } } - }