Get rid of using ProtocolHandlerFactory, part 2 86/5186/2
authorRobert Varga <rovarga@cisco.com>
Fri, 7 Feb 2014 21:08:39 +0000 (22:08 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 10 Feb 2014 13:08:05 +0000 (13:08 +0000)
Now that we do not rely on passing it around, we can safely keep
NetconfHandlerFactory wired directly to the
ProtocolMessageEncoder/Decoder.

Change-Id: I47a9b76f8d9bbb98304e06960e5a85d2730994f7
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/AbstractChannelInitializer.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfHandlerFactory.java

index aeee2fb04baea1c4bd1535d7b677fb1f50957d8e..52c59a2b31dd15b4711b9cc9bab14d4634f5bde3 100644 (file)
@@ -10,17 +10,17 @@ package org.opendaylight.controller.netconf.util;
 
 import io.netty.channel.socket.SocketChannel;
 import io.netty.util.concurrent.Promise;
+
 import org.opendaylight.controller.netconf.api.NetconfSession;
 import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerFactory;
 import org.opendaylight.controller.netconf.util.handler.NetconfHandlerFactory;
 import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator;
 import org.opendaylight.controller.netconf.util.messages.FramingMechanism;
-import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
 
 public abstract class AbstractChannelInitializer {
 
     public void initialize(SocketChannel ch, Promise<? extends NetconfSession> promise){
-        NetconfHandlerFactory handlerFactory = new NetconfHandlerFactory(new NetconfMessageFactory());
+        NetconfHandlerFactory handlerFactory = new NetconfHandlerFactory();
         ch.pipeline().addLast("aggregator", new NetconfMessageAggregator(FramingMechanism.EOM));
         ch.pipeline().addLast(handlerFactory.getDecoders());
         initializeAfterDecoder(ch, promise);
index d878c5e81911674763a174712c27328fcf971276..009e5762bc4daf3bebbdd069e57e68b28e4b5319 100644 (file)
@@ -8,24 +8,18 @@
 package org.opendaylight.controller.netconf.util.handler;
 
 import io.netty.channel.ChannelHandler;
-import org.opendaylight.controller.netconf.api.NetconfMessage;
+
 import org.opendaylight.controller.netconf.util.messages.NetconfMessageFactory;
-import org.opendaylight.protocol.framework.ProtocolHandlerFactory;
 import org.opendaylight.protocol.framework.ProtocolMessageDecoder;
 import org.opendaylight.protocol.framework.ProtocolMessageEncoder;
 
-public class NetconfHandlerFactory extends ProtocolHandlerFactory<NetconfMessage> {
-
-    public NetconfHandlerFactory(final NetconfMessageFactory msgFactory) {
-        super(msgFactory);
-    }
+public class NetconfHandlerFactory {
+    private final NetconfMessageFactory msgFactory = new NetconfMessageFactory();
 
-    @Override
     public ChannelHandler[] getEncoders() {
         return new ChannelHandler[] { new ProtocolMessageEncoder(this.msgFactory) };
     }
 
-    @Override
     public ChannelHandler[] getDecoders() {
         return new ChannelHandler[] { new ProtocolMessageDecoder(this.msgFactory) };
     }