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