jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r795735 - in /jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ version/
Date Mon, 20 Jul 2009 10:03:56 GMT
Author: tripod
Date: Mon Jul 20 10:03:56 2009
New Revision: 795735

URL: http://svn.apache.org/viewvc?rev=795735&view=rev
Log:
JCR-2209 Versioning operations should be done on the workspace

Added:
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java
  (contents, props changed)
      - copied, changed from r795452, jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java
Removed:
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java
Modified:
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplBase.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplMerge.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
    jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java

Copied: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java
(from r795452, jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java?p2=jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java&p1=jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java&r1=795452&r2=795735&rev=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java
Mon Jul 20 10:03:56 2009
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.core.version;
+package org.apache.jackrabbit.core;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
 
 import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
@@ -32,19 +32,18 @@
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
 
-import org.apache.jackrabbit.core.HierarchyManager;
-import org.apache.jackrabbit.core.ItemValidator;
-import org.apache.jackrabbit.core.LazyItemIterator;
-import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.RepositoryImpl;
-import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.WorkspaceImpl;
 import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.security.authorization.Permission;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.UpdatableItemStateManager;
+import org.apache.jackrabbit.core.version.InternalActivity;
+import org.apache.jackrabbit.core.version.InternalVersion;
+import org.apache.jackrabbit.core.version.InternalVersionHistory;
+import org.apache.jackrabbit.core.version.JcrVersionManagerImplMerge;
+import org.apache.jackrabbit.core.version.NodeStateEx;
+import org.apache.jackrabbit.core.version.VersionImpl;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;

Propchange: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/JcrVersionManagerImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
Mon Jul 20 10:03:56 2009
@@ -37,7 +37,6 @@
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.ItemVisitor;
-import javax.jcr.MergeException;
 import javax.jcr.NamespaceException;
 import javax.jcr.NoSuchWorkspaceException;
 import javax.jcr.Node;
@@ -60,12 +59,9 @@
 import javax.jcr.nodetype.PropertyDefinition;
 import javax.jcr.query.Query;
 import javax.jcr.query.QueryResult;
-import javax.jcr.version.OnParentVersionAction;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
-import javax.jcr.version.VersionIterator;
-import javax.jcr.version.VersionManager;
 
 import org.apache.jackrabbit.commons.JcrUtils;
 import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
@@ -93,16 +89,7 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.core.version.DateVersionSelector;
-import org.apache.jackrabbit.core.version.InternalFreeze;
-import org.apache.jackrabbit.core.version.InternalFrozenNode;
-import org.apache.jackrabbit.core.version.InternalFrozenVersionHistory;
-import org.apache.jackrabbit.core.version.InternalVersion;
-import org.apache.jackrabbit.core.version.InternalVersionHistory;
-import org.apache.jackrabbit.core.version.LabelVersionSelector;
-import org.apache.jackrabbit.core.version.VersionImpl;
-import org.apache.jackrabbit.core.version.VersionSelector;
-import org.apache.jackrabbit.core.version.JcrVersionManagerImpl;
+import org.apache.jackrabbit.core.JcrVersionManagerImpl;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Mon Jul 20 10:03:56 2009
@@ -989,10 +989,8 @@
      *                                  is not granted access to the specified
      *                                  workspace
      * @throws RepositoryException      if another error occurs
-     *
-     * FIX PUBLIC!!!!
      */
-    public final SessionImpl createSession(Subject subject,
+    protected final SessionImpl createSession(Subject subject,
                                               String workspaceName)
             throws NoSuchWorkspaceException, AccessDeniedException,
             RepositoryException {

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Mon Jul 20 10:03:56 2009
@@ -48,7 +48,6 @@
 import org.apache.jackrabbit.core.retention.RetentionRegistry;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
-import org.apache.jackrabbit.core.version.JcrVersionManagerImpl;
 import org.apache.jackrabbit.core.xml.ImportHandler;
 import org.apache.jackrabbit.core.xml.Importer;
 import org.apache.jackrabbit.core.xml.WorkspaceImporter;

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplBase.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplBase.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplBase.java
Mon Jul 20 10:03:56 2009
@@ -154,7 +154,7 @@
                 : null;
 
         // perform operation
-        JcrVersionManagerImpl.WriteOperation ops = startWriteOperation();
+        WriteOperation ops = startWriteOperation();
         try {
             // the 2 cases could be consolidated but is clearer this way
             if (checkin) {

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplMerge.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplMerge.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplMerge.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImplMerge.java
Mon Jul 20 10:03:56 2009
@@ -103,7 +103,7 @@
             // changes are made.
             return;
         }
-        JcrVersionManagerImpl.WriteOperation ops = startWriteOperation();
+        WriteOperation ops = startWriteOperation();
         try {
             internalMerge(state, srcRoot, failedIds, bestEffort, shallow);
             state.store();
@@ -380,7 +380,7 @@
             throw new VersionException(msg);
         }
 
-        JcrVersionManagerImpl.WriteOperation ops = startWriteOperation();
+        WriteOperation ops = startWriteOperation();
         try {
             // remove version from mergeFailed list
             setMergeFailed(state, failed);

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
Mon Jul 20 10:03:56 2009
@@ -164,7 +164,7 @@
             // check permissions
             checkVersionManagementPermission();
             session.getVersionManager().setVersionLabel(
-                    this, session.getQName(versionName),
+                    session, getInternalVersionHistory(), session.getQName(versionName),
                     session.getQName(label), move);
         } catch (NameException e) {
             throw new VersionException(e);
@@ -178,7 +178,8 @@
         try {
             // check permissions
             checkVersionManagementPermission();
-            javax.jcr.version.Version existing = session.getVersionManager().setVersionLabel(this,
null, session.getQName(label), true);
+            InternalVersion existing = session.getVersionManager().setVersionLabel(
+                    session, getInternalVersionHistory(), null, session.getQName(label),
true);
             if (existing == null) {
                 throw new VersionException("No version with label '" + label + "' exists
in this version history.");
             }
@@ -249,7 +250,8 @@
         try {
             // check permissions
             checkVersionManagementPermission();
-            session.getVersionManager().removeVersion(this, session.getQName(versionName));
+            session.getVersionManager().removeVersion(session,
+                    getInternalVersionHistory(), session.getQName(versionName));
         } catch (NameException e) {
             throw new RepositoryException(e);
         }

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
Mon Jul 20 10:03:56 2009
@@ -16,17 +16,14 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeImpl;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.spi.Name;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-
 /**
  * This interface defines the version manager. It gives access to the underlying
  * persistence layer of the versioning.
@@ -81,11 +78,12 @@
 
     /**
      * Removes the specified version from the given version history.
+     * @param session the session that performs the remove
      * @param history version history to remove the version from
      * @param versionName name of the version
      * @throws RepositoryException if an error occurs
      */
-    void removeVersion(VersionHistory history, Name versionName)
+    void removeVersion(Session session, InternalVersionHistory history, Name versionName)
             throws RepositoryException;
 
     /**
@@ -96,6 +94,7 @@
      * In either case, the version the label was previously assigned is returned,
      * or <code>null</code> of the label was not moved.
      *
+     * @param session the session that performs the operation
      * @param history version history
      * @param version name of the version
      * @param label new label
@@ -103,8 +102,10 @@
      * @return the version that had the label or <code>null</code>
      * @throws RepositoryException if an error occurs
      */
-    Version setVersionLabel(VersionHistory history, Name version, Name label,
-                            boolean move)
+    InternalVersion setVersionLabel(Session session, 
+                                    InternalVersionHistory history,
+                                    Name version, Name label,
+                                    boolean move)
             throws RepositoryException;
 
     /**

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
Mon Jul 20 10:03:56 2009
@@ -24,9 +24,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
 import javax.jcr.version.ActivityViolationException;
-import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
-import javax.jcr.version.VersionHistory;
 
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.core.SessionImpl;
@@ -434,20 +432,19 @@
      * This method must not be synchronized since it could cause deadlocks with
      * item-reading listeners in the observation thread.
      */
-    public void removeVersion(VersionHistory history, final Name name)
+    public void removeVersion(Session session,
+                              final InternalVersionHistory history,
+                              final Name name)
             throws VersionException, RepositoryException {
 
-        final VersionHistoryImpl historyImpl = (VersionHistoryImpl) history;
-        if (!historyImpl.hasNode(name)) {
+        if (!history.hasVersion(name)) {
             throw new VersionException("Version with name " + name.toString()
                     + " does not exist in this VersionHistory");
         }
 
-        escFactory.doSourced((SessionImpl) history.getSession(), new SourcedTarget() {
+        escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
             public Object run() throws RepositoryException {
-                InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl)
-                        historyImpl.getInternalVersionHistory();
-                internalRemoveVersion(vh, name);
+                internalRemoveVersion((InternalVersionHistoryImpl) history, name);
                 return null;
             }
         });
@@ -459,26 +456,18 @@
      * This method must not be synchronized since it could cause deadlocks with
      * item-reading listeners in the observation thread.
      */
-    public Version setVersionLabel(final VersionHistory history,
-                                   final Name version, final Name label,
-                                   final boolean move)
+    public InternalVersion setVersionLabel(Session session,
+                                           final InternalVersionHistory history,
+                                           final Name version, final Name label,
+                                           final boolean move)
             throws RepositoryException {
 
-        InternalVersion v = (InternalVersion)
-                escFactory.doSourced((SessionImpl) history.getSession(), new SourcedTarget()
{
+        return (InternalVersion)
+                escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
             public Object run() throws RepositoryException {
-                InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl)
-                        ((VersionHistoryImpl) history).getInternalVersionHistory();
-                return setVersionLabel(vh, version, label, move);
+                return setVersionLabel((InternalVersionHistoryImpl) history, version, label,
move);
             }
         });
-
-        if (v == null) {
-            return null;
-        } else {
-            return (Version)
-                    ((SessionImpl) history.getSession()).getNodeById(v.getId());
-        }
     }
 
     /**

Modified: jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java?rev=795735&r1=795734&r2=795735&view=diff
==============================================================================
--- jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
(original)
+++ jackrabbit/sandbox/tripod-JCR-2209/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
Mon Jul 20 10:03:56 2009
@@ -21,21 +21,20 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
-import javax.jcr.version.VersionHistory;
 
 import org.apache.jackrabbit.core.InternalXAResource;
-import org.apache.jackrabbit.core.id.ItemId;
-import org.apache.jackrabbit.core.id.NodeId;
-import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.TransactionContext;
 import org.apache.jackrabbit.core.TransactionException;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.observation.EventStateCollection;
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.state.ChangeLog;
+import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
+import org.apache.jackrabbit.core.state.ISMLocking.WriteLock;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateCacheFactory;
 import org.apache.jackrabbit.core.state.ItemStateException;
@@ -44,8 +43,6 @@
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.XAItemStateManager;
-import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
-import org.apache.jackrabbit.core.state.ISMLocking.WriteLock;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.core.virtual.VirtualNodeState;
 import org.apache.jackrabbit.core.virtual.VirtualPropertyState;
@@ -239,36 +236,31 @@
     /**
      * {@inheritDoc}
      */
-    public void removeVersion(VersionHistory history, Name versionName)
+    public void removeVersion(Session session, InternalVersionHistory history,
+                              Name versionName)
             throws RepositoryException {
-
         if (isInXA()) {
-            InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl)
-                    ((VersionHistoryImpl) history).getInternalVersionHistory();
-            internalRemoveVersion(vh, versionName);
-            return;
+            internalRemoveVersion((InternalVersionHistoryImpl) history, versionName);
+        } else {
+            vMgr.removeVersion(session, history, versionName);
         }
-        vMgr.removeVersion(history, versionName);
     }
 
     /**
      * {@inheritDoc}
      */
-    public Version setVersionLabel(VersionHistory history, Name version,
-                                   Name label, boolean move)
+    public InternalVersion setVersionLabel(Session session,
+                                           InternalVersionHistory history,
+                                           Name version,
+                                           Name label, boolean move)
             throws RepositoryException {
 
         if (isInXA()) {
-            InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl)
-                    ((VersionHistoryImpl) history).getInternalVersionHistory();
-            InternalVersion v = setVersionLabel(vh, version, label, move);
-            if (v == null) {
-                return null;
-            } else {
-                return (Version) ((SessionImpl) history.getSession()).getNodeById(v.getId());
-            }
+            return setVersionLabel((InternalVersionHistoryImpl) history,
+                    version, label, move);
+        } else {
+            return vMgr.setVersionLabel(session, history, version, label, move);
         }
-        return vMgr.setVersionLabel(history, version, label, move);
     }
 
     /**



Mime
View raw message