Add DOMRpcProviderService bulk registration
[mdsal.git] / dom / mdsal-dom-api / src / main / java / org / opendaylight / mdsal / dom / api / DOMRpcProviderService.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 java.util.Map;
11 import java.util.Set;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.concepts.Registration;
14
15 /**
16  * A {@link DOMService} which allows registration of RPC implementations with a conceptual router. The client
17  * counterpart of this service is {@link DOMRpcService}.
18  */
19 public interface DOMRpcProviderService extends DOMService {
20     /**
21      * Register an {@link DOMRpcImplementation} object with this service.
22      *
23      * @param implementation RPC implementation, must not be null
24      * @param rpcs Array of supported RPC identifiers. Must not be null, empty, or contain a null element.
25      *             Each identifier is added exactly once, no matter how many times it occurs.
26      * @return A {@link DOMRpcImplementationRegistration} object, guaranteed to be non-null.
27      * @throws NullPointerException if implementation or types is null
28      * @throws IllegalArgumentException if types is empty or contains a null element.
29      */
30     @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T>
31         registerRpcImplementation(@NonNull T implementation, @NonNull DOMRpcIdentifier... rpcs);
32
33     /**
34      * Register an {@link DOMRpcImplementation} object with this service.
35      *
36      * @param implementation RPC implementation, must not be null
37      * @param rpcs Set of supported RPC identifiers. Must not be null, empty, or contain a null element.
38      * @return A {@link DOMRpcImplementationRegistration} object, guaranteed to be non-null.
39      * @throws NullPointerException if implementation or types is null
40      * @throws IllegalArgumentException if types is empty or contains a null element.
41      */
42     @NonNull <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T>
43         registerRpcImplementation(@NonNull T implementation, @NonNull Set<DOMRpcIdentifier> rpcs);
44
45     /**
46      * Register a set of {@link DOMRpcImplementation}s with this service. The registration is performed atomically.
47      *
48      * @param map Map of RPC identifiers and their corresponding implementations
49      * @return A registration object, guaranteed to be non-null
50      * @throws NullPointerException if map is null or contains a null element
51      * @throws IllegalArgumentException if map is empty.
52      */
53     @NonNull Registration registerRpcImplementations(Map<DOMRpcIdentifier, DOMRpcImplementation> map);
54 }