2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.md.sal.binding.util;
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.rpc.RpcContextIdentifier;
17 import org.opendaylight.yangtools.concepts.ListenerRegistration;
18 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
19 import org.opendaylight.yangtools.yang.binding.Notification;
20 import org.opendaylight.yangtools.yang.binding.RpcService;
22 public abstract class AbstractBindingSalProviderInstance<N extends NotificationProviderService,
23 R extends RpcProviderRegistry>
24 extends AbstractBindingSalConsumerInstance<N, R>
25 implements RpcProviderRegistry, NotificationProviderService {
27 public AbstractBindingSalProviderInstance(final R rpcRegistry, final N notificationBroker) {
28 super(rpcRegistry, notificationBroker);
32 public <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> type, final T implementation)
33 throws IllegalStateException {
34 return getRpcRegistryChecked().addRpcImplementation(type, implementation);
38 public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> type,
39 final T implementation) throws IllegalStateException {
40 return getRpcRegistryChecked().addRoutedRpcImplementation(type, implementation);
44 public void publish(final Notification notification) {
45 getNotificationBrokerChecked().publish(notification);
49 public void publish(final Notification notification, final ExecutorService service) {
50 getNotificationBrokerChecked().publish(notification, service);
54 public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
56 return getRpcRegistryChecked().registerRouteChangeListener(listener);
60 public ListenerRegistration<NotificationInterestListener> registerInterestListener(
61 final NotificationInterestListener interestListener) {
62 return getNotificationBrokerChecked().registerInterestListener(interestListener);