ComponentFactory actionProviderServiceFactory = null;
@Reference(target = "(component.factory=" + OSGiMountPointService.FACTORY_NAME + ")")
ComponentFactory mountPointServiceFactory = null;
+ @Reference(target = "(component.factory=" + OSGiNotificationService.FACTORY_NAME + ")")
+ ComponentFactory notificationServiceFactory = null;
+ @Reference(target = "(component.factory=" + OSGiNotificationPublishService.FACTORY_NAME + ")")
+ ComponentFactory notificationPublishServiceFactory = null;
@Reference(target = "(component.factory=" + OSGiRpcConsumerRegistry.FACTORY_NAME + ")")
ComponentFactory rpcConsumerRegistryFactory = null;
@Reference(target = "(component.factory=" + OSGiRpcProviderService.FACTORY_NAME + ")")
new AdaptingTracker<>(ctx, DOMDataTreeService.class, DataTreeService.class, factory::createDataTreeService),
new AdaptingComponentTracker<>(ctx, DOMMountPointService.class, MountPointService.class,
factory::createMountPointService, mountPointServiceFactory),
- new AdaptingTracker<>(ctx, DOMNotificationService.class, NotificationService.class,
- factory::createNotificationService),
- new AdaptingTracker<>(ctx, DOMNotificationPublishService.class, NotificationPublishService.class,
- factory::createNotificationPublishService),
+ new AdaptingComponentTracker<>(ctx, DOMNotificationService.class, NotificationService.class,
+ factory::createNotificationService, notificationServiceFactory),
+ new AdaptingComponentTracker<>(ctx, DOMNotificationPublishService.class, NotificationPublishService.class,
+ factory::createNotificationPublishService, notificationPublishServiceFactory),
new AdaptingComponentTracker<>(ctx, DOMRpcService.class, RpcConsumerRegistry.class,
factory::createRpcConsumerRegistry, rpcConsumerRegistryFactory),
new AdaptingComponentTracker<>(ctx, DOMRpcProviderService.class, RpcProviderService.class,
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.binding.dom.adapter.osgi;
+
+import com.google.common.annotations.Beta;
+import com.google.common.util.concurrent.ListenableFuture;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.yangtools.yang.binding.Notification;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Beta
+@Component(factory = OSGiNotificationPublishService.FACTORY_NAME)
+public final class OSGiNotificationPublishService extends AbstractAdaptedService<NotificationPublishService>
+ implements NotificationPublishService {
+ // OSGi DS Component Factory name
+ static final String FACTORY_NAME = "org.opendaylight.mdsal.binding.dom.adapter.osgi.OSGiNotificationPublishService";
+
+ public OSGiNotificationPublishService() {
+ super(NotificationPublishService.class);
+ }
+
+ @Override
+ public void putNotification(final Notification notification) throws InterruptedException {
+ delegate().putNotification(notification);
+ }
+
+ @Override
+ public ListenableFuture<? extends Object> offerNotification(final Notification notification) {
+ return delegate().offerNotification(notification);
+ }
+
+ @Override
+ public ListenableFuture<? extends Object> offerNotification(final Notification notification, final int timeout,
+ final TimeUnit unit) throws InterruptedException {
+ return delegate().offerNotification(notification, timeout, unit);
+ }
+
+ @Activate
+ void activate(final Map<String, ?> properties) {
+ start(properties);
+ }
+
+ @Deactivate
+ void deactivate() {
+ stop();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2020 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.binding.dom.adapter.osgi;
+
+import com.google.common.annotations.Beta;
+import java.util.Map;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.NotificationListener;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+
+@Beta
+@Component(factory = OSGiNotificationService.FACTORY_NAME)
+public final class OSGiNotificationService extends AbstractAdaptedService<NotificationService>
+ implements NotificationService {
+ // OSGi DS Component Factory name
+ static final String FACTORY_NAME = "org.opendaylight.mdsal.binding.dom.adapter.osgi.OSGiNotificationService";
+
+ public OSGiNotificationService() {
+ super(NotificationService.class);
+ }
+
+ @Override
+ public <T extends NotificationListener> ListenerRegistration<T> registerNotificationListener(final T listener) {
+ return delegate().registerNotificationListener(listener);
+ }
+
+ @Activate
+ void activate(final Map<String, ?> properties) {
+ start(properties);
+ }
+
+ @Deactivate
+ void deactivate() {
+ stop();
+ }
+}