Revert "Update RPC invocation to take ContainerNode"
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMRpcService.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.concepts.ListenerRegistration;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
15
16 /**
17  * A {@link DOMService} which allows clients to invoke RPCs. The conceptual model of this service is that of a dynamic
18  * router, where the set of available RPC services can change dynamically. The service allows users to add a listener
19  * to track the process of RPCs becoming available.
20  */
21 // FIXME: once we have a DOMOperationService implementation, deprecate this interface
22 public interface DOMRpcService extends DOMService {
23     /**
24      * Initiate invocation of an RPC. This method is guaranteed to not block on any external
25      * resources.
26      *
27      * @param type SchemaPath of the RPC to be invoked
28      * @param input Input arguments, null if the RPC does not take any.
29      * @return A {@link ListenableFuture} which will return either a result structure, or report a subclass
30      *         of {@link DOMRpcException} reporting a transport error.
31      */
32     @NonNull ListenableFuture<? extends DOMRpcResult> invokeRpc(@NonNull SchemaPath type,
33             @NonNull NormalizedNode<?, ?> input);
34
35     /**
36      * Register a {@link DOMRpcAvailabilityListener} with this service to receive notifications
37      * about RPC implementations becoming (un)available. The listener will be invoked with the
38      * current implementations reported and will be kept uptodate as implementations come and go.
39      * Users should note that using a listener does not necessarily mean that
40      * {@link #invokeRpc(SchemaPath, NormalizedNode)} will not report a failure due to
41      * {@link DOMRpcImplementationNotAvailableException} and need to be ready to handle it.
42      * Implementations are encouraged to take reasonable precautions to prevent this scenario from
43      * occurring.
44      *
45      * @param listener {@link DOMRpcAvailabilityListener} instance to register
46      * @return A {@link ListenerRegistration} representing this registration. Performing a
47      *         {@link ListenerRegistration#close()} will cancel it. Returned object is guaranteed to be non-null.
48      */
49     @NonNull <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@NonNull T listener);
50 }