jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r773828 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/ jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ j...
Date Tue, 12 May 2009 08:59:35 GMT
Author: angela
Date: Tue May 12 08:59:34 2009
New Revision: 773828

URL: http://svn.apache.org/viewvc?rev=773828&view=rev
Log:
JCR-2104: JSR 283 Versioning
   - VersionHistory.getAllFrozenNodes()  (move iteratoradaptor from core to jcr-commons), VersionHistory.getVersionableIdentifier()
   - Version.getFrozenNode, Version.getLinearPredecessor()
   - VersionManager (work in progress): 170-methods, shallow merge, checkpoint
      -> extend SPI interfaces accordingly

JCR-2003: JCR2SPI / SPI: Add support for JCR 2.0
   - Session.hasPermission()
   - Node.getProperties/getNodes with glob
   - Node.getIdentifier()

JCR-2004: Update SPI locking to match JCR 2.0
   - separate JCR LockManager from the internal lock manager

Added:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java   (contents, props changed)
      - copied, changed from r773800, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/FrozenNodeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java   (contents, props changed)
      - copied, changed from r772858, jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
Removed:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/FrozenNodeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/DefaultVersionManager.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/OperationVisitor.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
    jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
    jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
    jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/JcrVersionManagerImpl.java Tue May 12 08:59:34 2009
@@ -20,20 +20,11 @@
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.InvalidItemStateException;
-import javax.jcr.PropertyType;
-import javax.jcr.lock.LockException;
-import javax.jcr.version.VersionException;
 
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
-import org.apache.jackrabbit.core.ItemValidator;
-import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.core.security.authorization.Permission;
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionHistory;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java Tue May 12 08:59:34 2009
@@ -24,6 +24,8 @@
 import org.apache.jackrabbit.core.security.authorization.Permission;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
+import org.apache.jackrabbit.commons.iterator.FrozenNodeIteratorAdapter;
+
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.Version;
 import org.slf4j.Logger;

Copied: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java (from r773800, jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/FrozenNodeIteratorAdapter.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java?p2=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java&p1=jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/FrozenNodeIteratorAdapter.java&r1=773800&r2=773828&rev=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/FrozenNodeIteratorAdapter.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java Tue May 12 08:59:34 2009
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.core.version;
+package org.apache.jackrabbit.commons.iterator;
 
 import javax.jcr.Node;
 import javax.jcr.NodeIterator;
@@ -22,7 +22,6 @@
 import javax.jcr.version.VersionIterator;
 
 import javax.jcr.version.Version;
-import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
 
 /**
  * Implements a node iterator that takes a version iterator and returns the

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FrozenNodeIteratorAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev Url

Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java?rev=773828&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java Tue May 12 08:59:34 2009
@@ -0,0 +1,125 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
+import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
+
+import javax.jcr.lock.LockManager;
+import javax.jcr.lock.LockException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Node;
+
+/**
+ * <code>JcrLockManager</code>...
+ */
+public class JcrLockManager implements LockManager {
+
+    /**
+     * logger instance
+     */
+    private static final Logger log = LoggerFactory.getLogger(JcrLockManager.class);
+
+    private final LockStateManager lockStateMgr;
+    private final ItemManager itemManager;
+    private final PathResolver resolver;
+
+    protected JcrLockManager(SessionImpl session) {
+        lockStateMgr = session.getLockStateManager();
+        itemManager = session.getItemManager();
+        resolver = session.getPathResolver();
+    }
+
+    //--------------------------------------------------------< LockManager >---
+    /**
+     * @see javax.jcr.lock.LockManager#getLock(String)
+     */
+    public javax.jcr.lock.Lock getLock(String absPath) throws LockException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.getLock();
+    }
+
+    /**
+     * @see javax.jcr.lock.LockManager#isLocked(String)
+     */
+    public boolean isLocked(String absPath) throws RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.isLocked();
+    }
+
+    /**
+     * @see javax.jcr.lock.LockManager#holdsLock(String)
+     */
+    public boolean holdsLock(String absPath) throws RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.holdsLock();
+    }
+
+    /**
+     * @see javax.jcr.lock.LockManager#lock(String, boolean, boolean, long, String)
+     */
+    public javax.jcr.lock.Lock lock(String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo) throws RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return ((NodeImpl) n).lock(isDeep, isSessionScoped, timeoutHint, ownerInfo);
+    }
+
+    /**
+     * @see javax.jcr.lock.LockManager#unlock(String)
+     */
+    public void unlock(String absPath) throws LockException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.unlock();
+    }
+
+    /**
+     * Returns the lock tokens present on the <code>SessionInfo</code> this
+     * manager has been created with.
+     *
+     * @see javax.jcr.lock.LockManager#getLockTokens()
+     */
+    public String[] getLockTokens() {
+        return lockStateMgr.getLockTokens();
+    }
+
+    /**
+     * Delegates this call to {@link WorkspaceManager#addLockToken(String)}.
+     * If this succeeds this method will inform all locks stored in the local
+     * map in order to give them the chance to update their lock information.
+     *
+     * @see javax.jcr.lock.LockManager#addLockToken(String)
+     */
+    public void addLockToken(String lt) throws LockException, RepositoryException {
+        lockStateMgr.addLockToken(lt);
+    }
+
+    /**
+     * If the lock addressed by the token is session-scoped, this method will
+     * throw a LockException, such as defined by JSR170 v.1.0.1 for
+     * {@link javax.jcr.Session#removeLockToken(String)}.<br>Otherwise the call is
+     * delegated to {@link WorkspaceManager#removeLockToken(String)}.
+     * All locks stored in the local lock map are notified by the removed
+     * token in order have them updated their lock information.
+     *
+     * @see javax.jcr.lock.LockManager#removeLockToken(String)
+     */
+    public void removeLockToken(String lt) throws LockException, RepositoryException {
+        lockStateMgr.removeLockToken(lt);
+    }
+
+}
\ No newline at end of file

Copied: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java (from r772858, jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java?p2=jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java&p1=jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java&r1=772858&r2=773828&rev=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java Tue May 12 08:59:34 2009
@@ -14,186 +14,224 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.jcr2spi.version;
+package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.state.Status;
-import org.apache.jackrabbit.jcr2spi.state.PropertyState;
-import org.apache.jackrabbit.jcr2spi.operation.Operation;
-import org.apache.jackrabbit.jcr2spi.operation.Checkout;
-import org.apache.jackrabbit.jcr2spi.operation.Checkin;
-import org.apache.jackrabbit.jcr2spi.operation.Restore;
-import org.apache.jackrabbit.jcr2spi.operation.ResolveMergeConflict;
-import org.apache.jackrabbit.jcr2spi.operation.Merge;
-import org.apache.jackrabbit.jcr2spi.operation.AddLabel;
-import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
-import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
-import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.slf4j.LoggerFactory;
 import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.version.VersionManager;
+import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
 
-import javax.jcr.RepositoryException;
-import javax.jcr.ItemNotFoundException;
+import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
-
-import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.spi.NodeId;
-import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.commons.name.NameConstants;
-
-import java.util.Iterator;
+import javax.jcr.version.VersionHistory;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.RepositoryException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.NodeIterator;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.MergeException;
+import javax.jcr.Node;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.lock.LockException;
 
 /**
  * <code>VersionManagerImpl</code>...
  */
-public class VersionManagerImpl implements VersionManager {
+public class JcrVersionManager implements javax.jcr.version.VersionManager {
 
-    private static Logger log = LoggerFactory.getLogger(VersionManagerImpl.class);
+    /**
+     * logger instance
+     */
+    private static final Logger log = LoggerFactory.getLogger(JcrVersionManager.class);
 
-    private final WorkspaceManager workspaceManager;
+    private final VersionManager vMgr;
+    private final SessionImpl session;
+    private final ItemManager itemManager;
+    private final PathResolver resolver;
 
-    public VersionManagerImpl(WorkspaceManager workspaceManager) {
-        this.workspaceManager = workspaceManager;
+    protected JcrVersionManager(SessionImpl session) {
+        this.session = session;
+        vMgr = session.getVersionStateManager();
+        itemManager = session.getItemManager();
+        resolver = session.getPathResolver();
     }
 
-    public NodeEntry checkin(NodeState nodeState) throws RepositoryException {
-        Checkin ci = Checkin.create(nodeState, this);
-        workspaceManager.execute(ci);
-        return workspaceManager.getHierarchyManager().getNodeEntry(ci.getNewVersionId());
+    //-----------------------------------------------------< VersionManager >---
+    /**
+     * @see javax.jcr.version.VersionManager#checkin(String)
+     */
+    public Version checkin(String absPath) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.checkin();
     }
 
-    public void checkout(NodeState nodeState) throws RepositoryException {
-        Operation co = Checkout.create(nodeState, this);
-        workspaceManager.execute(co);
+    /**
+     * @see javax.jcr.version.VersionManager#checkout(String)
+     */
+    public void checkout(String absPath) throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.checkout();
     }
 
     /**
-     * Search nearest ancestor that is versionable. If no versionable ancestor
-     * can be found, <code>true</code> is returned.
-     *
-     * @param nodeState
-     * @return
-     * @throws RepositoryException
+     * @see javax.jcr.version.VersionManager#checkpoint(String)
      */
-    public boolean isCheckedOut(NodeState nodeState) throws RepositoryException {
-        // shortcut: if state is new, its ancestor must be checkout
-        if (nodeState.getStatus() == Status.NEW) {
-            return true;
-        }
+    public Version checkpoint(String absPath) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException {
+        session.checkIsAlive();
+        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        return n.checkpoint();
+    }
 
-        NodeEntry nodeEntry = nodeState.getNodeEntry();
-        try {
-            // NOTE: since the hierarchy might not be completely loaded or some
-            // entry might even not be accessible, the check may not detect
-            // a checked-in parent. ok, as long as the 'server' finds out upon
-            // save or upon executing the workspace operation.
-            while (!nodeEntry.hasPropertyEntry(NameConstants.JCR_ISCHECKEDOUT)) {
-                NodeEntry parent = nodeEntry.getParent();
-                if (parent == null) {
-                    // reached root state without finding a jcr:isCheckedOut property
-                    return true;
-                }
-                nodeEntry = parent;
-            }
-            PropertyState propState = nodeEntry.getPropertyEntry(NameConstants.JCR_ISCHECKEDOUT).getPropertyState();
-            Boolean b = Boolean.valueOf(propState.getValue().getString());
-            return b.booleanValue();
-        } catch (ItemNotFoundException e) {
-            // error while accessing jcr:isCheckedOut property state.
-            // -> assume that checkedOut status is ok. see above for general
-            // notes about the capabilities of the jcr2spi implementation.
-        }
-        return true;
+    /**
+     * @see javax.jcr.version.VersionManager#isCheckedOut(String)
+     */
+    public boolean isCheckedOut(String absPath) throws RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.isCheckedOut();
     }
 
-    public void checkIsCheckedOut(NodeState nodeState) throws VersionException, RepositoryException {
-        if (!isCheckedOut(nodeState)) {
-            throw new VersionException(nodeState + " is checked-in");
-        }
+    /**
+     * @see javax.jcr.version.VersionManager#getVersionHistory(String)
+     */
+    public VersionHistory getVersionHistory(String absPath) throws UnsupportedRepositoryOperationException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.getVersionHistory();
+    }
+
+    /**
+     * @see javax.jcr.version.VersionManager#getBaseVersion(String)
+     */
+    public Version getBaseVersion(String absPath) throws UnsupportedRepositoryOperationException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.getBaseVersion();
     }
 
-    public void removeVersion(NodeState versionHistoryState, NodeState versionState) throws RepositoryException {
-        Operation op = RemoveVersion.create(versionState, versionHistoryState, this);
-        workspaceManager.execute(op);
+    /**
+     * @see javax.jcr.version.VersionManager#restore(Version[], boolean)
+     */
+    public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException {
+        session.checkIsAlive();
+        session.checkHasPendingChanges();
+
+        NodeState[] versionStates = new NodeState[versions.length];
+        for (int i = 0; i < versions.length; i++) {
+            versionStates[i] = session.getVersionState(versions[i]);
+        }
+        vMgr.restore(versionStates, removeExisting);
     }
 
-    public void addVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel, boolean moveLabel) throws RepositoryException {
-        Operation op = AddLabel.create(versionHistoryState, versionState, qLabel, moveLabel);
-        workspaceManager.execute(op);
+    /**
+     * @see javax.jcr.version.VersionManager#restore(String, String, boolean)
+     */
+    public void restore(String absPath, String versionName, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.restore(versionName, removeExisting);
     }
 
-    public void removeVersionLabel(NodeState versionHistoryState, NodeState versionState, Name qLabel) throws RepositoryException {
-        Operation op = RemoveLabel.create(versionHistoryState, versionState, qLabel);
-        workspaceManager.execute(op);
+    /**
+     * @see javax.jcr.version.VersionManager#restore(Version, boolean)
+     */
+    public void restore(Version version, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+        restore(new Version[]{version}, removeExisting);
     }
 
-    public void restore(NodeState nodeState, Path relativePath, NodeState versionState, boolean removeExisting) throws RepositoryException {
-        Operation op = Restore.create(nodeState, relativePath, versionState, removeExisting);
-        workspaceManager.execute(op);
+    /**
+     * @see javax.jcr.version.VersionManager#restore(String, Version, boolean)
+     */
+    public void restore(String absPath, Version version, boolean removeExisting) throws PathNotFoundException, ItemExistsException, VersionException, ConstraintViolationException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.restore(version, removeExisting);
     }
 
-    public void restore(NodeState[] versionStates, boolean removeExisting) throws RepositoryException {
-        Operation op = Restore.create(versionStates, removeExisting);
-        workspaceManager.execute(op);
+    /**
+     * @see javax.jcr.version.VersionManager#restoreByLabel(String, String, boolean)
+     */
+    public void restoreByLabel(String absPath, String versionLabel, boolean removeExisting) throws VersionException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.restoreByLabel(versionLabel, removeExisting);
     }
 
-    public Iterator merge(NodeState nodeState, String workspaceName, boolean bestEffort) throws RepositoryException {
-        Merge op = Merge.create(nodeState, workspaceName, bestEffort, this);
-        workspaceManager.execute(op);
-        return op.getFailedIds();
+    /**
+     * @see javax.jcr.version.VersionManager#merge(String, String, boolean)
+     */
+    public NodeIterator merge(String absPath, String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        return merge(absPath, srcWorkspace, bestEffort, false);
     }
 
-    public void resolveMergeConflict(NodeState nodeState, NodeState versionState,
-                                     boolean done) throws RepositoryException {
-        NodeId vId = versionState.getNodeId();
+    /**
+     * @see javax.jcr.version.VersionManager#merge(String, String, boolean, boolean)
+     */
+    public NodeIterator merge(String absPath, String srcWorkspace, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        // TODO: improve
+        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        return n.merge(srcWorkspace, bestEffort, isShallow);
+    }
 
-        PropertyState mergeFailedState = nodeState.getPropertyState(NameConstants.JCR_MERGEFAILED);
-        QValue[] vs = mergeFailedState.getValues();
+    /**
+     * @see javax.jcr.version.VersionManager#doneMerge(String, Version)
+     */
+    public void doneMerge(String absPath, Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.doneMerge(version);
+    }
 
-        NodeId[] mergeFailedIds = new NodeId[vs.length - 1];
-        for (int i = 0, j = 0; i < vs.length; i++) {
-            NodeId id = workspaceManager.getIdFactory().createNodeId(vs[i].getString());
-            if (!id.equals(vId)) {
-                mergeFailedIds[j] = id;
-                j++;
-            }
-            // else: the version id is being solved by this call and not
-            // part of 'jcr:mergefailed' any more
-        }
+    /**
+     * @see javax.jcr.version.VersionManager#cancelMerge(String, Version)
+     */
+    public void cancelMerge(String absPath, Version version) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
+        Node n = itemManager.getNode(resolver.getQPath(absPath));
+        n.cancelMerge(version);
+    }
 
-        PropertyState predecessorState = nodeState.getPropertyState(NameConstants.JCR_PREDECESSORS);
-        vs = predecessorState.getValues();
+    /**
+     * @see javax.jcr.version.VersionManager#createConfiguration(String, Version)
+     */
+    public Node createConfiguration(String absPath, Version baseline) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
 
-        int noOfPredecessors = (done) ? vs.length + 1 : vs.length;
-        NodeId[] predecessorIds = new NodeId[noOfPredecessors];
+    /**
+     * @see javax.jcr.version.VersionManager#setActivity(Node)
+     */
+    public Node setActivity(Node activity) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
 
-        int i = 0;
-        while (i < vs.length) {
-            predecessorIds[i] = workspaceManager.getIdFactory().createNodeId(vs[i].getString());
-            i++;
-        }
-        if (done) {
-            predecessorIds[i] = vId;
-        }
-        Operation op = ResolveMergeConflict.create(nodeState, mergeFailedIds, predecessorIds, done);
-        workspaceManager.execute(op);
+    /**
+     * @see javax.jcr.version.VersionManager#getActivity()
+     */
+    public Node getActivity() throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
     }
 
-    public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException {
-        NodeState ns = versionState.getChildNodeState(NameConstants.JCR_FROZENNODE, Path.INDEX_DEFAULT);
-        PropertyState ps = ns.getPropertyState(NameConstants.JCR_FROZENUUID);
-        String uniqueID = ps.getValue().getString();
+    /**
+     * @see javax.jcr.version.VersionManager#createActivity(String)
+     */
+    public Node createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
 
-        NodeId versionableId = workspaceManager.getIdFactory().createNodeId(uniqueID);
-        return workspaceManager.getHierarchyManager().getNodeEntry(versionableId);
+    /**
+     * @see javax.jcr.version.VersionManager#removeActivity(String)
+     */
+    public Node removeActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
     }
 
-    public NodeEntry getVersionHistoryEntry(NodeState versionableState) throws RepositoryException {
-        PropertyState ps = versionableState.getPropertyState(NameConstants.JCR_VERSIONHISTORY);
-        String uniqueID = ps.getValue().getString();
-        NodeId vhId = workspaceManager.getIdFactory().createNodeId(uniqueID);
-        return workspaceManager.getHierarchyManager().getNodeEntry(vhId);
+    /**
+     * @see javax.jcr.version.VersionManager#merge(Node)
+     */
+    public NodeIterator merge(Node activityNode) throws VersionException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        // TODO
+       throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
     }
 }
\ No newline at end of file

Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
------------------------------------------------------------------------------
    svn:keywords = author date id revision url

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Tue May 12 08:59:34 2009
@@ -799,6 +799,14 @@
         }
     }
 
+    Version checkpoint() throws RepositoryException {
+        checkIsVersionable();
+        checkHasPendingChanges();
+        checkIsLocked();
+        NodeEntry newVersion = session.getVersionStateManager().checkpoint(getNodeState());
+        return (Version) getItemManager().getItem(newVersion);
+    }
+    
     /**
      * @see Node#doneMerge(Version)
      */
@@ -881,6 +889,15 @@
      * @see Node#merge(String, boolean)
      */
     public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, VersionException, LockException, InvalidItemStateException, RepositoryException {
+        return merge(srcWorkspace, bestEffort, false);
+    }
+
+
+    /**
+     * TODO: Issue 728 of the pfd... this method is a leftover and will be removed in the final version.
+     * -> change to package protected then
+     */
+    public NodeIterator merge(String srcWorkspace, boolean bestEffort, boolean isShallow) throws RepositoryException {
         checkIsWritable();
         checkSessionHasPendingChanges();
 
@@ -891,7 +908,7 @@
         // make sure the workspace exists and is accessible for this session.
         session.checkAccessibleWorkspace(srcWorkspace);
 
-        Iterator failedIds = session.getVersionStateManager().merge(getNodeState(), srcWorkspace, bestEffort);
+        Iterator failedIds = session.getVersionStateManager().merge(getNodeState(), srcWorkspace, bestEffort, isShallow);
         return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), failedIds);
     }
 
@@ -1150,8 +1167,9 @@
      * @see Node#getIdentifier()
      */
     public String getIdentifier() throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        checkStatus();
+        // TODO: check again and add SPI method to create Node-Identifier from String
+        return getNodeEntry().getId().toString();
     }
 
     /**
@@ -1174,8 +1192,11 @@
      * @see javax.jcr.Node#getNodes(String[])
      */
     public NodeIterator getNodes(String[] nameGlobs) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        checkStatus();
+        List nodes = new ArrayList();
+        // traverse child nodes using a filtering collector
+        accept(new ChildrenCollectorFilter(nameGlobs, nodes, true, false, 1));
+        return new NodeIteratorAdapter(nodes);
     }
 
     /**
@@ -1183,8 +1204,11 @@
      * @see javax.jcr.Node#getProperty(String)
      */
     public PropertyIterator getProperty(String[] nameGlobs) throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        checkStatus();
+        List properties = new ArrayList();
+        // traverse child properties using a filtering collector
+        accept(new ChildrenCollectorFilter(nameGlobs, properties, true, false, 1));
+        return new PropertyIteratorAdapter(properties);
     }
 
     /**
@@ -1196,14 +1220,6 @@
     }
 
     /**
-     * @see javax.jcr.Node#getSharedSet()
-     */
-    public NodeIterator getSharedSet() throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
-    /**
      * @see javax.jcr.Node#getWeakReferences()
      */
     public PropertyIterator getWeakReferences() throws RepositoryException {
@@ -1220,9 +1236,9 @@
     }
 
     /**
-     * TODO: Issue 728 of the pfd... this method is a leftover and will be removed in the final version.
+     * @see javax.jcr.Node#getSharedSet()
      */
-    public NodeIterator merge(String srcWorkspace, boolean bestEffort, boolean isShallow) throws RepositoryException {
+    public NodeIterator getSharedSet() throws RepositoryException {
         // TODO: implementation missing
         throw new UnsupportedRepositoryOperationException("JCR-1104");
     }
@@ -1422,6 +1438,28 @@
         return (Node) getItemManager().getItem(nState.getHierarchyEntry());
     }
 
+    // TODO: protected due to usage within VersionImpl, VersionHistoryImpl (check for alternatives)
+    /**
+     *
+     * @param nodeName
+     * @param index
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
+    protected Node getNode(Name nodeName, int index) throws PathNotFoundException, RepositoryException {
+        checkStatus();
+        try {
+            NodeEntry nEntry = getNodeEntry().getNodeEntry(nodeName, index);
+            if (nEntry == null) {
+                throw new PathNotFoundException(LogUtil.saveGetJCRName(nodeName, session.getNameResolver()));
+            }
+            return (Node) getItemManager().getItem(nEntry);
+        } catch (AccessDeniedException e) {
+            throw new PathNotFoundException(LogUtil.saveGetJCRName(nodeName, session.getNameResolver()));
+        }
+    }
+
     /**
      *
      * @param qName

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java Tue May 12 08:59:34 2009
@@ -357,35 +357,7 @@
      * @see javax.jcr.Session#checkPermission(String, String)
      */
     public void checkPermission(String absPath, String actions) throws AccessControlException, RepositoryException {
-        checkIsAlive();
-        // build the array of actions to be checked
-        String[] actionsArr = actions.split(",");
-
-        Path targetPath = getQPath(absPath);
-
-        boolean isGranted;
-        // The given abs-path may point to a non-existing item
-        if (itemManager.nodeExists(targetPath)) {
-            NodeState nState = getHierarchyManager().getNodeState(targetPath);
-            isGranted = getAccessManager().isGranted(nState, actionsArr);
-        } else if (itemManager.propertyExists(targetPath)) {
-            PropertyState pState = getHierarchyManager().getPropertyState(targetPath);
-            isGranted = getAccessManager().isGranted(pState, actionsArr);
-        } else {
-            NodeState parentState = null;
-            Path parentPath = targetPath;
-            while (parentState == null) {
-                parentPath = parentPath.getAncestor(1);
-                if (itemManager.nodeExists(parentPath)) {
-                    parentState = getHierarchyManager().getNodeState(parentPath);
-                }
-            }
-            // parentState is the nearest existing nodeState or the root state.
-            Path relPath = parentPath.computeRelativePath(targetPath);
-            isGranted = getAccessManager().isGranted(parentState, relPath, actionsArr);
-        }
-
-        if (!isGranted) {
+        if (!hasPermission(absPath, actions)) {
             throw new AccessControlException("Access control violation: path = " + absPath + ", actions = " + actions);
         }
     }
@@ -569,10 +541,35 @@
     /**
      * @see Session#hasPermission(String, String)
      */
-    public boolean hasPermission(String absPath, String actions)
-            throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+    public boolean hasPermission(String absPath, String actions) throws RepositoryException {
+        checkIsAlive();
+        // build the array of actions to be checked
+        String[] actionsArr = actions.split(",");
+
+        Path targetPath = getQPath(absPath);
+
+        boolean isGranted;
+        // The given abs-path may point to a non-existing item
+        if (itemManager.nodeExists(targetPath)) {
+            NodeState nState = getHierarchyManager().getNodeState(targetPath);
+            isGranted = getAccessManager().isGranted(nState, actionsArr);
+        } else if (itemManager.propertyExists(targetPath)) {
+            PropertyState pState = getHierarchyManager().getPropertyState(targetPath);
+            isGranted = getAccessManager().isGranted(pState, actionsArr);
+        } else {
+            NodeState parentState = null;
+            Path parentPath = targetPath;
+            while (parentState == null) {
+                parentPath = parentPath.getAncestor(1);
+                if (itemManager.nodeExists(parentPath)) {
+                    parentState = getHierarchyManager().getNodeState(parentPath);
+                }
+            }
+            // parentState is the nearest existing nodeState or the root state.
+            Path relPath = parentPath.computeRelativePath(targetPath);
+            isGranted = getAccessManager().isGranted(parentState, relPath, actionsArr);
+        }
+        return isGranted;
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java Tue May 12 08:59:34 2009
@@ -105,6 +105,9 @@
     private QueryManager qManager;
     private VersionManager versionManager;
 
+    private LockManager jcrLockManager;
+    private javax.jcr.version.VersionManager jcrVersionManager;
+
     public WorkspaceImpl(String name, SessionImpl session, RepositoryConfig config, SessionInfo sessionInfo) throws RepositoryException {
         this.name = name;
         this.session = session;
@@ -245,13 +248,7 @@
      * @see javax.jcr.Workspace#restore(Version[], boolean)
      */
     public void restore(Version[] versions, boolean removeExisting) throws ItemExistsException, UnsupportedRepositoryOperationException, VersionException, LockException, InvalidItemStateException, RepositoryException {
-        session.checkHasPendingChanges();
-
-        NodeState[] versionStates = new NodeState[versions.length];
-        for (int i = 0; i < versions.length; i++) {
-            versionStates[i] = session.getVersionState(versions[i]);
-        }
-        getVersionStateManager().restore(versionStates, removeExisting);
+        getVersionManager().restore(versions, removeExisting);
     }
 
     /**
@@ -379,16 +376,23 @@
     public LockManager getLockManager() throws RepositoryException {
         session.checkIsAlive();
         session.checkSupportedOption(Repository.OPTION_LOCKING_SUPPORTED);
-        return getLockStateManager();
+        if (jcrLockManager == null) {
+            jcrLockManager = new JcrLockManager(session);
+        }
+        return jcrLockManager;
     }
 
     /**
      * @see javax.jcr.Workspace#getVersionManager()
      */
-    public javax.jcr.version.VersionManager getVersionManager()
+    public synchronized javax.jcr.version.VersionManager getVersionManager()
             throws RepositoryException {
-        // TODO: implementation missing
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        session.checkIsAlive();
+        session.checkSupportedOption(Repository.OPTION_VERSIONING_SUPPORTED);
+        if (jcrVersionManager == null) {
+            jcrVersionManager = new JcrVersionManager(session);
+        }
+        return jcrVersionManager;
     }
 
     //----------------------------------------------------< ManagerProvider >---
@@ -537,10 +541,10 @@
      *
      * @param wspManager
      * @param itemManager
-     * @return a new <code>LockManager</code> instance.
+     * @return a new <code>LockStateManager</code> instance.
      */
     protected LockStateManager createLockManager(WorkspaceManager wspManager, ItemManager itemManager) {
-        LockManagerImpl lMgr = new LockManagerImpl(wspManager, itemManager, session.getCacheBehaviour(), getPathResolver());
+        LockManagerImpl lMgr = new LockManagerImpl(wspManager, itemManager, session.getCacheBehaviour());
         session.addListener(lMgr);
         return lMgr;
     }

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java Tue May 12 08:59:34 2009
@@ -56,6 +56,7 @@
 import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
 import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
 import org.apache.jackrabbit.jcr2spi.operation.WorkspaceImport;
+import org.apache.jackrabbit.jcr2spi.operation.Checkpoint;
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
 import org.apache.jackrabbit.jcr2spi.observation.InternalEventListener;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
@@ -902,6 +903,15 @@
 
         /**
          * @inheritDoc
+         * @see OperationVisitor#visit(Checkpoint)
+         */
+        public void visit(Checkpoint operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+            NodeId newId = service.checkpoint(sessionInfo, operation.getNodeId());
+            operation.setNewVersionId(newId);
+        }
+
+        /**
+         * @inheritDoc
          * @see OperationVisitor#visit(Restore)
          */
         public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
@@ -927,7 +937,7 @@
          */
         public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
             NodeId nId = operation.getNodeId();
-            Iterator failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort());
+            Iterator failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort(), operation.isShallow());
             operation.setFailedIds(failed);
         }
 

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockManagerImpl.java Tue May 12 08:59:34 2009
@@ -19,7 +19,6 @@
 import org.apache.jackrabbit.jcr2spi.ItemManager;
 import org.apache.jackrabbit.jcr2spi.SessionListener;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
-import org.apache.jackrabbit.jcr2spi.NodeImpl;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.operation.LockOperation;
@@ -69,7 +68,6 @@
     private final WorkspaceManager wspManager;
     private final ItemManager itemManager;
     private final CacheBehaviour cacheBehaviour;
-    private final PathResolver resolver;
 
     /**
      * Map holding all locks that where created by this <code>Session</code> upon
@@ -81,115 +79,15 @@
     private final Map lockMap;
 
     public LockManagerImpl(WorkspaceManager wspManager, ItemManager itemManager,
-                           CacheBehaviour cacheBehaviour, PathResolver pathResolver) {
+                           CacheBehaviour cacheBehaviour) {
         this.wspManager = wspManager;
         this.itemManager = itemManager;
         this.cacheBehaviour = cacheBehaviour;
-        this.resolver = pathResolver;
         // use hard references in order to make sure, that entries refering
         // to locks created by the current session are not removed.
         lockMap = new HashMap();
     }
 
-    //--------------------------------------------------------< LockManager >---
-    /**
-     * @see javax.jcr.lock.LockManager#getLock(String)
-     */
-    public javax.jcr.lock.Lock getLock(String absPath) throws LockException, RepositoryException {
-        Node n = itemManager.getNode(resolver.getQPath(absPath));
-        return (javax.jcr.lock.Lock) n.getLock();
-    }
-
-    /**
-     * @see javax.jcr.lock.LockManager#isLocked(String)
-     */
-    public boolean isLocked(String absPath) throws RepositoryException {
-        Node n = itemManager.getNode(resolver.getQPath(absPath));
-        return n.isLocked();
-    }
-
-    /**
-     * @see javax.jcr.lock.LockManager#holdsLock(String)
-     */
-    public boolean holdsLock(String absPath) throws RepositoryException {
-        Node n = itemManager.getNode(resolver.getQPath(absPath));
-        return n.holdsLock();
-    }
-
-    /**
-     * @see javax.jcr.lock.LockManager#lock(String, boolean, boolean, long, String)
-     */
-    public javax.jcr.lock.Lock lock(String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint, String ownerInfo) throws RepositoryException {
-        Node n = itemManager.getNode(resolver.getQPath(absPath));
-        return (javax.jcr.lock.Lock) ((NodeImpl) n).lock(isDeep, isSessionScoped, timeoutHint, ownerInfo);
-    }
-
-    /**
-     * @see javax.jcr.lock.LockManager#unlock(String) 
-     */
-    public void unlock(String absPath) throws LockException, RepositoryException {
-        Node n = itemManager.getNode(resolver.getQPath(absPath));
-        n.unlock();
-    }
-
-    /**
-     * Returns the lock tokens present on the <code>SessionInfo</code> this
-     * manager has been created with.
-     *
-     * @see javax.jcr.lock.LockManager#getLockTokens()
-     */
-    public String[] getLockTokens() {
-        return wspManager.getLockTokens();
-    }
-
-    /**
-     * Delegates this call to {@link WorkspaceManager#addLockToken(String)}.
-     * If this succeeds this method will inform all locks stored in the local
-     * map in order to give them the chance to update their lock information.
-     *
-     * @see javax.jcr.lock.LockManager#addLockToken(String)
-     */
-    public void addLockToken(String lt) throws LockException, RepositoryException {
-        wspManager.addLockToken(lt);
-        notifyTokenAdded(lt);
-    }
-
-    /**
-     * If the lock addressed by the token is session-scoped, this method will
-     * throw a LockException, such as defined by JSR170 v.1.0.1 for
-     * {@link Session#removeLockToken(String)}.<br>Otherwise the call is
-     * delegated to {@link WorkspaceManager#removeLockToken(String)}.
-     * All locks stored in the local lock map are notified by the removed
-     * token in order have them updated their lock information.
-     *
-     * @see javax.jcr.lock.LockManager#removeLockToken(String)
-     */
-    public void removeLockToken(String lt) throws LockException, RepositoryException {
-        // JSR170 v. 1.0.1 defines that the token of a session-scoped lock may
-        // not be moved over to another session. thus removal ist not possible
-        // and the lock is always present in the lock map.
-        Iterator it = lockMap.values().iterator();
-        boolean found = false;
-        // loop over cached locks to determine if the token belongs to a session
-        // scoped lock, in which case the removal must fail immediately.
-        while (it.hasNext() && !found) {
-            LockImpl l = (LockImpl) it.next();
-            if (lt.equals(l.getLockToken())) {
-                // break as soon as the lock associated with the given token was found.
-                found = true;
-                if (l.isSessionScoped()) {
-                    throw new LockException("Cannot remove lock token associated with a session scoped lock.");
-                }
-            }
-        }
-
-        // remove lock token from sessionInfo. call will fail, if the session
-        // is not lock holder.
-        wspManager.removeLockToken(lt);
-        // inform about this lt being removed from this session
-        notifyTokenRemoved(lt);
-    }
-
     //----------------< org.apache.jackrabbit.jcr2spi.lock.LockStateManager >---
     /**
      * @see LockStateManager#lock(NodeState,boolean,boolean)
@@ -287,6 +185,65 @@
         } // else: state is not locked at all || session is lock-holder
     }
 
+
+    /**
+     * Returns the lock tokens present on the <code>SessionInfo</code> this
+     * manager has been created with.
+     *
+     * @see LockStateManager#getLockTokens()
+     */
+    public String[] getLockTokens() {
+        return wspManager.getLockTokens();
+    }
+
+    /**
+     * Delegates this call to {@link WorkspaceManager#addLockToken(String)}.
+     * If this succeeds this method will inform all locks stored in the local
+     * map in order to give them the chance to update their lock information.
+     *
+     * @see LockStateManager#addLockToken(String)
+     */
+    public void addLockToken(String lt) throws LockException, RepositoryException {
+        wspManager.addLockToken(lt);
+        notifyTokenAdded(lt);
+    }
+
+    /**
+     * If the lock addressed by the token is session-scoped, this method will
+     * throw a LockException, such as defined by JSR170 v.1.0.1 for
+     * {@link Session#removeLockToken(String)}.<br>Otherwise the call is
+     * delegated to {@link WorkspaceManager#removeLockToken(String)}.
+     * All locks stored in the local lock map are notified by the removed
+     * token in order have them updated their lock information.
+     *
+     * @see LockStateManager#removeLockToken(String)
+     */
+    public void removeLockToken(String lt) throws LockException, RepositoryException {
+        // JSR170 v. 1.0.1 defines that the token of a session-scoped lock may
+        // not be moved over to another session. thus removal ist not possible
+        // and the lock is always present in the lock map.
+        Iterator it = lockMap.values().iterator();
+        boolean found = false;
+        // loop over cached locks to determine if the token belongs to a session
+        // scoped lock, in which case the removal must fail immediately.
+        while (it.hasNext() && !found) {
+            LockImpl l = (LockImpl) it.next();
+            if (lt.equals(l.getLockToken())) {
+                // break as soon as the lock associated with the given token was found.
+                found = true;
+                if (l.isSessionScoped()) {
+                    throw new LockException("Cannot remove lock token associated with a session scoped lock.");
+                }
+            }
+        }
+
+        // remove lock token from sessionInfo. call will fail, if the session
+        // is not lock holder.
+        wspManager.removeLockToken(lt);
+        // inform about this lt being removed from this session
+        notifyTokenRemoved(lt);
+    }
+
     //----------------------------------------------------< SessionListener >---
     /**
      * @see SessionListener#loggingOut(Session)

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java Tue May 12 08:59:34 2009
@@ -19,14 +19,13 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockException;
-import javax.jcr.lock.LockManager;
 
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 
 /**
  * Defines the functionality needed for locking and unlocking nodes.
  */
-public interface LockStateManager extends LockManager {
+public interface LockStateManager {
 
     /**
      * Lock a node. Checks whether the node is not locked and then

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Merge.java Tue May 12 08:59:34 2009
@@ -42,14 +42,16 @@
     private final NodeState nodeState;
     private final String srcWorkspaceName;
     private final boolean bestEffort;
+    private final boolean isShallow;
     private final VersionManager mgr;
 
     private Iterator failedIds = null;
 
-    private Merge(NodeState nodeState, String srcWorkspaceName, boolean bestEffort, VersionManager mgr) {
+    private Merge(NodeState nodeState, String srcWorkspaceName, boolean bestEffort, boolean isShallow, VersionManager mgr) {
         this.nodeState = nodeState;
         this.srcWorkspaceName = srcWorkspaceName;
         this.bestEffort = bestEffort;
+        this.isShallow = isShallow;
         this.mgr = mgr;
 
         // NOTE: affected-states only needed for transient modifications
@@ -96,6 +98,10 @@
         return bestEffort;
     }
 
+    public boolean isShallow() {
+        return isShallow;
+    }
+
     public void setFailedIds(Iterator failedIds) {
         if (failedIds == null) {
             throw new IllegalArgumentException("IdIterator must not be null.");
@@ -119,7 +125,7 @@
      * @param srcWorkspaceName
      * @return
      */
-    public static Merge create(NodeState nodeState, String srcWorkspaceName, boolean bestEffort, VersionManager mgr) {
-        return new Merge(nodeState, srcWorkspaceName, bestEffort, mgr);
+    public static Merge create(NodeState nodeState, String srcWorkspaceName, boolean bestEffort, boolean isShallow, VersionManager mgr) {
+        return new Merge(nodeState, srcWorkspaceName, bestEffort, isShallow, mgr);
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/OperationVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/OperationVisitor.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/OperationVisitor.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/OperationVisitor.java Tue May 12 08:59:34 2009
@@ -58,6 +58,8 @@
 
     public void visit(Checkin operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException;
 
+    public void visit(Checkpoint operation) throws RepositoryException;
+
     public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException;
 
     public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java Tue May 12 08:59:34 2009
@@ -43,6 +43,7 @@
 import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
 import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
 import org.apache.jackrabbit.jcr2spi.operation.WorkspaceImport;
+import org.apache.jackrabbit.jcr2spi.operation.Checkpoint;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.ManagerProvider;
@@ -416,7 +417,7 @@
 
     /**
      * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Clone)
+     * @see OperationVisitor#visit(Copy)
      */
     public void visit(Copy operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
         throw new UnsupportedOperationException("Internal error: Copy cannot be handled by session ItemStateManager.");
@@ -424,7 +425,7 @@
 
     /**
      * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Clone)
+     * @see OperationVisitor#visit(Checkout)
      */
     public void visit(Checkout operation) throws RepositoryException, UnsupportedRepositoryOperationException {
         throw new UnsupportedOperationException("Internal error: Checkout cannot be handled by session ItemStateManager.");
@@ -432,7 +433,7 @@
 
     /**
      * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Clone)
+     * @see OperationVisitor#visit(Checkin)
      */
     public void visit(Checkin operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
         throw new UnsupportedOperationException("Internal error: Checkin cannot be handled by session ItemStateManager.");
@@ -440,6 +441,14 @@
 
     /**
      * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Checkpoint)
+     */
+    public void visit(Checkpoint operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Checkin cannot be handled by session ItemStateManager.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
      * @see OperationVisitor#visit(Update)
      */
     public void visit(Update operation) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException {

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Tue May 12 08:59:34 2009
@@ -35,6 +35,7 @@
 import javax.jcr.version.VersionIterator;
 
 import org.apache.jackrabbit.commons.iterator.RangeIteratorAdapter;
+import org.apache.jackrabbit.commons.iterator.FrozenNodeIteratorAdapter;
 import org.apache.jackrabbit.jcr2spi.ItemLifeCycleListener;
 import org.apache.jackrabbit.jcr2spi.LazyItemIterator;
 import org.apache.jackrabbit.jcr2spi.NodeImpl;
@@ -78,8 +79,7 @@
      * @see VersionHistory#getVersionableUUID()
      */
     public String getVersionableUUID() throws RepositoryException {
-        checkStatus();
-        return getProperty(NameConstants.JCR_VERSIONABLEUUID).getString();
+        return getVersionableIdentifier();
     }
 
     /**
@@ -237,14 +237,13 @@
      * @see VersionHistory#getAllFrozenNodes()
      */
     public NodeIterator getAllFrozenNodes() throws RepositoryException {
-        // TODO
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        return new FrozenNodeIteratorAdapter(getAllVersions());
     }
 
     /**
      * @see VersionHistory#getAllLinearFrozenNodes()
      */
-    public NodeIterator getAllLinearFrozenNodes() throws RepositoryException {
+    public NodeIterator getAllLinearFrozenNodes() throws RepositoryException {        
         // TODO
         throw new UnsupportedRepositoryOperationException("JCR-1104");
     }
@@ -261,8 +260,8 @@
      * @see VersionHistory#getVersionableIdentifier()
      */
     public String getVersionableIdentifier() throws RepositoryException {
-        // TODO
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        checkStatus();
+        return getProperty(NameConstants.JCR_VERSIONABLEUUID).getString();
     }
     
     //---------------------------------------------------------------< Item >---

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionImpl.java Tue May 12 08:59:34 2009
@@ -79,6 +79,14 @@
     }
 
     /**
+     * @see Version#getLinearSuccessor()
+     */
+    public Version getLinearSuccessor() throws RepositoryException {
+        // TODO
+        throw new UnsupportedRepositoryOperationException("JCR-1104");
+    }
+    
+    /**
      *
      * @return
      * @throws RepositoryException
@@ -89,27 +97,28 @@
     }
 
     /**
-     * @see Version#getFrozenNode()
-     */
-    public Node getFrozenNode() throws RepositoryException {
-        // TODO
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
-    }
-
-    /**
      * @see Version#getLinearPredecessor()
      */
     public Version getLinearPredecessor() throws RepositoryException {
-        // TODO
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+        Value[] values = getProperty(NameConstants.JCR_PREDECESSORS).getValues();
+        if (values != null && values.length > 0) {
+            Node n = session.getNodeByUUID(values[0].getString());
+            if (n instanceof Version) {
+                return (Version) n;
+            } else {
+                throw new RepositoryException("Version property contains invalid value not pointing to a 'Version'");
+            }
+        } else {
+            return null;
+        }
     }
 
     /**
-     * @see Version#getLinearSuccessor()
+     * @see Version#getFrozenNode()
      */
-    public Version getLinearSuccessor() throws RepositoryException {
-        // TODO
-        throw new UnsupportedRepositoryOperationException("JCR-1104");
+    public Node getFrozenNode() throws RepositoryException {
+        return getNode(NameConstants.JCR_FROZENNODE, 1);
+
     }
 
     //---------------------------------------------------------------< Item >---

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManager.java Tue May 12 08:59:34 2009
@@ -62,6 +62,13 @@
 
     /**
      * @param nodeState
+     * @throws RepositoryException
+     * @see javax.jcr.version.VersionManager#checkpoint(String)
+     */
+    public NodeEntry checkpoint(NodeState nodeState) throws RepositoryException;
+
+    /**
+     * @param nodeState
      * @return
      * @throws RepositoryException
      * @see javax.jcr.Node#isCheckedOut()
@@ -160,6 +167,25 @@
 
     /**
      * @param nodeState
+     * @param workspaceName
+     * @param bestEffort
+     * @param isShallow
+     * @return An Iterator over <code>NodeId</code>s of all <code>Node</code>s
+     * that failed to be merged and need manual resolution by the user of the API.
+     * @throws NoSuchWorkspaceException
+     * @throws AccessDeniedException
+     * @throws MergeException
+     * @throws LockException
+     * @throws InvalidItemStateException
+     * @throws RepositoryException
+     * @see #resolveMergeConflict(NodeState,NodeState,boolean)
+     * @see javax.jcr.Node#merge(String, boolean)
+     */
+    public Iterator merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+
+
+    /**
+     * @param nodeState
      * @param versionState
      * @param done
      * @throws VersionException

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionManagerImpl.java Tue May 12 08:59:34 2009
@@ -28,6 +28,7 @@
 import org.apache.jackrabbit.jcr2spi.operation.AddLabel;
 import org.apache.jackrabbit.jcr2spi.operation.RemoveLabel;
 import org.apache.jackrabbit.jcr2spi.operation.RemoveVersion;
+import org.apache.jackrabbit.jcr2spi.operation.Checkpoint;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.slf4j.LoggerFactory;
@@ -35,6 +36,11 @@
 
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemNotFoundException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.MergeException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.lock.LockException;
 import javax.jcr.version.VersionException;
 
 import org.apache.jackrabbit.spi.Name;
@@ -69,6 +75,12 @@
         workspaceManager.execute(co);
     }
 
+    public NodeEntry checkpoint(NodeState nodeState) throws RepositoryException {
+        Checkpoint cp = Checkpoint.create(nodeState, this);
+        workspaceManager.execute(cp);
+        return workspaceManager.getHierarchyManager().getNodeEntry(cp.getNewVersionId());
+    }
+
     /**
      * Search nearest ancestor that is versionable. If no versionable ancestor
      * can be found, <code>true</code> is returned.
@@ -140,7 +152,11 @@
     }
 
     public Iterator merge(NodeState nodeState, String workspaceName, boolean bestEffort) throws RepositoryException {
-        Merge op = Merge.create(nodeState, workspaceName, bestEffort, this);
+        return merge(nodeState, workspaceName, bestEffort, false);
+    }
+
+    public Iterator merge(NodeState nodeState, String workspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        Merge op = Merge.create(nodeState, workspaceName, bestEffort, isShallow, this);
         workspaceManager.execute(op);
         return op.getFailedIds();
     }

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/AbstractReadableRepositoryService.java Tue May 12 08:59:34 2009
@@ -547,6 +547,14 @@
     /**
      * @throws UnsupportedRepositoryOperationException always.
      */
+    public NodeId checkpoint(SessionInfo sessionInfo, NodeId nodeId)
+            throws UnsupportedRepositoryOperationException, LockException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
     public void removeVersion(SessionInfo sessionInfo,
                               NodeId versionHistoryId,
                               NodeId versionId)
@@ -586,6 +594,17 @@
     /**
      * @throws UnsupportedRepositoryOperationException always.
      */
+    public Iterator merge(SessionInfo sessionInfo,
+                          NodeId nodeId,
+                          String srcWorkspaceName,
+                          boolean bestEffort,
+                          boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
     public void resolveMergeConflict(SessionInfo sessionInfo,
                                      NodeId nodeId,
                                      NodeId[] mergeFailedIds,

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/logging/RepositoryServiceLogger.java Tue May 12 08:59:34 2009
@@ -22,6 +22,7 @@
 
 import javax.jcr.Credentials;
 import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 
 import org.apache.jackrabbit.spi.Batch;
 import org.apache.jackrabbit.spi.EventBundle;
@@ -384,6 +385,14 @@
         }, "checkout(SessionInfo, NodeId)", new Object[]{unwrap(sessionInfo), nodeId});
     }
 
+    public NodeId checkpoint(final SessionInfo sessionInfo, final NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        return (NodeId) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return service.checkpoint(unwrap(sessionInfo), nodeId);
+            }
+        }, "checkpoint(SessionInfo, NodeId)", new Object[]{unwrap(sessionInfo), nodeId});
+    }
+
     public void removeVersion(final SessionInfo sessionInfo, final NodeId versionHistoryId,
             final NodeId versionId) throws RepositoryException {
 
@@ -431,6 +440,17 @@
                 new Object[]{unwrap(sessionInfo), nodeId, srcWorkspaceName, Boolean.valueOf(bestEffort)});
     }
 
+    public Iterator merge(final SessionInfo sessionInfo, final NodeId nodeId, final String srcWorkspaceName,
+            final boolean bestEffort, final boolean isShallow) throws RepositoryException {
+
+        return (Iterator) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return service.merge(unwrap(sessionInfo), nodeId, srcWorkspaceName, bestEffort, isShallow);
+            }
+        }, "merge(SessionInfo, NodeId, String, boolean, boolean)",
+                new Object[]{unwrap(sessionInfo), nodeId, srcWorkspaceName, Boolean.valueOf(bestEffort)});
+    }
+
     public void resolveMergeConflict(final SessionInfo sessionInfo, final NodeId nodeId,
             final NodeId[] mergeFailedIds, final NodeId[] predecessorIds) throws RepositoryException {
 

Modified: jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java (original)
+++ jackrabbit/trunk/jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/RepositoryService.java Tue May 12 08:59:34 2009
@@ -601,6 +601,19 @@
     public void checkout(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, LockException, RepositoryException;
 
     /**
+     * Performs a checkpoint for the <code>Node</code> identified by the given
+     * <code>NodeId</code>.
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.lock.LockException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.version.VersionManager#checkpoint(String)
+     */
+    public NodeId checkpoint(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
      * Remove the version inditified by the specified <code>versionId</code>.
      *
      * @param sessionInfo
@@ -687,6 +700,27 @@
     public Iterator merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
 
     /**
+      * Merge the node identified by the given <code>NodeId</code> and its subtree
+      * with the corresponding node present in the workspace with the name of
+      * <code>srcWorkspaceName</code>.
+      *
+      * @param sessionInfo
+      * @param nodeId
+      * @param srcWorkspaceName
+      * @param bestEffort
+      * @return an <code>Iterator</code> over the {@link NodeId}s of all nodes that
+      * received a merge result of "fail" in the course of this operation.
+      * @throws javax.jcr.NoSuchWorkspaceException
+      * @throws javax.jcr.AccessDeniedException
+      * @throws javax.jcr.MergeException
+      * @throws javax.jcr.lock.LockException
+      * @throws javax.jcr.InvalidItemStateException
+      * @throws javax.jcr.RepositoryException
+      * @see javax.jcr.version.VersionManager#merge(String, String, boolean, boolean)
+      */
+     public Iterator merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException;
+
+    /**
      * Resolve an existing merge conflict present with the node identified by
      * the given <code>NodeId</code>.
      *

Modified: jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2dav/src/main/java/org/apache/jackrabbit/spi2dav/RepositoryServiceImpl.java Tue May 12 08:59:34 2009
@@ -1394,6 +1394,11 @@
         execute(method, sessionInfo);
     }
 
+    public NodeId checkpoint(SessionInfo sessionInfo, NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
+
     /**
      * @see RepositoryService#removeVersion(SessionInfo, NodeId, NodeId)
      */
@@ -1471,6 +1476,11 @@
         }
     }
 
+    public Iterator merge(SessionInfo sessionInfo, NodeId nodeId, String srcWorkspaceName, boolean bestEffort, boolean isShallow) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
+
     /**
      * @see RepositoryService#resolveMergeConflict(SessionInfo, NodeId, NodeId[], NodeId[])
      */

Modified: jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java?rev=773828&r1=773827&r2=773828&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-spi2jcr/src/main/java/org/apache/jackrabbit/spi2jcr/RepositoryServiceImpl.java Tue May 12 08:59:34 2009
@@ -88,6 +88,7 @@
 import javax.jcr.version.VersionException;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.Version;
+import javax.jcr.version.VersionManager;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NodeTypeManager;
@@ -659,6 +660,17 @@
         }, sInfo);
     }
 
+    public NodeId checkpoint(SessionInfo sessionInfo, final NodeId nodeId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+        Version newVersion = (Version) executeWithLocalEvents(new Callable() {
+            public Object run() throws RepositoryException {
+                VersionManager vMgr = sInfo.getSession().getWorkspace().getVersionManager();
+                return vMgr.checkpoint(getNodePath(nodeId, sInfo));
+            }
+        }, sInfo);
+        return idFactory.createNodeId(newVersion, sInfo.getNamePathResolver());
+    }
+
     /**
      * {@inheritDoc}
      */
@@ -789,6 +801,30 @@
     /**
      * {@inheritDoc}
      */
+    public Iterator merge(final SessionInfo sessionInfo,
+                          final NodeId nodeId,
+                          final String srcWorkspaceName,
+                          final boolean bestEffort,
+                          final boolean isShallow)
+            throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+        return (Iterator) executeWithLocalEvents(new Callable() {
+            public Object run() throws RepositoryException {
+                VersionManager vMgr = sInfo.getSession().getWorkspace().getVersionManager();
+                NodeIterator it = vMgr.merge(getNodePath(nodeId, sInfo), srcWorkspaceName, bestEffort, isShallow);
+                List ids = new ArrayList();
+                while (it.hasNext()) {
+                    ids.add(idFactory.createNodeId(it.nextNode(),
+                            sInfo.getNamePathResolver()));
+                }
+                return ids.iterator();
+            }
+        }, sInfo);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public void resolveMergeConflict(final SessionInfo sessionInfo,
                                      final NodeId nodeId,
                                      final NodeId[] mergeFailedIds,
@@ -1454,6 +1490,11 @@
         return n.getNode(jcrPath);
     }
 
+    private String getNodePath(NodeId nodeId, SessionInfoImpl sessionInfo) throws RepositoryException {
+        // TODO: improve. avoid roundtrip over node access.
+        return getNode(nodeId, sessionInfo).getPath();
+    }
+
     private Property getProperty(PropertyId id, SessionInfoImpl sessionInfo) throws ItemNotFoundException, PathNotFoundException, RepositoryException {
         Session session = sessionInfo.getSession();
         Node n;



Mime
View raw message