Decouple config and netconf subsystems.
[controller.git] / opendaylight / netconf / netconf-mapping-api / src / main / java / org / opendaylight / controller / netconf / mapping / api / NetconfOperation.java
index 58857b4438fef15e208f397b9e61167230867b70..00b3124e7f19076b96ddadae22c0599228c75783 100644 (file)
@@ -8,13 +8,46 @@
 
 package org.opendaylight.controller.netconf.mapping.api;
 
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
-import org.opendaylight.controller.netconf.api.NetconfOperationRouter;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.w3c.dom.Document;
 
+/**
+ * NetconfOperation handles netconf requests. Multiple operations might be
+ * capable of handling one request at the same time. In such case, these
+ * operations are chained (ordered by HandlingPriority returned by canHandle
+ * method) and executed.
+ *
+ * Operation can be declared as singleton or last in chain (see abstract
+ * implementations in netconf-util). If the operation is not singleton or last,
+ * it is responsible for the execution of subsequent operation and for merging
+ * the results.
+ *
+ */
 public interface NetconfOperation {
 
-    HandlingPriority canHandle(Document message);
+    /**
+     * Singleton operations should return
+     * HandlingPriority.HANDLE_WITH_MAX_PRIORITY, last operations
+     * HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.
+     *
+     * @param requestMessage
+     * @return
+     */
+    HandlingPriority canHandle(Document message) throws DocumentedException;
 
-    Document handle(Document message, NetconfOperationRouter operationRouter) throws NetconfDocumentedException;
+    /**
+     * Execute current netconf operation and trigger execution of subsequent
+     * operations. subsequentOperation parameter will provide information, if
+     * current operation is the termination point in execution. In case of
+     * last/singleton operation, subsequentOperation must indicate termination
+     * point.
+     *
+     * @param requestMessage
+     * @param subsequentOperation
+     *            execution of subsequent netconf operation
+     * @return
+     * @throws DocumentedException
+     */
+    Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation)
+            throws DocumentedException;
 }