jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tri...@apache.org
Subject svn commit: r796899 - in /jackrabbit/trunk/jackrabbit-core/src/main: java/org/apache/jackrabbit/core/ java/org/apache/jackrabbit/core/version/ resources/org/apache/jackrabbit/core/nodetype/
Date Wed, 22 Jul 2009 22:42:19 GMT
Author: tripod
Date: Wed Jul 22 22:42:18 2009
New Revision: 796899

URL: http://svn.apache.org/viewvc?rev=796899&view=rev
Log:
JCR-2140: Baselines

Removed:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalConfiguration.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalConfigurationImpl.java
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/VersionManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaseline.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaselineImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalXAVersionManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplBase.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplConfig.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
    jackrabbit/trunk/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd

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=796899&r1=796898&r2=796899&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 Wed Jul 22 22:42:18 2009
@@ -479,7 +479,6 @@
                 SYSTEM_ROOT_NODE_ID,
                 VERSION_STORAGE_NODE_ID,
                 ACTIVITIES_NODE_ID,
-                CONFIGURATIONS_NODE_ID,
                 cacheFactory,
                 ismLocking);
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/VersionManagerImpl.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/VersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/VersionManagerImpl.java Wed Jul 22 22:42:18 2009
@@ -39,15 +39,13 @@
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.UpdatableItemStateManager;
-import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.InternalActivity;
 import org.apache.jackrabbit.core.version.InternalBaseline;
-import org.apache.jackrabbit.core.version.InternalConfiguration;
 import org.apache.jackrabbit.core.version.InternalVersion;
 import org.apache.jackrabbit.core.version.InternalVersionHistory;
-import org.apache.jackrabbit.core.version.VersionManagerImplConfig;
 import org.apache.jackrabbit.core.version.NodeStateEx;
 import org.apache.jackrabbit.core.version.VersionImpl;
+import org.apache.jackrabbit.core.version.VersionManagerImplConfig;
 import org.apache.jackrabbit.core.version.VersionSet;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
@@ -89,13 +87,7 @@
         NodeStateEx state = getNodeState(absPath,
                 ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD | ItemValidator.CHECK_PENDING_CHANGES_ON_NODE,
                 Permission.VERSION_MNGMT);
-        NodeId baseId;
-        if (isConfiguration(state)) {
-            InternalConfiguration config = vMgr.getConfiguration(state.getNodeId());
-            baseId = checkin(config);
-        } else {
-            baseId = checkoutCheckin(state, true, false);
-        }
+        NodeId baseId = checkoutCheckin(state, true, false);
         return (VersionImpl) session.getNodeById(baseId);
     }
 
@@ -106,11 +98,7 @@
         NodeStateEx state = getNodeState(absPath,
                 ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD,
                 Permission.VERSION_MNGMT);
-        if (isConfiguration(state)) {
-            // currently has no effect
-        } else {
-            checkoutCheckin(state, false, true);
-        }
+        checkoutCheckin(state, false, true);
     }
 
     /**
@@ -120,13 +108,7 @@
         NodeStateEx state = getNodeState(absPath,
                 ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD | ItemValidator.CHECK_PENDING_CHANGES_ON_NODE,
                 Permission.VERSION_MNGMT);
-        NodeId baseId;
-        if (isConfiguration(state)) {
-            InternalConfiguration config = vMgr.getConfiguration(state.getNodeId());
-            baseId = checkin(config);
-        } else {
-            baseId = checkoutCheckin(state, true, true);
-        }
+        NodeId baseId = checkoutCheckin(state, true, true);
         return (VersionImpl) session.getNodeById(baseId);
     }
 
@@ -180,24 +162,12 @@
         Map<NodeId, InternalVersion> toRestore = new HashMap<NodeId, InternalVersion>();
         for (Version version : versions) {
             InternalVersion v = vMgr.getVersion(((VersionImpl) version).getNodeId());
-            if (v instanceof InternalBaseline) {
-                // do simple explode, ignore restoring of nt:configuration node for now.
-                for (InternalVersion bv: ((InternalBaseline) v).getBaseVersions().versions().values()) {
-                    // check for collision
-                    NodeId historyId = bv.getVersionHistory().getId();
-                    if (toRestore.containsKey(historyId)) {
-                        throw new VersionException("Unable to restore. Two or more versions have same version history.");
-                    }
-                    toRestore.put(historyId, bv);
-                }
-            } else {
-                // check for collision
-                NodeId historyId = v.getVersionHistory().getId();
-                if (toRestore.containsKey(historyId)) {
-                    throw new VersionException("Unable to restore. Two or more versions have same version history.");
-                }
-                toRestore.put(historyId, v);
+            // check for collision
+            NodeId historyId = v.getVersionHistory().getId();
+            if (toRestore.containsKey(historyId)) {
+                throw new VersionException("Unable to restore. Two or more versions have same version history.");
             }
+            toRestore.put(historyId, v);
         }
         WriteOperation ops = startWriteOperation();
         try {
@@ -218,12 +188,7 @@
         NodeStateEx state = getNodeState(absPath,
                 ItemValidator.CHECK_PENDING_CHANGES | ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD,
                 Permission.NONE);
-        if (isConfiguration(state)) {
-            InternalConfiguration config = vMgr.getConfiguration(state.getNodeId());
-            restore(config, session.getQName(versionName), removeExisting);
-        } else {
-            restore(state, session.getQName(versionName), removeExisting);
-        }
+        restore(state, session.getQName(versionName), removeExisting);
     }
 
     /**
@@ -237,12 +202,7 @@
             NodeStateEx state = getNodeState(absPath,
                     ItemValidator.CHECK_PENDING_CHANGES | ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD,
                     Permission.NONE);
-            if (isConfiguration(state)) {
-                InternalConfiguration config = vMgr.getConfiguration(state.getNodeId());
-                restore(config, version, removeExisting);
-            } else {
-                restore(state, version, removeExisting);
-            }
+            restore(state, version, removeExisting);
         } else {
             // parent has to exist
             Path path = session.getQPath(absPath);
@@ -265,12 +225,7 @@
         NodeStateEx state = getNodeState(absPath,
                 ItemValidator.CHECK_PENDING_CHANGES | ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD,
                 Permission.NONE);
-        if (isConfiguration(state)) {
-            InternalConfiguration config = vMgr.getConfiguration(state.getNodeId());
-            restoreByLabel(config, session.getQName(versionLabel), removeExisting);
-        } else {
-            restoreByLabel(state, session.getQName(versionLabel), removeExisting);
-        }
+        restoreByLabel(state, session.getQName(versionLabel), removeExisting);
     }
 
     /**
@@ -390,7 +345,6 @@
                 throw new UnsupportedRepositoryOperationException(
                         "Create configuration to existing nodes only allowed without specifying a basline: " + absPath);
             }
-
             NodeStateEx state = getNodeState(absPath,
                     ItemValidator.CHECK_LOCK | ItemValidator.CHECK_PENDING_CHANGES_ON_NODE | ItemValidator.CHECK_HOLD,
                     Permission.VERSION_MNGMT);
@@ -402,18 +356,8 @@
                 throw new UnsupportedRepositoryOperationException("Node is already a configuration root: " + absPath);
             }
 
-            WriteOperation ops = startWriteOperation();
-            try {
-                NodeId configId = vMgr.createConfiguration(session, state.getNodeId());
-                state.setPropertyValue(NameConstants.JCR_CONFIGURATION, InternalValue.create(configId));
-                state.store();
-                ops.save();
-                return session.getNodeById(configId);
-            } catch (ItemStateException e) {
-                throw new RepositoryException(e);
-            } finally {
-                ops.close();
-            }
+            NodeId configId = createConfiguration(state);
+            return session.getNodeById(configId);
         } else {
             // check if supplied baseline is valid
             if (baseline == null) {
@@ -436,8 +380,8 @@
             NodeStateEx state = getNodeState(parent,
                     ItemValidator.CHECK_PENDING_CHANGES | ItemValidator.CHECK_LOCK | ItemValidator.CHECK_HOLD,
                     Permission.NONE);
-            InternalConfiguration config = restore(state, name, bl);
-            return session.getNodeById(config.getId());
+            NodeId configId = restore(state, name, bl);
+            return session.getNodeById(configId);
         }
     }
 
@@ -556,18 +500,4 @@
         }
     }
 
-    /**
-     * Checks if the given node state is a nt:configuration. Note that this check
-     * is currently used to either avoid versioning operations on nt:configuration
-     * nodes or to use a differnt strategy for such nodes.
-     *
-     * @param state the state to check
-     * @return <code>true</code> if it is a configuration
-     * @throws RepositoryException if an error occurs
-     */
-    private boolean isConfiguration(NodeStateEx state) throws RepositoryException {
-        return state.getEffectiveNodeType().includesNodeType(NameConstants.NT_CONFIGURATION);
-    }
-
-
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaseline.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaseline.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaseline.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaseline.java Wed Jul 22 22:42:18 2009
@@ -40,12 +40,4 @@
      */
     VersionSet getBaseVersions() throws RepositoryException;
 
-    /**
-     * Returns the configuration of this baseline. this is basically the
-     * versionable node.
-     *
-     * @return the configuration
-     * @throws RepositoryException if an error occurs or the configuration does not exist.
-     */
-    InternalConfiguration getConfiguration() throws RepositoryException;
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaselineImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaselineImpl.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaselineImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalBaselineImpl.java Wed Jul 22 22:42:18 2009
@@ -19,7 +19,6 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 
-import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 
 /**
@@ -48,11 +47,4 @@
         throw new UnsupportedRepositoryOperationException("InternalBaseline.getBaseversions()");
     }
 
-    /**
-     * {@inheritDoc}
-     */
-    public InternalConfiguration getConfiguration() throws RepositoryException {
-        NodeId configId = getVersionHistory().getVersionableId();
-        return (InternalConfiguration) vMgr.getItem(configId);
-    }
 }
\ No newline at end of file

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManager.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManager.java Wed Jul 22 22:42:18 2009
@@ -63,10 +63,13 @@
      *
      * @param session session that invokes the checkin
      * @param node node to checkin
+     * @param baseVersions set of base versions to record in the baseline if the
+     *        given node is a nt:configuration
      * @return the newly created version
      * @throws RepositoryException if an error occurs
      */
-    InternalVersion checkin(Session session, NodeStateEx node) throws RepositoryException;
+    InternalVersion checkin(Session session, NodeStateEx node, Set<NodeId> baseVersions)
+            throws RepositoryException;
 
     /**
      * invokes the checkout() on the persistent version manager.
@@ -149,47 +152,6 @@
     InternalBaseline getBaseline(NodeId id) throws RepositoryException;
 
     /**
-     * Creates a new internal configuration that represents a configuration
-     * of the tree rooted at the node specified by <code>rootId</code>
-     *
-     * @param session the session that creates the configuration
-     * @param rootId root id of the configuration
-     * @return the node id of the new internal configuration
-     * @throws RepositoryException if an error occurs
-     */
-    NodeId createConfiguration(Session session, NodeId rootId)
-            throws RepositoryException;
-
-    /**
-     * Returns the configuration for the workspace node with the given id.
-     * @param rootId the node id for the configuration root node.
-     * @return the configuration or <code>null</code> if it does not exist.
-     * @throws RepositoryException if an error occurs
-     */
-    InternalConfiguration getConfigurationForNode(NodeId rootId) throws RepositoryException;
-
-    /**
-     * Returns the configuration for the given id.
-     * @param nodeId the node id
-     * @return the configuration
-     * @throws RepositoryException if not exist or an error occurs
-     */
-    InternalConfiguration getConfiguration(NodeId nodeId) throws RepositoryException;
-
-    /**
-     * Performs a checkin of the configuration.
-     *
-     * @param session session that performs the checkin
-     * @param config internal configuration
-     * @param baseVersions set of base versions to record in the baseline
-     * @return the new baseline
-     * @throws RepositoryException if an error occurs
-     */
-    InternalBaseline checkin(Session session, InternalConfiguration config,
-                             Set<NodeId> baseVersions)
-            throws RepositoryException;
-
-    /**
      * Returns the activity with the given id
      *
      * @param id id of the activity to retrieve

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerBase.java Wed Jul 22 22:42:18 2009
@@ -22,7 +22,6 @@
 import javax.jcr.ReferentialIntegrityException;
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
-import javax.jcr.PropertyType;
 import javax.jcr.version.VersionException;
 
 import org.apache.jackrabbit.core.id.NodeId;
@@ -75,11 +74,6 @@
     protected NodeStateEx activitiesRoot;
 
     /**
-     * Persistent root node of the configurations.
-     */
-    protected NodeStateEx configurationsRoot;
-
-    /**
      * the lock on this version manager
      */
     private final DefaultISMLocking rwLock = new DefaultISMLocking();
@@ -456,90 +450,6 @@
     }
 
     /**
-     * Creates a new configuration node.
-     * <p/>
-     * The nt:confguration is stored within the nt:configurations storage using
-     * the nodeid of the configuration root (rootId) as path.
-     *
-     * @param rootId the id of the root node of the workspace configuration
-     * @return a node state of the created configuration
-     * @throws RepositoryException if an error occurs
-     */
-    NodeStateEx internalCreateConfiguration(NodeId rootId)
-            throws RepositoryException {
-        WriteOperation ops = startWriteOperation();
-        try {
-            // If the parameter baseline is null, a new version history is created
-            // to store baselines of the new configuration, and the jcr:baseVersion
-            // of the new configuration references the root of the new version history.
-            NodeStateEx configParent = getParentNode(configurationsRoot,
-                    rootId.toString(), NameConstants.REP_CONFIGURATIONS);
-            Name name = getName(rootId.toString());
-
-            NodeId configId = new NodeId();
-            NodeStateEx config = configParent.addNode(name, NameConstants.NT_CONFIGURATION, configId, true);
-            config.setPropertyValue(NameConstants.JCR_ROOT, InternalValue.create(rootId));
-
-            // now create the version history of the baseline
-            NodeStateEx histParent = getParentNode(historyRoot, configId.toString(), NameConstants.REP_VERSIONSTORAGE);
-            Name histName = getName(configId.toString());
-            NodeStateEx history =
-                InternalVersionHistoryImpl.create(this, histParent, histName, config.getState(), null);
-            InternalVersionHistory vh = new InternalVersionHistoryImpl(this, history);
-
-            // and set the base version and history to the config
-            NodeId blId = vh.getRootVersion().getId();
-            config.setPropertyValue(NameConstants.JCR_BASEVERSION, InternalValue.create(blId));
-            config.setPropertyValue(NameConstants.JCR_VERSIONHISTORY, InternalValue.create(vh.getId()));
-            config.setPropertyValue(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(true));
-            InternalValue[] preds = new InternalValue[]{InternalValue.create(blId)};
-            config.setPropertyValues(NameConstants.JCR_PREDECESSORS, PropertyType.REFERENCE, preds, true);
-            configParent.store();
-            ops.save();
-
-            return config;
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        } finally {
-            ops.close();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public InternalConfiguration getConfigurationForNode(NodeId rootId) throws RepositoryException {
-        ReadLock lock = acquireReadLock();
-        try {
-            String uuid = rootId.toString();
-            Name name = getName(uuid);
-
-            NodeStateEx parent = getParentNode(configurationsRoot, uuid, null);
-            if (parent != null && parent.hasNode(name)) {
-                NodeStateEx config = parent.getNode(name, 1);
-                return new InternalConfigurationImpl(this, config);
-            } else {
-                return null;
-            }
-        } finally {
-            lock.release();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public InternalConfiguration getConfiguration(NodeId nodeId)
-            throws RepositoryException {
-        // lock handling via getItem()
-        InternalConfiguration config = (InternalConfiguration) getItem(nodeId);
-        if (config == null) {
-            throw new ItemNotFoundException(nodeId.toString());
-        }
-        return config;
-    }
-
-    /**
      * Removes the specified activity
      *
      * @param activity the acitvity to remove
@@ -591,7 +501,7 @@
      * @param name string name
      * @return A <code>Name</code> object.
      */
-    private Name getName(String name) {
+    protected static Name getName(String name) {
         return NameFactoryImpl.getInstance().create(Name.NS_DEFAULT_URI, name);
     }
 
@@ -609,7 +519,7 @@
      * @return parent node of the version history, or <code>null</code>
      * @throws RepositoryException if an error occurs
      */
-    private NodeStateEx getParentNode(NodeStateEx parent, String uuid, Name interNT)
+    protected static NodeStateEx getParentNode(NodeStateEx parent, String uuid, Name interNT)
             throws RepositoryException {
         NodeStateEx n = parent;
         for (int i = 0; i < 3; i++) {
@@ -633,18 +543,20 @@
      * @param history the version history
      * @param node node to checkin
      * @param simple flag indicates simple versioning
+     * @param baseVersions in case the node is a nt:configuration
      * @return internal version
      * @throws javax.jcr.RepositoryException if an error occurs
      * @see javax.jcr.Node#checkin()
      */
     protected InternalVersion internalCheckin(InternalVersionHistoryImpl history,
-                                      NodeStateEx node, boolean simple)
+                                      NodeStateEx node, boolean simple,
+                                      final Set<NodeId> baseVersions)
             throws RepositoryException {
         WriteOperation operation = startWriteOperation();
         try {
             String versionName = calculateCheckinVersionName(history, node, simple);
             InternalVersionImpl v = history.checkin(
-                    NameFactoryImpl.getInstance().create("", versionName), node, null);
+                    NameFactoryImpl.getInstance().create("", versionName), node, baseVersions);
 
             // check for jcr:activity
             if (node.hasProperty(NameConstants.JCR_ACTIVITY)) {
@@ -662,44 +574,6 @@
     }
 
     /**
-     * internally checks in a configuration
-     * @param config the config
-     * @param baseVersions the base versions to record
-     * @return the new baseline
-     * @throws RepositoryException if an error occurs
-     */
-    protected InternalBaseline internalCheckin(InternalConfigurationImpl config,
-                                               Set<NodeId> baseVersions)
-            throws RepositoryException {
-        InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl) getVersionHistoryOfNode(config.getId());
-        WriteOperation operation = startWriteOperation();
-        try {
-            NodeStateEx node = config.node;
-            String versionName = calculateCheckinVersionName(vh, node, false);
-            InternalBaseline v = (InternalBaseline) vh.checkin(
-                    NameFactoryImpl.getInstance().create("", versionName),
-                    node, baseVersions);
-            // update properties on 'node' to point to the new base version
-            // but leave it checked out
-            node.setPropertyValue(
-                    NameConstants.JCR_BASEVERSION,
-                    InternalValue.create(v.getId()));
-            node.setPropertyValues(
-                    NameConstants.JCR_PREDECESSORS,
-                    PropertyType.REFERENCE,
-                    new InternalValue[]{InternalValue.create(v.getId())}
-            );
-            node.store();
-            operation.save();
-            return v;
-        } catch (ItemStateException e) {
-            throw new RepositoryException(e);
-        } finally {
-            operation.close();
-        }
-    }
-
-    /**
      * Calculates the name of the new version that will be created by a
      * checkin call. The name is determined as follows:
      * <ul>
@@ -879,8 +753,6 @@
                     return new InternalVersionHistoryImpl(this, pNode);
                 } else if (ntName.equals(NameConstants.NT_ACTIVITY)) {
                     return new InternalActivityImpl(this, pNode);
-                } else if (ntName.equals(NameConstants.NT_CONFIGURATION)) {
-                    return new InternalConfigurationImpl(this, pNode);
                 } else {
                     return null;
                 }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalVersionManagerImpl.java Wed Jul 22 22:42:18 2009
@@ -84,11 +84,6 @@
      */
     private static final Path ACTIVITIES_PATH;
 
-    /**
-     * The path to the configurations storage: /jcr:system/jcr:versionStorage/jcr:configurations
-     */
-    private static final Path CONFIGURATIONS_PATH;
-
     static {
         try {
             PathBuilder builder = new PathBuilder();
@@ -104,12 +99,6 @@
             builder.addLast(NameConstants.JCR_ACTIVITIES);
             ACTIVITIES_PATH = builder.getPath();
 
-            builder = new PathBuilder();
-            builder.addRoot();
-            builder.addLast(NameConstants.JCR_SYSTEM);
-            builder.addLast(NameConstants.JCR_VERSIONSTORAGE);
-            builder.addLast(NameConstants.JCR_CONFIGURATIONS);
-            CONFIGURATIONS_PATH = builder.getPath();
         } catch (MalformedPathException e) {
             // will not happen. path is always valid
             throw new InternalError("Cannot initialize path");
@@ -158,7 +147,6 @@
      * @param rootParentId node id of the version storage parent (i.e. jcr:system)
      * @param storageId node id of the version storage (i.e. jcr:versionStorage)
      * @param activitiesId node id of the activities storage (i.e. jcr:activities)
-     * @param configurationsId node if of the configurations storage (i.e. jcr:configurations)
      * @param cacheFactory item state cache factory
      * @param ismLocking workspace item state locking
      * @throws RepositoryException if an error occurs
@@ -169,7 +157,6 @@
                               NodeId rootParentId,
                               NodeId storageId,
                               NodeId activitiesId,
-                              NodeId configurationsId,
                               ItemStateCacheFactory cacheFactory,
                               ISMLocking ismLocking) throws RepositoryException {
         super(ntReg);
@@ -224,32 +211,6 @@
                 pMgr.store(cl);
             }
 
-            // check for jcr:configurations
-            if (!pMgr.exists(configurationsId)) {
-                NodeState root = pMgr.createNew(configurationsId);
-                root.setParentId(storageId);
-                root.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_VERSIONSTORAGE).getApplicableChildNodeDef(
-                        NameConstants.JCR_CONFIGURATIONS, NameConstants.REP_CONFIGURATIONS, ntReg).getId());
-                root.setNodeTypeName(NameConstants.REP_CONFIGURATIONS);
-                PropertyState pt = pMgr.createNew(new PropertyId(activitiesId, NameConstants.JCR_PRIMARYTYPE));
-                pt.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_CONFIGURATIONS).getApplicablePropertyDef(
-                        NameConstants.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId());
-                pt.setMultiValued(false);
-                pt.setType(PropertyType.NAME);
-                pt.setValues(new InternalValue[]{InternalValue.create(NameConstants.REP_CONFIGURATIONS)});
-                root.addPropertyName(pt.getName());
-
-                // add activities as child
-                NodeState historyState = pMgr.load(storageId);
-                historyState.addChildNodeEntry(NameConstants.JCR_CONFIGURATIONS, configurationsId);
-
-                ChangeLog cl = new ChangeLog();
-                cl.added(root);
-                cl.added(pt);
-                cl.modified(historyState);
-                pMgr.store(cl);
-            }
-
             sharedStateMgr = createItemStateManager(pMgr, storageId, ntReg, cacheFactory, ismLocking);
 
             stateMgr = LocalItemStateManager.createInstance(sharedStateMgr, escFactory, cacheFactory);
@@ -261,9 +222,6 @@
             nodeState = (NodeState) stateMgr.getItemState(activitiesId);
             activitiesRoot =  new NodeStateEx(stateMgr, ntReg, nodeState, NameConstants.JCR_ACTIVITIES);
 
-            nodeState = (NodeState) stateMgr.getItemState(configurationsId);
-            configurationsRoot =  new NodeStateEx(stateMgr, ntReg, nodeState, NameConstants.JCR_CONFIGURATIONS);
-
             // create the virtual item state provider
             versProvider = new VersionItemStateProvider(
                     getHistoryRootId(), sharedStateMgr);
@@ -348,35 +306,6 @@
 
     /**
      * {@inheritDoc}
-     */
-    public NodeId createConfiguration(Session session, final NodeId rootId)
-            throws RepositoryException {
-        NodeStateEx state = (NodeStateEx)
-                escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
-            public Object run() throws RepositoryException {
-                return internalCreateConfiguration(rootId);
-            }
-        });
-        return state.getNodeId();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public InternalBaseline checkin(Session session,
-                                    final InternalConfiguration config,
-                                    final Set<NodeId> baseVersions)
-            throws RepositoryException {
-        return (InternalBaseline)
-                escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
-            public Object run() throws RepositoryException {
-                return internalCheckin((InternalConfigurationImpl) config, baseVersions);
-            }
-        });
-    }
-
-    /**
-     * {@inheritDoc}
      * <p/>
      * This method must not be synchronized since it could cause deadlocks with
      * item-reading listeners in the observation thread.
@@ -489,7 +418,8 @@
      * This method must not be synchronized since it could cause deadlocks with
      * item-reading listeners in the observation thread.
      */
-    public InternalVersion checkin(final Session session, final NodeStateEx node)
+    public InternalVersion checkin(final Session session, final NodeStateEx node,
+                                   final Set<NodeId> baseVersions)
             throws RepositoryException {
         return (InternalVersion)
                 escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
@@ -500,11 +430,11 @@
                     // the property
                     NodeId histId = node.getPropertyValue(NameConstants.JCR_VERSIONHISTORY).getNodeId();
                     vh = getVersionHistory(histId);
-                    return internalCheckin((InternalVersionHistoryImpl) vh, node, false);
+                    return internalCheckin((InternalVersionHistoryImpl) vh, node, false, baseVersions);
                 } else {
                     // in simple versioning the history id needs to be calculated
                     vh = getVersionHistoryOfNode(node.getNodeId());
-                    return internalCheckin((InternalVersionHistoryImpl) vh, node, true);
+                    return internalCheckin((InternalVersionHistoryImpl) vh, node, true, baseVersions);
                 }
             }
         });

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalXAVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalXAVersionManager.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalXAVersionManager.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/InternalXAVersionManager.java Wed Jul 22 22:42:18 2009
@@ -179,37 +179,6 @@
     /**
      * {@inheritDoc}
      */
-    public NodeId createConfiguration(Session session, NodeId rootId)
-            throws RepositoryException {
-        if (isInXA()) {
-            NodeStateEx state = internalCreateConfiguration(rootId);
-            InternalConfiguration config = new InternalConfigurationImpl(vMgr, state);
-            xaItems.put(state.getNodeId(), config);
-            return config.getId();
-        } else {
-            return vMgr.createConfiguration(session, rootId);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public InternalBaseline checkin(Session session,
-                                    InternalConfiguration config,
-                                    Set<NodeId> baseVersions)
-            throws RepositoryException {
-        if (isInXA()) {
-            InternalBaseline version = internalCheckin((InternalConfigurationImpl) config, baseVersions);
-            xaItems.put(version.getId(), version);
-            return version;
-        } else {
-            return vMgr.checkin(session, config, baseVersions);
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public void removeActivity(Session session, NodeId nodeId)
             throws RepositoryException {
 
@@ -244,7 +213,8 @@
     /**
      * {@inheritDoc}
      */
-    public InternalVersion checkin(Session session, NodeStateEx node) throws RepositoryException {
+    public InternalVersion checkin(Session session, NodeStateEx node, Set<NodeId> baseVersions)
+            throws RepositoryException {
         if (isInXA()) {
             InternalVersionHistory vh;
             InternalVersion version;
@@ -253,15 +223,15 @@
                 // the property
                 NodeId histId = node.getPropertyValue(NameConstants.JCR_VERSIONHISTORY).getNodeId();
                 vh = getVersionHistory(histId);
-                version = internalCheckin((InternalVersionHistoryImpl) vh, node, false);
+                version = internalCheckin((InternalVersionHistoryImpl) vh, node, false, baseVersions);
             } else {
                 // in simple versioning the history id needs to be calculated
                 vh = getVersionHistoryOfNode(node.getNodeId());
-                version = internalCheckin((InternalVersionHistoryImpl) vh, node, true);
+                version = internalCheckin((InternalVersionHistoryImpl) vh, node, true, baseVersions);
             }
             return version;
         } else {
-            return vMgr.checkin(session, node);
+            return vMgr.checkin(session, node, baseVersions);
         }
     }
 
@@ -474,14 +444,15 @@
      * Before modifying version history given, make a local copy of it.
      */
     protected InternalVersion internalCheckin(InternalVersionHistoryImpl history,
-                                      NodeStateEx node, boolean simple)
+                                      NodeStateEx node, boolean simple,
+                                      Set<NodeId> baseVersions)
             throws RepositoryException {
 
         if (history.getVersionManager() != this) {
             history = makeLocalCopy(history);
             xaItems.put(history.getId(), history);
         }
-        InternalVersion version = super.internalCheckin(history, node, simple);
+        InternalVersion version = super.internalCheckin(history, node, simple, baseVersions);
         NodeId frozenNodeId = version.getFrozenNodeId();
         InternalVersionItem frozenNode = createInternalVersionItem(frozenNodeId);
         if (frozenNode != null) {

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplBase.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplBase.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplBase.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplBase.java Wed Jul 22 22:42:18 2009
@@ -16,11 +16,15 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import java.util.Set;
+import java.util.HashSet;
+
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
 import javax.jcr.NamespaceException;
 import javax.jcr.Node;
 import javax.jcr.PropertyType;
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.version.Version;
 
 import org.apache.jackrabbit.core.HierarchyManager;
@@ -158,7 +162,12 @@
         try {
             // the 2 cases could be consolidated but is clearer this way
             if (checkin) {
-                InternalVersion v = vMgr.checkin(session, state);
+                // check for configuration
+                Set<NodeId> baseVersions = null;
+                if (state.getEffectiveNodeType().includesNodeType(NameConstants.NT_CONFIGURATION)) {
+                    baseVersions = collectBaseVersions(state);
+                }
+                InternalVersion v = vMgr.checkin(session, state, baseVersions);
                 baseId = v.getId();
                 if (isFull) {
                     state.setPropertyValue(
@@ -194,6 +203,45 @@
         }
     }
 
+    /**
+     * Collects the base versions for the workspace configuration referenced by
+     * the given config node.
+     * @param config the config
+     * @return the id of the new base version
+     * @throws RepositoryException if an error occurs
+     */
+    private Set<NodeId> collectBaseVersions(NodeStateEx config) throws RepositoryException {
+        NodeId rootId = config.getPropertyValue(NameConstants.JCR_ROOT).getNodeId();
+        NodeStateEx root = getNodeStateEx(rootId);
+        if (root == null) {
+            throw new ItemNotFoundException("Configuration root node for " + safeGetJCRPath(config) + " not found.");
+        }
+        Set<NodeId> baseVersions = new HashSet<NodeId>();
+        baseVersions.add(root.getPropertyValue(NameConstants.JCR_BASEVERSION).getNodeId());
+        collectBaseVersions(root, baseVersions);
+        return baseVersions;
+    }
+
+    /**
+     * Recursivly collects all base versions of this configuration tree.
+     * @param root node to traverse
+     * @param baseVersions set of base versions to fill
+     * @throws RepositoryException if an error occurs
+     */
+    private void collectBaseVersions(NodeStateEx root, Set<NodeId> baseVersions)
+            throws RepositoryException {
+        for (NodeStateEx child: root.getChildNodes()) {
+            if (child.getEffectiveNodeType().includesNodeType(NameConstants.MIX_VERSIONABLE)) {
+                if (child.hasProperty(NameConstants.JCR_CONFIGURATION)) {
+                    // don't traverse into child nodes that have a jcr:configuration
+                    // property as they belong to a different configuration.
+                    continue;
+                }
+                baseVersions.add(child.getPropertyValue(NameConstants.JCR_BASEVERSION).getNodeId());
+            }
+            collectBaseVersions(child, baseVersions);
+        }
+    }
 
     /**
      * Checks if the underlying node is versionable, i.e. has 'mix:versionable' or a

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplConfig.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplConfig.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplConfig.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplConfig.java Wed Jul 22 22:42:18 2009
@@ -16,19 +16,17 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import java.util.HashSet;
-import java.util.Set;
-
-import javax.jcr.ItemNotFoundException;
+import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.version.Version;
 
 import org.apache.jackrabbit.core.HierarchyManager;
+import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.UpdatableItemStateManager;
+import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
@@ -61,13 +59,13 @@
      * @param parent the parent state
      * @param name the name of the new node (tree)
      * @param baseline the baseline that recorded the versions
-     * @return the configuration
+     * @return the node id of the configuration
      * @throws RepositoryException if an error occurs
      */
-    protected InternalConfiguration restore(NodeStateEx parent, Name name, InternalBaseline baseline)
+    protected NodeId restore(NodeStateEx parent, Name name, InternalBaseline baseline)
             throws RepositoryException {
-        InternalConfiguration config = baseline.getConfiguration();
-        NodeId rootId = config.getRootId();
+        NodeStateEx config = parent.getNode(baseline.getVersionHistory().getVersionableId());
+        NodeId rootId = config.getPropertyValue(NameConstants.JCR_ROOT).getNodeId();
         if (stateMgr.hasItemState(rootId)) {
             NodeStateEx existing = parent.getNode(rootId);
             throw new UnsupportedRepositoryOperationException(
@@ -97,7 +95,7 @@
             // now just restore all versions
             internalRestore(versions, true);
             ops.save();
-            return config;
+            return config.getNodeId();
         } catch (ItemStateException e) {
             throw new RepositoryException(e);
         } finally {
@@ -106,51 +104,16 @@
     }
 
     /**
-     * Performs a configuration checkin
-     * @param config the config
-     * @return the id of the new base version
-     * @throws RepositoryException if an error occurs
-     */
-    protected NodeId checkin(InternalConfiguration config) throws RepositoryException {
-        NodeStateEx root = getRootNode(config);
-        Set<NodeId> baseVersions = new HashSet<NodeId>();
-        baseVersions.add(root.getPropertyValue(NameConstants.JCR_BASEVERSION).getNodeId());
-        collectBaseVersions(root, baseVersions);
-        return vMgr.checkin(session, config, baseVersions).getId();
-    }
-
-    /**
-     * Recursivly collects all base versions of this configuration tree.
-     * @param root node to traverse
-     * @param baseVersions set of base versions to fill
-     * @throws RepositoryException if an error occurs
-     */
-    private void collectBaseVersions(NodeStateEx root, Set<NodeId> baseVersions)
-            throws RepositoryException {
-        for (NodeStateEx child: root.getChildNodes()) {
-            if (child.getEffectiveNodeType().includesNodeType(NameConstants.MIX_VERSIONABLE)) {
-                if (child.hasProperty(NameConstants.JCR_CONFIGURATION)) {
-                    // don't traverse into child nodes that have a jcr:configuration
-                    // property as they belong to a different configuration.
-                    continue;
-                }
-                baseVersions.add(child.getPropertyValue(NameConstants.JCR_BASEVERSION).getNodeId());
-            }
-            collectBaseVersions(child, baseVersions);
-        }
-    }
-
-    /**
      * Performs a configuration restore
      * @param config config to restore
      * @param name name of the baseline version
      * @param removeExisting remove existing flag
      * @throws RepositoryException if an error occurs
      */
-    protected void restore(InternalConfiguration config, Name name, boolean removeExisting)
-            throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("not implemented, yet");
-    }
+//    protected void restore(InternalConfiguration config, Name name, boolean removeExisting)
+//            throws RepositoryException {
+//        throw new UnsupportedRepositoryOperationException("not implemented, yet");
+//    }
 
     /**
      * Performs a configuration restore
@@ -159,10 +122,10 @@
      * @param removeExisting remove existing flag
      * @throws RepositoryException if an error occurs
      */
-    protected void restoreByLabel(InternalConfiguration config, Name name, boolean removeExisting)
-            throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("not implemented, yet");
-    }
+//    protected void restoreByLabel(InternalConfiguration config, Name name, boolean removeExisting)
+//            throws RepositoryException {
+//        throw new UnsupportedRepositoryOperationException("not implemented, yet");
+//    }
 
     /**
      * Performs a configuration restore
@@ -171,21 +134,81 @@
      * @param removeExisting remove existing flag
      * @throws RepositoryException if an error occurs
      */
-    protected void restore(InternalConfiguration config, Version version, boolean removeExisting)
+//    protected void restore(InternalConfiguration config, Version version, boolean removeExisting)
+//            throws RepositoryException {
+//        throw new UnsupportedRepositoryOperationException("not implemented, yet");
+//    }
+
+    /**
+     * Creates a new configuration node.
+     * <p/>
+     * The nt:confguration is stored within the nt:configurations storage using
+     * the nodeid of the configuration root (rootId) as path.
+     *
+     * @param state the node of the workspace configuration
+     * @return the node id of the created configuration
+     * @throws RepositoryException if an error occurs
+     */
+    protected NodeId createConfiguration(NodeStateEx state)
             throws RepositoryException {
-        throw new UnsupportedRepositoryOperationException("not implemented, yet");
+
+        WriteOperation ops = startWriteOperation();
+        try {
+            NodeId rootId = state.getNodeId();
+            NodeStateEx configRoot = internalGetConfigRoot();
+            NodeStateEx configParent = InternalVersionManagerBase.getParentNode(
+                    configRoot,
+                    rootId.toString(),
+                    NameConstants.REP_CONFIGURATIONS);
+            Name name = InternalVersionManagerBase.getName(rootId.toString());
+
+            NodeId configId = new NodeId();
+            NodeStateEx config = configParent.addNode(name, NameConstants.NT_CONFIGURATION, configId, true);
+            config.setPropertyValue(NameConstants.JCR_ROOT, InternalValue.create(rootId));
+
+            // init mix:versionable flags
+            VersionHistoryInfo vh = vMgr.getVersionHistory(session, config.getState(), null);
+
+            // and set the base version and history to the config
+            InternalValue historyId = InternalValue.create(vh.getVersionHistoryId());
+            InternalValue versionId = InternalValue.create(vh.getRootVersionId());
+
+            config.setPropertyValue(NameConstants.JCR_BASEVERSION, versionId);
+            config.setPropertyValue(NameConstants.JCR_VERSIONHISTORY, historyId);
+            config.setPropertyValue(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(true));
+            config.setPropertyValues(NameConstants.JCR_PREDECESSORS, PropertyType.REFERENCE, new InternalValue[]{versionId});
+            configParent.store();
+
+            // set configuration reference in state
+            state.setPropertyValue(NameConstants.JCR_CONFIGURATION, InternalValue.create(configId));
+            state.store();
+
+            ops.save();
+
+            return configId;
+        } catch (ItemStateException e) {
+            throw new RepositoryException(e);
+        } finally {
+            ops.close();
+        }
     }
 
     /**
-     * Returns the configuration root node for the given config.
-     * @param config the config
+     * Returns the root node of the configurations storage located at
+     * "/jcr:system/jcr:configurations"
+     *
      * @return the root node
-     * @throws RepositoryException if an error occurs or the root node does not exist
+     * @throws RepositoryException if an error occurs
      */
-    private NodeStateEx getRootNode(InternalConfiguration config) throws RepositoryException {
-        NodeStateEx root = getNodeStateEx(config.getRootId());
+    private NodeStateEx internalGetConfigRoot() throws RepositoryException {
+        NodeStateEx system = getNodeStateEx(RepositoryImpl.SYSTEM_ROOT_NODE_ID);
+        NodeStateEx root = system.getNode(NameConstants.JCR_CONFIGURATIONS, 1);
         if (root == null) {
-            throw new ItemNotFoundException("Configuration root node for " + config.getId() + " not found.");
+            root = system.addNode(
+                    NameConstants.JCR_CONFIGURATIONS,
+                    NameConstants.REP_CONFIGURATIONS,
+                    RepositoryImpl.CONFIGURATIONS_NODE_ID, false);
+            system.store();
         }
         return root;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java?rev=796899&r1=796898&r2=796899&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java (original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImplRestore.java Wed Jul 22 22:42:18 2009
@@ -291,7 +291,7 @@
         } else {
             // with simple versioning, the node is checked in automatically,
             // thus not allowing any branches
-            vMgr.checkin(session, state);
+            vMgr.checkin(session, state, null);
         }
         // 3. N's jcr:isCheckedOut property is set to false.
         state.setPropertyValue(NameConstants.JCR_ISCHECKEDOUT, InternalValue.create(false));

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=796899&r1=796898&r2=796899&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 Wed Jul 22 22:42:18 2009
@@ -496,6 +496,7 @@
   orderable
   + jcr:versionStorage (rep:versionStorage) = rep:versionStorage mandatory protected ABORT
   + jcr:nodeTypes (rep:nodeTypes) = rep:nodeTypes mandatory protected ABORT
+  + jcr:configurations (rep:Configurations) = rep:Configurations protected sns ABORT
   + * (nt:base) = nt:unstructured sns IGNORE
 
 // implementation note: currently we keep the activities below the version storage
@@ -506,7 +507,6 @@
   + * (nt:versionHistory) = nt:versionHistory protected sns ABORT
   + * (rep:versionStorage) = rep:versionStorage protected sns ABORT
   + * (rep:Activities) = rep:Activities protected sns ABORT
-  + * (rep:Configurations) = rep:Configurations protected sns ABORT
 
 [rep:Activities]
   + * (nt:activity) = nt:activity protected sns ABORT



Mime
View raw message