From 77fa76b4b15ec6d74920349f9a066ec4597b2585 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Tue, 16 Aug 2016 11:04:00 +0200 Subject: HONEYCOMB-22: Remove karaf based distribution and wiring Change-Id: I48aafb726de53b6ad3fb9b97c202f712dfa4a540 Signed-off-by: Maros Marsalek --- .../HoneycombNotificationManagerModule.java | 93 ---------------------- 1 file changed, 93 deletions(-) delete mode 100644 infra/notification/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/notification/impl/rev160601/HoneycombNotificationManagerModule.java (limited to 'infra/notification/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/notification/impl/rev160601/HoneycombNotificationManagerModule.java') diff --git a/infra/notification/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/notification/impl/rev160601/HoneycombNotificationManagerModule.java b/infra/notification/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/notification/impl/rev160601/HoneycombNotificationManagerModule.java deleted file mode 100644 index 056b38798..000000000 --- a/infra/notification/impl/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/notification/impl/rev160601/HoneycombNotificationManagerModule.java +++ /dev/null @@ -1,93 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.notification.impl.rev160601; - -import io.fd.honeycomb.notification.NotificationCollector; -import io.fd.honeycomb.notification.NotificationProducer; -import io.fd.honeycomb.notification.impl.HoneycombNotificationCollector; -import io.fd.honeycomb.notification.impl.NotificationProducerRegistry; -import io.fd.honeycomb.notification.impl.NotificationProducerTracker; -import java.util.Collection; -import org.opendaylight.controller.md.sal.binding.impl.BindingDOMNotificationPublishServiceAdapter; -import org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec; -import org.opendaylight.controller.md.sal.dom.broker.impl.DOMNotificationRouter; -import org.opendaylight.yangtools.yang.binding.Notification; - -public class HoneycombNotificationManagerModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.notification.impl.rev160601.AbstractHoneycombNotificationManagerModule { - - public HoneycombNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) { - super(identifier, dependencyResolver); - } - - public HoneycombNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.notification.impl.rev160601.HoneycombNotificationManagerModule oldModule, java.lang.AutoCloseable oldInstance) { - super(identifier, dependencyResolver, oldModule, oldInstance); - } - - @Override - public void customValidation() { - // add custom validation form module attributes here. - } - - @Override - public java.lang.AutoCloseable createInstance() { - final DOMNotificationRouter notificationRouter = getDomNotificationServiceDependency(); - - // Create the registry to keep track of what's registered - final NotificationProducerRegistry notificationProducerRegistry = - new NotificationProducerRegistry(getNotificationProducersDependency()); - - // Create BA version of notification service (implementation is free from ODL) - final BindingToNormalizedNodeCodec codec = getRuntimeMappingCodecDependency(); - final BindingDOMNotificationPublishServiceAdapter bindingDOMNotificationPublishServiceAdapter = - new BindingDOMNotificationPublishServiceAdapter(codec, notificationRouter); - - // Create Collector on top of BA notification service and registry - final HoneycombNotificationCollector honeycombNotificationCollector = - new HoneycombNotificationCollector(bindingDOMNotificationPublishServiceAdapter, notificationProducerRegistry); - - // Create tracker, responsible for starting and stopping registered notification producers whenever necessary - final NotificationProducerTracker notificationProducerTracker = - new NotificationProducerTracker(notificationProducerRegistry, honeycombNotificationCollector, - notificationRouter); - - // TODO wire with restconf - // DOMNotificationService is already provided by DOMBroker injected into RESTCONF, however RESTCONF - // only supports data-change notification, nothing else. So currently its impossible. - - return new CloseableCollector(honeycombNotificationCollector, () -> { - // Close all resources in order opposite to instantiation - notificationProducerTracker.close(); - honeycombNotificationCollector.close(); - bindingDOMNotificationPublishServiceAdapter.close(); - // notificationProducerRegistry; no close, it's just a collection - }); - } - - /** - * NotificationCollector wrapper in which close method execution can be injected - */ - private class CloseableCollector implements AutoCloseable, NotificationCollector, NotificationProducer { - - private final HoneycombNotificationCollector honeycombNotificationCollector; - private final AutoCloseable resources; - - CloseableCollector(final HoneycombNotificationCollector honeycombNotificationCollector, - final AutoCloseable resources) { - this.honeycombNotificationCollector = honeycombNotificationCollector; - this.resources = resources; - } - - @Override - public void close() throws Exception { - resources.close(); - } - - @Override - public void onNotification(final Notification notification) { - honeycombNotificationCollector.onNotification(notification); - } - - @Override - public Collection> getNotificationTypes() { - return honeycombNotificationCollector.getNotificationTypes(); - } - } -} -- cgit 1.2.3-korg