Netconf stack by default locks the data store before issuing
[netconf.git] / netconf / sal-netconf-connector / src / main / java / org / opendaylight / netconf / sal / connect / netconf / sal / NetconfDeviceDataBroker.java
index 694e120ae28d3f4fd9551bf5daeb9bc1da84ad2d..57c27280bd250e23b77a90aedbf24993a2a3b2ea 100644 (file)
@@ -30,13 +30,15 @@ import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
 public final class NetconfDeviceDataBroker implements PingPongMergingDOMDataBroker {
+
     private final RemoteDeviceId id;
     private final NetconfBaseOps netconfOps;
-
     private final boolean rollbackSupport;
     private final boolean candidateSupported;
     private final boolean runningWritable;
 
+    private boolean isLockAllowed = true;
+
     public NetconfDeviceDataBroker(final RemoteDeviceId id, final SchemaContext schemaContext,
                                    final DOMRpcService rpc, final NetconfSessionPreferences netconfSessionPreferences) {
         this.id = id;
@@ -65,12 +67,12 @@ public final class NetconfDeviceDataBroker implements PingPongMergingDOMDataBrok
     public DOMDataTreeWriteTransaction newWriteOnlyTransaction() {
         if (candidateSupported) {
             if (runningWritable) {
-                return new WriteCandidateRunningTx(id, netconfOps, rollbackSupport);
+                return new WriteCandidateRunningTx(id, netconfOps, rollbackSupport, isLockAllowed);
             } else {
-                return new WriteCandidateTx(id, netconfOps, rollbackSupport);
+                return new WriteCandidateTx(id, netconfOps, rollbackSupport, isLockAllowed);
             }
         } else {
-            return new WriteRunningTx(id, netconfOps, rollbackSupport);
+            return new WriteRunningTx(id, netconfOps, rollbackSupport, isLockAllowed);
         }
     }
 
@@ -83,4 +85,9 @@ public final class NetconfDeviceDataBroker implements PingPongMergingDOMDataBrok
     public ClassToInstanceMap<DOMDataBrokerExtension> getExtensions() {
         return ImmutableClassToInstanceMap.of();
     }
+
+    void setLockAllowed(boolean isLockAllowedOrig) {
+        this.isLockAllowed = isLockAllowedOrig;
+    }
+
 }