jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r810096 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: RepositoryImpl.java state/SharedItemStateManager.java
Date Tue, 01 Sep 2009 15:24:29 GMT
Author: mreutegg
Date: Tue Sep  1 15:24:28 2009
New Revision: 810096

URL: http://svn.apache.org/viewvc?rev=810096&view=rev
Log:
JCR-2287: Mandatory jcr:activities node missing after upgrade

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java?rev=810096&r1=810095&r2=810096&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/RepositoryImpl.java
Tue Sep  1 15:24:28 2009
@@ -145,12 +145,12 @@
     public static final NodeId VERSION_STORAGE_NODE_ID = NodeId.valueOf("deadbeef-face-babe-cafe-babecafebabe");
 
     /**
-     * hardcoded id of the "/jcr:system/jcr:versionStorage/jcr:activities" node
+     * hardcoded id of the "/jcr:system/jcr:activities" node
      */
     public static final NodeId ACTIVITIES_NODE_ID = NodeId.valueOf("deadbeef-face-babe-ac71-babecafebabe");
 
     /**
-     * hardcoded id of the "/jcr:system/jcr:versionStorage/jcr:configurations" node
+     * hardcoded id of the "/jcr:system/jcr:configurations" node
      */
     public static final NodeId CONFIGURATIONS_NODE_ID = NodeId.valueOf("deadbeef-face-babe-c04f-babecafebabe");
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=810096&r1=810095&r2=810096&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
Tue Sep  1 15:24:28 2009
@@ -202,6 +202,7 @@
         if (!hasNonVirtualItemState(rootNodeId)) {
             createRootNodeState(rootNodeId, ntReg);
         }
+        ensureActivitiesNode();
     }
 
     /**
@@ -1315,6 +1316,28 @@
     }
 
     /**
+     * Makes sure child node entry for mandatory jcr:activities exist.
+     * Repositories upgraded from 1.x do not have it.
+     * <p/>
+     * This method assumes that the jcr:system node already exists.
+     *
+     * @throws ItemStateException if an error occurs while reading or writing to
+     *                            the persistence manager.
+     */
+    private void ensureActivitiesNode() throws ItemStateException {
+        NodeState jcrSystemState = (NodeState) getNonVirtualItemState(RepositoryImpl.SYSTEM_ROOT_NODE_ID);
+        if (!jcrSystemState.hasChildNodeEntry(RepositoryImpl.ACTIVITIES_NODE_ID)) {
+            jcrSystemState.addChildNodeEntry(NameConstants.JCR_ACTIVITIES, RepositoryImpl.ACTIVITIES_NODE_ID);
+
+            ChangeLog changeLog = new ChangeLog();
+            changeLog.modified(jcrSystemState);
+
+            persistMgr.store(changeLog);
+            changeLog.persisted();
+        }
+    }
+
+    /**
      * Returns the item state for the given id without considering virtual
      * item state providers.
      */



Mime
View raw message