Fix checkstyle warnings in netconf-impl.
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / mapping / operations / DefaultStopExi.java
index 836f826912b2793e7b9c19678717372367f5ed13..2b90a6150552e9306f3a137c6fe7056b2e422b3d 100644 (file)
@@ -8,10 +8,11 @@
 package org.opendaylight.controller.netconf.impl.mapping.operations;
 
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
-import org.opendaylight.controller.netconf.api.NetconfSession;
-import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;
+import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.impl.NetconfServerSession;
 import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
@@ -20,43 +21,38 @@ import org.w3c.dom.Element;
 public class DefaultStopExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {
 
     public static final String STOP_EXI = "stop-exi";
-    private NetconfSession netconfSession;
+    private NetconfServerSession netconfSession;
 
-    private static final Logger logger = LoggerFactory
-            .getLogger(DefaultStartExi.class);
+    private static final Logger LOG = LoggerFactory
+            .getLogger(DefaultStopExi.class);
 
     public DefaultStopExi(String netconfSessionIdForReporting) {
         super(netconfSessionIdForReporting);
     }
 
+    @Override
+    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {
+        LOG.debug("Received stop-exi message {} ", XmlUtil.toString(operationElement));
+
+        netconfSession.stopExiCommunication();
+
+        Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);
+        LOG.trace("{} operation successful", STOP_EXI);
+        return getSchemaResult;
+    }
+
     @Override
     protected String getOperationName() {
         return STOP_EXI;
     }
 
     @Override
-    protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement)
-            throws NetconfDocumentedException {
-        throw new UnsupportedOperationException("Not implemented");
-        /*
-        netconfSession.remove(ExiDecoderHandler.class);
-        netconfSession.removeAfterMessageSent(ExiEncoderHandler.HANDLER_NAME);
-
-        Element getSchemaResult = document.createElement(XmlNetconfConstants.OK);
-        XmlUtil.addNamespaceAttr(getSchemaResult,
-                XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
-        logger.trace("{} operation successful", STOP_EXI);
-        logger.debug("received stop-exi message {} ", XmlUtil.toString(document));
-        return getSchemaResult;
-        */
+    protected String getOperationNamespace() {
+        return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;
     }
 
     @Override
-    public void setNetconfSession(NetconfSession s) {
+    public void setNetconfSession(NetconfServerSession s) {
         this.netconfSession = s;
     }
-
-    public NetconfSession getNetconfSession() {
-        return netconfSession;
-    }
 }