jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1328944 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/api/ oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/ oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/
Date Sun, 22 Apr 2012 19:29:50 GMT
Author: mduerig
Date: Sun Apr 22 19:29:50 2012
New Revision: 1328944

URL: http://svn.apache.org/viewvc?rev=1328944&view=rev
Log:
OAK-18: Define Oak API 
copy(), move() and removeNode() return boolean to indicate success or failure

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java?rev=1328944&r1=1328943&r2=1328944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/Branch.java
Sun Apr 22 19:29:50 2012
@@ -32,8 +32,9 @@ public interface Branch {
      *
      * @param sourcePath source path relative to this node state
      * @param destPath destination path relative to this node state
+     * @return  {@code true} on success, {@code false} otherwise.
      */
-    void move(String sourcePath, String destPath);
+    boolean move(String sourcePath, String destPath);
 
     /**
      * Copy the node state located at {@code sourcePath} to a node
@@ -44,8 +45,9 @@ public interface Branch {
      *
      * @param sourcePath source path relative to this node state
      * @param destPath destination path relative to this node state
+     * @return  {@code true} on success, {@code false} otherwise.
      */
-    void copy(String sourcePath, String destPath);
+    boolean copy(String sourcePath, String destPath);
 
     /**
      * Retrieve the child node state at the given {@code path}.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java?rev=1328944&r1=1328943&r2=1328944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/api/TransientNodeState.java
Sun Apr 22 19:29:50 2012
@@ -122,8 +122,9 @@ public interface TransientNodeState {
      * Remove the child node state with the given {@code name}. Does nothing
      * if no such child node exists.
      * @param name  name of the node state to remove
+     * @return  {@code false} iff no such child node exists.
      */
-    void removeNode(String name);
+    boolean removeNode(String name);
 
     /**
      * Set a single valued property state on this node state.

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java?rev=1328944&r1=1328943&r2=1328944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/KernelBranch.java
Sun Apr 22 19:29:50 2012
@@ -65,35 +65,37 @@ public class KernelBranch implements Bra
     }
 
     @Override
-    public void move(String sourcePath, String destPath) {
+    public boolean move(String sourcePath, String destPath) {
         TransientKernelNodeState sourceNode = getTransientState(sourcePath);
         if (sourceNode == null) {
-            return;
+            return false;
         }
 
         TransientKernelNodeState destParent = getTransientState(getParentPath(destPath));
         String destName = getName(destPath);
         if (destParent == null || destParent.hasNode(destName)) {
-            return;
+            return false;
         }
 
         sourceNode.move(destParent, destName);
+        return true;
     }
 
     @Override
-    public void copy(String sourcePath, String destPath) {
+    public boolean copy(String sourcePath, String destPath) {
         TransientKernelNodeState sourceNode = getTransientState(sourcePath);
         if (sourceNode == null) {
-            return;
+            return false;
         }
 
         TransientKernelNodeState destParent = getTransientState(getParentPath(destPath));
         String destName = getName(destPath);
         if (destParent == null || destParent.hasNode(destName)) {
-            return;
+            return false;
         }
 
         sourceNode.copy(destParent, destName);
+        return true;
     }
 
     @Override

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java?rev=1328944&r1=1328943&r2=1328944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/kernel/TransientKernelNodeState.java
Sun Apr 22 19:29:50 2012
@@ -381,12 +381,16 @@ public class TransientKernelNodeState im
     }
 
     @Override
-    public void removeNode(String name) {
+    public boolean removeNode(String name) {
         if (hasNode(name)) {
             markNodeRemoved(name);
             if (listener != null) {
                 listener.removeNode(this, name);
             }
+            return true;
+        }
+        else {
+            return false;
         }
     }
 

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java?rev=1328944&r1=1328943&r2=1328944&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/SessionImpl.java
Sun Apr 22 19:29:50 2012
@@ -58,8 +58,8 @@ public class SessionImpl extends Abstrac
     private final ValueFactory valueFactory;
     private final Workspace workspace;
     private final SessionContext<SessionImpl> sessionContext = new Context();
-    private boolean isAlive = true;
 
+    private boolean isAlive = true;
     private Branch branch;
 
     SessionImpl(GlobalContext globalContext, ContentSession contentSession) {
@@ -67,7 +67,6 @@ public class SessionImpl extends Abstrac
         this.contentSession = contentSession;
         this.valueFactory = new ValueFactoryImpl();
         workspace = new WorkspaceImpl(sessionContext);
-
         this.branch = contentSession.branchRoot();
     }
 



Mime
View raw message