2 * Copyright (c) 2015 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
8 package org.opendaylight.mdsal.dom.api;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.opendaylight.yangtools.concepts.Registration;
16 * A {@link DOMService} which allows registration of RPC implementations with a conceptual router. The client
17 * counterpart of this service is {@link DOMRpcService}.
19 public interface DOMRpcProviderService extends DOMService<DOMRpcProviderService, DOMRpcProviderService.Extension> {
21 * Marker interface for an extension to {@link DOMRpcProviderService}.
23 interface Extension extends DOMService.Extension<DOMRpcProviderService, Extension> {
28 * Register an {@link DOMRpcImplementation} object with this service.
30 * @param implementation RPC implementation, must not be null
31 * @param rpcs Array of supported RPC identifiers. Must not be null, empty, or contain a null element.
32 * Each identifier is added exactly once, no matter how many times it occurs.
33 * @return A {@link Registration} object, guaranteed to be non-null.
34 * @throws NullPointerException if implementation or types is null
35 * @throws IllegalArgumentException if types is empty or contains a null element.
37 default @NonNull Registration registerRpcImplementation(final @NonNull DOMRpcImplementation implementation,
38 final @NonNull DOMRpcIdentifier... rpcs) {
39 return registerRpcImplementation(implementation, Set.of(rpcs));
43 * Register an {@link DOMRpcImplementation} object with this service.
45 * @param implementation RPC implementation, must not be null
46 * @param rpcs Set of supported RPC identifiers. Must not be null, empty, or contain a null element.
47 * @return A {@link Registration} object, guaranteed to be non-null.
48 * @throws NullPointerException if implementation or types is null
49 * @throws IllegalArgumentException if types is empty or contains a null element.
51 // FIXME: just Registration and forward to Map
52 @NonNull Registration registerRpcImplementation(@NonNull DOMRpcImplementation implementation,
53 @NonNull Set<DOMRpcIdentifier> rpcs);
56 * Register a set of {@link DOMRpcImplementation}s with this service. The registration is performed atomically.
58 * @param map Map of RPC identifiers and their corresponding implementations
59 * @return A registration object, guaranteed to be non-null
60 * @throws NullPointerException if map is null or contains a null element
61 * @throws IllegalArgumentException if map is empty.
63 @NonNull Registration registerRpcImplementations(Map<DOMRpcIdentifier, DOMRpcImplementation> map);