bba32011fc38ed61ab6b33d9ef53978445af4e0a
[controller.git] / opendaylight / md-sal / sal-binding-util / src / main / java / org / opendaylight / controller / md / sal / binding / util / AbstractBindingSalProviderInstance.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.md.sal.binding.util;
9
10 import java.util.concurrent.ExecutorService;
11 import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener;
12 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
13 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
14 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
15 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
16 import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
17 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
18 import org.opendaylight.yangtools.concepts.ListenerRegistration;
19 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
20 import org.opendaylight.yangtools.yang.binding.Notification;
21 import org.opendaylight.yangtools.yang.binding.RpcService;
22
23 public abstract class AbstractBindingSalProviderInstance<D extends DataProviderService, N extends NotificationProviderService, R extends RpcProviderRegistry> //
24         extends AbstractBindingSalConsumerInstance<D, N, R> //
25         implements //
26         DataProviderService, //
27         RpcProviderRegistry, //
28         NotificationProviderService {
29
30     public AbstractBindingSalProviderInstance(final R rpcRegistry, final N notificationBroker,
31             final D dataBroker) {
32         super(rpcRegistry, notificationBroker, dataBroker);
33     }
34
35     @Override
36     public <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> type, final T implementation)
37             throws IllegalStateException {
38         return getRpcRegistryChecked().addRpcImplementation(type, implementation);
39     }
40
41     @Override
42     public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> type, final T implementation)
43             throws IllegalStateException {
44         return getRpcRegistryChecked().addRoutedRpcImplementation(type, implementation);
45     }
46
47     @Override
48     public void publish(final Notification notification) {
49         getNotificationBrokerChecked().publish(notification);
50     }
51
52     @Override
53     public void publish(final Notification notification, final ExecutorService service) {
54         getNotificationBrokerChecked().publish(notification, service);
55     }
56
57     @Override
58     public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
59             final L listener) {
60         return getRpcRegistryChecked().registerRouteChangeListener(listener);
61     }
62
63     @Override
64     public ListenerRegistration<NotificationInterestListener> registerInterestListener(
65             final NotificationInterestListener interestListener) {
66         return getNotificationBrokerChecked().registerInterestListener(interestListener);
67     }
68 }