Correct ActionProviderService method definition
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / main / java / org / opendaylight / mdsal / binding / dom / adapter / osgi / OSGiNotificationPublishService.java
1 /*
2  * Copyright (c) 2020 PANTHEON.tech, s.r.o. 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.mdsal.binding.dom.adapter.osgi;
9
10 import com.google.common.annotations.Beta;
11 import com.google.common.util.concurrent.ListenableFuture;
12 import java.util.Map;
13 import java.util.concurrent.TimeUnit;
14 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
15 import org.opendaylight.yangtools.yang.binding.Notification;
16 import org.osgi.service.component.annotations.Activate;
17 import org.osgi.service.component.annotations.Component;
18 import org.osgi.service.component.annotations.Deactivate;
19
20 @Beta
21 @Component(factory = OSGiNotificationPublishService.FACTORY_NAME)
22 public final class OSGiNotificationPublishService extends AbstractAdaptedService<NotificationPublishService>
23         implements NotificationPublishService {
24     // OSGi DS Component Factory name
25     static final String FACTORY_NAME = "org.opendaylight.mdsal.binding.dom.adapter.osgi.OSGiNotificationPublishService";
26
27     public OSGiNotificationPublishService() {
28         super(NotificationPublishService.class);
29     }
30
31     @Override
32     public void putNotification(final Notification notification) throws InterruptedException {
33         delegate().putNotification(notification);
34     }
35
36     @Override
37     public ListenableFuture<? extends Object> offerNotification(final Notification notification) {
38         return delegate().offerNotification(notification);
39     }
40
41     @Override
42     public ListenableFuture<? extends Object> offerNotification(final Notification notification, final int timeout,
43             final TimeUnit unit) throws InterruptedException {
44         return delegate().offerNotification(notification, timeout, unit);
45     }
46
47     @Activate
48     void activate(final Map<String, ?> properties) {
49         start(properties);
50     }
51
52     @Deactivate
53     void deactivate(final int reason) {
54         stop(reason);
55     }
56 }