jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r165134 - in /incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version: InternalVersionHistory.java VersionHistoryImpl.java persistence/InternalFrozenNodeImpl.java persistence/InternalVersionHistoryImpl.java
Date Thu, 28 Apr 2005 13:02:28 GMT
Author: tripod
Date: Thu Apr 28 06:02:26 2005
New Revision: 165134

URL: http://svn.apache.org/viewcvs?rev=165134&view=rev
Log:
- fixing some javadocs
- fixing checkin behaviour for OPV=Version for non versionable node
- fixing exceptions thrown by version label operations

Modified:
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalFrozenNodeImpl.java
    incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java?rev=165134&r1=165133&r2=165134&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/InternalVersionHistory.java
Thu Apr 28 06:02:26 2005
@@ -28,16 +28,16 @@
 public interface InternalVersionHistory extends InternalVersionItem {
 
     /**
-     * Equivalalent to {@link VersionHistory#getRootVersion()}.
+     * Equivalalent to {@link javax.jcr.version.VersionHistory#getRootVersion()}.
      *
-     * @see VersionHistory#getRootVersion()
+     * @see javax.jcr.version.VersionHistory#getRootVersion()
      */
     InternalVersion getRootVersion();
 
     /**
-     * Equivalalent to {@link VersionHistory#getVersion(java.lang.String)}.
+     * Equivalalent to {@link javax.jcr.version.VersionHistory#getVersion(java.lang.String)}.
      *
-     * @see VersionHistory#getVersion(java.lang.String)
+     * @see javax.jcr.version.VersionHistory#getVersion(java.lang.String)
      */
     InternalVersion getVersion(QName versionName) throws VersionException;
 
@@ -69,10 +69,10 @@
     InternalVersion getVersion(String uuid);
 
     /**
-     * Equivalalent to {@link VersionHistory#getVersionByLabel(java.lang.String)}
+     * Equivalalent to {@link javax.jcr.version.VersionHistory#getVersionByLabel(java.lang.String)}
      * but returns <code>null</code> if the version does not exists.
      *
-     * @see VersionHistory#getVersionByLabel(java.lang.String)
+     * @see javax.jcr.version.VersionHistory#getVersionByLabel(java.lang.String)
      */
     InternalVersion getVersionByLabel(QName label);
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java?rev=165134&r1=165133&r2=165134&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/VersionHistoryImpl.java
Thu Apr 28 06:02:26 2005
@@ -94,9 +94,9 @@
             }
             return (Version) session.getNodeByUUID(v.getId());
         } catch (IllegalNameException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         } catch (UnknownPrefixException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         }
     }
 
@@ -112,9 +112,9 @@
             }
             return (Version) session.getNodeByUUID(v.getId());
         } catch (IllegalNameException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         } catch (UnknownPrefixException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         }
     }
 
@@ -129,9 +129,9 @@
                     QName.fromJCRName(label, session.getNamespaceResolver()),
                     move);
         } catch (IllegalNameException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         } catch (UnknownPrefixException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         }
     }
 
@@ -148,9 +148,9 @@
                 throw new VersionException("No version with label '" + label + "' exists
in this version history.");
             }
         } catch (IllegalNameException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         } catch (UnknownPrefixException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         }
     }
 
@@ -213,9 +213,9 @@
             QName qLabel = QName.fromJCRName(label, session.getNamespaceResolver());
             return ((VersionImpl) version).getInternalVersion().hasLabel(qLabel);
         } catch (IllegalNameException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         } catch (UnknownPrefixException e) {
-            throw new RepositoryException(e);
+            throw new VersionException(e);
         }
     }
 

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalFrozenNodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalFrozenNodeImpl.java?rev=165134&r1=165133&r2=165134&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalFrozenNodeImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalFrozenNodeImpl.java
Thu Apr 28 06:02:26 2005
@@ -49,6 +49,28 @@
         implements InternalFrozenNode, Constants {
 
     /**
+     * checkin mode init. specifies, that node is only initialized
+     */
+    public static final int MODE_INIT = 0;
+
+    /**
+     * checkin mode version. specifies, that the OPV value should be used to
+     * determine the checkin behaviour.
+     */
+    public static final int MODE_VERSION = 1;
+
+    /**
+     * checkin mode copy. specifies, that the items are always copied.
+     */
+    private static final int MODE_COPY = 2;
+
+    /**
+     * mode flag specifies, that the mode should be recursed. otherwise i
+     * will be redetermined by the opv.
+     */
+    private static final int MODE_COPY_RECURSIVE = 6;
+
+    /**
      * the underlying persistance node
      */
     private PersistentNode node;
@@ -245,8 +267,7 @@
      * @throws RepositoryException
      */
     protected static PersistentNode checkin(PersistentNode parent, QName name,
-                                            NodeImpl src, boolean initOnly,
-                                            boolean forceCopy)
+                                            NodeImpl src, int mode)
             throws RepositoryException {
 
         PersistentNode node;
@@ -270,14 +291,13 @@
             }
             node.setPropertyValues(JCR_FROZENMIXINTYPES, PropertyType.NAME, ivalues);
         }
-
-        if (!initOnly) {
+        if (mode != MODE_INIT) {
             // add the properties
             PropertyIterator piter = src.getProperties();
             while (piter.hasNext()) {
                 PropertyImpl prop = (PropertyImpl) piter.nextProperty();
                 int opv;
-                if (forceCopy) {
+                if ((mode & MODE_COPY) > 0) {
                     opv = OnParentVersionAction.COPY;
                 } else {
                     opv = prop.getDefinition().getOnParentVersion();
@@ -303,7 +323,7 @@
             while (niter.hasNext()) {
                 NodeImpl child = (NodeImpl) niter.nextNode();
                 int opv;
-                if (forceCopy) {
+                if ((mode & MODE_COPY_RECURSIVE) > 0) {
                     opv = OnParentVersionAction.COPY;
                 } else {
                     opv = child.getDefinition().getOnParentVersion();
@@ -325,9 +345,11 @@
                                     InternalValue.create(child.getBaseVersion().getUUID()));
                             break;
                         }
-                        // else copy
+                        // else copy but do not recurse
+                        checkin(node, child.getQName(), child, MODE_COPY);
+                        break;
                     case OnParentVersionAction.COPY:
-                        checkin(node, child.getQName(), child, false, true);
+                        checkin(node, child.getQName(), child, MODE_COPY_RECURSIVE);
                         break;
                 }
             }

Modified: incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java?rev=165134&r1=165133&r2=165134&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
(original)
+++ incubator/jackrabbit/trunk/src/java/org/apache/jackrabbit/core/version/persistence/InternalVersionHistoryImpl.java
Thu Apr 28 06:02:26 2005
@@ -383,7 +383,7 @@
         vNode.setPropertyValues(JCR_PREDECESSORS, PropertyType.STRING, predecessors);
 
         // checkin source node
-        InternalFrozenNodeImpl.checkin(vNode, JCR_FROZENNODE, src, false, false);
+        InternalFrozenNodeImpl.checkin(vNode, JCR_FROZENNODE, src, InternalFrozenNodeImpl.MODE_VERSION);
 
         // and store
         node.store();
@@ -478,7 +478,7 @@
         vNode.setPropertyValues(JCR_PREDECESSORS, PropertyType.REFERENCE, InternalValue.EMPTY_ARRAY);
 
         // add also an empty frozen node to the root version
-        InternalFrozenNodeImpl.checkin(vNode, JCR_FROZENNODE, src, true, false);
+        InternalFrozenNodeImpl.checkin(vNode, JCR_FROZENNODE, src, InternalFrozenNodeImpl.MODE_INIT);
 
         parent.store();
         return new InternalVersionHistoryImpl(vMgr, pNode);



Mime
View raw message