X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fimpl%2FBindingDOMNotificationListenerAdapter.java;h=cd3220e755306d2e379bfff647e38c2dcd34f042;hb=179402f071adcb7b3298a28d5144800ded8b997b;hp=c9a1756435538acfade024a0317f5abedb144c67;hpb=f96b3f1dfbd6e4a220caa84b24134600b17952ca;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java index c9a1756435..cd3220e755 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMNotificationListenerAdapter.java @@ -8,6 +8,7 @@ package org.opendaylight.controller.md.sal.binding.impl; import com.google.common.collect.ImmutableMap; +import com.google.common.reflect.TypeToken; import java.lang.reflect.Method; import java.util.HashMap; import java.util.HashSet; @@ -38,12 +39,18 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener { @Override public void onNotification(@Nonnull final DOMNotification notification) { - final Notification baNotification = - codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody()); + final Notification baNotification = deserialize(notification); final QName notificationQName = notification.getType().getLastComponent(); getInvoker(notification.getType()).invokeNotification(delegate, notificationQName, baNotification); } + private Notification deserialize(final DOMNotification notification) { + if(notification instanceof LazySerializedDOMNotification) { + return ((LazySerializedDOMNotification) notification).getBindingData(); + } + return codec.fromNormalizedNodeNotification(notification.getType(), notification.getBody()); + } + private NotificationListenerInvoker getInvoker(final SchemaPath type) { return invokers.get(type); } @@ -52,9 +59,10 @@ class BindingDOMNotificationListenerAdapter implements DOMNotificationListener { return invokers.keySet(); } - private static Map createInvokerMapFor(final Class implClz) { + public static Map createInvokerMapFor(final Class implClz) { final Map builder = new HashMap<>(); - for(final Class iface : implClz.getInterfaces()) { + for(final TypeToken ifaceToken : TypeToken.of(implClz).getTypes().interfaces()) { + Class iface = ifaceToken.getRawType(); if(NotificationListener.class.isAssignableFrom(iface) && BindingReflections.isBindingClass(iface)) { @SuppressWarnings("unchecked") final Class listenerType = (Class) iface;