MD-SAL StatisticsManager - Minor modification in the group and meter rpc/notifications
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / codegen / RuntimeCodeGenerator.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.codegen;
9
10 import org.opendaylight.controller.sal.binding.spi.DelegateProxy;
11 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory;
12 import org.opendaylight.controller.sal.binding.spi.RpcRouter;
13 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
14 import org.opendaylight.yangtools.yang.binding.RpcImplementation;
15 import org.opendaylight.yangtools.yang.binding.RpcService;
16 import org.opendaylight.yangtools.yang.binding.annotations.RoutingContext;
17
18 public interface RuntimeCodeGenerator {
19
20     /**
21      * Returns an instance of provided RpcService type which delegates all calls
22      * to the delegate.
23      * 
24      * <p>
25      * Returned instance:
26      * <ul>
27      * <li>implements provided subclass of RpcService type and
28      * {@link DelegateProxy} interface.
29      * <li>
30      * <p>
31      * delegates all invocations of methods, which are defined in RpcService
32      * subtype to delegate which is defined by
33      * {@link DelegateProxy#setDelegate(Object)}.
34      * <p>
35      * If delegate is not defined (<code>getDelegate() == null</code>)
36      * implementation throws {@link IllegalStateException}
37      * <li>{@link DelegateProxy#getDelegate()} - returns the delegate to which
38      * all calls are delegated.
39      * <li>{@link DelegateProxy#setDelegate(Object)} - sets the delegate for
40      * particular instance
41      * 
42      * </ul>
43      * 
44      * @param serviceType
45      *            - Subclass of RpcService for which direct proxy is to be
46      *            generated.
47      * @return Instance of RpcService of provided serviceType which implements
48      *         and {@link DelegateProxy}
49      * @throws IllegalArgumentException
50      * 
51      */
52     <T extends RpcService> T getDirectProxyFor(Class<T> serviceType) throws IllegalArgumentException;
53
54     /**
55      * Returns an instance of provided RpcService type which routes all calls to
56      * other instances selected on particular input field.
57      * 
58      * <p>
59      * Returned instance:
60      * <ul>
61      * <li>Implements:
62      * <ul>
63      * <li>{@link DelegateProxy}
64      * <li>{@link RpcRouter}
65      * </ul>
66      * <li>
67      * routes all invocations of methods, which are defined in RpcService
68      * subtype based on method arguments and routing information defined in the
69      * RpcRoutingTables for this instance
70      * {@link RpcRouter#getRoutingTable(Class)}.
71      * <ul>
72      * <li>
73      * Implementation uses
74      * {@link RpcRouter#getService(Class, InstanceIdentifier)} method to
75      * retrieve particular instance to which call will be routed.
76      * <li>
77      * Instance of {@link InstanceIdentifier} is determined by first argument of
78      * method and is retrieved via method which is annotated with
79      * {@link RoutingContext}. Class representing Routing Context Identifier is
80      * retrieved by {@link RoutingContext}.
81      * <li>If first argument is not defined / {@link RoutingContext} annotation
82      * is not present on any field invocation will be delegated to default
83      * service {@link RpcRouter#getDefaultService()}.
84      * </ul>
85      * 
86      * @param serviceType
87      *            - Subclass of RpcService for which Router is to be generated.
88      * @return Instance of RpcService of provided serviceType which implements
89      *         also {@link RpcRouter}<T> and {@link DelegateProxy}
90      */
91     <T extends RpcService> RpcRouter<T> getRouterFor(Class<T> serviceType) throws IllegalArgumentException;
92
93     NotificationInvokerFactory getInvokerFactory();
94 }