Merge "Resolve Bug:717 - Remove fragment version requirement from config-persister-*"
[controller.git] / opendaylight / netconf / config-netconf-connector / src / main / java / org / opendaylight / controller / netconf / confignetconfconnector / operations / Validate.java
index 017b5e6c39a3f1dfa0865ca07b5e75a71e67183a..642c4456a8cc79dea6b884dc84c575d4af6bd664 100644 (file)
@@ -8,7 +8,9 @@
 
 package org.opendaylight.controller.netconf.confignetconfconnector.operations;
 
-import com.google.common.base.Preconditions;
+import java.util.HashMap;
+import java.util.Map;
+
 import org.opendaylight.controller.config.api.ValidationException;
 import org.opendaylight.controller.config.util.ConfigRegistryClient;
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
@@ -18,13 +20,14 @@ import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorT
 import org.opendaylight.controller.netconf.confignetconfconnector.transactions.TransactionProvider;
 import org.opendaylight.controller.netconf.util.xml.XmlElement;
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;
+import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
-import java.util.HashMap;
-import java.util.Map;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
 
 public class Validate extends AbstractConfigNetconfOperation {
 
@@ -62,7 +65,7 @@ public class Validate extends AbstractConfigNetconfOperation {
     }
 
     @Override
-    protected Element handle(Document document, XmlElement xml) throws NetconfDocumentedException {
+    protected Element handleWithNoSubsequentOperations(Document document, XmlElement xml) throws NetconfDocumentedException {
         try {
             checkXml(xml);
         } catch (IllegalStateException e) {
@@ -99,6 +102,6 @@ public class Validate extends AbstractConfigNetconfOperation {
 
         logger.trace("Datastore {} validated successfully", Datastore.candidate);
 
-        return document.createElement(XmlNetconfConstants.OK);
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.<String>absent());
     }
 }