You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by tr...@apache.org on 2009/05/26 19:12:03 UTC

svn commit: r778802 - in /jackrabbit/trunk: jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/ jackrabbit-core/src/...

Author: tripod
Date: Tue May 26 17:12:03 2009
New Revision: 778802

URL: http://svn.apache.org/viewvc?rev=778802&view=rev
Log:
JCR-2058 JSR 283: VersionManager and new versioning methods
- added jcr:copiedFrom property to version history

Added:
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/CopyTest.java
      - copied, changed from r778529, jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java
Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
    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/VersionIteratorImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PropertyDefTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/TestAll.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java
    jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt
    jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameConstants.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java Tue May 26 17:12:03 2009
@@ -1809,6 +1809,20 @@
                 // add new child node entry to new node
                 newState.addChildNodeEntry(entry.getName(), newChildState.getNodeId());
             }
+            // init version history if needed
+            VersionHistoryInfo history = null;
+            if (versionable && flag == COPY) {
+                NodeId copiedFrom = null;
+                if (fullVersionable) {
+                    // base version of copied versionable node is reference value of
+                    // the histories jcr:copiedFrom property
+                    PropertyId propId = new PropertyId(srcState.getNodeId(), NameConstants.JCR_BASEVERSION);
+                    PropertyState prop = (PropertyState) srcStateMgr.getItemState(propId);
+                    copiedFrom = new NodeId(prop.getValues()[0].getUUID());
+                }
+                VersionManager manager = session.getVersionManager();
+                history = manager.getVersionHistory(session, newState, copiedFrom);
+            }
             // copy properties
             iter = srcState.getPropertyNames().iterator();
             while (iter.hasNext()) {
@@ -1838,26 +1852,16 @@
                 PropertyState newChildState =
                         copyPropertyState(srcChildState, id, propName);
 
-                if (versionable && flag == COPY) {
-                    /**
-                     * a versionable node is being copied:
-                     * copied properties declared by mix:versionable need to be
-                     * adjusted accordingly.
-                     */
-                    VersionManager manager = session.getVersionManager();
+                if (history != null) {
                     if (fullVersionable) {
                         if (propName.equals(NameConstants.JCR_VERSIONHISTORY)) {
                             // jcr:versionHistory
-                            VersionHistoryInfo history =
-                                manager.getVersionHistory(session, newState);
                             InternalValue value = InternalValue.create(
                                     history.getVersionHistoryId().getUUID());
                             newChildState.setValues(new InternalValue[] { value });
                         } else if (propName.equals(NameConstants.JCR_BASEVERSION)
                                 || propName.equals(NameConstants.JCR_PREDECESSORS)) {
                             // jcr:baseVersion or jcr:predecessors
-                            VersionHistoryInfo history =
-                                manager.getVersionHistory(session, newState);
                             InternalValue value = InternalValue.create(
                                     history.getRootVersionId().getUUID());
                             newChildState.setValues(new InternalValue[] { value });
@@ -1871,7 +1875,6 @@
                         if (propName.equals(NameConstants.JCR_ISCHECKEDOUT)) {
                             // jcr:isCheckedOut
                             newChildState.setValues(new InternalValue[]{InternalValue.create(true)});
-                            manager.getVersionHistory(session, newState);
                         }
                     }
                 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemImpl.java Tue May 26 17:12:03 2009
@@ -736,7 +736,7 @@
                          * otherwise create a new version history
                          */
                         VersionHistoryInfo history =
-                            vMgr.getVersionHistory(session, nodeState);
+                            vMgr.getVersionHistory(session, nodeState, null);
                         InternalValue historyId = InternalValue.create(
                                 history.getVersionHistoryId().getUUID());
                         InternalValue versionId = InternalValue.create(
@@ -758,7 +758,7 @@
                     // version history, since simple versioning does not
                     // expose it's reference in a property
                     VersionManager vMgr = session.getVersionManager();
-                    vMgr.getVersionHistory(session, nodeState);
+                    vMgr.getVersionHistory(session, nodeState, null);
 
                     // create isCheckedOutProperty if not already exists
                     NodeImpl node = (NodeImpl) itemMgr.getItem(itemState.getId());

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/value/InternalValue.java Tue May 26 17:12:03 2009
@@ -484,7 +484,7 @@
     }
 
     public UUID getUUID() {
-        assert val != null && type == PropertyType.REFERENCE;
+        assert val != null && (type == PropertyType.REFERENCE || type == PropertyType.WEAKREFERENCE);
         return (UUID) val;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/AbstractVersionManager.java Tue May 26 17:12:03 2009
@@ -137,6 +137,7 @@
 
     /**
      * Acquires the write lock on this version manager.
+     * @return returns the write lock
      */
     protected WriteLock acquireWriteLock() {
         while (true) {
@@ -150,6 +151,7 @@
 
     /**
      * acquires the read lock on this version manager.
+     * @return returns the read lock
      */
     protected ReadLock acquireReadLock() {
         while (true) {
@@ -246,7 +248,8 @@
     /**
      * {@inheritDoc}
      */
-    public VersionHistoryInfo getVersionHistory(Session session, NodeState node)
+    public VersionHistoryInfo getVersionHistory(Session session, NodeState node,
+                                                NodeId copiedFrom)
             throws RepositoryException {
         VersionHistoryInfo info = null;
 
@@ -268,7 +271,7 @@
         }
 
         if (info == null) {
-            info = createVersionHistory(session, node);
+            info = createVersionHistory(session, node, copiedFrom);
         }
 
         return info;
@@ -279,14 +282,17 @@
      * a new 'mix:versionable' node or when adding the 'mix:versionable' mixin
      * to a node.
      *
-     * @param session
-     * @param node NodeState
+     * @param session repository session
+     * @param node versionable node state
+     * @param copiedFrom node id for the jcr:copiedFrom property
      * @return identifier of the new version history node
-     * @throws RepositoryException
-     * @see #getVersionHistory(Session, NodeState)
+     * @throws RepositoryException if an error occurrs
+     * @see #getVersionHistory(Session, NodeState, NodeId)
      */
-    protected abstract VersionHistoryInfo createVersionHistory(
-            Session session, NodeState node) throws RepositoryException;
+    protected abstract VersionHistoryInfo createVersionHistory(Session session,
+                                                               NodeState node,
+                                                               NodeId copiedFrom)
+            throws RepositoryException;
 
     /**
      * Returns the item with the given persistent id. Subclass responsibility.
@@ -343,10 +349,11 @@
      * Creates a new Version History.
      *
      * @param node the node for which the version history is to be initialized
+     * @param copiedFrom node id for the jcr:copiedFrom parameter
      * @return the identifiers of the newly created version history and root version
-     * @throws javax.jcr.RepositoryException
+     * @throws RepositoryException if an error occurs
      */
-    NodeStateEx createVersionHistory(NodeState node)
+    NodeStateEx createVersionHistory(NodeState node, NodeId copiedFrom)
             throws RepositoryException {
         WriteOperation operation = startWriteOperation();
         try {
@@ -361,7 +368,7 @@
 
             // create new history node in the persistent state
             NodeStateEx history =
-                InternalVersionHistoryImpl.create(this, parent, name, node);
+                InternalVersionHistoryImpl.create(this, parent, name, node, copiedFrom);
 
             // end update
             operation.save();
@@ -497,8 +504,8 @@
         } else {
             // 1. search a predecessor, suitable for generating the new name
             Value[] values = node.getProperty(NameConstants.JCR_PREDECESSORS).getValues();
-            for (int i = 0; i < values.length; i++) {
-                InternalVersion pred = history.getVersion(NodeId.valueOf(values[i].getString()));
+            for (Value value: values) {
+                InternalVersion pred = history.getVersion(NodeId.valueOf(value.getString()));
                 if (best == null
                         || pred.getName().getLocalName().length() < best.getName().getLocalName().length()) {
                     best = pred;
@@ -590,7 +597,7 @@
      * Invoked by the internal version item itself, when it's underlying
      * persistence state was discarded.
      *
-     * @param item
+     * @param item item that was discarded
      */
     protected void itemDiscarded(InternalVersionItem item) {
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionHistoryImpl.java Tue May 26 17:12:03 2009
@@ -39,6 +39,7 @@
 import java.util.Iterator;
 import java.util.Set;
 import java.util.LinkedHashMap;
+import java.util.Map;
 
 /**
  * Implements a <code>InternalVersionHistory</code>
@@ -61,7 +62,7 @@
      * key = version label (String)
      * value = version name
      */
-    private HashMap labelCache = new HashMap();
+    private Map<Name, Name> labelCache = new HashMap<Name, Name>();
 
     /**
      * the root version of this history
@@ -73,19 +74,19 @@
      * key = version name
      * value = version id (NodeId)
      */
-    private LinkedHashMap/*<Name, NodeId>*/ nameCache = new LinkedHashMap/*<Name, NodeId>*/();
+    private Map<Name, NodeId> nameCache = new LinkedHashMap<Name, NodeId>();
 
     /**
      * the hashmap of all versions
      * key = version id (NodeId)
      * value = version
      */
-    private HashMap/*<NodeId, InternalVersion>*/ versionCache = new HashMap/*<NodeId, InternalVersion>*/();
+    private Map<NodeId, InternalVersion> versionCache = new HashMap<NodeId, InternalVersion>();
 
     /**
      * Temporary version cache, used on a refresh.
      */
-    private HashMap/*<NodeId, InternalVersion>*/ tempVersionCache = new HashMap/*<NodeId, InternalVersion>*/();
+    private Map<NodeId, InternalVersion> tempVersionCache = new HashMap<NodeId, InternalVersion>();
 
     /**
      * the node that holds the label nodes
@@ -136,8 +137,7 @@
         // init label cache
         try {
             PropertyState[] labels = labelNode.getProperties();
-            for (int i = 0; i < labels.length; i++) {
-                PropertyState pState = labels[i];
+            for (PropertyState pState : labels) {
                 if (pState.getType() == PropertyType.REFERENCE) {
                     Name labelName = pState.getName();
                     UUID ref = pState.getValues()[0].getUUID();
@@ -159,8 +159,7 @@
         // get version entries
         ChildNodeEntry[] children = (ChildNodeEntry[])
             node.getState().getChildNodeEntries().toArray();
-        for (int i = 0; i < children.length; i++) {
-            ChildNodeEntry child = children[i];
+        for (ChildNodeEntry child : children) {
             if (child.getName().equals(NameConstants.JCR_VERSIONLABELS)) {
                 continue;
             }
@@ -169,9 +168,7 @@
 
         // fix legacy
         if (rootVersion.getSuccessors().length == 0) {
-            Iterator iter = nameCache.keySet().iterator();
-            while (iter.hasNext()) {
-                Name versionName = (Name) iter.next();
+            for (Name versionName : nameCache.keySet()) {
                 InternalVersionImpl v = createVersionInstance(versionName);
                 v.legacyResolveSuccessors();
             }
@@ -188,9 +185,8 @@
         init();
 
         // invalidate all versions that are not referenced any more
-        Iterator iter = tempVersionCache.values().iterator();
-        while (iter.hasNext()) {
-            InternalVersionImpl v = (InternalVersionImpl) iter.next();
+        for (Object o : tempVersionCache.values()) {
+            InternalVersionImpl v = (InternalVersionImpl) o;
             v.invalidate();
         }
         tempVersionCache.clear();
@@ -210,10 +206,8 @@
             vMgr.versionCreated(v);
 
             // add labels
-            Iterator iter = labelCache.keySet().iterator();
-            while (iter.hasNext()) {
-                Name labelName = (Name) iter.next();
-                Name versionName = (Name) labelCache.get(labelName);
+            for (Name labelName: labelCache.keySet()) {
+                Name versionName = labelCache.get(labelName);
                 if (v.getName().equals(versionName)) {
                     v.internalAddLabel(labelName);
                 }
@@ -265,12 +259,12 @@
      * {@inheritDoc}
      */
     public InternalVersion getVersion(Name versionName) throws VersionException {
-        NodeId versionId = (NodeId) nameCache.get(versionName);
+        NodeId versionId = nameCache.get(versionName);
         if (versionId == null) {
             throw new VersionException("Version " + versionName + " does not exist.");
         }
 
-        InternalVersion v = (InternalVersion) versionCache.get(versionId);
+        InternalVersion v = versionCache.get(versionId);
         if (v == null) {
             v = createVersionInstance(versionName);
         }
@@ -288,11 +282,9 @@
      * {@inheritDoc}
      */
     public InternalVersion getVersion(NodeId id) {
-        InternalVersion v = (InternalVersion) versionCache.get(id);
+        InternalVersion v = versionCache.get(id);
         if (v == null) {
-            Iterator iter = nameCache.keySet().iterator();
-            while (iter.hasNext()) {
-                Name versionName = (Name) iter.next();
+            for (Name versionName : nameCache.keySet()) {
                 if (nameCache.get(versionName).equals(id)) {
                     v = createVersionInstance(versionName);
                     break;
@@ -306,13 +298,13 @@
      * {@inheritDoc}
      */
     public InternalVersion getVersionByLabel(Name label) {
-        Name versionName = (Name) labelCache.get(label);
+        Name versionName = labelCache.get(label);
         if (versionName == null) {
             return null;
         }
 
-        NodeId id = (NodeId) nameCache.get(versionName);
-        InternalVersion v = (InternalVersion) versionCache.get(id);
+        NodeId id = nameCache.get(versionName);
+        InternalVersion v = versionCache.get(id);
         if (v == null) {
             v = createVersionInstance(versionName);
         }
@@ -323,7 +315,7 @@
      * {@inheritDoc}
      */
     public Name[] getVersionNames() {
-        return (Name[]) nameCache.keySet().toArray(new Name[nameCache.size()]);
+        return nameCache.keySet().toArray(new Name[nameCache.size()]);
     }
     
     /**
@@ -344,7 +336,7 @@
      * {@inheritDoc}
      */
     public Name[] getVersionLabels() {
-        return (Name[]) labelCache.keySet().toArray(new Name[labelCache.size()]);
+        return labelCache.keySet().toArray(new Name[labelCache.size()]);
     }
 
     /**
@@ -381,9 +373,9 @@
 
         // unregister from labels
         Name[] labels = v.internalGetLabels();
-        for (int i = 0; i < labels.length; i++) {
-            v.internalRemoveLabel(labels[i]);
-            labelNode.removeProperty(labels[i]);
+        for (Name label : labels) {
+            v.internalRemoveLabel(label);
+            labelNode.removeProperty(label);
         }
         // detach from the version graph
         v.internalDetach();
@@ -417,8 +409,8 @@
         }
 
         // now also remove from labelCache
-        for (int i = 0; i < labels.length; i++) {
-            labelCache.remove(labels[i]);
+        for (Name label : labels) {
+            labelCache.remove(label);
         }
     }
 
@@ -443,7 +435,7 @@
         if (versionName != null && version == null) {
             throw new VersionException("Version " + versionName + " does not exist in this version history.");
         }
-        Name prevName = (Name) labelCache.get(label);
+        Name prevName = labelCache.get(label);
         InternalVersionImpl prev = null;
         if (prevName == null) {
             if (version == null) {
@@ -558,12 +550,13 @@
      * @param parent parent node
      * @param name history name
      * @param nodeState node state
+     * @param copiedFrom the id of the base version
      * @return new node state
      * @throws RepositoryException if an error occurs
      */
     static NodeStateEx create(
             AbstractVersionManager vMgr, NodeStateEx parent, Name name,
-            NodeState nodeState) throws RepositoryException {
+            NodeState nodeState, NodeId copiedFrom) throws RepositoryException {
 
         // create history node
         NodeId historyId = new NodeId(UUID.randomUUID());
@@ -576,6 +569,11 @@
         // create label node
         pNode.addNode(NameConstants.JCR_VERSIONLABELS, NameConstants.NT_VERSIONLABELS, null, false);
 
+        // initialize the 'jcr:copiedFrom' property
+        if (copiedFrom != null) {
+            pNode.setPropertyValue(NameConstants.JCR_COPIEDFROM, InternalValue.create(copiedFrom.getUUID(), true));
+        }
+        
         // create root version
         NodeId versionId = new NodeId(UUID.randomUUID());
         NodeStateEx vNode = pNode.addNode(NameConstants.JCR_ROOTVERSION, NameConstants.NT_VERSION, versionId, true);

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=778802&r1=778801&r2=778802&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 26 17:12:03 2009
@@ -20,13 +20,11 @@
 import javax.jcr.NodeIterator;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionHistory;
 
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionHistory;
-import org.slf4j.LoggerFactory;
-import org.slf4j.Logger;
 
 /**
  * Implementation of the {@link javax.jcr.version.VersionManager}.
@@ -37,11 +35,6 @@
 public class JcrVersionManagerImpl implements javax.jcr.version.VersionManager {
 
     /**
-     * default logger
-     */
-    private static final Logger log = LoggerFactory.getLogger(JcrVersionManagerImpl.class);
-
-    /**
      * workspace session
      */
     private final SessionImpl session;
@@ -58,7 +51,7 @@
      * {@inheritDoc}
      */
     public Version checkin(String absPath) throws RepositoryException {
-        return (Version) session.getNode(absPath).checkin();
+        return session.getNode(absPath).checkin();
     }
 
     /**
@@ -75,7 +68,7 @@
         // this is not quite correct, since the entire checkpoint operation
         // should be atomic
         Node node = session.getNode(absPath);
-        Version v = (Version) node.checkin();
+        Version v = node.checkin();
         node.checkout();
         return v;
     }
@@ -92,7 +85,7 @@
      */
     public VersionHistory getVersionHistory(String absPath)
             throws RepositoryException {
-        return (VersionHistory) session.getNode(absPath).getVersionHistory();
+        return session.getNode(absPath).getVersionHistory();
     }
 
     /**
@@ -100,7 +93,7 @@
      */
     public Version getBaseVersion(String absPath)
             throws RepositoryException {
-        return (Version) session.getNode(absPath).getBaseVersion();
+        return session.getNode(absPath).getBaseVersion();
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java Tue May 26 17:12:03 2009
@@ -44,7 +44,7 @@
     /**
      * the id's of the versions to return
      */
-    private LinkedList/*<NodeId>*/ versions = new LinkedList/*<NodeId>*/();
+    private LinkedList<NodeId> versions = new LinkedList<NodeId>();
 
     /**
      * the current position
@@ -99,7 +99,7 @@
         if (versions.isEmpty()) {
             throw new NoSuchElementException();
         }
-        NodeId id = (NodeId) versions.removeFirst();
+        NodeId id = versions.removeFirst();
         pos++;
 
         try {
@@ -162,10 +162,10 @@
      * @param root the root version
      */
     private synchronized void initVersions(InternalVersion root) {
-        LinkedList workQueue = new LinkedList();
+        LinkedList<InternalVersion> workQueue = new LinkedList<InternalVersion>();
         workQueue.add(root);
         while (!workQueue.isEmpty()) {
-            InternalVersion currentVersion = (InternalVersion) workQueue.removeFirst();
+            InternalVersion currentVersion = workQueue.removeFirst();
             NodeId id = currentVersion.getId();
             if (!versions.contains(id)) {
                 versions.add(id);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java Tue May 26 17:12:03 2009
@@ -49,11 +49,13 @@
      * is versionable.
      *
      * @param session workspace session
-     * @param node node whose version history should be returned
+     * @param vNode node whose version history should be returned
+     * @param copiedFrom the node id for the jcr:copiedFrom property use for copied nodes
      * @return identifiers of the version history and root version nodes
      * @throws RepositoryException if an error occurs
      */
-    VersionHistoryInfo getVersionHistory(Session session, NodeState node)
+    VersionHistoryInfo getVersionHistory(Session session, NodeState vNode, 
+                                         NodeId copiedFrom)
             throws RepositoryException;
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java Tue May 26 17:12:03 2009
@@ -16,6 +16,17 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.jcr.PropertyType;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.version.Version;
+import javax.jcr.version.VersionException;
+import javax.jcr.version.VersionHistory;
+
 import org.apache.commons.collections.map.ReferenceMap;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
@@ -30,44 +41,32 @@
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.core.state.ChangeLog;
+import org.apache.jackrabbit.core.state.ISMLocking;
+import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateCacheFactory;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.LocalItemStateManager;
-import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
-import org.apache.jackrabbit.core.state.ISMLocking;
-import org.apache.jackrabbit.core.state.NoSuchItemStateException;
-import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
-import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.PathBuilder;
-import org.apache.jackrabbit.spi.commons.conversion.MalformedPathException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.jcr.PropertyType;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.jcr.version.Version;
-import javax.jcr.version.VersionException;
-import javax.jcr.version.VersionHistory;
-
 /**
  * This Class implements a VersionManager.
  */
-public class VersionManagerImpl extends AbstractVersionManager implements ItemStateListener, UpdateEventListener {
+public class VersionManagerImpl extends AbstractVersionManager
+        implements ItemStateListener, UpdateEventListener {
 
     /**
      * the default logger
@@ -212,12 +211,13 @@
      * This method must not be synchronized since it could cause deadlocks with
      * item-reading listeners in the observation thread.
      */
-    protected VersionHistoryInfo createVersionHistory(
-            Session session, final NodeState node) throws RepositoryException {
+    protected VersionHistoryInfo createVersionHistory(Session session,
+                  final NodeState node, final NodeId copiedFrom)
+            throws RepositoryException {
         NodeStateEx state = (NodeStateEx)
                 escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
             public Object run() throws RepositoryException {
-                return createVersionHistory(node);
+                return createVersionHistory(node, copiedFrom);
             }
         });
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java Tue May 26 17:12:03 2009
@@ -85,7 +85,7 @@
     /**
      * Items that have been modified and are part of the XA environment.
      */
-    private Map xaItems;
+    private Map<NodeId, InternalVersionItem> xaItems;
 
     /**
      * flag that indicates if the version manager was locked during prepare
@@ -99,6 +99,12 @@
 
     /**
      * Creates a new instance of this class.
+     *
+     * @param vMgr the underlying version manager
+     * @param ntReg node type registry
+     * @param session the session
+     * @param cacheFactory cache factory
+     * @throws RepositoryException if a an error occurs
      */
     public XAVersionManager(VersionManagerImpl vMgr, NodeTypeRegistry ntReg,
                             SessionImpl session, ItemStateCacheFactory cacheFactory)
@@ -140,11 +146,13 @@
     /**
      * {@inheritDoc}
      */
-    protected VersionHistoryInfo createVersionHistory(Session session, NodeState node)
+    protected VersionHistoryInfo createVersionHistory(Session session,
+                                                      NodeState node,
+                                                      NodeId copiedFrom)
             throws RepositoryException {
 
         if (isInXA()) {
-            NodeStateEx state = createVersionHistory(node);
+            NodeStateEx state = createVersionHistory(node, copiedFrom);
             InternalVersionHistory history =
                 new InternalVersionHistoryImpl(vMgr, state);
             xaItems.put(state.getNodeId(), history);
@@ -153,7 +161,7 @@
                     state.getNodeId(),
                     state.getState().getChildNodeEntry(root, 1).getId());
         }
-        return vMgr.createVersionHistory(session, node);
+        return vMgr.createVersionHistory(session, node, copiedFrom);
     }
 
     /**
@@ -349,7 +357,7 @@
      protected InternalVersionItem getItem(NodeId id) throws RepositoryException {
         InternalVersionItem item = null;
         if (xaItems != null) {
-            item = (InternalVersionItem) xaItems.get(id);
+            item = xaItems.get(id);
         }
         if (item == null) {
             item = vMgr.getItem(id);
@@ -424,12 +432,12 @@
             // also put 'successor' and 'predecessor' version items to xaItem sets
             InternalVersion v = history.getVersion(name);
             InternalVersion[] vs = v.getSuccessors();
-            for (int i = 0; i < vs.length; i++) {
-                xaItems.put(vs[i].getId(), vs[i]);
+            for (InternalVersion v1 : vs) {
+                xaItems.put(v1.getId(), v1);
             }
             vs = v.getPredecessors();
-            for (int i = 0; i < vs.length; i++) {
-                xaItems.put(vs[i].getId(), vs[i]);
+            for (InternalVersion v1 : vs) {
+                xaItems.put(v1.getId(), v1);
             }
         }
         super.removeVersion(history, name);
@@ -475,14 +483,15 @@
     /**
      * {@inheritDoc}
      */
+    @SuppressWarnings("unchecked")
     public void associate(TransactionContext tx) {
         ((XAItemStateManager) stateMgr).associate(tx);
 
-        Map xaItems = null;
+        Map<NodeId, InternalVersionItem> xaItems = null;
         if (tx != null) {
-            xaItems = (Map) tx.getAttribute(ITEMS_ATTRIBUTE_NAME);
+            xaItems = (Map<NodeId, InternalVersionItem>) tx.getAttribute(ITEMS_ATTRIBUTE_NAME);
             if (xaItems == null) {
-                xaItems = new HashMap();
+                xaItems = new HashMap<NodeId, InternalVersionItem>();
                 tx.setAttribute(ITEMS_ATTRIBUTE_NAME, xaItems);
             }
         }
@@ -616,6 +625,7 @@
     /**
      * Return a flag indicating whether this version manager is currently
      * associated with an XA transaction.
+     * @return <code>true</code> if the version manager is in a transaction
      */
     private boolean isInXA() {
         return xaItems != null;
@@ -625,6 +635,9 @@
      * Make a local copy of an internal version item. This will recreate the
      * (global) version item with state information from our own state
      * manager.
+     * @param history source
+     * @return the new copy
+     * @throws RepositoryException if an error occurs
      */
     private InternalVersionHistoryImpl makeLocalCopy(InternalVersionHistoryImpl history)
             throws RepositoryException {
@@ -643,6 +656,8 @@
     /**
      * Return a flag indicating whether an internal version item belongs to
      * a different XA environment.
+     * @param item the item to check
+     * @return <code>true</code> if in a different env
      */
     boolean differentXAEnv(InternalVersionItemImpl item) {
         if (item.getVersionManager() == this) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Tue May 26 17:12:03 2009
@@ -315,7 +315,7 @@
              * otherwise create a new version history
              */
             VersionHistoryInfo history =
-                versionManager.getVersionHistory(session, node);
+                versionManager.getVersionHistory(session, node, null);
             InternalValue historyId = InternalValue.create(
                     history.getVersionHistoryId().getUUID());
             InternalValue versionId = InternalValue.create(

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties Tue May 26 17:12:03 2009
@@ -416,6 +416,7 @@
 javax.jcr.tck.version.versionableNodeType=test:versionable
 javax.jcr.tck.version.simpleVersionableNodeType=nt:unstructured
 javax.jcr.tck.version.propertyValue=aPropertyValue
+javax.jcr.tck.version.destination=/testroot/versionableNodeName3
 
 # testroot for the version package
 # the test root must allow versionable and non-versionable nodes being created below

Modified: jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd Tue May 26 17:12:03 2009
@@ -79,7 +79,7 @@
 [nt:versionHistory] > nt:base, mix:referenceable
   - jcr:versionableUuid (string) mandatory autocreated protected abort
     /** @since 2.0 */
-    // - jcr:copiedFrom (weakreference) protected abort < 'nt:version'
+  - jcr:copiedFrom (weakreference) protected abort < 'nt:version'
   + jcr:rootVersion (nt:version) = nt:version mandatory autocreated protected abort
   + jcr:versionLabels (nt:versionLabels) = nt:versionLabels mandatory autocreated protected abort
   + * (nt:version) = nt:version protected abort

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/AbstractJCRTest.java Tue May 26 17:12:03 2009
@@ -104,6 +104,11 @@
     protected String jcrVersionHistory;
 
     /**
+     * JCR Name jcr:copiedFrom using the namespace resolver of the current session.
+     */
+    protected String jcrCopiedFrom;
+
+    /**
      * JCR Name jcr:frozenNode using the namespace resolver of the current session.
      */
     protected String jcrFrozenNode;
@@ -329,6 +334,7 @@
         jcrSuccessors = superuser.getNamespacePrefix(NS_JCR_URI) + ":successors";
         jcrCreated = superuser.getNamespacePrefix(NS_JCR_URI) + ":created";
         jcrVersionHistory = superuser.getNamespacePrefix(NS_JCR_URI) + ":versionHistory";
+        jcrCopiedFrom = superuser.getNamespacePrefix(NS_JCR_URI) + ":copiedFrom";
         jcrFrozenNode = superuser.getNamespacePrefix(NS_JCR_URI) + ":frozenNode";
         jcrFrozenUuid = superuser.getNamespacePrefix(NS_JCR_URI) + ":frozenUuid";
         jcrRootVersion = superuser.getNamespacePrefix(NS_JCR_URI) + ":rootVersion";

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PropertyDefTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PropertyDefTest.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PropertyDefTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/nodetype/PropertyDefTest.java Tue May 26 17:12:03 2009
@@ -200,6 +200,9 @@
                     case PropertyType.REFERENCE:
                     case PropertyType.BOOLEAN:
                     case PropertyType.UNDEFINED:
+                    case PropertyType.WEAKREFERENCE:
+                    case PropertyType.DECIMAL:
+                    case PropertyType.URI:
                         // success
                         break;
                     default:

Copied: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/CopyTest.java (from r778529, jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/CopyTest.java?p2=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/CopyTest.java&p1=jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java&r1=778529&r2=778802&rev=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/CopyTest.java Tue May 26 17:12:03 2009
@@ -14,29 +14,37 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.jackrabbit.test.api.version.simple;
+package org.apache.jackrabbit.test.api.version;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
 import javax.jcr.Workspace;
 import javax.jcr.version.VersionHistory;
 import javax.jcr.version.VersionManager;
+import javax.jcr.version.Version;
+
+import org.apache.jackrabbit.test.api.version.simple.AbstractVersionTest;
 
 /**
- * <code>CopyTest</code> checks if simple versionable nodes are copied correctly:
+ * <code>CopyTest</code> checks if full versionable nodes are copied correctly:
  *
  * 15.1.4 Copying Versionable Nodes and Version Lineage
  * Under both simple and full versioning, when an existing versionable node N is
  * copied to a new location either in the same workspace or another, and the
- * repository preserves the versionable mixin (see �10.7.4 Dropping Mixins on
+ * repository preserves the versionable mixin (see 10.7.4 Dropping Mixins on
  * Copy):
- * ? A copy of N, call it M, is created, as usual.
- * ? A new, empty, version history for M, call it HM, is also created.
+ * - A copy of N, call it M, is created, as usual.
+ * - A new, empty, version history for M, call it HM, is also created.
+ *
+ * Under full versioning:
+ * - The properties jcr:versionHistory, jcr:baseVersion and
+ *   jcr:predecessors of M are not copied from N but are initialized as usual.
+ * - The jcr:copiedFrom property of HM is set to point to the base version of N.
  *
  * @test
  * @sources CopyTest.java
- * @executeClass javax.jcr.version.simple.CopyTest
- * @keywords simple-versioning
+ * @executeClass javax.jcr.version.CopyTest
+ * @keywords versioning
  */
 public class CopyTest extends AbstractVersionTest {
 
@@ -66,9 +74,7 @@
 
         // check versionable
         Node v = superuser.getNode(dstPath);
-        assertTrue("Copied Node.isNodeType(mix:simpleVersionable) must return true.",
-                v.isNodeType(mixSimpleVersionable));
-        assertFalse("Copied Node.isNodeType(mix:versionable) must return false.",
+        assertTrue("Copied Node.isNodeType(mix:cersionable) must return true.",
                 v.isNodeType(mixVersionable));
 
         // check different version history
@@ -78,5 +84,12 @@
 
         // check if 1 version
         assertEquals("Copied node must have 1 version.", 1, getNumberOfVersions(vh2));
+
+        // check if jcr:copiedFrom is set correctly
+        assertTrue("Version history of desination must have a jcr:copiedFrom property", vh2.hasProperty(jcrCopiedFrom));
+
+        Node ref = vh2.getProperty(jcrCopiedFrom).getNode();
+        Version base = vMgr.getBaseVersion(srcPath);
+        assertTrue("jcr:copiedFrom must point to the base version of the original.", ref.isSame(base));
     }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/TestAll.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/TestAll.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/TestAll.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/TestAll.java Tue May 26 17:12:03 2009
@@ -42,6 +42,7 @@
         suite.addTestSuite(VersionLabelTest.class);
         suite.addTestSuite(CheckoutTest.class);
         suite.addTestSuite(CheckinTest.class);
+        suite.addTestSuite(CopyTest.class);
         suite.addTestSuite(VersionGraphTest.class);
         suite.addTestSuite(RemoveVersionTest.class);
         suite.addTestSuite(RestoreTest.class);

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/version/simple/CopyTest.java Tue May 26 17:12:03 2009
@@ -28,10 +28,10 @@
  * 15.1.4 Copying Versionable Nodes and Version Lineage
  * Under both simple and full versioning, when an existing versionable node N is
  * copied to a new location either in the same workspace or another, and the
- * repository preserves the versionable mixin (see �10.7.4 Dropping Mixins on
+ * repository preserves the versionable mixin (see 10.7.4 Dropping Mixins on
  * Copy):
- * ? A copy of N, call it M, is created, as usual.
- * ? A new, empty, version history for M, call it HM, is also created.
+ * - A copy of N, call it M, is created, as usual.
+ * - A new, empty, version history for M, call it HM, is also created.
  *
  * @test
  * @sources CopyTest.java

Modified: jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt (original)
+++ jackrabbit/trunk/jackrabbit-jcr-tests/src/main/resources/org/apache/jackrabbit/test/api/nodetype/spec/nt-versionHistory.txt Tue May 26 17:12:03 2009
@@ -37,6 +37,15 @@
   Protected true
   SameNameSiblings false
 PropertyDefinition
+  Name jcr:copiedFrom
+  RequiredType WEAKREFERENCE
+  DefaultValues null
+  AutoCreated false
+  Mandatory false
+  OnParentVersion ABORT
+  Protected true
+  Multiple false
+PropertyDefinition
   Name jcr:versionableUuid
   RequiredType STRING
   DefaultValues null

Modified: jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameConstants.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameConstants.java?rev=778802&r1=778801&r2=778802&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameConstants.java (original)
+++ jackrabbit/trunk/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/name/NameConstants.java Tue May 26 17:12:03 2009
@@ -214,6 +214,11 @@
      */
     public static final Name JCR_VERSIONABLEUUID = FACTORY.create(Name.NS_JCR_URI, "versionableUuid");
 
+    /**
+     * jcr:copiedFrom
+     */
+    public static final Name JCR_COPIEDFROM = FACTORY.create(Name.NS_JCR_URI, "copiedFrom");
+
     //--------------------------------< node type related item name constants >
 
     /**