jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r779101 - in /jackrabbit/trunk: jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/ jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ ...
Date Wed, 27 May 2009 10:48:30 GMT
Author: angela
Date: Wed May 27 10:48:29 2009
New Revision: 779101

URL: http://svn.apache.org/viewvc?rev=779101&view=rev
Log:
JCR-2104: JSR 283 Versioning (intermediate commit, work in progress)

Added:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java
      - copied, changed from r778693, jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateConfiguration.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveActivity.java
      - copied, changed from r779022, jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java
Modified:
    jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.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/WorkspaceManager.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/operation/RemoveVersion.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/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-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java?rev=779101&r1=779100&r2=779101&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java Wed May 27 10:48:29 2009
@@ -20,7 +20,9 @@
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
+import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
+import org.apache.jackrabbit.commons.iterator.NodeIteratorAdapter;
 
 import javax.jcr.version.Version;
 import javax.jcr.version.VersionException;
@@ -37,6 +39,7 @@
 import javax.jcr.Node;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.lock.LockException;
+import java.util.Iterator;
 
 /**
  * <code>VersionManagerImpl</code>...
@@ -166,9 +169,19 @@
      * @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);
+        n.checkIsWritable();
+        session.checkHasPendingChanges();
+
+        // if same workspace, ignore
+        if (session.getWorkspace().getName().equals(srcWorkspace)) {
+            return NodeIteratorAdapter.EMPTY;
+        }
+        // make sure the workspace exists and is accessible for this session.
+        session.checkAccessibleWorkspace(srcWorkspace);
+        
+        Iterator failedIds = session.getVersionStateManager().merge((NodeState) n.getItemState(), srcWorkspace, bestEffort, isShallow);
+        return new LazyItemIterator(itemManager, session.getHierarchyManager(), failedIds);
     }
 
     /**
@@ -191,8 +204,10 @@
      * @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");
+        // TODO: add validation
+        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        NodeEntry entry = vMgr.createConfiguration((NodeState) n.getItemState(), (NodeState) ((NodeImpl) baseline).getItemState());
+        return (Node) itemManager.getItem(entry);
     }
 
     /**
@@ -215,15 +230,17 @@
      * @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");
+        // TODO: add validation
+        NodeEntry entry = vMgr.createActivity(title);
+        return (Node) itemManager.getItem(entry);
     }
 
     /**
      * @see javax.jcr.version.VersionManager#removeActivity(String)
      */
     public Node removeActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
-        // TODO
+        // TODO uncomment as soon as jsr 283 is fixed
+        // vMgr.removeActivity((NodeState) ((NodeImpl) activityNode).getItemState());       
         throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
     }
 
@@ -231,7 +248,8 @@
      * @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");
+        // TODO: add validation
+        Iterator failedIds = vMgr.mergeActivity((NodeState) ((NodeImpl) activityNode).getItemState());
+        return new LazyItemIterator(itemManager, session.getHierarchyManager(), failedIds);
     }
 }
\ No newline at end of file

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -983,7 +983,7 @@
      * @see Node#merge(String, boolean)
      */
     public NodeIterator merge(String srcWorkspace, boolean bestEffort) throws NoSuchWorkspaceException, AccessDeniedException, VersionException, LockException, InvalidItemStateException, RepositoryException {
-        return merge(srcWorkspace, bestEffort, false);
+        return session.getWorkspace().getVersionManager().merge(getPath(), srcWorkspace, bestEffort);
     }
 
 
@@ -992,18 +992,7 @@
      * -> change to package protected then
      */
     public NodeIterator merge(String srcWorkspace, boolean bestEffort, boolean isShallow) throws RepositoryException {
-        checkIsWritable();
-        checkSessionHasPendingChanges();
-
-        // if same workspace, ignore
-        if (session.getWorkspace().getName().equals(srcWorkspace)) {
-            return NodeIteratorAdapter.EMPTY;
-        }
-        // make sure the workspace exists and is accessible for this session.
-        session.checkAccessibleWorkspace(srcWorkspace);
-
-        Iterator failedIds = session.getVersionStateManager().merge(getNodeState(), srcWorkspace, bestEffort, isShallow);
-        return new LazyItemIterator(getItemManager(), session.getHierarchyManager(), failedIds);
+        return session.getWorkspace().getVersionManager().merge(getPath(), srcWorkspace, bestEffort, isShallow);
     }
 
     /**

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -57,6 +57,9 @@
 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.operation.CreateActivity;
+import org.apache.jackrabbit.jcr2spi.operation.CreateConfiguration;
+import org.apache.jackrabbit.jcr2spi.operation.RemoveActivity;
 import org.apache.jackrabbit.jcr2spi.security.AccessManager;
 import org.apache.jackrabbit.jcr2spi.observation.InternalEventListener;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
@@ -961,7 +964,12 @@
          */
         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(), operation.isShallow());
+            Iterator failed;
+            if (operation.isActivityMerge()) {
+                failed = service.mergeActivity(sessionInfo, nId);
+            } else {
+                failed = service.merge(sessionInfo, nId, operation.getSourceWorkspaceName(), operation.bestEffort(), operation.isShallow());
+            }
             operation.setFailedIds(failed);
         }
 
@@ -1038,6 +1046,29 @@
         public void visit(WorkspaceImport operation) throws RepositoryException {
             service.importXml(sessionInfo, operation.getNodeId(), operation.getXmlStream(), operation.getUuidBehaviour());
         }
+
+        /**
+         * @see OperationVisitor#visit(CreateActivity)
+         */
+        public void visit(CreateActivity operation) throws RepositoryException {
+            NodeId activityId = service.createActivity(sessionInfo, operation.getTitle());
+            operation.setNewActivityId(activityId);
+        }
+
+        /**
+         * @see OperationVisitor#visit(RemoveActivity)
+         */
+        public void visit(RemoveActivity operation) throws RepositoryException {
+            service.removeActivity(sessionInfo, (NodeId) operation.getRemoveId());
+        }
+
+        /**
+         * @see OperationVisitor#visit(CreateConfiguration)
+         */
+        public void visit(CreateConfiguration operation) throws RepositoryException {
+            NodeId configId = service.createConfiguration(sessionInfo, operation.getNodeId(), operation.getBaselineId());
+            operation.setNewConfigurationId(configId);
+        }
     }
 
     //------------------------------------------------------< ChangePolling >---

Copied: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java (from r778693, jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java?p2=jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java&p1=jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java&r1=778693&r2=779101&rev=779101&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java Wed May 27 10:48:29 2009
@@ -16,9 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi.operation;
 
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.version.VersionManager;
 import org.apache.jackrabbit.spi.NodeId;
 import org.slf4j.Logger;
@@ -31,22 +28,21 @@
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 import javax.jcr.version.VersionException;
-import java.util.Iterator;
 
 /**
  * <code>Checkout</code>...
  */
-public class Checkpoint extends AbstractOperation {
+public class CreateActivity extends AbstractOperation {
 
-    private static Logger log = LoggerFactory.getLogger(Checkpoint.class);
+    private static Logger log = LoggerFactory.getLogger(CreateActivity.class);
 
-    private final NodeState nodeState;
+    private final String title;
     private final VersionManager mgr;
-    
-    private NodeId newVersionId;
 
-    private Checkpoint(NodeState nodeState, VersionManager mgr) {
-        this.nodeState = nodeState;
+    private NodeId newActivityId;
+
+    private CreateActivity(String title, VersionManager mgr) {
+        this.title = title;
         this.mgr = mgr;
         // NOTE: affected-states only needed for transient modifications
     }
@@ -60,27 +56,13 @@
     /**
      * Invalidate the target <code>NodeState</code>.
      *
-     * @see org.apache.jackrabbit.jcr2spi.operation.Operation#persisted()
+     * @see Operation#persisted()
      */
     public void persisted() {
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
-        try {
-            NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
-            if (vhe != null) {
-                vhe.invalidate(true);
-            }
-        } catch (RepositoryException e) {
-            log.warn("Failed to access Version history entry -> skip invalidation.", e);
-        }
-        // non-recursive invalidation (but including all properties)
-        NodeEntry nodeEntry = (NodeEntry) nodeState.getHierarchyEntry();
-        Iterator entries = nodeEntry.getPropertyEntries();
-        while (entries.hasNext()) {
-            PropertyEntry pe = (PropertyEntry) entries.next();
-            pe.invalidate(false);
-        }
-        nodeEntry.invalidate(false);
+        
+        // TODO: check if invaliation of the activity store is required.
     }
 
     //----------------------------------------< Access Operation Parameters >---
@@ -88,20 +70,20 @@
      *
      * @return
      */
-    public NodeId getNodeId() throws RepositoryException {
-        return nodeState.getNodeEntry().getWorkspaceId();
+    public String getTitle() throws RepositoryException {
+        return title;
     }
 
-    public void setNewVersionId(NodeId newVersionId) {
-        this.newVersionId = newVersionId;
+    public void setNewActivityId(NodeId newActivityId) {
+        this.newActivityId = newActivityId;
     }
 
-    public NodeId getNewVersionId() {
-        return this.newVersionId;
+    public NodeId getNewActivityId() {
+        return this.newActivityId;
     }
 
     //------------------------------------------------------------< Factory >---
-    public static Checkpoint create(NodeState nodeState, VersionManager mgr) {
-        return new Checkpoint(nodeState, mgr);
+    public static CreateActivity create(String title, VersionManager mgr) {
+        return new CreateActivity(title, mgr);
     }
 }
\ No newline at end of file

Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateConfiguration.java?rev=779101&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateConfiguration.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateConfiguration.java Wed May 27 10:48:29 2009
@@ -0,0 +1,99 @@
+/*
+ * 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.operation;
+
+import org.apache.jackrabbit.jcr2spi.version.VersionManager;
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.spi.NodeId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
+
+/**
+ * <code>Checkout</code>...
+ */
+public class CreateConfiguration extends AbstractOperation {
+
+    private static Logger log = LoggerFactory.getLogger(CreateConfiguration.class);
+
+    private final NodeState nodeState;
+    private final NodeState baselineState;
+    private final VersionManager mgr;
+
+    private NodeId newConfigurationId;
+
+    private CreateConfiguration(NodeState nodeState, NodeState baselineState, VersionManager mgr) {
+        this.nodeState = nodeState;
+        this.baselineState = baselineState;
+        this.mgr = mgr;
+        // NOTE: affected-states only needed for transient modifications
+    }
+
+    //----------------------------------------------------------< Operation >---
+    public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+        assert status == STATUS_PENDING;
+        visitor.visit(this);
+    }
+
+    /**
+     * Invalidate the target <code>NodeState</code>.
+     *
+     * @see org.apache.jackrabbit.jcr2spi.operation.Operation#persisted()
+     */
+    public void persisted() {
+        assert status == STATUS_PENDING;
+        status = STATUS_PERSISTED;
+
+        // TODO: check if the configuration store needs to be invalidated.
+
+        nodeState.getHierarchyEntry().invalidate(false);
+    }
+
+    //----------------------------------------< Access Operation Parameters >---
+    /**
+     *
+     * @return
+     * @throws RepositoryException
+     */
+    public NodeId getNodeId() throws RepositoryException {
+        return nodeState.getNodeEntry().getWorkspaceId();
+    }
+
+    public NodeId getBaselineId() throws RepositoryException {
+        return baselineState.getNodeEntry().getWorkspaceId();
+    }
+
+    public void setNewConfigurationId(NodeId newConfigurationId) {
+        this.newConfigurationId = newConfigurationId;
+    }
+
+    public NodeId getNewConfigurationId() {
+        return newConfigurationId;
+    }
+
+    //------------------------------------------------------------< Factory >---
+    public static CreateConfiguration create(NodeState nodeState, NodeState baselineState, VersionManager mgr) {
+        return new CreateConfiguration(nodeState, baselineState, mgr);
+    }
+}
\ No newline at end of file

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -74,15 +74,19 @@
     public void persisted() {
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
-        try {
-            NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
-            if (vhe != null) {
-                vhe.invalidate(true);
+        if (isActivityMerge()) {
+            // TODO invalidate
+        } else {
+            try {
+                NodeEntry vhe = mgr.getVersionHistoryEntry(nodeState);
+                if (vhe != null) {
+                    vhe.invalidate(true);
+                }
+            } catch (RepositoryException e) {
+                log.warn("Error while retrieving VersionHistory entry:", e.getMessage());
             }
-        } catch (RepositoryException e) {
-            log.warn("Error while retrieving VersionHistory entry:", e.getMessage());
+            nodeState.getHierarchyEntry().invalidate(true);
         }
-        nodeState.getHierarchyEntry().invalidate(true);
     }
 
     //----------------------------------------< Access Operation Parameters >---
@@ -102,6 +106,10 @@
         return isShallow;
     }
 
+    public boolean isActivityMerge() {
+        return srcWorkspaceName == null;
+    }
+
     public void setFailedIds(Iterator failedIds) {
         if (failedIds == null) {
             throw new IllegalArgumentException("IdIterator must not be null.");

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -79,4 +79,10 @@
     public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException;
 
     public void visit(WorkspaceImport operation) throws RepositoryException;
+
+    public void visit(CreateActivity operation) throws RepositoryException;
+
+    public void visit(RemoveActivity operation) throws RepositoryException;
+
+    public void visit(CreateConfiguration operation) throws RepositoryException;
 }
\ No newline at end of file

Copied: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveActivity.java (from r779022, jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveActivity.java?p2=jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveActivity.java&p1=jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java&r1=779022&r2=779101&rev=779101&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveActivity.java Wed May 27 10:48:29 2009
@@ -16,12 +16,11 @@
  */
 package org.apache.jackrabbit.jcr2spi.operation;
 
-import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
-import org.apache.jackrabbit.jcr2spi.version.VersionManager;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
 import org.apache.jackrabbit.spi.ItemId;
+import org.apache.jackrabbit.spi.PropertyId;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -29,30 +28,27 @@
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.RepositoryException;
 import javax.jcr.version.VersionException;
-import java.util.Iterator;
 
 /**
  * <code>RemoveVersion</code>...
  */
-public class RemoveVersion extends Remove {
+public class RemoveActivity extends Remove {
 
-    private static Logger log = LoggerFactory.getLogger(RemoveVersion.class);
+    private static Logger log = LoggerFactory.getLogger(RemoveActivity.class);
 
-    private NodeEntry versionableEntry = null;
+    private final PropertyId[] refs;
+    private final HierarchyManager hMgr;
 
-    protected RemoveVersion(ItemState removeState, NodeState parent, VersionManager mgr)
+    private RemoveActivity(NodeState removeActivity, HierarchyManager hierarchyMgr)
             throws RepositoryException {
-        super(removeState, parent);
-        try {
-            versionableEntry = mgr.getVersionableNodeEntry((NodeState) removeState);
-        } catch (RepositoryException e) {
-            log.warn("Failed to retrieve the hierarchy entry of the versionable node.", e);
-        }
+        super(removeActivity, removeActivity.getParent());
+        refs = removeActivity.getNodeReferences();
+        hMgr = hierarchyMgr;
     }
 
     //----------------------------------------------------------< Operation >---
     /**
-     * @see Operation#accept(OperationVisitor)
+     * @see org.apache.jackrabbit.jcr2spi.operation.Operation#accept(org.apache.jackrabbit.jcr2spi.operation.OperationVisitor)
      */
     public void accept(OperationVisitor visitor) throws AccessDeniedException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
         assert status == STATUS_PENDING;
@@ -63,24 +59,22 @@
      * Invalidates the <code>NodeState</code> that has been updated and all
      * its decendants. Second, the parent state gets invalidated.
      *
-     * @see Operation#persisted()
+     * @see org.apache.jackrabbit.jcr2spi.operation.Operation#persisted()
      */
     public void persisted() {
         assert status == STATUS_PENDING;
         status = STATUS_PERSISTED;
-        // invaliate the versionable node as well (version related properties)
-        if (versionableEntry != null) {
-            Iterator propEntries = versionableEntry.getPropertyEntries();
-            while (propEntries.hasNext()) {
-                PropertyEntry pe = (PropertyEntry) propEntries.next();
-                pe.invalidate(false);
+        
+        // invalidate all references to the removed activity
+        for (int i = 0; i < refs.length; i++) {
+            HierarchyEntry entry = hMgr.lookup(refs[i]);
+            if (entry != null) {
+                entry.invalidate(false);
             }
-            versionableEntry.invalidate(false);
         }
 
-        // invalidate the versionhistory entry and all its children
-        // in order to the the v-graph recalculated
-        removeState.getHierarchyEntry().getParent().invalidate(true);
+        // invalidate the activities parent
+        parent.getNodeEntry().invalidate(false);
     }
 
     //----------------------------------------< Access Operation Parameters >---
@@ -89,9 +83,9 @@
     }
 
     //------------------------------------------------------------< Factory >---
-    public static Operation create(NodeState versionState, NodeState vhState, VersionManager mgr)
+    public static Operation create(NodeState activityState, HierarchyManager hierarchyMgr)
             throws RepositoryException {
-        RemoveVersion rm = new RemoveVersion(versionState, vhState, mgr);
+        RemoveActivity rm = new RemoveActivity(activityState, hierarchyMgr);
         return rm;
     }
-}
+}
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java?rev=779101&r1=779100&r2=779101&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/RemoveVersion.java Wed May 27 10:48:29 2009
@@ -40,7 +40,7 @@
 
     private NodeEntry versionableEntry = null;
 
-    protected RemoveVersion(ItemState removeState, NodeState parent, VersionManager mgr)
+    private RemoveVersion(ItemState removeState, NodeState parent, VersionManager mgr)
             throws RepositoryException {
         super(removeState, parent);
         try {
@@ -79,8 +79,8 @@
         }
 
         // invalidate the versionhistory entry and all its children
-        // in order to the the v-graph recalculated
-        removeState.getHierarchyEntry().getParent().invalidate(true);
+        // in order to have the v-graph recalculated
+        parent.getNodeEntry().invalidate(true);
     }
 
     //----------------------------------------< Access Operation Parameters >---

Added: jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java?rev=779101&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java (added)
+++ jackrabbit/trunk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java Wed May 27 10:48:29 2009
@@ -0,0 +1,188 @@
+/*
+ * 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.operation;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.MergeException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.ReferentialIntegrityException;
+import javax.jcr.RepositoryException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.version.VersionException;
+
+/**
+ * <code>TransientOperationVisitor</code>...
+ */
+public abstract class TransientOperationVisitor implements OperationVisitor {
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Clone)
+     */
+    public void visit(Clone operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Clone isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Copy)
+     */
+    public void visit(Copy operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Copy  isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Checkout)
+     */
+    public void visit(Checkout operation) throws RepositoryException, UnsupportedRepositoryOperationException {
+        throw new UnsupportedOperationException("Internal error: Checkout isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Checkin)
+     */
+    public void visit(Checkin operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Checkin isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Checkpoint)
+     */
+    public void visit(Checkpoint operation) throws UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Checkin isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Update)
+     */
+    public void visit(Update operation) throws NoSuchWorkspaceException, AccessDeniedException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Update isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Restore)
+     */
+    public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Restore isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(Merge)
+     */
+    public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Merge isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(ResolveMergeConflict)
+     */
+    public void visit(ResolveMergeConflict operation) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: ResolveMergeConflict isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(LockOperation)
+     */
+    public void visit(LockOperation operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: Lock isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(LockRefresh)
+     */
+    public void visit(LockRefresh operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: LockRefresh isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(LockRelease)
+     */
+    public void visit(LockRelease operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: LockRelease isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(AddLabel)
+     */
+    public void visit(AddLabel operation) throws VersionException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: AddLabel isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(RemoveLabel)
+     */
+    public void visit(RemoveLabel operation) throws VersionException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: RemoveLabel isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(RemoveVersion)
+     */
+    public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException {
+        throw new UnsupportedOperationException("Internal error: RemoveVersion isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(WorkspaceImport)
+     */
+    public void visit(WorkspaceImport operation) throws RepositoryException {
+        throw new UnsupportedOperationException("Internal error: WorkspaceImport isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(CreateActivity)
+     */
+    public void visit(CreateActivity operation) throws RepositoryException {
+        throw new UnsupportedOperationException("Internal error: CreateActivity isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(RemoveActivity)
+     */
+    public void visit(RemoveActivity operation) throws RepositoryException {
+        throw new UnsupportedOperationException("Internal error: RemoveActivity isn't a transient operation.");
+    }
+
+    /**
+     * @throws UnsupportedOperationException
+     * @see OperationVisitor#visit(CreateConfiguration)
+     */
+    public void visit(CreateConfiguration operation) throws RepositoryException {
+        throw new UnsupportedOperationException("Internal error: CreateConfiguration isn't a transient operation.");
+    }
+}
\ No newline at end of file

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -16,72 +16,53 @@
  */
 package org.apache.jackrabbit.jcr2spi.state;
 
-import org.apache.jackrabbit.jcr2spi.util.ReferenceChangeTracker;
+import org.apache.jackrabbit.jcr2spi.ManagerProvider;
+import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
+import org.apache.jackrabbit.jcr2spi.hierarchy.PropertyEntry;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
-import org.apache.jackrabbit.jcr2spi.operation.Operation;
-import org.apache.jackrabbit.jcr2spi.operation.OperationVisitor;
 import org.apache.jackrabbit.jcr2spi.operation.AddNode;
 import org.apache.jackrabbit.jcr2spi.operation.AddProperty;
-import org.apache.jackrabbit.jcr2spi.operation.Clone;
-import org.apache.jackrabbit.jcr2spi.operation.Copy;
 import org.apache.jackrabbit.jcr2spi.operation.Move;
+import org.apache.jackrabbit.jcr2spi.operation.Operation;
+import org.apache.jackrabbit.jcr2spi.operation.OperationVisitor;
 import org.apache.jackrabbit.jcr2spi.operation.Remove;
+import org.apache.jackrabbit.jcr2spi.operation.ReorderNodes;
 import org.apache.jackrabbit.jcr2spi.operation.SetMixin;
 import org.apache.jackrabbit.jcr2spi.operation.SetPropertyValue;
-import org.apache.jackrabbit.jcr2spi.operation.ReorderNodes;
-import org.apache.jackrabbit.jcr2spi.operation.Checkout;
-import org.apache.jackrabbit.jcr2spi.operation.Checkin;
-import org.apache.jackrabbit.jcr2spi.operation.Update;
-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.LockOperation;
-import org.apache.jackrabbit.jcr2spi.operation.LockRefresh;
-import org.apache.jackrabbit.jcr2spi.operation.LockRelease;
-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.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;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
-
+import org.apache.jackrabbit.jcr2spi.operation.TransientOperationVisitor;
+import org.apache.jackrabbit.jcr2spi.util.ReferenceChangeTracker;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QNodeDefinition;
+import org.apache.jackrabbit.spi.QPropertyDefinition;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.QValueFactory;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
+import javax.jcr.AccessDeniedException;
 import javax.jcr.InvalidItemStateException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.PropertyType;
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
-import javax.jcr.AccessDeniedException;
-import javax.jcr.ItemExistsException;
+import javax.jcr.Session;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.ValueFormatException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.PropertyType;
-import javax.jcr.PathNotFoundException;
-import javax.jcr.Session;
-import javax.jcr.MergeException;
-import javax.jcr.version.VersionException;
+import javax.jcr.lock.LockException;
 import javax.jcr.nodetype.ConstraintViolationException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.lock.LockException;
+import javax.jcr.version.VersionException;
+import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
-import java.util.ArrayList;
-import java.io.InputStream;
 
 /**
  * <code>SessionItemStateManager</code> ...
  */
-public class SessionItemStateManager implements UpdatableItemStateManager, OperationVisitor {
+public class SessionItemStateManager extends TransientOperationVisitor implements UpdatableItemStateManager {
 
     private static Logger log = LoggerFactory.getLogger(SessionItemStateManager.class);
 
@@ -407,134 +388,6 @@
         transientStateMgr.addOperation(operation);
     }
 
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Clone)
-     */
-    public void visit(Clone operation) throws NoSuchWorkspaceException, LockException, ConstraintViolationException, AccessDeniedException, ItemExistsException, UnsupportedRepositoryOperationException, VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Clone cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @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.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Checkout)
-     */
-    public void visit(Checkout operation) throws RepositoryException, UnsupportedRepositoryOperationException {
-        throw new UnsupportedOperationException("Internal error: Checkout cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @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.");
-    }
-
-    /**
-     * @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 {
-        throw new UnsupportedOperationException("Internal error: Update cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Restore)
-     */
-    public void visit(Restore operation) throws VersionException, PathNotFoundException, ItemExistsException, UnsupportedRepositoryOperationException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Restore cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(Merge)
-     */
-    public void visit(Merge operation) throws NoSuchWorkspaceException, AccessDeniedException, MergeException, LockException, InvalidItemStateException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Merge cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(ResolveMergeConflict)
-     */
-    public void visit(ResolveMergeConflict operation) throws VersionException, InvalidItemStateException, UnsupportedRepositoryOperationException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Update cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(LockOperation)
-     */
-    public void visit(LockOperation operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: Lock cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(LockRefresh)
-     */
-    public void visit(LockRefresh operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: LockRefresh cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(LockRelease)
-     */
-    public void visit(LockRelease operation) throws AccessDeniedException, InvalidItemStateException, UnsupportedRepositoryOperationException, LockException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: LockRelease cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(AddLabel)
-     */
-    public void visit(AddLabel operation) throws VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: AddLabel cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(RemoveLabel)
-     */
-    public void visit(RemoveLabel operation) throws VersionException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: RemoveLabel cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(RemoveVersion)
-     */
-    public void visit(RemoveVersion operation) throws VersionException, AccessDeniedException, ReferentialIntegrityException, RepositoryException {
-        throw new UnsupportedOperationException("Internal error: RemoveVersion cannot be handled by session ItemStateManager.");
-    }
-
-    /**
-     * @throws UnsupportedOperationException
-     * @see OperationVisitor#visit(WorkspaceImport)
-     */
-    public void visit(WorkspaceImport operation) throws RepositoryException {
-        throw new UnsupportedOperationException("Internal error: WorkspaceImport cannot be handled by session ItemStateManager.");
-    }
-
     //--------------------------------------------< Internal State Handling >---
     /**
      *

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -199,6 +199,42 @@
 
     /**
      *
+     * @param nodeState
+     * @param baselineState
+     * @return
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public NodeEntry createConfiguration(NodeState nodeState, NodeState baselineState) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
+     * @param title
+     * @return
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
+     * @param activityState
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * 
+     * @param activityState
+     * @return
+     * @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public Iterator mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
      * @param versionState
      * @return
      */

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -29,6 +29,9 @@
 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.operation.CreateActivity;
+import org.apache.jackrabbit.jcr2spi.operation.CreateConfiguration;
+import org.apache.jackrabbit.jcr2spi.operation.RemoveActivity;
 import org.apache.jackrabbit.jcr2spi.WorkspaceManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.slf4j.LoggerFactory;
@@ -40,6 +43,7 @@
 import javax.jcr.AccessDeniedException;
 import javax.jcr.MergeException;
 import javax.jcr.InvalidItemStateException;
+import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.lock.LockException;
 import javax.jcr.version.VersionException;
 
@@ -197,6 +201,29 @@
         workspaceManager.execute(op);
     }
 
+    public NodeEntry createConfiguration(NodeState nodeState, NodeState baselineState) throws UnsupportedRepositoryOperationException, RepositoryException {
+        CreateConfiguration op = CreateConfiguration.create(nodeState, baselineState, this);
+        workspaceManager.execute(op);
+        return workspaceManager.getHierarchyManager().getNodeEntry(op.getNewConfigurationId());
+    }
+
+    public NodeEntry createActivity(String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        CreateActivity op = CreateActivity.create(title, this);
+        workspaceManager.execute(op);
+        return workspaceManager.getHierarchyManager().getNodeEntry(op.getNewActivityId());
+    }
+
+    public void removeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException {
+        Operation op = RemoveActivity.create(activityState, workspaceManager.getHierarchyManager());
+        workspaceManager.execute(op);
+    }
+
+    public Iterator mergeActivity(NodeState activityState) throws UnsupportedRepositoryOperationException, RepositoryException {
+        Merge op = Merge.create(activityState, null, false, false, this);
+        workspaceManager.execute(op);
+        return op.getFailedIds();
+    }
+
     public NodeEntry getVersionableNodeEntry(NodeState versionState) throws RepositoryException {
         NodeState ns = versionState.getChildNodeState(NameConstants.JCR_FROZENNODE, Path.INDEX_DEFAULT);
         PropertyState ps = ns.getPropertyState(NameConstants.JCR_FROZENUUID);

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -649,6 +649,36 @@
         throw new UnsupportedRepositoryOperationException();
     }
 
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public NodeId createActivity(SessionInfo sessionInfo, String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public void removeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public Iterator mergeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+
+    }
+
+    /**
+     * @throws UnsupportedRepositoryOperationException always.
+     */
+    public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId, NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        throw new UnsupportedRepositoryOperationException();
+    }
+
     //-----------------------------< observation >------------------------------
 
     /**

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -491,6 +491,40 @@
                 new Object[]{unwrap(sessionInfo), versionHistoryId, versionId, label});
     }
 
+    public NodeId createActivity(final SessionInfo sessionInfo, final String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        return (NodeId) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return service.createActivity(unwrap(sessionInfo), title);
+            }
+        }, "createActivity(SessionInfo, String)", new Object[]{unwrap(sessionInfo), title});
+    }
+
+    public void removeActivity(final SessionInfo sessionInfo, final NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        execute(new Callable() {
+            public Object call() throws RepositoryException {
+                service.removeActivity(unwrap(sessionInfo), activityId);
+                return null;
+            }
+        }, "removeActivity(SessionInfo, NodeId)",
+                new Object[]{unwrap(sessionInfo), activityId});
+    }
+
+    public Iterator mergeActivity(final SessionInfo sessionInfo, final NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        return (Iterator) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return service.mergeActivity(unwrap(sessionInfo), activityId);
+            }
+        }, "mergeActivity(SessionInfo, NodeId)", new Object[]{unwrap(sessionInfo), activityId});
+    }
+
+    public NodeId createConfiguration(final SessionInfo sessionInfo, final NodeId nodeId, final NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        return (NodeId) execute(new Callable() {
+            public Object call() throws RepositoryException {
+                return service.createConfiguration(unwrap(sessionInfo), nodeId, baselineId);
+            }
+        }, "createConfiguration(SessionInfo, NodeId, NodeId)", new Object[]{unwrap(sessionInfo), nodeId, baselineId});
+    }
+
     public String[] getSupportedQueryLanguages(final SessionInfo sessionInfo) throws RepositoryException {
         return (String[]) execute(new Callable() {
             public Object call() 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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -579,13 +579,13 @@
      *
      * @param sessionInfo
      * @param nodeId
+     * @return <code>NodeId</code> of newly created version
      * @throws javax.jcr.version.VersionException
      * @throws javax.jcr.UnsupportedRepositoryOperationException
      * @throws javax.jcr.InvalidItemStateException
      * @throws javax.jcr.lock.LockException
      * @throws javax.jcr.RepositoryException
      * @see javax.jcr.Node#checkin()
-     * @return <code>NodeId</code> of newly created version
      */
     public NodeId checkin(SessionInfo sessionInfo, NodeId nodeId) throws VersionException, UnsupportedRepositoryOperationException, InvalidItemStateException, LockException, RepositoryException;
 
@@ -608,8 +608,8 @@
      *
      * @param sessionInfo
      * @param nodeId
+     * @return <code>NodeId</code> of newly created version
      * @throws javax.jcr.UnsupportedRepositoryOperationException
-     * @throws javax.jcr.lock.LockException
      * @throws javax.jcr.RepositoryException
      * @see javax.jcr.version.VersionManager#checkpoint(String)
      * @since JCR 2.0
@@ -781,6 +781,54 @@
      */
     public void removeVersionLabel(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId, Name label) throws VersionException, RepositoryException;
 
+    /**
+     * Create a new activity.
+     *
+     * @param sessionInfo
+     * @param title
+     * @return the <code>NodeId</code> of the new activity node.
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.version.VersionManager#createActivity(String)
+     * @since JCR 2.0
+     */
+    public NodeId createActivity(SessionInfo sessionInfo, String title) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * Removes the activity identified by the specified <code>activityId</code>.
+     *
+     * @param sessionInfo
+     * @param activityId
+     * @throws javax.jcr.UnsupportedRepositoryOperationException
+     * @throws javax.jcr.RepositoryException
+     * @see javax.jcr.version.VersionManager#removeActivity(String)
+     * @since JCR 2.0
+     */
+    public void removeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     * Merges the activity identified by the given <code>activityId</code> into
+     * the workspace the specified <code>sessionInfo</code> has been created for.
+     *
+     * @param sessionInfo
+     * @param activityId
+     * @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 UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     */
+    public Iterator mergeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException;
+
+    /**
+     *
+     * @param sessionInfo
+     * @param nodeId
+     * @param baselineId   @return  @throws UnsupportedRepositoryOperationException
+     * @throws RepositoryException
+     * @see javax.jcr.version.VersionManager#createConfiguration(String, Version)
+     */
+    public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId, NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException;
+
     //----------------------------------------------------------< Searching >---
     /**
      * Returns a String array identifying all query languages supported by this

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -1547,6 +1547,38 @@
     }
 
     /**
+     * @see RepositoryService#createActivity(SessionInfo, String)
+     */
+    public NodeId createActivity(SessionInfo sessionInfo, String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
+
+    /**
+     * @see RepositoryService#removeActivity(SessionInfo, NodeId)
+     */
+    public void removeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
+
+    /**
+     * @see RepositoryService#mergeActivity(SessionInfo, NodeId)
+     */
+    public Iterator mergeActivity(SessionInfo sessionInfo, NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
+
+    /**
+     * @see RepositoryService#createConfiguration(SessionInfo, NodeId, NodeId)
+     */
+    public NodeId createConfiguration(SessionInfo sessionInfo, NodeId nodeId, NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        // TODO
+        throw new UnsupportedOperationException("JCR-2104: JSR 283 Versioning. Implementation missing");
+    }
+
+    /**
      * @see RepositoryService#getSupportedQueryLanguages(SessionInfo)
      */
     public String[] getSupportedQueryLanguages(SessionInfo sessionInfo) throws RepositoryException {

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=779101&r1=779100&r2=779101&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 Wed May 27 10:48:29 2009
@@ -791,8 +791,8 @@
         final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
         return (Iterator) executeWithLocalEvents(new Callable() {
             public Object run() throws RepositoryException {
-                Node n = getNode(nodeId, sInfo);
-                NodeIterator it = n.merge(srcWorkspaceName, bestEffort);
+                String nodePath = getNodePath(nodeId, sInfo);
+                NodeIterator it = getVersionManager(sInfo).merge(nodePath, srcWorkspaceName, bestEffort);
                 List ids = new ArrayList();
                 while (it.hasNext()) {
                     ids.add(idFactory.createNodeId(it.nextNode(),
@@ -815,8 +815,8 @@
         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);
+                String nodePath = getNodePath(nodeId, sInfo);
+                NodeIterator it = getVersionManager(sInfo).merge(nodePath, srcWorkspaceName, bestEffort, isShallow);
                 List ids = new ArrayList();
                 while (it.hasNext()) {
                     ids.add(idFactory.createNodeId(it.nextNode(),
@@ -924,6 +924,68 @@
     /**
      * {@inheritDoc}
      */
+    public NodeId createActivity(SessionInfo sessionInfo, final String title) throws UnsupportedRepositoryOperationException, RepositoryException {
+        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+        final VersionManager vMgr = getVersionManager(sInfo);
+        Node activity = (Node) executeWithLocalEvents(new Callable() {
+            public Object run() throws RepositoryException {
+                return vMgr.createActivity(title);
+            }
+        }, getSessionInfoImpl(sessionInfo));
+        return idFactory.createNodeId(activity, sInfo.getNamePathResolver());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void removeActivity(SessionInfo sessionInfo, final NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+        final VersionManager vMgr = getVersionManager(sInfo);
+        Node activity = (Node) executeWithLocalEvents(new Callable() {
+            public Object run() throws RepositoryException {
+                // TODO: uncomment as soon as removeActivity method is fixed in jsr 283
+                // return vMgr.removeActivity(getNode(activityId, sInfo));
+                throw new UnsupportedOperationException("Impl missing... waiting for updated jsr 283 jar.");
+            }
+        }, getSessionInfoImpl(sessionInfo));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator mergeActivity(SessionInfo sessionInfo, final NodeId activityId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+        return (Iterator) executeWithLocalEvents(new Callable() {
+            public Object run() throws RepositoryException {
+                Node node = getNode(activityId, sInfo);
+                NodeIterator it = getVersionManager(sInfo).merge(node);
+                List ids = new ArrayList();
+                while (it.hasNext()) {
+                    ids.add(idFactory.createNodeId(it.nextNode(),
+                            sInfo.getNamePathResolver()));
+                }
+                return ids.iterator();
+            }
+        }, sInfo);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeId createConfiguration(SessionInfo sessionInfo, final NodeId nodeId, final NodeId baselineId) throws UnsupportedRepositoryOperationException, RepositoryException {
+        final SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
+        final VersionManager vMgr = getVersionManager(sInfo);
+        Node configuration = (Node) executeWithLocalEvents(new Callable() {
+            public Object run() throws RepositoryException {
+                return vMgr.createConfiguration(getNodePath(nodeId, sInfo), (Version) getNode(baselineId, sInfo));
+            }
+        }, getSessionInfoImpl(sessionInfo));
+        return idFactory.createNodeId(configuration, sInfo.getNamePathResolver());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
     public String[] getSupportedQueryLanguages(SessionInfo sessionInfo)
             throws RepositoryException {
         SessionInfoImpl sInfo = getSessionInfoImpl(sessionInfo);
@@ -1570,6 +1632,10 @@
         return n.getProperty(jcrPath);
     }
 
+    private VersionManager getVersionManager(SessionInfoImpl sessionInfo) throws RepositoryException {
+        return sessionInfo.getSession().getWorkspace().getVersionManager();
+    }
+
     private Query createQuery(Session session,
                               String statement,
                               String language,



Mime
View raw message