Decouple config and netconf subsystems.
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / mapping / AbstractNetconfOperation.java
index b7ebc51b70712a5ebabc322018c5707636113d13..707274ed4a1522235c2004c5adca7c4bf9d4e731 100644 (file)
@@ -10,13 +10,14 @@ package org.opendaylight.controller.netconf.util.mapping;
 
 import com.google.common.base.Optional;
 import java.util.Map;
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
+import org.opendaylight.controller.config.util.xml.XmlElement;
+import org.opendaylight.controller.config.util.xml.XmlMappingConstants;
+import org.opendaylight.controller.config.util.xml.XmlUtil;
 import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperation;
 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution;
-import org.opendaylight.controller.netconf.util.xml.XmlElement;
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -34,7 +35,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
     }
 
     @Override
-    public HandlingPriority canHandle(final Document message) throws NetconfDocumentedException {
+    public HandlingPriority canHandle(final Document message) throws DocumentedException {
         OperationNameAndNamespace operationNameAndNamespace = null;
         operationNameAndNamespace = new OperationNameAndNamespace(message);
         return canHandle(operationNameAndNamespace.getOperationName(), operationNameAndNamespace.getNamespace());
@@ -44,7 +45,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
         private final String operationName, namespace;
         private final XmlElement operationElement;
 
-        public OperationNameAndNamespace(final Document message) throws NetconfDocumentedException {
+        public OperationNameAndNamespace(final Document message) throws DocumentedException {
             XmlElement requestElement = null;
             requestElement = getRequestElementWithCheck(message);
             operationElement = requestElement.getOnlyChildElement();
@@ -65,7 +66,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
         }
     }
 
-    protected static XmlElement getRequestElementWithCheck(final Document message) throws NetconfDocumentedException {
+    protected static XmlElement getRequestElementWithCheck(final Document message) throws DocumentedException {
         return XmlElement.fromDomElementWithExpected(message.getDocumentElement(), XmlNetconfConstants.RPC_KEY,
                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
     }
@@ -88,7 +89,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
 
     @Override
     public Document handle(final Document requestMessage,
-            final NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {
+            final NetconfOperationChainedExecution subsequentOperation) throws DocumentedException {
 
         XmlElement requestElement = getRequestElementWithCheck(requestMessage);
 
@@ -98,7 +99,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
         Map<String, Attr> attributes = requestElement.getAttributes();
 
         Element response = handle(document, operationElement, subsequentOperation);
-        Element rpcReply = XmlUtil.createElement(document, XmlNetconfConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
+        Element rpcReply = XmlUtil.createElement(document, XmlMappingConstants.RPC_REPLY_KEY, Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0));
 
         if(XmlElement.fromDomElement(response).hasNamespace()) {
             rpcReply.appendChild(response);
@@ -119,7 +120,7 @@ public abstract class AbstractNetconfOperation implements NetconfOperation {
     }
 
     protected abstract Element handle(Document document, XmlElement message, NetconfOperationChainedExecution subsequentOperation)
-            throws NetconfDocumentedException;
+            throws DocumentedException;
 
     @Override
     public String toString() {