b7a42eda1f51db83ad4f147676f0aa128a681dcc
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / spi / RpcRouter.java
1 /*
2  * Copyright (c) 2013 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.spi;
9
10 import org.opendaylight.yangtools.yang.binding.BaseIdentity;
11 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
12 import org.opendaylight.yangtools.yang.binding.RpcService;
13
14 /**
15  * RpcRouter is responsible for selecting RpcService based on provided routing
16  * context identifier {@link RpcRoutingTable#getContextIdentifier()} and path in
17  * overal data tree (@link {@link InstanceIdentifier}.
18  * 
19  * 
20  * @author Tony Tkacik <ttkacik@cisco.com>
21  * 
22  * @param <T>
23  *            Type of RpcService for which router provides routing information
24  *            and route selection.
25  */
26 public interface RpcRouter<T extends RpcService> {
27
28     /**
29      * Returns a type of RpcService which is served by this instance of router.
30      * 
31      * @return type of RpcService which is served by this instance of router.
32      */
33     Class<T> getRpcServiceType();
34
35     /**
36      * Returns a routing table for particular route context
37      * 
38      * @param routeContext
39      * @return Routing Table for particular route context.
40      */
41     <C extends BaseIdentity> RpcRoutingTable<C, T> getRoutingTable(Class<C> routeContext);
42
43     /**
44      * Returns an instance of RpcService which is responsible for processing
45      * particular path.
46      * 
47      * @param context
48      *            Rpc Routing Context
49      * @param path
50      *            Instance Identifier which is used as a selector of instance.
51      * @return instance of RpcService which is responsible for processing
52      *         particular path.
53      */
54     T getService(Class<? extends BaseIdentity> context, InstanceIdentifier<?> path);
55
56     /**
57      * Returns a default fallback instance of RpcService which is responsible
58      * for handling all unknown imports.
59      * 
60      * @return default instance responsible for processing RPCs.
61      */
62     T getDefaultService();
63     
64     /**
65      * 
66      */
67     void setDefaultService();
68
69 }