Remove DOMDataTreeShard and all related interfaces
[mdsal.git] / binding / mdsal-binding-dom-adapter / src / main / java / org / opendaylight / mdsal / binding / dom / adapter / osgi / DynamicBindingAdapter.java
index 48fe1faef29e35e40466f190cb954b6ae0f1c1aa..cfa9904218cc6ce25836417076bc7779fb4cb5fc 100644 (file)
@@ -13,7 +13,6 @@ import org.opendaylight.mdsal.binding.api.ActionProviderService;
 import org.opendaylight.mdsal.binding.api.ActionService;
 import org.opendaylight.mdsal.binding.api.BindingService;
 import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.DataTreeService;
 import org.opendaylight.mdsal.binding.api.MountPointService;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.mdsal.binding.api.NotificationService;
@@ -23,7 +22,6 @@ import org.opendaylight.mdsal.binding.dom.adapter.spi.AdapterFactory;
 import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
 import org.opendaylight.mdsal.dom.api.DOMActionService;
 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
 import org.opendaylight.mdsal.dom.api.DOMNotificationService;
@@ -50,12 +48,22 @@ import org.slf4j.LoggerFactory;
 public final class DynamicBindingAdapter {
     private static final Logger LOG = LoggerFactory.getLogger(DynamicBindingAdapter.class);
 
-    private List<AbstractAdaptingTracker<?, ?, ?>> trackers = ImmutableList.of();
+    private List<AdaptingTracker<?, ?>> trackers = ImmutableList.of();
 
     @Reference
     AdapterFactory factory = null;
+    @Reference(target = "(component.factory=" + OSGiActionService.FACTORY_NAME + ")")
+    ComponentFactory actionServiceFactory = null;
+    @Reference(target = "(component.factory=" + OSGiActionProviderService.FACTORY_NAME + ")")
+    ComponentFactory actionProviderServiceFactory = null;
+    @Reference(target = "(component.factory=" + OSGiDataBroker.FACTORY_NAME + ")")
+    ComponentFactory dataBrokerFactory = null;
     @Reference(target = "(component.factory=" + OSGiMountPointService.FACTORY_NAME + ")")
     ComponentFactory mountPointServiceFactory = null;
+    @Reference(target = "(component.factory=" + OSGiNotificationService.FACTORY_NAME + ")")
+    ComponentFactory notificationServiceFactory = null;
+    @Reference(target = "(component.factory=" + OSGiNotificationPublishService.FACTORY_NAME + ")")
+    ComponentFactory notificationPublishServiceFactory = null;
     @Reference(target = "(component.factory=" + OSGiRpcConsumerRegistry.FACTORY_NAME + ")")
     ComponentFactory rpcConsumerRegistryFactory = null;
     @Reference(target = "(component.factory=" + OSGiRpcProviderService.FACTORY_NAME + ")")
@@ -64,21 +72,22 @@ public final class DynamicBindingAdapter {
     @Activate
     void activate(final BundleContext ctx) {
         trackers = ImmutableList.of(
-            new AdaptingTracker<>(ctx, DOMDataBroker.class, DataBroker.class, factory::createDataBroker),
-            new AdaptingTracker<>(ctx, DOMDataTreeService.class, DataTreeService.class, factory::createDataTreeService),
-            new AdaptingComponentTracker<>(ctx, DOMMountPointService.class, MountPointService.class,
+            new AdaptingTracker<>(ctx, DOMDataBroker.class, DataBroker.class, factory::createDataBroker,
+                    dataBrokerFactory),
+            new AdaptingTracker<>(ctx, DOMMountPointService.class, MountPointService.class,
                     factory::createMountPointService, mountPointServiceFactory),
             new AdaptingTracker<>(ctx, DOMNotificationService.class, NotificationService.class,
-                    factory::createNotificationService),
+                    factory::createNotificationService, notificationServiceFactory),
             new AdaptingTracker<>(ctx, DOMNotificationPublishService.class, NotificationPublishService.class,
-                    factory::createNotificationPublishService),
-            new AdaptingComponentTracker<>(ctx, DOMRpcService.class, RpcConsumerRegistry.class,
+                    factory::createNotificationPublishService, notificationPublishServiceFactory),
+            new AdaptingTracker<>(ctx, DOMRpcService.class, RpcConsumerRegistry.class,
                     factory::createRpcConsumerRegistry, rpcConsumerRegistryFactory),
-            new AdaptingComponentTracker<>(ctx, DOMRpcProviderService.class, RpcProviderService.class,
+            new AdaptingTracker<>(ctx, DOMRpcProviderService.class, RpcProviderService.class,
                     factory::createRpcProviderService, rpcProviderServiceFactory),
-            new AdaptingTracker<>(ctx, DOMActionService.class, ActionService.class, factory::createActionService),
+            new AdaptingTracker<>(ctx, DOMActionService.class, ActionService.class, factory::createActionService,
+                    actionServiceFactory),
             new AdaptingTracker<>(ctx, DOMActionProviderService.class, ActionProviderService.class,
-                factory::createActionProviderService));
+                    factory::createActionProviderService, actionProviderServiceFactory));
 
         LOG.debug("Starting {} DOMService trackers", trackers.size());
         trackers.forEach(ServiceTracker::open);
@@ -89,7 +98,7 @@ public final class DynamicBindingAdapter {
     void deactivate() {
         LOG.debug("Stopping {} DOMService trackers", trackers.size());
         if (!trackers.isEmpty()) {
-            trackers.forEach(AbstractAdaptingTracker::close);
+            trackers.forEach(AdaptingTracker::close);
             LOG.info("{} DOMService trackers stopped", trackers.size());
         }
         trackers = ImmutableList.of();