Move NetconfDeviceTopologyAdapter
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / sal / NetconfDeviceSalProvider.java
index 12aac10510111997bf5038c76f4095349b9a75c7..ff4af4649ea6141fe3f82384fdd37174b628fe46 100644 (file)
@@ -11,7 +11,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 import static java.util.Objects.requireNonNull;
 
-import org.opendaylight.mdsal.binding.api.DataBroker;
 import org.opendaylight.mdsal.dom.api.DOMActionService;
 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
 import org.opendaylight.mdsal.dom.api.DOMMountPoint;
@@ -33,26 +32,17 @@ import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+// FIXME: remove this class and promote MountInstance to a top-level construct
+// Non-final for mocking
 public class NetconfDeviceSalProvider implements AutoCloseable {
     private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceSalProvider.class);
 
     private final RemoteDeviceId id;
     private final MountInstance mountInstance;
 
-    private volatile NetconfDeviceTopologyAdapter topologyDatastoreAdapter;
-
     public NetconfDeviceSalProvider(final RemoteDeviceId deviceId, final DOMMountPointService mountService) {
-        this(deviceId, mountService, null);
-    }
-
-    // FIXME: NETCONF-918: remove this method
-    public NetconfDeviceSalProvider(final RemoteDeviceId deviceId, final DOMMountPointService mountService,
-            final DataBroker dataBroker) {
-        id = deviceId;
+        id = requireNonNull(deviceId);
         mountInstance = new MountInstance(mountService, id);
-        if (dataBroker != null) {
-            topologyDatastoreAdapter = new NetconfDeviceTopologyAdapter(dataBroker, id);
-        }
     }
 
     public MountInstance getMountInstance() {
@@ -61,20 +51,9 @@ public class NetconfDeviceSalProvider implements AutoCloseable {
         return mountInstance;
     }
 
-    public NetconfDeviceTopologyAdapter getTopologyDatastoreAdapter() {
-        final NetconfDeviceTopologyAdapter local = topologyDatastoreAdapter;
-        checkState(local != null,
-                "%s: Sal provider %s was not initialized by sal. Cannot get topology datastore adapter", id, this);
-        return local;
-    }
-
     @Override
     public void close() {
         mountInstance.close();
-        if (topologyDatastoreAdapter != null) {
-            topologyDatastoreAdapter.close();
-            topologyDatastoreAdapter = null;
-        }
     }
 
     public static class MountInstance implements AutoCloseable {