Deprecate ClassToInstance-taking methods
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / main / java / org / opendaylight / mdsal / binding / dom / adapter / osgi / OSGiNotificationService.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 java.util.Map;
11 import java.util.concurrent.Executor;
12 import org.opendaylight.mdsal.binding.api.NotificationService;
13 import org.opendaylight.yangtools.concepts.Registration;
14 import org.opendaylight.yangtools.yang.binding.DataObject;
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 @Component(factory = OSGiNotificationService.FACTORY_NAME)
21 public final class OSGiNotificationService extends AbstractAdaptedService<NotificationService>
22         implements NotificationService {
23     // OSGi DS Component Factory name
24     static final String FACTORY_NAME = "org.opendaylight.mdsal.binding.dom.adapter.osgi.OSGiNotificationService";
25
26     @Activate
27     public OSGiNotificationService(final Map<String, ?> properties) {
28         super(NotificationService.class, properties);
29     }
30
31     @Deactivate
32     void deactivate(final int reason) {
33         stop(reason);
34     }
35
36     @Override
37     public <N extends Notification<N> & DataObject> Registration registerListener(final Class<N> type,
38             final NotificationService.Listener<N> listener, final Executor executor) {
39         return delegate.registerListener(type, listener, executor);
40     }
41
42     @Override
43     public Registration registerCompositeListener(final NotificationService.CompositeListener listener,
44             final Executor executor) {
45         return delegate.registerCompositeListener(listener, executor);
46     }
47 }