Deprecate RpcService
[mdsal.git] / binding / mdsal-binding-api / src / main / java / org / opendaylight / mdsal / binding / api / RpcProviderService.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.binding.api;
9
10 import com.google.common.collect.ClassToInstanceMap;
11 import java.util.Set;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.concepts.ObjectRegistration;
14 import org.opendaylight.yangtools.concepts.Registration;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.binding.Rpc;
17 import org.opendaylight.yangtools.yang.binding.RpcService;
18
19 /**
20  * Provides ability to registered Remote Procedure Call (RPC) service implementations. The RPCs are defined in YANG
21  * models.
22  */
23 public interface RpcProviderService extends BindingService {
24     /**
25      * Register RPCs combined in a {@link RpcService} interface.
26      *
27      * @param <R> {@link RpcService} type
28      * @param <I> {@link RpcService} implementation type
29      * @param type {@link RpcService} class
30      * @param implementation implementation object
31      * @return An {@link ObjectRegistration} controlling unregistration
32      * @throws NullPointerException if any argument is {@code null}
33      * @deprecated Use {@link #registerRpcImplementation(Rpc)} or
34      *             {@link #registerRpcImplementations(ClassToInstanceMap)} instead.
35      */
36     @Deprecated(since = "11.0.0", forRemoval = true)
37     <R extends RpcService, I extends R> @NonNull ObjectRegistration<I> registerRpcImplementation(Class<R> type,
38         I implementation);
39
40     /**
41      * Register RPCs combined in a {@link RpcService} interface on a set of datastore context paths.
42      *
43      * @param <R> {@link RpcService} type
44      * @param <I> {@link RpcService} implementation type
45      * @param type {@link RpcService} class
46      * @param implementation implementation object
47      * @param paths Datastore paths to service
48      * @return An {@link ObjectRegistration} controlling unregistration
49      * @throws NullPointerException if any argument is {@code null}
50      * @deprecated Use {@link #registerRpcImplementation(Rpc, Set)} or
51      *             {@link #registerRpcImplementations(ClassToInstanceMap, Set)} instead.
52      */
53     @Deprecated(since = "11.0.0", forRemoval = true)
54     <R extends RpcService, I extends R> @NonNull ObjectRegistration<I> registerRpcImplementation(Class<R> type,
55         I implementation, Set<InstanceIdentifier<?>> paths);
56
57     /**
58      * Register an {@link Rpc} implementation.
59      *
60      * @param implementation implementation object
61      * @return A {@link Registration} controlling unregistration
62      * @throws NullPointerException if {@code implementation} is {@code null}
63      */
64     @NonNull Registration registerRpcImplementation(Rpc<?, ?> implementation);
65
66     /**
67      * Register an {@link Rpc} implementation on a set of datastore context paths.
68      *
69      * @param implementation implementation object
70      * @param paths Datastore paths to service
71      * @return A {@link Registration} controlling unregistration
72      * @throws NullPointerException if any argument is {@code null}
73      */
74     @NonNull Registration registerRpcImplementation(Rpc<?, ?> implementation, Set<InstanceIdentifier<?>> paths);
75
76     /**
77      * Register a set of {@link Rpc} implementations. Note that this method does not support registering multiple
78      * implementations of the same {@link Rpc} and hence we require specifying them through a
79      * {@link ClassToInstanceMap}.
80      *
81      * @param implementations implementation objects
82      * @return A {@link Registration} controlling unregistration
83      * @throws NullPointerException if {@code implementations} is {@code null}
84      */
85     @NonNull Registration registerRpcImplementations(ClassToInstanceMap<Rpc<?, ?>> implementations);
86
87     /**
88      * Register a set of {@link Rpc} implementations on a set of datastore context paths. Note that this method does not
89      * support registering multiple implementations of the same {@link Rpc} and hence we require specifying them through
90      * a {@link ClassToInstanceMap}.
91      *
92      * @param implementations implementation objects
93      * @return A {@link Registration} controlling unregistration
94      * @throws NullPointerException if any argument is {@code null}
95      */
96     @NonNull Registration registerRpcImplementations(ClassToInstanceMap<Rpc<?, ?>> implementations,
97         Set<InstanceIdentifier<?>> paths);
98 }