Remove unused exceptions
[netconf.git] / netconf / tools / netconf-testtool / src / main / java / org / opendaylight / netconf / test / tool / rpc / SimulatedGetConfig.java
index e6db368b928cde01f861a58410c34bd9f71797a6..4c2a8592a9946111412974fc325b484fc2a7f31d 100644 (file)
@@ -11,20 +11,18 @@ package org.opendaylight.netconf.test.tool.rpc;
 import com.google.common.base.Optional;
 import java.io.File;
 import java.io.IOException;
-import java.util.Collections;
 import java.util.List;
-import org.opendaylight.controller.config.util.xml.DocumentedException;
-import org.opendaylight.controller.config.util.xml.XmlElement;
-import org.opendaylight.controller.config.util.xml.XmlUtil;
+import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
-import org.opendaylight.netconf.confignetconfconnector.operations.AbstractConfigNetconfOperation;
+import org.opendaylight.netconf.api.xml.XmlUtil;
+import org.opendaylight.netconf.util.mapping.AbstractLastNetconfOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
-public class SimulatedGetConfig extends AbstractConfigNetconfOperation {
+public class SimulatedGetConfig extends AbstractLastNetconfOperation {
 
     private final DataList storage;
     private static final Logger LOG = LoggerFactory
@@ -32,7 +30,7 @@ public class SimulatedGetConfig extends AbstractConfigNetconfOperation {
 
     public SimulatedGetConfig(final String netconfSessionIdForReporting, final DataList storage,
                               final Optional<File> initialConfigXMLFile) {
-        super(null, netconfSessionIdForReporting);
+        super(netconfSessionIdForReporting);
 
         if (initialConfigXMLFile.isPresent()) {
             LOG.info("File is present: {}", initialConfigXMLFile.get()
@@ -43,14 +41,13 @@ public class SimulatedGetConfig extends AbstractConfigNetconfOperation {
         }
     }
 
-    private DataList loadInitialConfigXMLFile(final File file) {
+    private static DataList loadInitialConfigXMLFile(final File file) {
         LOG.info("Loading initial config xml file: {}", file.getName());
         DataList configData = new DataList();
-        List<XmlElement> xmlElementList = Collections.emptyList();
         try {
             Element element = XmlUtil.readXmlToElement(file);
             XmlElement xmlElement = XmlElement.fromDomElement(element);
-            xmlElementList = xmlElement.getChildElements();
+            List<XmlElement> xmlElementList = xmlElement.getChildElements();
             configData.setConfigList(xmlElementList);
         } catch (IOException e) {
             LOG.info("IO exception loading xml file: {} ", e.getMessage());
@@ -62,8 +59,7 @@ public class SimulatedGetConfig extends AbstractConfigNetconfOperation {
     }
 
     @Override
-    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement)
-            throws DocumentedException {
+    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
         final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
 
         for (final XmlElement e : storage.getConfigList()) {