[dna-commits] DNA SVN: r1311 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Tue Oct 27 16:02:40 EDT 2009


Author: bcarothers
Date: 2009-10-27 16:02:40 -0400 (Tue, 27 Oct 2009)
New Revision: 1311

Modified:
   trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
Log:
DNA-457 Add JSR-170 Locking Optional Feature

The attached patch (DNA-457_fixed_RequestProcessor.patch) corrects the default RequestProcessor implementation to populate the actual location on the request, looking up the path for the node if necessary.

Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java	2009-10-27 19:12:46 UTC (rev 1310)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java	2009-10-27 20:02:40 UTC (rev 1311)
@@ -866,6 +866,21 @@
      * @param request the request
      */
     public void process( LockBranchRequest request ) {
+        Location actualLocation = request.at();
+        if (!actualLocation.hasPath()) {
+            VerifyNodeExistsRequest nodeExists = new VerifyNodeExistsRequest(request.at(), request.inWorkspace());
+
+            process(nodeExists);
+
+            if (nodeExists.hasError()) {
+                request.setError(nodeExists.getError());
+                return;
+            }
+
+            actualLocation = nodeExists.getActualLocationOfNode();
+        }
+
+        request.setActualLocation(actualLocation);
     }
 
     /**
@@ -879,6 +894,21 @@
      * @param request the request
      */
     public void process( UnlockBranchRequest request ) {
+        Location actualLocation = request.at();
+        if (!actualLocation.hasPath()) {
+            VerifyNodeExistsRequest nodeExists = new VerifyNodeExistsRequest(request.at(), request.inWorkspace());
+
+            process(nodeExists);
+
+            if (nodeExists.hasError()) {
+                request.setError(nodeExists.getError());
+                return;
+            }
+
+            actualLocation = nodeExists.getActualLocationOfNode();
+        }
+
+        request.setActualLocation(actualLocation);
     }
 
     /**



More information about the dna-commits mailing list