Bug 8568: Remove DataProviderService from RootBindingAwareBroker 23/58023/3
authorTom Pantelis <tompantelis@gmail.com>
Tue, 30 May 2017 23:07:28 +0000 (19:07 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Thu, 1 Jun 2017 12:56:11 +0000 (08:56 -0400)
Change-Id: Ib5e4f70ef72819103544cd6388558dc4a05b55d2
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/RootBindingAwareBroker.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AbstractDataServiceTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java
opendaylight/md-sal/sal-binding-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/binding/impl/BindingBrokerImplModule.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalConsumerInstance.java
opendaylight/md-sal/sal-binding-util/src/main/java/org/opendaylight/controller/md/sal/binding/util/AbstractBindingSalProviderInstance.java

index 640bc65..5465a95 100644 (file)
@@ -24,8 +24,6 @@ import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.binding.api.mount.MountProviderService;
 import org.opendaylight.controller.sal.binding.api.mount.MountService;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
@@ -53,9 +51,6 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
 
     private NotificationPublishService notificationPublishService;
 
-    @SuppressWarnings("deprecation")
-    private DataProviderService legacyDataBroker;
-
     private DataBroker dataBroker;
 
     private MountProviderService legacyMount;
@@ -83,10 +78,6 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         return controllerRoot;
     }
 
-    public DataProviderService getDataBroker() {
-        return this.legacyDataBroker;
-    }
-
     public NotificationProviderService getNotificationBroker() {
         return this.notificationBroker;
     }
@@ -94,6 +85,7 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
     public NotificationPublishService getNotificationPublishService() {
         return this.notificationPublishService;
     }
+
     public RpcProviderRegistry getRpcProviderRegistry() {
         return this.rpcBroker;
     }
@@ -130,21 +122,16 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         this.notificationPublishService = notificationPublishService;
     }
 
-    public void setLegacyDataBroker(final DataProviderService dataBroker) {
-        this.legacyDataBroker = dataBroker;
-    }
-
     public void start() {
         checkState(controllerRoot == null, "Binding Aware Broker was already started.");
         LOG.info("Starting Binding Aware Broker: {}", identifier);
 
-        controllerRoot = new RootSalInstance(getRpcProviderRegistry(), getNotificationBroker(), getDataBroker());
+        controllerRoot = new RootSalInstance(getRpcProviderRegistry(), getNotificationBroker());
 
         final ImmutableClassToInstanceMap.Builder<BindingAwareService> consBuilder = ImmutableClassToInstanceMap
                 .builder();
 
         consBuilder.put(NotificationService.class, getRoot());
-        consBuilder.put(DataBrokerService.class, getRoot());
         consBuilder.put(RpcConsumerRegistry.class, getRoot());
         if (dataBroker != null) {
             consBuilder.put(DataBroker.class, dataBroker);
@@ -156,8 +143,7 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
         final ImmutableClassToInstanceMap.Builder<BindingAwareService> provBuilder = ImmutableClassToInstanceMap
                 .builder();
         provBuilder.putAll(supportedConsumerServices).put(NotificationProviderService.class, getRoot())
-                .put(DataProviderService.class, getRoot()).put(RpcProviderRegistry.class, getRoot())
-                .put(MountProviderService.class, legacyMount);
+                .put(RpcProviderRegistry.class, getRoot()) .put(MountProviderService.class, legacyMount);
         if (notificationPublishService != null) {
             provBuilder.put(NotificationPublishService.class, notificationPublishService);
         }
@@ -216,11 +202,11 @@ public class RootBindingAwareBroker implements Mutable, Identifiable<String>, Bi
     }
 
     public class RootSalInstance extends
-            AbstractBindingSalProviderInstance<DataProviderService, NotificationProviderService, RpcProviderRegistry> {
+            AbstractBindingSalProviderInstance<NotificationProviderService, RpcProviderRegistry> {
 
         public RootSalInstance(final RpcProviderRegistry rpcRegistry,
-                final NotificationProviderService notificationBroker, final DataProviderService dataBroker) {
-            super(rpcRegistry, notificationBroker, dataBroker);
+                final NotificationProviderService notificationBroker) {
+            super(rpcRegistry, notificationBroker);
         }
     }
 
index d79bff1..aa80e11 100644 (file)
@@ -10,14 +10,11 @@ package org.opendaylight.controller.sal.binding.test;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.junit.Before;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.binding.test.util.BindingBrokerTestFactory;
 import org.opendaylight.controller.sal.binding.test.util.BindingTestContext;
 
 public abstract class AbstractDataServiceTest {
 
-    protected DataProviderService baDataService;
-
     protected BindingTestContext testContext;
 
     @Before
@@ -28,8 +25,6 @@ public abstract class AbstractDataServiceTest {
         factory.setStartWithParsedSchema(getStartWithSchema());
         testContext = factory.getTestContext();
         testContext.start();
-
-        baDataService = testContext.getBindingDataBroker();
     }
 
     protected boolean getStartWithSchema() {
index 5bd1316..9da772a 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.controller.sal.binding.test.util;
 
 import static com.google.common.base.Preconditions.checkState;
+
 import com.google.common.annotations.Beta;
 import com.google.common.collect.ClassToInstanceMap;
 import com.google.common.collect.ImmutableMap;
@@ -15,13 +16,13 @@ import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.MutableClassToInstanceMap;
 import com.google.common.util.concurrent.ListeningExecutorService;
 import com.google.common.util.concurrent.MoreExecutors;
+import javassist.ClassPool;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.MountPointService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.md.sal.binding.compat.HeliumNotificationProviderServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.compat.HeliumRpcProviderRegistry;
-import org.opendaylight.controller.md.sal.binding.compat.HydrogenDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.binding.compat.HydrogenMountProvisionServiceAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMDataBrokerAdapter;
 import org.opendaylight.controller.md.sal.binding.impl.BindingDOMMountPointServiceAdapter;
@@ -59,7 +60,6 @@ import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeC
 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import javassist.ClassPool;
 
 @Beta
 public class BindingTestContext implements AutoCloseable {
@@ -153,7 +153,6 @@ public class BindingTestContext implements AutoCloseable {
 
     public void startBindingBroker() {
         checkState(this.executor != null, "Executor needs to be set");
-        checkState(this.baData != null, "Binding Data Broker must be started");
         checkState(this.baNotifyImpl != null, "Notification Service must be started");
 
         this.baConsumerRpc = new BindingDOMRpcServiceAdapter(getDomRpcInvoker(), this.codec);
@@ -165,7 +164,6 @@ public class BindingTestContext implements AutoCloseable {
         this.baBrokerImpl.setMountService(mountService);
         this.baBrokerImpl.setLegacyMountManager(new HydrogenMountProvisionServiceAdapter(mountService));
         this.baBrokerImpl.setRpcBroker(new HeliumRpcProviderRegistry(this.baConsumerRpc, this.baProviderRpc));
-        this.baBrokerImpl.setLegacyDataBroker(this.baData);
         this.baBrokerImpl.setNotificationBroker(this.baNotifyImpl);
         this.baBrokerImpl.start();
     }
@@ -201,7 +199,6 @@ public class BindingTestContext implements AutoCloseable {
         startDomMountPoint();
         startBindingToDomMappingService();
         startNewDataBroker();
-        startNewBindingDataBroker();
         startBindingNotificationBroker();
         startBindingBroker();
 
@@ -211,11 +208,6 @@ public class BindingTestContext implements AutoCloseable {
         }
     }
 
-    public void startNewBindingDataBroker() {
-        final HydrogenDataBrokerAdapter forwarded = new HydrogenDataBrokerAdapter(this.dataBroker);
-        this.baData = forwarded;
-    }
-
     private void startDomMountPoint() {
         this.biMountImpl = new DOMMountPointServiceImpl();
     }
@@ -249,11 +241,6 @@ public class BindingTestContext implements AutoCloseable {
         updateYangSchema(moduleInfos);
     }
 
-    @Deprecated
-    public DataProviderService getBindingDataBroker() {
-        return this.baData;
-    }
-
     public RpcProviderRegistry getBindingRpcRegistry() {
         return this.baBrokerImpl.getRoot();
     }
index 71bd001..fe2e499 100644 (file)
@@ -69,7 +69,6 @@ public final class BindingBrokerImplModule extends
         final MountProviderService legacyMount = createLegacyMountPointService(mount);
 
 
-        broker.setLegacyDataBroker(getDataBrokerDependency());
         broker.setNotificationBroker(getNotificationServiceDependency());
         if (getNotificationPublishServiceDependency() != null) {
             broker.setNotificationPublishService(getNotificationPublishServiceDependency());
index 53abd39..861f9f0 100644 (file)
@@ -7,29 +7,19 @@
  */
 package org.opendaylight.controller.md.sal.binding.util;
 
+import com.google.common.base.Preconditions;
 import org.opendaylight.controller.sal.binding.api.NotificationListener;
 import org.opendaylight.controller.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.controller.sal.binding.api.data.DataBrokerService;
-import org.opendaylight.controller.sal.binding.api.data.DataChangeListener;
-import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-import com.google.common.base.Preconditions;
-
-public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerService, N extends NotificationService, R extends RpcConsumerRegistry> //
-        implements //
-        RpcConsumerRegistry, //
-        NotificationService, //
-        DataBrokerService {
+public abstract class AbstractBindingSalConsumerInstance<N extends NotificationService, R extends RpcConsumerRegistry>
+        implements RpcConsumerRegistry, NotificationService {
 
     private final R rpcRegistry;
     private final N notificationBroker;
-    private final D dataBroker;
 
     protected final R getRpcRegistry() {
         return rpcRegistry;
@@ -39,10 +29,6 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
         return notificationBroker;
     }
 
-    protected final D getDataBroker() {
-        return dataBroker;
-    }
-
     protected final R getRpcRegistryChecked() {
         Preconditions.checkState(rpcRegistry != null,"Rpc Registry is not available.");
         return rpcRegistry;
@@ -53,16 +39,9 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
         return notificationBroker;
     }
 
-    protected final D getDataBrokerChecked() {
-        Preconditions.checkState(dataBroker != null, "Data Broker is not available");
-        return dataBroker;
-    }
-
-
-    protected AbstractBindingSalConsumerInstance(R rpcRegistry, N notificationBroker, D dataBroker) {
+    protected AbstractBindingSalConsumerInstance(R rpcRegistry, N notificationBroker) {
         this.rpcRegistry = rpcRegistry;
         this.notificationBroker = notificationBroker;
-        this.dataBroker = dataBroker;
     }
 
     @Override
@@ -81,27 +60,4 @@ public abstract class AbstractBindingSalConsumerInstance<D extends DataBrokerSer
             org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
         return getNotificationBrokerChecked().registerNotificationListener(listener);
     }
-
-    @Override
-    public DataModificationTransaction beginTransaction() {
-        return getDataBrokerChecked().beginTransaction();
-    }
-
-    @Override
-    @Deprecated
-    public DataObject readConfigurationData(InstanceIdentifier<? extends DataObject> path) {
-        return getDataBrokerChecked().readConfigurationData(path);
-    }
-
-    @Override
-    public DataObject readOperationalData(InstanceIdentifier<? extends DataObject> path) {
-        return getDataBrokerChecked().readOperationalData(path);
-    }
-
-    @Override
-    @Deprecated
-    public ListenerRegistration<DataChangeListener> registerDataChangeListener(
-            InstanceIdentifier<? extends DataObject> path, DataChangeListener listener) {
-        return getDataBrokerChecked().registerDataChangeListener(path, listener);
-    }
 }
index bba3201..8fb31d1 100644 (file)
@@ -13,23 +13,19 @@ import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcR
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.controller.sal.binding.api.data.DataProviderService;
 import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.Notification;
 import org.opendaylight.yangtools.yang.binding.RpcService;
 
-public abstract class AbstractBindingSalProviderInstance<D extends DataProviderService, N extends NotificationProviderService, R extends RpcProviderRegistry> //
-        extends AbstractBindingSalConsumerInstance<D, N, R> //
-        implements //
-        DataProviderService, //
-        RpcProviderRegistry, //
-        NotificationProviderService {
+public abstract class AbstractBindingSalProviderInstance<N extends NotificationProviderService,
+                                                         R extends RpcProviderRegistry>
+        extends AbstractBindingSalConsumerInstance<N, R>
+        implements RpcProviderRegistry, NotificationProviderService {
 
-    public AbstractBindingSalProviderInstance(final R rpcRegistry, final N notificationBroker,
-            final D dataBroker) {
-        super(rpcRegistry, notificationBroker, dataBroker);
+    public AbstractBindingSalProviderInstance(final R rpcRegistry, final N notificationBroker) {
+        super(rpcRegistry, notificationBroker);
     }
 
     @Override
@@ -39,8 +35,8 @@ public abstract class AbstractBindingSalProviderInstance<D extends DataProviderS
     }
 
     @Override
-    public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> type, final T implementation)
-            throws IllegalStateException {
+    public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> type,
+            final T implementation) throws IllegalStateException {
         return getRpcRegistryChecked().addRoutedRpcImplementation(type, implementation);
     }
 

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.