c64e24c9c232d2aab54847713c7f5f1c7aa236dd
[controller.git] / opendaylight / md-sal / sal-binding-api / src / main / java / org / opendaylight / controller / sal / binding / api / RpcProviderRegistry.java
1 /*
2  * Copyright (c) 2014 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.controller.sal.binding.api;
9
10 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangePublisher;
11 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
13 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
14 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
15 import org.opendaylight.yangtools.yang.binding.RpcService;
16
17 /**
18  * Interface defining provider's access to the Rpc Registry which could be used
19  * to register their implementations of service to the MD-SAL.
20  *
21  * @author ttkacik
22  *
23  */
24 public interface RpcProviderRegistry extends //
25         RpcConsumerRegistry, //
26         RouteChangePublisher<RpcContextIdentifier, InstanceIdentifier<?>> {
27     /**
28      * Registers an global RpcService implementation.
29      *
30      * @param type
31      * @param implementation
32      * @return
33      */
34     <T extends RpcService> RpcRegistration<T> addRpcImplementation(Class<T> type, T implementation)
35             throws IllegalStateException;
36
37     /**
38      *
39      * Register an Routed RpcService where routing is determined on annotated
40      * (in YANG model) context-reference and value of annotated leaf.
41      *
42      * @param type
43      *            Type of RpcService, use generated interface class, not your
44      *            implementation clas
45      * @param implementation
46      *            Implementation of RpcService
47      * @return Registration object for routed Rpc which could be used to close
48      *         an
49      *
50      * @throws IllegalStateException
51      */
52     <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(Class<T> type, T implementation)
53             throws IllegalStateException;
54 }