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%2FForwardedNotificationService.java;h=8ce8da8203f3f694ef7b68bc5d7b09ffc747e2e5;hb=fdb31721b3b17060158556f3e36be5800be18a07;hp=fc7a742d5e006ff2e9ea76760353961a90497dad;hpb=35d50d7b5b69ebb08c753a699bf0aa1e645027fe;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ForwardedNotificationService.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ForwardedNotificationService.java index fc7a742d5e..8ce8da8203 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ForwardedNotificationService.java +++ b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/ForwardedNotificationService.java @@ -7,15 +7,20 @@ */ package org.opendaylight.controller.md.sal.binding.impl; +import com.google.common.collect.ClassToInstanceMap; +import com.google.common.collect.ImmutableSet; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Set; import javax.annotation.Nonnull; import org.opendaylight.controller.md.sal.binding.api.NotificationService; +import org.opendaylight.controller.md.sal.binding.impl.BindingDOMAdapterBuilder.Factory; import org.opendaylight.controller.md.sal.dom.api.DOMNotification; import org.opendaylight.controller.md.sal.dom.api.DOMNotificationListener; import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService; +import org.opendaylight.controller.md.sal.dom.api.DOMService; +import org.opendaylight.controller.sal.binding.codegen.impl.SingletonHolder; import org.opendaylight.controller.sal.binding.spi.NotificationInvokerFactory; import org.opendaylight.yangtools.binding.data.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.yangtools.concepts.AbstractListenerRegistration; @@ -27,6 +32,14 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath; public class ForwardedNotificationService implements NotificationService, AutoCloseable { + public static final Factory BUILDER_FACTORY = new Factory() { + + @Override + public BindingDOMAdapterBuilder newBuilder() { + return new Builder(); + } + + }; private final BindingNormalizedNodeSerializer codec; private final DOMNotificationService domNotifService; private final NotificationInvokerFactory notificationInvokerFactory; @@ -92,4 +105,23 @@ public class ForwardedNotificationService implements NotificationService, AutoCl } } + private static class Builder extends BindingDOMAdapterBuilder { + + + @Override + protected NotificationService createInstance(BindingToNormalizedNodeCodec codec, + ClassToInstanceMap delegates) { + DOMNotificationService domNotification = delegates.getInstance(DOMNotificationService.class); + NotificationInvokerFactory invokerFactory = SingletonHolder.INVOKER_FACTORY; + return new ForwardedNotificationService(codec.getCodecFactory(), domNotification, invokerFactory); + } + + @Override + public Set> getRequiredDelegates() { + return ImmutableSet.of(DOMNotificationService.class); + } + + + + } }