Update RPC invocation to take ContainerNode
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMRpcImplementation.java
1 /*
2  * Copyright (c) 2015 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 package org.opendaylight.mdsal.dom.api;
9
10 import com.google.common.util.concurrent.ListenableFuture;
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
13
14 /**
15  * Interface implemented by an individual RPC implementation. This API allows for dispatch
16  * implementations, e.g. an individual object handling a multitude of RPCs.
17  */
18 public interface DOMRpcImplementation {
19     /**
20      * Initiate invocation of the RPC. Implementations of this method are
21      * expected to not block on external resources.
22      *
23      * @param rpc RPC identifier which was invoked
24      * @param input Input arguments, null if the RPC does not take any.
25      * @return A {@link ListenableFuture} which will return either a result structure,
26      *         or report a subclass of {@link DOMRpcException} reporting a transport
27      *         error.
28      * @throws NullPointerException if any argument is null
29      */
30     @NonNull ListenableFuture<? extends DOMRpcResult> invokeRpc(@NonNull DOMRpcIdentifier rpc,
31             @NonNull ContainerNode input);
32
33     /**
34      * Return the relative invocation cost of this implementation. Default implementation return 0.
35      *
36      * @return Non-negative cost of invoking this implementation.
37      */
38     default long invocationCost() {
39         return 0;
40     }
41 }