Merge "Fixed typo in SnapshotBackedWriteTransaction class"
[controller.git] / opendaylight / netconf / netconf-mapping-api / src / main / java / org / opendaylight / controller / netconf / mapping / api / NetconfOperation.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.controller.netconf.mapping.api;
10
11 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
12 import org.w3c.dom.Document;
13
14 /**
15  * NetconfOperation handles netconf requests. Multiple operations might be
16  * capable of handling one request at the same time. In such case, these
17  * operations are chained (ordered by HandlingPriority returned by canHandle
18  * method) and executed.
19  *
20  * Operation can be declared as singleton or last in chain (see abstract
21  * implementations in netconf-util). If the operation is not singleton or last,
22  * it is responsible for the execution of subsequent operation and for merging
23  * the results.
24  *
25  */
26 public interface NetconfOperation {
27
28     /**
29      * Singleton operations should return
30      * HandlingPriority.HANDLE_WITH_MAX_PRIORITY, last operations
31      * HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.
32      *
33      * @param requestMessage
34      * @return
35      */
36     HandlingPriority canHandle(Document message) throws NetconfDocumentedException;
37
38     /**
39      * Execute current netconf operation and trigger execution of subsequent
40      * operations. subsequentOperation parameter will provide information, if
41      * current operation is the termination point in execution. In case of
42      * last/singleton operation, subsequentOperation must indicate termination
43      * point.
44      *
45      * @param requestMessage
46      * @param subsequentOperation
47      *            execution of subsequent netconf operation
48      * @return
49      * @throws NetconfDocumentedException
50      */
51     Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation)
52             throws NetconfDocumentedException;
53 }