Bug 981: Converted test to use BitsType.create()
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / sal / binding / impl / NotificationBrokerImpl.xtend
index a7dcf80e8dbd5366ca366b0d2c50fce573a598bf..6d675b4b5eb5f546b1a7fd7743d301fb62a56f0b 100644 (file)
@@ -8,25 +8,26 @@
 package org.opendaylight.controller.sal.binding.impl\r
 \r
 import com.google.common.collect.HashMultimap\r
+import com.google.common.collect.ImmutableSet\r
 import com.google.common.collect.Multimap\r
-import java.util.Collection\r
+import com.google.common.collect.Multimaps\r
 import java.util.Collections\r
 import java.util.concurrent.Callable\r
 import java.util.concurrent.ExecutorService\r
+import java.util.concurrent.Future\r
+import java.util.Set\r
 import org.opendaylight.controller.sal.binding.api.NotificationListener\r
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService\r
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService.NotificationInterestListener\r
+import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder\r
 import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory.NotificationInvoker\r
 import org.opendaylight.yangtools.concepts.AbstractObjectRegistration\r
 import org.opendaylight.yangtools.concepts.ListenerRegistration\r
 import org.opendaylight.yangtools.concepts.Registration\r
+import org.opendaylight.yangtools.concepts.util.ListenerRegistry\r
 import org.opendaylight.yangtools.yang.binding.Notification\r
 import org.slf4j.LoggerFactory\r
-import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder\rimport com.google.common.collect.Multimaps\r
-import org.opendaylight.yangtools.concepts.util.ListenerRegistry\r
-import org.opendaylight.controller.sal.binding.api.NotificationProviderService.NotificationInterestListener\rimport java.util.Set
-import com.google.common.collect.ImmutableSet
-import java.util.concurrent.Future
-
+\r
 class NotificationBrokerImpl implements NotificationProviderService, AutoCloseable {\r
     \r
     val ListenerRegistry<NotificationInterestListener> interestListeners = ListenerRegistry.create;\r
@@ -48,48 +49,10 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab
         this.executor = executor;\r
     }\r
 \r
-    @Deprecated\r
-    override <T extends Notification> addNotificationListener(Class<T> notificationType,\r
-        NotificationListener<T> listener) {\r
-        listeners.put(notificationType, listener)\r
-    }\r
-\r
-    @Deprecated\r
-    override <T extends Notification> removeNotificationListener(Class<T> notificationType,\r
-        NotificationListener<T> listener) {\r
-        listeners.remove(notificationType, listener)\r
-    }\r
-\r
-    override notify(Notification notification) {\r
-        publish(notification)\r
-    }\r
-\r
     def getNotificationTypes(Notification notification) {\r
         notification.class.interfaces.filter[it != Notification && Notification.isAssignableFrom(it)]\r
     }\r
 \r
-    @SuppressWarnings("unchecked")\r
-    private def notifyAll(Collection<NotificationListener<?>> listeners, Notification notification) {\r
-        listeners.forEach[(it as NotificationListener).onNotification(notification)]\r
-    }\r
-\r
-    @Deprecated\r
-    override addNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {\r
-        throw new UnsupportedOperationException("Deprecated method. Use registerNotificationListener instead.");\r
-\r
-    }\r
-\r
-    @Deprecated\r
-    override removeNotificationListener(org.opendaylight.yangtools.yang.binding.NotificationListener listener) {\r
-        throw new UnsupportedOperationException(\r
-            "Deprecated method. Use RegisterNotificationListener returned value to close registration.")\r
-    }\r
-\r
-    @Deprecated\r
-    override notify(Notification notification, ExecutorService service) {\r
-        publish(notification, service)\r
-    }\r
-\r
     override publish(Notification notification) {\r
         publish(notification, executor)\r
     }\r
@@ -97,7 +60,7 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab
     override publish(Notification notification, ExecutorService service) {\r
         val allTypes = notification.notificationTypes\r
 \r
-        var Iterable<NotificationListener<?>> listenerToNotify = Collections.emptySet();\r
+        var Iterable<NotificationListener<? extends Object>> listenerToNotify = Collections.emptySet();\r
         for (type : allTypes) {\r
             listenerToNotify = listenerToNotify + listeners.get(type as Class<? extends Notification>)\r
         }\r
@@ -105,14 +68,14 @@ class NotificationBrokerImpl implements NotificationProviderService, AutoCloseab
         submitAll(executor,tasks);\r
     }\r
     \r
-    def submitAll(ExecutorService service, Set<NotifyTask> tasks) {
+    def submitAll(ExecutorService service, Set<NotifyTask> tasks) {\r
         val ret = ImmutableSet.<Future<Object>>builder();\r
         for(task : tasks) {\r
             ret.add(service.submit(task));\r
         }\r
-        return ret.build();
+        return ret.build();\r
     }\r
-\r
+    \r
     override <T extends Notification> registerNotificationListener(Class<T> notificationType,\r
         NotificationListener<T> listener) {\r
         val reg = new GenericNotificationRegistration<T>(notificationType, listener, this);\r