2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.netconf.server.api.operations;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.netconf.api.DocumentedException;
13 import org.w3c.dom.Document;
16 * NetconfOperation handles netconf requests. Multiple operations might be
17 * capable of handling one request at the same time. In such case, these
18 * operations are chained (ordered by HandlingPriority returned by canHandle
19 * method) and executed.
22 * Operation can be declared as singleton or last in chain (see abstract
23 * implementations in netconf-util). If the operation is not singleton or last,
24 * it is responsible for the execution of subsequent operation and for merging
27 public interface NetconfOperation {
29 * Singleton operations should return {@link HandlingPriority#HANDLE_WITH_MAX_PRIORITY}, last operations
30 * {@link HandlingPriority#HANDLE_WITH_DEFAULT_PRIORITY}.
32 * @param message request message
33 * @return A {@link HandlingPriority}, or {@code null} if the message is not handled
34 * @throws DocumentedException if the message is found to have structural errors
36 @Nullable HandlingPriority canHandle(Document message) throws DocumentedException;
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
45 * @param requestMessage request message
46 * @param subsequentOperation execution of subsequent netconf operation
47 * @return {@code document}
48 * @throws DocumentedException if operation fails
50 Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation)
51 throws DocumentedException;