jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1483342 - /jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java
Date Thu, 16 May 2013 13:10:48 GMT
Author: mreutegg
Date: Thu May 16 13:10:47 2013
New Revision: 1483342

URL: http://svn.apache.org/r1483342
Log:
OAK-168: Basic JCR VersionManager support
- Checkout is allowed even with pending changes (Oak will currently save pending changes on
checkin)

Modified:
    jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java

Modified: jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java?rev=1483342&r1=1483341&r2=1483342&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java
(original)
+++ jackrabbit/oak/trunk/oak-jcr/src/main/java/org/apache/jackrabbit/oak/jcr/version/ReadWriteVersionManager.java
Thu May 16 13:10:47 2013
@@ -33,6 +33,8 @@ import org.apache.jackrabbit.oak.namepat
 import org.apache.jackrabbit.oak.plugins.nodetype.ReadOnlyNodeTypeManager;
 import org.apache.jackrabbit.oak.plugins.version.ReadOnlyVersionManager;
 import org.apache.jackrabbit.oak.plugins.version.VersionConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 
@@ -41,6 +43,7 @@ import static com.google.common.base.Pre
  */
 public class ReadWriteVersionManager extends ReadOnlyVersionManager {
 
+    private static final Logger log = LoggerFactory.getLogger(ReadWriteVersionManager.class);
     private final Tree versionStorage;
     private final Root workspaceRoot;
 
@@ -125,8 +128,6 @@ public class ReadWriteVersionManager ext
      * Performs a checkout on a versionable tree.
      *
      * @param versionable the versionable node to check out.
-     * @throws InvalidItemStateException if the current root has pending
-     *                                   changes.
      * @throws UnsupportedRepositoryOperationException
      *                                   if the versionable tree isn't actually
      *                                   versionable.
@@ -136,15 +137,17 @@ public class ReadWriteVersionManager ext
     public void checkout(@Nonnull Tree versionable)
             throws UnsupportedRepositoryOperationException,
             InvalidItemStateException, RepositoryException {
-        if (workspaceRoot.hasPendingChanges()) {
-            throw new InvalidItemStateException("Unable to perform checkout. " +
-                    "Session has pending changes.");
-        }
         if (!isVersionable(versionable)) {
             throw new UnsupportedRepositoryOperationException(
                     versionable.getPath() + " is not versionable");
         }
         if (!isCheckedOut(versionable)) {
+            if (workspaceRoot.hasPendingChanges()) {
+                // TODO: perform checkout on separate root and refresh session
+                //       while keeping pending changes.
+                log.warn("Session has pending changes. Checkout operation will " +
+                        "save those changes as well.");
+            }
             versionable.setProperty(VersionConstants.JCR_ISCHECKEDOUT,
                     Boolean.TRUE, Type.BOOLEAN);
             try {



Mime
View raw message