Split error messages
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / sal / LockChangeListener.java
index ee3d6a08aeaab6607e3c2bafd82136aab2e84aef..d0820e97a279b648185d715ad96de14df3314d3c 100644 (file)
@@ -12,6 +12,7 @@ import org.opendaylight.mdsal.binding.api.DataObjectModification;
 import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
 import org.opendaylight.mdsal.binding.api.DataTreeModification;
 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.netconf.dom.api.NetconfDataTreeService;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.optional.rev190614.netconf.node.fields.optional.topology.node.DatastoreLock;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -21,9 +22,12 @@ final class LockChangeListener implements DataTreeChangeListener<DatastoreLock>
     private static final Logger LOG = LoggerFactory.getLogger(LockChangeListener.class);
 
     private final NetconfDeviceDataBroker netconfDeviceDataBroker;
+    private final NetconfDataTreeServiceImpl netconfDataTreeService;
 
-    LockChangeListener(final DOMDataBroker netconfDeviceDataBrokder) {
+    LockChangeListener(final DOMDataBroker netconfDeviceDataBrokder,
+                       final NetconfDataTreeService netconfDataTreeService) {
         this.netconfDeviceDataBroker = (NetconfDeviceDataBroker)netconfDeviceDataBrokder;
+        this.netconfDataTreeService = (NetconfDataTreeServiceImpl) netconfDataTreeService;
     }
 
     @Override
@@ -39,9 +43,11 @@ final class LockChangeListener implements DataTreeChangeListener<DatastoreLock>
                                  + "the data store may interfere with data consistency.");
                     }
                     netconfDeviceDataBroker.setLockAllowed(rootNode.getDataAfter().isDatastoreLockAllowed());
+                    netconfDataTreeService.setLockAllowed(rootNode.getDataAfter().isDatastoreLockAllowed());
                     break;
                 case DELETE:
                     netconfDeviceDataBroker.setLockAllowed(true);
+                    netconfDataTreeService.setLockAllowed(true);
                     break;
                 default:
                     LOG.debug("Unsupported modification type: {}.", rootNode.getModificationType());