Merge "Statistics-Manager - Performance Improvement 1) Introduced statistics request...
[controller.git] / opendaylight / netconf / netconf-client / src / main / java / org / opendaylight / controller / netconf / client / NetconfClientSession.java
index 2d07dd58332ea6bd8b5c030a6408be876aae0278..f4efb1fc7dc9bf56cd3176c769f72c312ee351d2 100644 (file)
@@ -8,14 +8,19 @@
 
 package org.opendaylight.controller.netconf.client;
 
-import io.netty.channel.Channel;
-
 import java.util.Collection;
 
-import org.opendaylight.controller.netconf.api.AbstractNetconfSession;
+import org.opendaylight.controller.netconf.util.AbstractNetconfSession;
+import org.opendaylight.controller.netconf.util.handler.NetconfEXICodec;
+import org.opendaylight.controller.netconf.util.handler.NetconfEXIToMessageDecoder;
+import org.opendaylight.controller.netconf.util.handler.NetconfMessageToEXIEncoder;
+import org.opendaylight.controller.netconf.util.handler.NetconfMessageToXMLEncoder;
+import org.opendaylight.controller.netconf.util.handler.NetconfXMLToMessageDecoder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import io.netty.channel.Channel;
+
 public final class NetconfClientSession extends AbstractNetconfSession<NetconfClientSession, NetconfClientSessionListener> {
 
     private static final Logger logger = LoggerFactory.getLogger(NetconfClientSession.class);
@@ -23,7 +28,7 @@ public final class NetconfClientSession extends AbstractNetconfSession<NetconfCl
 
     public NetconfClientSession(NetconfClientSessionListener sessionListener, Channel channel, long sessionId,
             Collection<String> capabilities) {
-        super(sessionListener,channel,sessionId);
+        super(sessionListener, channel, sessionId);
         this.capabilities = capabilities;
         logger.debug("Client Session {} created", toString());
     }
@@ -36,4 +41,18 @@ public final class NetconfClientSession extends AbstractNetconfSession<NetconfCl
     protected NetconfClientSession thisInstance() {
         return this;
     }
+
+    @Override
+    protected void addExiHandlers(NetconfEXICodec exiCodec) {
+        // TODO used only in negotiator, client supports only auto start-exi
+        replaceMessageDecoder(new NetconfEXIToMessageDecoder(exiCodec));
+        replaceMessageEncoder(new NetconfMessageToEXIEncoder(exiCodec));
+    }
+
+    @Override
+    public void stopExiCommunication() {
+        // TODO never used, Netconf client does not support stop-exi
+        replaceMessageDecoder(new NetconfXMLToMessageDecoder());
+        replaceMessageEncoder(new NetconfMessageToXMLEncoder());
+    }
 }