Fix raw references to NotificationListener 35/12635/2
authorRobert Varga <rovarga@cisco.com>
Fri, 7 Nov 2014 17:54:15 +0000 (18:54 +0100)
committerRobert Varga <rovarga@cisco.com>
Sat, 8 Nov 2014 11:11:05 +0000 (12:11 +0100)
The restconf broker has raw references, so modify the type definition to
allow passing the type down.

Change-Id: If456a1312d1ccce67987d0b4db1ba613b48d91db
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/impl/NotificationServiceImpl.java
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/RemoteNotificationListener.java
opendaylight/md-sal/sal-restconf-broker/src/main/java/org/opendaylight/controller/sal/restconf/broker/listeners/SalNotificationListener.java

index c08f329f0d81d694e8c4f97a04fd2dfe69c25468..192836e9fae825373096ae1f8327d93c2ccdd187 100644 (file)
@@ -39,7 +39,7 @@ public class NotificationServiceImpl implements NotificationService {
         notifications.add(new QName(notificationType.toString()));
         String notificationStreamName = RemoteStreamTools.createNotificationStream(salRemoteService, notifications);
         final Map<String,EventStreamInfo> desiredEventStream = RemoteStreamTools.createEventStream(restconfClientContext, notificationStreamName);
-        RemoteNotificationListener remoteNotificationListener = new RemoteNotificationListener(listener);
+        RemoteNotificationListener<T> remoteNotificationListener = new RemoteNotificationListener<T>(listener);
 
         final ListenerRegistration<?> listenerRegistration = restconfClientContext.getEventStreamContext(desiredEventStream.get(desiredEventStream.get(notificationStreamName)))
                 .registerNotificationListener(remoteNotificationListener);
index 895a5030e965bfdf19c35b459a2c3f5e64acd3ec..82fa2ae2e971338dacb4a09e7cd58e83f701b5ce 100644 (file)
@@ -8,15 +8,16 @@
 package org.opendaylight.controller.sal.restconf.broker.listeners;
 
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
+import org.opendaylight.yangtools.yang.binding.Notification;
 
-public class RemoteNotificationListener implements org.opendaylight.yangtools.yang.binding.NotificationListener {
+public class RemoteNotificationListener<T extends Notification> implements org.opendaylight.yangtools.yang.binding.NotificationListener {
 
-    org.opendaylight.controller.sal.binding.api.NotificationListener listener;
+    NotificationListener<T> listener;
 
-    public RemoteNotificationListener(NotificationListener listener){
+    public RemoteNotificationListener(NotificationListener<T> listener){
         this.listener = listener;
     }
-    public NotificationListener getListener(){
+    public NotificationListener<T> getListener() {
         return this.listener;
     }
 
index 16ca0aee932e66d9669fcd28528c45d267dedf09..3c4bbba4a4e8a273bc1e58095e785eec2dbf17ba 100644 (file)
@@ -11,14 +11,14 @@ import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 
-public class SalNotificationListener implements NotificationListener {
-    private NotificationListener notificationListener;
+public class SalNotificationListener<T extends Notification> implements NotificationListener<T> {
+    private NotificationListener<T> notificationListener;
 
-    public SalNotificationListener( NotificationListener notificationListener){
+    public SalNotificationListener( NotificationListener<T> notificationListener){
         this.notificationListener = notificationListener;
     }
     @Override
     public void onNotification(Notification notification) {
-        this.notificationListener.onNotification(notification);
+        this.notificationListener.onNotification((T)notification);
     }
 }