jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r792142 [14/35] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/security/ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrab...
Date Wed, 08 Jul 2009 13:57:46 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionIteratorImpl.java Wed Jul  8 13:57:13 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
@@ -81,12 +81,13 @@
      * @param rootVersion the root version
      * @param baseVersion the ending base version
      */
-    public VersionIteratorImpl(Session session, InternalVersion rootVersion, InternalVersion baseVersion) {
+    public VersionIteratorImpl(Session session, InternalVersion rootVersion,
+                               InternalVersion baseVersion) {
         this.session = (SessionImpl) session;
         if (baseVersion == null) {
-            initVersions(rootVersion);
+            collectAllVersions(rootVersion);
         } else {
-            initVersions(rootVersion, baseVersion);
+            collectLinearVersions(baseVersion);
         }
         // retrieve initial size, since size of the list is not stable
         size = versions.size();
@@ -99,7 +100,7 @@
         if (versions.isEmpty()) {
             throw new NoSuchElementException();
         }
-        NodeId id = (NodeId) versions.removeFirst();
+        NodeId id = versions.removeFirst();
         pos++;
 
         try {
@@ -161,11 +162,11 @@
      *
      * @param root the root version
      */
-    private synchronized void initVersions(InternalVersion root) {
-        LinkedList workQueue = new LinkedList();
+    private synchronized void collectAllVersions(InternalVersion root) {
+        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);
@@ -177,15 +178,13 @@
     }
 
     /**
-     * Adds all versions of a single line of decent starting from <code>root</code>
-     * and ending at <code>base</code>.
+     * Adds all versions of a single line of decent starting from the root
+     * version to the <code>base</code> version.
      *
-     * @param root the root version
      * @param base the base version
      */
-    private synchronized void initVersions(InternalVersion root, InternalVersion base) {
-        NodeId rootId = root == null ? null : root.getId();
-        while (base != null && !base.getId().equals(rootId)) {
+    private synchronized void collectLinearVersions(InternalVersion base) {
+        while (base != null) {
             versions.addFirst(base.getId());
             InternalVersion[] preds = base.getPredecessors();
             if (preds.length == 0) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManager.java Wed Jul  8 13:57:13 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;
 
     /**
@@ -67,6 +69,15 @@
     Version checkin(NodeImpl node) throws RepositoryException;
 
     /**
+     * invokes the checkout() on the persistent version manager.
+     *
+     * @param node node to checkout
+     * @return the base version
+     * @throws RepositoryException if an error occurs
+     */
+    Version checkout(NodeImpl node) throws RepositoryException;
+
+    /**
      * Removes the specified version from the given version history.
      * @param history version history to remove the version from
      * @param versionName name of the version
@@ -124,6 +135,15 @@
     InternalVersion getVersion(NodeId id) throws RepositoryException;
 
     /**
+     * Returns the activity with the given id
+     *
+     * @param id id of the activity to retrieve
+     * @return the activity.
+     * @throws RepositoryException if an error occurs
+     */
+    InternalActivity getActivity(NodeId id) throws RepositoryException;
+
+    /**
      * Returns the head version of the node with the given id. this is always
      * the last of all versions. this only works correctly for liner version
      * graphs (i.e. simple versioning)
@@ -135,6 +155,23 @@
     InternalVersion getHeadVersionOfNode(NodeId id) throws RepositoryException;
 
     /**
+     * Creates a new activity
+     * @param session the current session
+     * @param title title of the new activity
+     * @return the nodeid of the new activity
+     * @throws RepositoryException if an error occurs
+     */
+    NodeId createActivity(Session session, String title) throws RepositoryException;
+
+    /**
+     * Removes an activity and all 
+     * @param session the current session
+     * @param nodeId id of the activity to remove
+     * @throws RepositoryException if an error occurs
+     */
+    void removeActivity(Session session, NodeId nodeId) throws RepositoryException;
+
+    /**
      * Close this version manager. After having closed a persistence
      * manager, further operations on this object are treated as illegal
      * and throw

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java Wed Jul  8 13:57:13 2009
@@ -16,7 +16,20 @@
  */
 package org.apache.jackrabbit.core.version;
 
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+
+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 javax.jcr.version.ActivityViolationException;
+
 import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.jackrabbit.core.ItemId;
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.PropertyId;
@@ -30,44 +43,33 @@
 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.state.NodeReferences;
 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
@@ -79,6 +81,11 @@
      */
     private static final Path VERSION_STORAGE_PATH;
 
+    /**
+     * The path to the version storage: /jcr:system/jcr:versionStorage/jcr:activities
+     */
+    private static final Path ACTIVITIES_PATH;
+
     static {
         try {
             PathBuilder builder = new PathBuilder();
@@ -86,6 +93,13 @@
             builder.addLast(NameConstants.JCR_SYSTEM);
             builder.addLast(NameConstants.JCR_VERSIONSTORAGE);
             VERSION_STORAGE_PATH = builder.getPath();
+
+            builder = new PathBuilder();
+            builder.addRoot();
+            builder.addLast(NameConstants.JCR_SYSTEM);
+            builder.addLast(NameConstants.JCR_VERSIONSTORAGE);
+            builder.addLast(NameConstants.JCR_ACTIVITIES);
+            ACTIVITIES_PATH = builder.getPath();
         } catch (MalformedPathException e) {
             // will not happen. path is always valid
             throw new InternalError("Cannot initialize path");
@@ -120,7 +134,8 @@
     /**
      * Map of returned items. this is kept for invalidating
      */
-    private final ReferenceMap versionItems = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
+    private final Map<ItemId, InternalVersionItem> versionItems =
+            new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK);
 
     /**
      * Creates a new version manager
@@ -128,8 +143,10 @@
      */
     public VersionManagerImpl(PersistenceManager pMgr, FileSystem fs,
                               NodeTypeRegistry ntReg,
-                              DelegatingObservationDispatcher obsMgr, NodeId rootId,
+                              DelegatingObservationDispatcher obsMgr,
                               NodeId rootParentId,
+                              NodeId storageId,
+                              NodeId activitiesId,
                               ItemStateCacheFactory cacheFactory,
                               ISMLocking ismLocking) throws RepositoryException {
         super(ntReg);
@@ -139,13 +156,13 @@
             this.escFactory = new DynamicESCFactory(obsMgr);
 
             // need to store the version storage root directly into the persistence manager
-            if (!pMgr.exists(rootId)) {
-                NodeState root = pMgr.createNew(rootId);
+            if (!pMgr.exists(storageId)) {
+                NodeState root = pMgr.createNew(storageId);
                 root.setParentId(rootParentId);
                 root.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_SYSTEM).getApplicableChildNodeDef(
                         NameConstants.JCR_VERSIONSTORAGE, NameConstants.REP_VERSIONSTORAGE, ntReg).getId());
                 root.setNodeTypeName(NameConstants.REP_VERSIONSTORAGE);
-                PropertyState pt = pMgr.createNew(new PropertyId(rootId, NameConstants.JCR_PRIMARYTYPE));
+                PropertyState pt = pMgr.createNew(new PropertyId(storageId, NameConstants.JCR_PRIMARYTYPE));
                 pt.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_SYSTEM).getApplicablePropertyDef(
                         NameConstants.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId());
                 pt.setMultiValued(false);
@@ -157,14 +174,44 @@
                 cl.added(pt);
                 pMgr.store(cl);
             }
-            sharedStateMgr = createItemStateManager(pMgr, rootId, ntReg, cacheFactory, ismLocking);
 
-            stateMgr = new LocalItemStateManager(sharedStateMgr, escFactory, cacheFactory);
+            // check for jcr:activities
+            if (!pMgr.exists(activitiesId)) {
+                NodeState root = pMgr.createNew(activitiesId);
+                root.setParentId(storageId);
+                root.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_VERSIONSTORAGE).getApplicableChildNodeDef(
+                        NameConstants.JCR_ACTIVITIES, NameConstants.REP_ACTIVITIES, ntReg).getId());
+                root.setNodeTypeName(NameConstants.REP_ACTIVITIES);
+                PropertyState pt = pMgr.createNew(new PropertyId(activitiesId, NameConstants.JCR_PRIMARYTYPE));
+                pt.setDefinitionId(ntReg.getEffectiveNodeType(NameConstants.REP_ACTIVITIES).getApplicablePropertyDef(
+                        NameConstants.JCR_PRIMARYTYPE, PropertyType.NAME, false).getId());
+                pt.setMultiValued(false);
+                pt.setType(PropertyType.NAME);
+                pt.setValues(new InternalValue[]{InternalValue.create(NameConstants.REP_ACTIVITIES)});
+                root.addPropertyName(pt.getName());
+
+                // add activities as child
+                NodeState historyState = pMgr.load(storageId);
+                historyState.addChildNodeEntry(NameConstants.JCR_ACTIVITIES, activitiesId);
+                                
+                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);
             stateMgr.addListener(this);
 
-            NodeState nodeState = (NodeState) stateMgr.getItemState(rootId);
+            NodeState nodeState = (NodeState) stateMgr.getItemState(storageId);
             historyRoot = new NodeStateEx(stateMgr, ntReg, nodeState, NameConstants.JCR_VERSIONSTORAGE);
 
+            nodeState = (NodeState) stateMgr.getItemState(activitiesId);
+            activitiesRoot =  new NodeStateEx(stateMgr, ntReg, nodeState, NameConstants.JCR_ACTIVITIES);
+
             // create the virtual item state provider
             versProvider = new VersionItemStateProvider(
                     getHistoryRootId(), sharedStateMgr);
@@ -212,12 +259,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 internalCreateVersionHistory(node, copiedFrom);
             }
         });
 
@@ -232,6 +280,39 @@
 
     /**
      * {@inheritDoc}
+     * <p/>
+     * This method must not be synchronized since it could cause deadlocks with
+     * item-reading listeners in the observation thread.
+     */
+    public NodeId createActivity(Session session, final String title) throws RepositoryException {
+        NodeStateEx state = (NodeStateEx)
+                escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
+            public Object run() throws RepositoryException {
+                return internalCreateActivity(title);
+            }
+        });
+        return state.getNodeId();
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p/>
+     * This method must not be synchronized since it could cause deadlocks with
+     * item-reading listeners in the observation thread.
+     */
+    public void removeActivity(Session session, final NodeId nodeId)
+            throws RepositoryException {
+        escFactory.doSourced((SessionImpl) session, new SourcedTarget() {
+            public Object run() throws RepositoryException {
+                InternalActivityImpl act = (InternalActivityImpl) getItem(nodeId);
+                internalRemoveActivity(act);
+                return null;
+            }
+        });
+    }
+
+    /**
+     * {@inheritDoc}
      */
     public boolean hasItem(NodeId id) {
         ReadLock lock = acquireReadLock();
@@ -254,7 +335,7 @@
         ReadLock lock = acquireReadLock();
         try {
             synchronized (versionItems) {
-                InternalVersionItem item = (InternalVersionItem) versionItems.get(id);
+                InternalVersionItem item = versionItems.get(id);
                 if (item == null) {
                     item = createInternalVersionItem(id);
                     if (item != null) {
@@ -269,7 +350,63 @@
             lock.release();
         }
     }
-    
+    /**
+     * {@inheritDoc}
+     *
+     * this method currently does no modifications to the persistence and just
+     * checks if the checkout is valid in respect to a possible activity set on
+     * the session
+     */
+    public Version checkout(NodeImpl node) throws RepositoryException {
+        NodeId baseId = NodeId.valueOf(node.getProperty(NameConstants.JCR_BASEVERSION).getString());
+        NodeImpl activity = (NodeImpl) node.getSession().getWorkspace().getVersionManager().getActivity();
+        if (activity != null) {
+            // If there exists another workspace with node N' where N' also has version
+            // history H, N' is checked out and the jcr:activity property of N'
+            // references A, then the checkout fails with an
+            // ActivityViolationException indicating which workspace currently has
+            // the checkout.
+
+            // we're currently leverage the fact, that only references to "real"
+            // workspaces are recorded.
+            NodeId nodeId = activity.getNodeId();
+            NodeReferencesId refId = new NodeReferencesId(nodeId);
+            if (stateMgr.hasNodeReferences(refId)) {
+                try {
+                    NodeReferences refs = stateMgr.getNodeReferences(refId);
+                    if (refs.hasReferences()) {
+                        throw new ActivityViolationException("Unable to checkout. " +
+                                "Activity is already used for the same node in " +
+                                "another workspace.");
+                    }
+                } catch (ItemStateException e) {
+                    throw new RepositoryException("Error during checkout.", e);
+                }
+            }
+
+            // TODO:
+            // If there is a version in H that is not an eventual predecessor of N but
+            // whose jcr:activity references A, then the checkout fails with an
+            // ActivityViolationException
+            InternalActivityImpl a = (InternalActivityImpl) getItem(nodeId);
+            NodeId historyId = NodeId.valueOf(node.getProperty(NameConstants.JCR_VERSIONHISTORY).getString());
+            InternalVersionHistory history = (InternalVersionHistory) getItem(historyId);
+            InternalVersion version = a.getLatestVersion(history);
+            if (version != null) {
+                InternalVersion baseVersion = (InternalVersion) getItem(baseId);
+                while (baseVersion != null && !baseVersion.getId().equals(version.getId())) {
+                    baseVersion = baseVersion.getLinearPredecessor();
+                }
+                if (baseVersion == null) {
+                    throw new ActivityViolationException("Unable to checkout. " +
+                            "Activity is used by another version on a different branch: " + version.getName());
+                }
+            }
+        }
+        return (VersionImpl)
+                ((SessionImpl) node.getSession()).getNodeById(baseId);
+    }
+
     /**
      * {@inheritDoc}
      * <p/>
@@ -286,11 +423,11 @@
                     // the property
                     String histUUID = node.getProperty(NameConstants.JCR_VERSIONHISTORY).getString();
                     vh = getVersionHistory(NodeId.valueOf(histUUID));
-                    return checkin((InternalVersionHistoryImpl) vh, node, false);
+                    return internalCheckin((InternalVersionHistoryImpl) vh, node, false);
                 } else {
                     // in simple versioning the history id needs to be calculated
                     vh = getVersionHistoryOfNode(node.getNodeId());
-                    return checkin((InternalVersionHistoryImpl) vh, node, true);
+                    return internalCheckin((InternalVersionHistoryImpl) vh, node, true);
                 }
             }
         });
@@ -318,7 +455,7 @@
             public Object run() throws RepositoryException {
                 InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl)
                         historyImpl.getInternalVersionHistory();
-                removeVersion(vh, name);
+                internalRemoveVersion(vh, name);
                 return null;
             }
         });
@@ -359,14 +496,12 @@
      *
      * @param items items updated
      */
-    public void itemsUpdated(Collection items) {
+    public void itemsUpdated(Collection<InternalVersionItem> items) {
         ReadLock lock = acquireReadLock();
         try {
             synchronized (versionItems) {
-                Iterator iter = items.iterator();
-                while (iter.hasNext()) {
-                    InternalVersionItem item = (InternalVersionItem) iter.next();
-                    InternalVersionItem cached = (InternalVersionItem) versionItems.remove(item.getId());
+                for (InternalVersionItem item : items) {
+                    InternalVersionItem cached = versionItems.remove(item.getId());
                     if (cached != null) {
                         if (cached instanceof InternalVersionHistoryImpl) {
                             InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl) cached;
@@ -411,14 +546,19 @@
     /**
      * {@inheritDoc}
      */
-    protected boolean hasItemReferences(InternalVersionItem item)
+    protected boolean hasItemReferences(NodeId id)
+            throws RepositoryException {
+        return stateMgr.hasNodeReferences(new NodeReferencesId(id));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected NodeStateEx getNodeStateEx(NodeId parentNodeId)
             throws RepositoryException {
         try {
-            NodeReferences refs = stateMgr.getNodeReferences(
-                    new NodeReferencesId(item.getId()));
-            return refs.hasReferences();
-        } catch (NoSuchItemStateException e) {
-            return false;
+            NodeState state = (NodeState) stateMgr.getItemState(parentNodeId);
+            return new NodeStateEx(stateMgr, ntReg, state, null);
         } catch (ItemStateException e) {
             throw new RepositoryException(e);
         }
@@ -434,7 +574,8 @@
     }
 
     /**
-     * Return the shared item state manager.
+     * Returns the shared item state manager.
+     * @return the shared item state manager.
      */
     protected SharedItemStateManager getSharedStateMgr() {
         return sharedStateMgr;
@@ -532,7 +673,7 @@
 
         /**
          * Creates a new event state collection factory
-         * @param obsMgr
+         * @param obsMgr dispatcher
          */
         public DynamicESCFactory(DelegatingObservationDispatcher obsMgr) {
             this.obsMgr = obsMgr;
@@ -569,9 +710,10 @@
         /**
          * Executes the given runnable using the given event source.
          *
-         * @param eventSource
-         * @param runnable
-         * @throws RepositoryException
+         * @param eventSource event source
+         * @param runnable the runnable to execute
+         * @return the return value of the executed runnable
+         * @throws RepositoryException if an error occurs
          */
         public synchronized Object doSourced(SessionImpl eventSource, SourcedTarget runnable)
                 throws RepositoryException {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/XAVersionManager.java Wed Jul  8 13:57:13 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)
@@ -106,7 +112,7 @@
         super(ntReg);
         this.vMgr = vMgr;
         this.session = session;
-        this.stateMgr = new XAItemStateManager(vMgr.getSharedStateMgr(),
+        this.stateMgr = XAItemStateManager.createInstance(vMgr.getSharedStateMgr(),
                 this, CHANGE_LOG_ATTRIBUTE_NAME, cacheFactory);
 
         NodeState state;
@@ -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 = internalCreateVersionHistory(node, copiedFrom);
             InternalVersionHistory history =
                 new InternalVersionHistoryImpl(vMgr, state);
             xaItems.put(state.getNodeId(), history);
@@ -153,7 +161,57 @@
                     state.getNodeId(),
                     state.getState().getChildNodeEntry(root, 1).getId());
         }
-        return vMgr.createVersionHistory(session, node);
+        return vMgr.createVersionHistory(session, node, copiedFrom);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NodeId createActivity(Session session, String title)
+            throws RepositoryException {
+
+        if (isInXA()) {
+            NodeStateEx state = internalCreateActivity(title);
+            InternalActivityImpl activity =
+                new InternalActivityImpl(vMgr, state);
+            xaItems.put(state.getNodeId(), activity);
+            return state.getNodeId();
+        }
+        return vMgr.createActivity(session, title);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void removeActivity(Session session, NodeId nodeId)
+            throws RepositoryException {
+
+        if (isInXA()) {
+            InternalActivityImpl act = (InternalActivityImpl) getItem(nodeId);
+            internalRemoveActivity(act);
+        }
+        vMgr.removeActivity(session, nodeId);
+    }
+
+    /**
+     * {@inheritDoc}
+     * <p/>
+     * Before modifying activity, make a local copy of it.
+     */
+    protected void internalRemoveActivity(InternalActivityImpl activity)
+            throws VersionException, RepositoryException {
+        if (activity.getVersionManager() != this) {
+            activity = makeLocalCopy(activity);
+            xaItems.put(activity.getId(), activity);
+        }
+        super.internalRemoveActivity(activity);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Version checkout(NodeImpl node) throws RepositoryException {
+        return vMgr.checkout(node);
     }
 
     /**
@@ -168,11 +226,11 @@
                 // the property
                 String histUUID = node.getProperty(NameConstants.JCR_VERSIONHISTORY).getString();
                 vh = getVersionHistory(NodeId.valueOf(histUUID));
-                version = checkin((InternalVersionHistoryImpl) vh, node, false);
+                version = internalCheckin((InternalVersionHistoryImpl) vh, node, false);
             } else {
                 // in simple versioning the history id needs to be calculated
                 vh = getVersionHistoryOfNode(node.getNodeId());
-                version = checkin((InternalVersionHistoryImpl) vh, node, true);
+                version = internalCheckin((InternalVersionHistoryImpl) vh, node, true);
             }
             return (Version) ((SessionImpl) node.getSession()).getNodeById(version.getId());
         }
@@ -188,7 +246,7 @@
         if (isInXA()) {
             InternalVersionHistoryImpl vh = (InternalVersionHistoryImpl)
                     ((VersionHistoryImpl) history).getInternalVersionHistory();
-            removeVersion(vh, versionName);
+            internalRemoveVersion(vh, versionName);
             return;
         }
         vMgr.removeVersion(history, versionName);
@@ -349,7 +407,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);
@@ -370,9 +428,22 @@
     /**
      * {@inheritDoc}
      */
-    protected boolean hasItemReferences(InternalVersionItem item)
+    protected boolean hasItemReferences(NodeId id)
+            throws RepositoryException {
+        return session.getNodeById(id).getReferences().hasNext();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    protected NodeStateEx getNodeStateEx(NodeId parentNodeId)
             throws RepositoryException {
-        return session.getNodeById(item.getId()).getReferences().hasNext();
+        try {
+            NodeState state = (NodeState) stateMgr.getItemState(parentNodeId);
+            return new NodeStateEx(stateMgr, ntReg, state, null);
+        } catch (ItemStateException e) {
+            throw new RepositoryException(e);
+        }
     }
 
     /**
@@ -380,7 +451,7 @@
      * <p/>
      * Before modifying version history given, make a local copy of it.
      */
-    protected InternalVersion checkin(InternalVersionHistoryImpl history,
+    protected InternalVersion internalCheckin(InternalVersionHistoryImpl history,
                                       NodeImpl node, boolean simple)
             throws RepositoryException {
 
@@ -388,7 +459,7 @@
             history = makeLocalCopy(history);
             xaItems.put(history.getId(), history);
         }
-        InternalVersion version = super.checkin(history, node, simple);
+        InternalVersion version = super.internalCheckin(history, node, simple);
         NodeId frozenNodeId = version.getFrozenNodeId();
         InternalVersionItem frozenNode = createInternalVersionItem(frozenNodeId);
         if (frozenNode != null) {
@@ -402,7 +473,7 @@
      * <p/>
      * Before modifying version history given, make a local copy of it.
      */
-    protected void removeVersion(InternalVersionHistoryImpl history, Name name)
+    protected void internalRemoveVersion(InternalVersionHistoryImpl history, Name name)
             throws VersionException, RepositoryException {
 
         if (history.getVersionManager() != this) {
@@ -411,15 +482,15 @@
             // 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);
+        super.internalRemoveVersion(history, name);
     }
 
     /**
@@ -462,14 +533,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);
             }
         }
@@ -502,10 +574,12 @@
      * Delegate the call to our XA item state manager. If successful, inform
      * global repository manager to update its caches.
      */
+    @SuppressWarnings("unchecked")
     public void commit(TransactionContext tx) throws TransactionException {
         if (vmgrLocked) {
             ((XAItemStateManager) stateMgr).commit(tx);
-            Map xaItems = (Map) tx.getAttribute(ITEMS_ATTRIBUTE_NAME);
+            Map<NodeId, InternalVersionItem> xaItems =
+                    (Map<NodeId, InternalVersionItem>) tx.getAttribute(ITEMS_ATTRIBUTE_NAME);
             vMgr.itemsUpdated(xaItems.values());
         }
     }
@@ -603,6 +677,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;
@@ -612,6 +687,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 {
@@ -628,8 +706,32 @@
     }
 
     /**
+     * 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 act source
+     * @return the new copy
+     * @throws RepositoryException if an error occurs
+     */
+    private InternalActivityImpl makeLocalCopy(InternalActivityImpl act)
+            throws RepositoryException {
+        ReadLock lock = acquireReadLock();
+        try {
+            NodeState state = (NodeState) stateMgr.getItemState(act.getId());
+            NodeStateEx stateEx = new NodeStateEx(stateMgr, ntReg, state, null);
+            return new InternalActivityImpl(this, stateEx);
+        } catch (ItemStateException e) {
+            throw new RepositoryException("Unable to make local copy", e);
+        } finally {
+            lock.release();
+        }
+    }
+
+    /**
      * 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/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/BufferedStringValue.java Wed Jul  8 13:57:13 2009
@@ -63,12 +63,12 @@
      * The maximum size for buffering data in memory.
      */
     private static final int MAX_BUFFER_SIZE = 0x10000;
-    
+
     /**
      * The in-memory buffer.
      */
     private StringWriter buffer;
-    
+
     /**
      * The number of characters written so far.
      * If the in-memory buffer is used, this is position within buffer (size of actual data in buffer)
@@ -80,7 +80,7 @@
      * MAX_BUFFER_SIZE.
      */
     private File tmpFile;
-    
+
     /**
      * Writer used to write to tmpFile.
      */
@@ -88,7 +88,7 @@
 
     private final NamePathResolver nsContext;
     private final ValueFactory valueFactory;
-    
+
     /**
      * Whether the value is base64 encoded.
      */
@@ -116,7 +116,7 @@
     public long length() throws IOException {
         return length;
     }
-    
+
     private String retrieveString() throws IOException {
         String value = retrieve();
         if (base64) {
@@ -158,7 +158,7 @@
             throw new IOException("this instance has already been disposed");
         }
     }
-    
+
     private Reader openReader() throws IOException {
         return new InputStreamReader(
                 new BufferedInputStream(new FileInputStream(tmpFile)), "UTF-8");
@@ -290,21 +290,8 @@
                 } else {
                     // >= 65kb: deserialize BINARY type
                     // using Reader and temporary file
-                    if (InternalValue.USE_DATA_STORE) {
-                        Base64ReaderInputStream in = new Base64ReaderInputStream(reader());
-                        return InternalValue.createTemporary(in);
-                    }
-                    TransientFileFactory fileFactory = TransientFileFactory.getInstance();
-                    File tmpFile = fileFactory.createTransientFile("bin", null, null);
-                    FileOutputStream out = new FileOutputStream(tmpFile);
-                    Reader reader = reader();
-                    try {
-                        Base64.decode(reader, out);
-                    } finally {
-                        reader.close();
-                        out.close();
-                    }
-                    return InternalValue.create(tmpFile);
+                    Base64ReaderInputStream in = new Base64ReaderInputStream(reader());
+                    return InternalValue.createTemporary(in);
                 }
             } else {
                 // convert serialized value to InternalValue using
@@ -383,7 +370,7 @@
 
     /**
      * Whether this value is base64 encoded
-     * 
+     *
      * @param base64 the flag
      */
     public void setBase64(boolean base64) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ClonedInputSource.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ClonedInputSource.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ClonedInputSource.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/ClonedInputSource.java Wed Jul  8 13:57:13 2009
@@ -34,12 +34,12 @@
  * {@link #cloneInputSource()} method.
  */
 public class ClonedInputSource extends InputSource {
-    private final char characterArray[];
-    private final byte byteArray[];
+    private final char[] characterArray;
+    private final byte[] byteArray;
 
     /**
      * Clone existing input source.
-     * 
+     *
      * @param input
      * @throws RepositoryException
      */
@@ -64,7 +64,7 @@
         }
     }
 
-    private ClonedInputSource(char characterArray[], byte byteArray[]) {
+    private ClonedInputSource(char[] characterArray, byte[] byteArray) {
         super();
         this.characterArray = characterArray;
         this.byteArray = byteArray;
@@ -81,7 +81,7 @@
     /**
      * Make a clone if this input source. The input source being cloned is still
      * valid after cloning.
-     * 
+     *
      * @return input source clone.
      */
     public ClonedInputSource cloneInputSource() {
@@ -108,7 +108,7 @@
                 final int bufferSize = Math.min(stream.available(), 4096);
                 ByteArrayOutputStream s = new ByteArrayOutputStream(bufferSize);
 
-                byte buffer[] = new byte[bufferSize];
+                byte[] buffer = new byte[bufferSize];
                 while (true) {
                     int numRead = stream.read(buffer);
                     if (numRead > 0) {
@@ -140,7 +140,7 @@
                 final int bufferSize = 4096;
                 CharArrayWriter w = new CharArrayWriter(bufferSize);
 
-                char buffer[] = new char[bufferSize];
+                char[] buffer = new char[bufferSize];
                 while (true) {
                     int numRead = reader.read(buffer);
                     if (numRead > 0) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/PropInfo.java Wed Jul  8 13:57:13 2009
@@ -153,7 +153,8 @@
             // can only be multi-valued (n == 0 || n > 1)
             node.setProperty(name, va, type);
         }
-        if (type == PropertyType.REFERENCE) {
+        if (type == PropertyType.REFERENCE
+                || type == PropertyType.WEAKREFERENCE) {
             // store reference for later resolution
             refTracker.processedReference(node.getProperty(name));
         }
@@ -215,7 +216,8 @@
         // make sure property is valid according to its definition
         itemOps.validate(prop);
 
-        if (prop.getType() == PropertyType.REFERENCE) {
+        if (prop.getType() == PropertyType.REFERENCE
+                || prop.getType() == PropertyType.WEAKREFERENCE) {
             // store reference for later resolution
             refTracker.processedReference(prop);
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Wed Jul  8 13:57:13 2009
@@ -24,7 +24,6 @@
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.uuid.UUID;
-import org.apache.jackrabbit.value.ReferenceValue;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -282,7 +281,8 @@
         while (iter.hasNext()) {
             Property prop = (Property) iter.next();
             // being paranoid...
-            if (prop.getType() != PropertyType.REFERENCE) {
+            if (prop.getType() != PropertyType.REFERENCE
+                    && prop.getType() != PropertyType.WEAKREFERENCE) {
                 continue;
             }
             if (prop.getDefinition().isMultiple()) {
@@ -293,7 +293,9 @@
                     UUID original = UUID.fromString(val.getString());
                     UUID adjusted = refTracker.getMappedUUID(original);
                     if (adjusted != null) {
-                        newVals[i] = new ReferenceValue(session.getNodeByUUID(adjusted));
+                        newVals[i] = session.getValueFactory().createValue(
+                                session.getNodeByUUID(adjusted),
+                                prop.getType() != PropertyType.REFERENCE);
                     } else {
                         // reference doesn't need adjusting, just copy old value
                         newVals[i] = val;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java Wed Jul  8 13:57:13 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(
@@ -598,7 +598,8 @@
             while (iter.hasNext()) {
                 PropertyState prop = (PropertyState) iter.next();
                 // being paranoid...
-                if (prop.getType() != PropertyType.REFERENCE) {
+                if (prop.getType() != PropertyType.REFERENCE
+                    && prop.getType() != PropertyType.WEAKREFERENCE) {
                     continue;
                 }
                 boolean modified = false;
@@ -609,7 +610,9 @@
                     UUID original = val.getUUID();
                     UUID adjusted = refTracker.getMappedUUID(original);
                     if (adjusted != null) {
-                        newVals[i] = InternalValue.create(adjusted);
+                        newVals[i] = InternalValue.create(
+                                adjusted,
+                                prop.getType() != PropertyType.REFERENCE);
                         modified = true;
                     } else {
                         // reference doesn't need adjusting, just copy old value

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/javadoc/org/apache/jackrabbit/core/package.html
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/javadoc/org/apache/jackrabbit/core/package.html?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/javadoc/org/apache/jackrabbit/core/package.html (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/javadoc/org/apache/jackrabbit/core/package.html Wed Jul  8 13:57:13 2009
@@ -76,7 +76,7 @@
 <p/>
 Every repository item is uniquely identified by its <code>ItemId</code>. The id
 of a node (<code>NodeId</code>) consists of the node's uuid. The id of a property
-(<code>PropertyId</code>) consists of the parent node's uuid and the qualified
+(<code>PropertyId</code>) consists of the parent node's uuid and the
 name of the property.
 
 <h2>Item managers</h2>

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources-filtered/org/apache/jackrabbit/core/repository.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources-filtered/org/apache/jackrabbit/core/repository.properties?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources-filtered/org/apache/jackrabbit/core/repository.properties (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources-filtered/org/apache/jackrabbit/core/repository.properties Wed Jul  8 13:57:13 2009
@@ -56,6 +56,9 @@
 # The presence of this key indicates that this implementation supports simple versioning.
 option.simple.versioning.supported = true
 
+# The presence of this key indicates that this implementation supports activities.
+option.activities.supported = true
+
 # The presence of this key indicates that this implementation supports observation.
 option.observation.supported = true
 
@@ -68,6 +71,9 @@
 # The presence of this key indicates that this implementation supports access control.
 option.access.control.supported = true
 
+# The presence of this key indicates that this implementation supports node type management.
+option.node.type.management.supported = true
+
 # The presence of this key indicates that this implementation supports retention.
 option.retention.supported = true
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/JackrabbitRepositoryStub.properties Wed Jul  8 13:57:13 2009
@@ -76,6 +76,9 @@
 # Test class: DatePropertyTest
 javax.jcr.tck.DatePropertyTest.testroot=/testdata
 
+# Test class: DecimalPropertyTest
+javax.jcr.tck.DecimalPropertyTest.testroot=/testdata
+
 # Test class: DoublePropertyTest
 javax.jcr.tck.DoublePropertyTest.testroot=/testdata
 
@@ -416,6 +419,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/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/nodetype/builtin_nodetypes.cnd Wed Jul  8 13:57:13 2009
@@ -21,27 +21,281 @@
 <mix='http://www.jcp.org/jcr/mix/1.0'>
 
 //------------------------------------------------------------------------------
-// B A S E  T Y P E S
+// B A S E  T Y P E
 //------------------------------------------------------------------------------
 
+/**
+ * nt:base is an abstract primary node type that is the base type for all other
+ * primary node types. It is the only primary node type without supertypes.
+ *
+ * @since 1.0
+ */
 [nt:base]
-  - jcr:primaryType (name) mandatory autocreated protected compute
-  - jcr:mixinTypes (name) protected multiple compute
+  // abstract (currently causes test-case failures, see JCR-2159)
+  - jcr:primaryType (NAME) mandatory autocreated protected COMPUTE
+  - jcr:mixinTypes (NAME) protected multiple COMPUTE
+
+//------------------------------------------------------------------------------
+// S T A N D A R D   A P P L I C A T I O N   N O D E   T Y P E S
+//------------------------------------------------------------------------------
+
+/**
+ * This abstract node type serves as the supertype of nt:file and nt:folder.
+ * @since 1.0
+ */
+[nt:hierarchyNode] > mix:created
+  // abstract (currently causes test-case failures, see JCR-2159)
+
+/**
+ * Nodes of this node type may be used to represent files. This node type inherits
+ * the item definitions of nt:hierarchyNode and requires a single child node called
+ * jcr:content. The jcr:content node is used to hold the actual content of the
+ * file. This child node is mandatory, but not auto-created. Its node type will be
+ * application-dependent and therefore it must be added by the user. A common
+ * approach is to make the jcr:content a node of type nt:resource. The
+ * jcr:content child node is also designated as the primary child item of its parent.
+ *
+ * @since 1.0
+ */
+[nt:file] > nt:hierarchyNode
+  primaryitem jcr:content
+  + jcr:content (nt:base) mandatory
+
+/**
+ * The nt:linkedFile node type is similar to nt:file, except that the content
+ * node is not stored directly as a child node, but rather is specified by a
+ * REFERENCE property. This allows the content node to reside anywhere in the
+ * workspace and to be referenced by multiple nt:linkedFile nodes. The content
+ * node must be referenceable.
+ *
+ * @since 1.0
+ */
+[nt:linkedFile] > nt:hierarchyNode
+  primaryitem jcr:content
+  - jcr:content (REFERENCE) mandatory
+
+/**
+ * Nodes of this type may be used to represent folders or directories. This node
+ * type inherits the item definitions of nt:hierarchyNode and adds the ability
+ * to have any number of other nt:hierarchyNode child nodes with any names.
+ * This means, in particular, that it can have child nodes of types nt:folder,
+ * nt:file or nt:linkedFile.
+ *
+ * @since 1.0
+ */
+[nt:folder] > nt:hierarchyNode
+  + * (nt:hierarchyNode) VERSION
+
+/**
+ * This node type may be used to represent the content of a file. In particular,
+ * the jcr:content subnode of an nt:file node will often be an nt:resource.
+ *
+ * @since 1.0
+ */
+[nt:resource] > mix:mimeType, mix:lastModified
+  primaryitem jcr:data
+  - jcr:data (BINARY) mandatory
+  
+/**
+ * This mixin node type can be used to add standardized title and description
+ * properties to a node.
+ *
+ * Note that the protected attributes suggested by JSR283 are omitted in this variant.
+ * @since 2.0
+ */
+[mix:title]
+  mixin
+  - jcr:title (STRING)
+  - jcr:description (STRING)
+
+/**
+ * This mixin node type can be used to add standardized creation information
+ * properties to a node. Since the properties are protected, their values are
+ * controlled by the repository, which should set them appropriately upon the
+ * initial persist of a node with this mixin type. In cases where this mixin is
+ * added to an already existing node the semantics of these properties are
+ * implementation specific.
+ *
+ * @since 2.0
+ */
+[mix:created]
+  mixin
+  - jcr:created (DATE) autocreated protected
+  - jcr:createdBy (STRING) protected
+
+/**
+ * This mixin node type can be used to provide standardized modification
+ * information properties to a node.
+ *
+ * The following is not yet implemented in Jackrabbit:
+ * "Since the properties are protected, their values
+ *  are controlled by the repository, which should set them appropriately upon a
+ *  significant modification of the subgraph of a node with this mixin. What
+ *  constitutes a significant modification will depend on the semantics of the various
+ *  parts of a node's subgraph and is implementation-dependent"
+ *
+ * Note that the protected attributes suggested by JSR283 are omitted in this variant.
+ * @since 2.0
+ */
+[mix:lastModified]
+  mixin
+  - jcr:lastModified (DATE)
+  - jcr:lastModifiedBy (STRING)
+
+/**
+ * This mixin node type can be used to provide a standardized property that
+ * specifies the natural language in which the content of a node is expressed.
+ * The value of the jcr:language property should be a language code as defined
+ * in RFC 46465. Examples include "en" (English), "en-US" (United States English),
+ * "de" (German) and "de-CH" (Swiss German).
+ *
+ * Note that the protected attributes suggested by JSR283 are omitted in this variant.
+ * @since 2.0
+ */
+[mix:language]
+  mixin
+  - jcr:language (STRING)
+
+/**
+ * This mixin node type can be used to provide standardized mimetype and
+ * encoding properties to a node. If a node of this type has a primary item
+ * that is a single-value BINARY property then jcr:mimeType property indicates
+ * the media type applicable to the contents of that property and, if that
+ * media type is one to which a text encoding applies, the jcr:encoding property
+ * indicates the character set used. If a node of this type does not meet the
+ * above precondition then the interpretation of the jcr:mimeType and
+ * jcr:encoding properties is implementation-dependent.
+ *
+ * Note that the protected attributes suggested by JSR283 are omitted in this variant.
+ * @since 2.0
+ */
+[mix:mimeType]
+  mixin
+  - jcr:mimeType (STRING)
+  - jcr:encoding (STRING)
+
+/**
+ * This node type may be used to represent the location of a JCR item not just
+ * within a particular workspace but within the space of all workspaces in all JCR
+ * repositories.
+ *
+ * @prop jcr:protocol Stores a string holding the protocol through which the
+ *                    target repository is to be accessed.
+ * @prop jcr:host     Stores a string holding the host name of the system
+ *                    through which the repository is to be accessed.
+ * @prop jcr:port     Stores a string holding the port number through which the
+ *                    target repository is to be accessed.
+ *
+ * The semantics of these properties above are left undefined but are assumed to be
+ * known by the application. The names and descriptions of the properties are not
+ * normative and the repository does not enforce any particular semantic
+ * interpretation on them.
+ *
+ * @prop jcr:repository Stores a string holding the name of the target repository.
+ * @prop jcr:workspace  Stores the name of a workspace.
+ * @prop jcr:path       Stores a path to an item.
+ * @prop jcr:id         Stores a weak reference to a node.
+ *
+ * In most cases either the jcr:path or the jcr:id property would be used, but
+ * not both, since they may point to different nodes. If any of the properties
+ * other than jcr:path and jcr:id are missing, the address can be interpreted as
+ * relative to the current container at the same level as the missing specifier.
+ * For example, if no repository is specified, then the address can be
+ * interpreted as referring to a workspace and path or id within the current
+ * repository.
+ *
+ * @since 2.0
+ */
+[nt:address]
+  - jcr:protocol (STRING)
+  - jcr:host (STRING)
+  - jcr:port (STRING)
+  - jcr:repository (STRING)
+  - jcr:workspace (STRING)
+  - jcr:path (PATH)
+  - jcr:id (WEAKREFERENCE)
+
+/**
+ * The mix:etag mixin type defines a standardized identity validator for BINARY 
+ * properties similar to the entity tags used in HTTP/1.1
+ *
+ * A jcr:etag property is an opaque string whose syntax is identical to that
+ * defined for entity tags in HTTP/1.1. Semantically, the jcr:etag is comparable
+ * to the HTTP/1.1 strong entity tag.
+ *
+ * On creation of a mix:etag node N, or assignment of mix:etag to N, the
+ * repository must create a jcr:etag property with an implementation determined
+ * value.
+ *
+ * The value of the jcr:etag property must change immediately on persist of any
+ * of the following changes to N:
+ * - A BINARY property is added t o N.
+ * - A BINARY property is removed from N.
+ * - The value of an existing BINARY property of N changes.
+ *
+ * @since 2.0
+ */
+[mix:etag]
+  mixin
+  // currently has a default value because auto-creation not handled see JCR-2116
+  - jcr:etag (STRING) = '' protected autocreated
+
+//------------------------------------------------------------------------------
+// U N S T R U C T U R E D   C O N T E N T
+//------------------------------------------------------------------------------
 
+/**
+ * This node type is used to store unstructured content. It allows any number of
+ * child nodes or properties with any names. It also allows multiple nodes having
+ * the same name as well as both multi-value and single-value properties with any
+ * names. This node type also supports client-orderable child nodes.
+ *
+ * @since 1.0
+ */
 [nt:unstructured]
   orderable
-  - * (undefined) multiple
-  - * (undefined)
-  + * (nt:base) = nt:unstructured multiple version
+  - * (UNDEFINED) multiple
+  - * (UNDEFINED)
+  + * (nt:base) = nt:unstructured sns VERSION
+
+//------------------------------------------------------------------------------
+// R E F E R E N C E A B L E
+//------------------------------------------------------------------------------
 
+/**
+ * This node type adds an auto-created, mandatory, protected STRING property to
+ * the node, called jcr:uuid, which exposes the identifier of the node.
+ * Note that the term "UUID" is used for backward compatibility with JCR 1.0
+ * and does not necessarily imply the use of the UUID syntax, or global uniqueness.
+ * The identifier of a referenceable node must be a referenceable identifier.
+ * Referenceable identifiers must fulfill a number of constraints beyond the
+ * minimum required of standard identifiers (see ยค3.8.3 Referenceable Identifiers).
+ * A reference property is a property that holds the referenceable identifier of a
+ * referenceable node and therefore serves as a pointer to that node. The two types
+ * of reference properties, REFERENCE and WEAKREFERENCE differ in that the former
+ * enforces referential integrity while the latter does not.
+ *
+ * @since 1.0
+ */
 [mix:referenceable]
   mixin
-  - jcr:uuid (string) mandatory autocreated protected initialize
+  - jcr:uuid (STRING) mandatory autocreated protected INITIALIZE 
+
+//------------------------------------------------------------------------------
+// L O C K I N G
+//------------------------------------------------------------------------------
 
+/**
+ * @since 1.0
+ */
 [mix:lockable]
   mixin
-  - jcr:lockOwner (string) protected ignore
-  - jcr:lockIsDeep (boolean) protected ignore
+  - jcr:lockOwner (STRING) protected IGNORE
+  - jcr:lockIsDeep (BOOLEAN) protected IGNORE
+
+//------------------------------------------------------------------------------
+// S H A R E A B L E   N O D E S
+//------------------------------------------------------------------------------
 
 /**
  * @since 2.0
@@ -58,175 +312,231 @@
  */
 [mix:simpleVersionable]
   mixin
-  - jcr:isCheckedOut (boolean) = 'true' mandatory autocreated protected ignore
+  - jcr:isCheckedOut (BOOLEAN) = 'true' mandatory autocreated protected IGNORE
 
+/**
+ * @since 1.0
+ */
 [mix:versionable] > mix:simpleVersionable, mix:referenceable
   mixin
-  - jcr:versionHistory (reference) mandatory protected
-    < 'nt:versionHistory'
-  - jcr:baseVersion (reference) mandatory protected ignore
-    < 'nt:version'
-  - jcr:predecessors (reference) mandatory protected multiple
-    < 'nt:version'
-  - jcr:mergeFailed (reference) protected multiple abort
+  - jcr:versionHistory (REFERENCE) mandatory protected < 'nt:versionHistory'
+  - jcr:baseVersion (REFERENCE) mandatory protected IGNORE < 'nt:version'
+  - jcr:predecessors (REFERENCE) mandatory protected multiple < 'nt:version'
+  - jcr:mergeFailed (REFERENCE) protected multiple ABORT < 'nt:version'
     /** @since 2.0 */
-  - jcr:activity (reference) protected
-    < 'nt:activity'
+  - jcr:activity (REFERENCE) protected < 'nt:activity'
     /** @since 2.0 */
-  - jcr:configuration (reference) protected
-    < 'nt:configuration'
+  - jcr:configuration (REFERENCE) protected < 'nt:configuration'
 
-[nt:versionHistory] > nt:base, mix:referenceable
-  - jcr:versionableUuid (string) mandatory autocreated protected abort
+/**
+ * @since 1.0
+ */
+[nt:versionHistory] > mix:referenceable
+  - jcr:versionableUuid (STRING) mandatory autocreated protected ABORT
     /** @since 2.0 */
-    // - 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
+  - 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
 
+/**
+ * @since 1.0
+ */
 [nt:versionLabels]
-  - * (reference) protected abort
-    < 'nt:version'
+  - * (REFERENCE) protected ABORT < 'nt:version'
 
-[nt:version] > nt:base, mix:referenceable
-  - jcr:created (date) mandatory autocreated protected abort
-  - jcr:predecessors (reference) protected multiple abort
-    < 'nt:version'
-  - jcr:successors (reference) protected multiple abort
-    < 'nt:version'
+/**
+ * @since 1.0
+ */
+[nt:version] > mix:referenceable
+  - jcr:created (DATE) mandatory autocreated protected ABORT
+  - jcr:predecessors (REFERENCE) protected multiple ABORT < 'nt:version'
+  - jcr:successors (REFERENCE) protected multiple ABORT < 'nt:version'
     /** @since 2.0 */
-  - jcr:activity (reference) protected abort
-    < 'nt:activity'
-  + jcr:frozenNode (nt:frozenNode) protected abort
+  - jcr:activity (REFERENCE) protected ABORT < 'nt:activity'
+  + jcr:frozenNode (nt:frozenNode) protected ABORT
 
-[nt:frozenNode] > nt:base, mix:referenceable
+/**
+ * @since 1.0
+ */
+[nt:frozenNode] > mix:referenceable
   orderable
-  - jcr:frozenPrimaryType (name) mandatory autocreated protected abort
-  - jcr:frozenMixinTypes (name) protected multiple abort
-  - jcr:frozenUuid (string) mandatory autocreated protected abort
-  - * (undefined) protected abort
-  - * (undefined) protected multiple abort
-  + * (nt:base) protected multiple abort
+  - jcr:frozenPrimaryType (NAME) mandatory autocreated protected ABORT
+  - jcr:frozenMixinTypes (NAME) protected multiple ABORT
+  - jcr:frozenUuid (STRING) mandatory autocreated protected ABORT
+  - * (UNDEFINED) protected ABORT
+  - * (UNDEFINED) protected multiple ABORT
+  + * (nt:base) protected sns ABORT
 
+/**
+ * @since 1.0
+ */
 [nt:versionedChild]
-  - jcr:childVersionHistory (reference) mandatory autocreated protected abort
-    < 'nt:versionHistory'
+  - jcr:childVersionHistory (REFERENCE) mandatory autocreated protected ABORT < 'nt:versionHistory'
 
 /**
  * @since 2.0
  */
-[nt:activity] > nt:base, mix:referenceable
-  - jcr:activityTitle (string) mandatory autocreated protected
+[nt:activity] > mix:referenceable
+  - jcr:activityTitle (STRING) mandatory autocreated protected
 
 /**
  * @since 2.0
  */
-[nt:configuration] > nt:base, mix:versionable
-  - jcr:root (reference) mandatory autocreated protected
+[nt:configuration] > mix:versionable
+  - jcr:root (REFERENCE) mandatory autocreated protected
 
 //------------------------------------------------------------------------------
 // N O D E T Y P E S
 //------------------------------------------------------------------------------
 
+/**
+ * This node type is used to store a node type definition. Property and child node
+ * definitions within the node type definition are stored as same-name sibling nodes
+ * of type nt:propertyDefinition and nt:childNodeDefinition.
+ *
+ * @since 1.0
+ */
 [nt:nodeType]
-  - jcr:nodeTypeName (name) mandatory
-  - jcr:supertypes (name) multiple
-  - jcr:isMixin (boolean) mandatory
-  - jcr:hasOrderableChildNodes (boolean) mandatory
-  - jcr:primaryItemName (name)
-  + jcr:propertyDefinition (nt:propertyDefinition) = nt:propertyDefinition multiple version
-  + jcr:childNodeDefinition (nt:childNodeDefinition) = nt:childNodeDefinition multiple version
+  - jcr:nodeTypeName (NAME) protected mandatory
+  - jcr:supertypes (NAME) protected multiple
+  - jcr:isAbstract (BOOLEAN) protected mandatory
+  - jcr:isQueryable (BOOLEAN) protected mandatory
+  - jcr:isMixin (BOOLEAN) protected mandatory
+  - jcr:hasOrderableChildNodes (BOOLEAN) protected mandatory
+  - jcr:primaryItemName (NAME) protected
+  + jcr:propertyDefinition (nt:propertyDefinition) = nt:propertyDefinition protected sns
+  + jcr:childNodeDefinition (nt:childNodeDefinition) = nt:childNodeDefinition protected sns
 
+/**
+ * This node type used to store a property definition within a node type definition,
+ * which itself is stored as an nt:nodeType node.
+ *
+ * @since 1.0
+ */
 [nt:propertyDefinition]
-  - jcr:name (name)
-  - jcr:autoCreated (boolean) mandatory
-  - jcr:mandatory (boolean) mandatory
-  - jcr:onParentVersion (string) mandatory
-    < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT'
-  - jcr:protected (boolean) mandatory
-  - jcr:requiredType (string) mandatory
-    < 'STRING', 'BINARY', 'LONG', 'DOUBLE', 'BOOLEAN', 'DATE', 'NAME', 'PATH', 'REFERENCE', 'UNDEFINED'
-  - jcr:valueConstraints (string) multiple
-  - jcr:defaultValues (undefined) multiple
-  - jcr:multiple (boolean) mandatory
+  - jcr:name (NAME) protected 
+  - jcr:autoCreated (BOOLEAN) protected mandatory
+  - jcr:mandatory (BOOLEAN) protected mandatory
+  - jcr:onParentVersion (STRING) protected mandatory
+      < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT'
+  - jcr:protected (BOOLEAN) protected mandatory
+  - jcr:requiredType (STRING) protected mandatory
+    < 'STRING', 'URI', 'BINARY', 'LONG', 'DOUBLE',
+      'DECIMAL', 'BOOLEAN', 'DATE', 'NAME', 'PATH',
+      'REFERENCE', 'WEAKREFERENCE', 'UNDEFINED'
+  - jcr:valueConstraints (STRING) protected multiple
+  - jcr:defaultValues (UNDEFINED) protected multiple
+  - jcr:multiple (BOOLEAN) protected mandatory
+  - jcr:availableQueryOperators (NAME) protected mandatory multiple
+  - jcr:isFullTextSearchable (BOOLEAN) protected mandatory
+  - jcr:isQueryOrderable (BOOLEAN) protected mandatory
 
+/**
+ * This node type used to store a child node definition within a node type definition,
+ * which itself is stored as an nt:nodeType node.
+ *
+ * @since 1.0
+ */
 [nt:childNodeDefinition]
-  - jcr:name (name)
-  - jcr:autoCreated (boolean) mandatory
-  - jcr:mandatory (boolean) mandatory
-  - jcr:onParentVersion (string) mandatory
-    < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT'
-  - jcr:protected (boolean) mandatory
-  - jcr:requiredPrimaryTypes (name) = 'nt:base' mandatory multiple
-  - jcr:defaultPrimaryType (name)
-  - jcr:sameNameSiblings (boolean) mandatory
+  - jcr:name (NAME) protected
+  - jcr:autoCreated (BOOLEAN) protected mandatory
+  - jcr:mandatory (BOOLEAN) protected mandatory
+  - jcr:onParentVersion (STRING) protected mandatory 
+      < 'COPY', 'VERSION', 'INITIALIZE', 'COMPUTE', 'IGNORE', 'ABORT'
+  - jcr:protected (BOOLEAN) protected mandatory
+  - jcr:requiredPrimaryTypes (NAME) = 'nt:base' protected mandatory multiple
+  - jcr:defaultPrimaryType (NAME) protected
+  - jcr:sameNameSiblings (BOOLEAN) protected mandatory
 
 //------------------------------------------------------------------------------
-// M I S C
+// Q U E R Y
 //------------------------------------------------------------------------------
 
-[nt:hierarchyNode]
-  - jcr:created (date) autocreated protected initialize
-
-[nt:folder] > nt:hierarchyNode
-  + * (nt:hierarchyNode) version
-
-[nt:file] > nt:hierarchyNode
-  + jcr:content (nt:base) primary mandatory
-
-[nt:linkedFile] > nt:hierarchyNode
-  - jcr:content (reference) primary mandatory
+/**
+ * @since 1.0
+ */
+[nt:query]
+  - jcr:statement (STRING)
+  - jcr:language (STRING)
 
-[nt:resource] > nt:base, mix:referenceable
-  - jcr:encoding (string)
-  - jcr:mimeType (string) mandatory
-  - jcr:data (binary) primary mandatory
-  - jcr:lastModified (date) mandatory ignore
+//------------------------------------------------------------------------------
+// L I F E C Y C L E   M A N A G E M E N T
+//------------------------------------------------------------------------------
 
-[nt:query]
-  - jcr:statement (string)
-  - jcr:language (string)
+/**
+ * Only nodes with mixin node type mix:lifecycle may participate in a lifecycle.
+ *
+ * @peop jcr:lifecyclePolicy
+ *              This property is a reference to another node that contains
+ *              lifecycle policy information. The definition of the referenced
+ *              node is not specified.
+ * @prop jcr:currentLifecycleState
+ *              This property is a string identifying the current lifecycle
+ *              state of this node. The format of this string is not specified.
+ *
+ * @since 2.0
+ */
+[mix:lifecycle]
+  mixin
+  - jcr:lifecyclePolicy (REFERENCE) protected INITIALIZE
+  - jcr:currentLifecycleState (STRING) protected INITIALIZE
 
 //------------------------------------------------------------------------------
 // J A C K R A B B I T   I N T E R N A L S
 //------------------------------------------------------------------------------
 
 [rep:nodeTypes]
-  + * (nt:nodeType) = nt:nodeType protected abort
+  + * (nt:nodeType) = nt:nodeType protected ABORT
 
 [rep:root] > nt:unstructured
-  orderable
-  + jcr:system (rep:system) = rep:system mandatory ignore
+  + jcr:system (rep:system) = rep:system mandatory IGNORE
 
 [rep:system]
   orderable
-  + jcr:versionStorage (rep:versionStorage) = rep:versionStorage mandatory protected abort
-  + jcr:nodeTypes (rep:nodeTypes) = rep:nodeTypes mandatory protected abort
-  + * (nt:base) = nt:unstructured multiple ignore
+  + jcr:versionStorage (rep:versionStorage) = rep:versionStorage mandatory protected ABORT
+  + jcr:nodeTypes (rep:nodeTypes) = rep:nodeTypes mandatory protected ABORT
+  + * (nt:base) = nt:unstructured sns IGNORE
+
+// implementation note: currently we keep the activities below the version storage
+// because of the complexity of adding new virtual item state providers.
+// the future goal is to keep them as siblings, of course.
 
 [rep:versionStorage]
-  + * (nt:versionHistory) = nt:versionHistory protected multiple abort
-  + * (rep:versionStorage) = rep:versionStorage protected multiple abort
-
+  + * (nt:versionHistory) = nt:versionHistory protected sns ABORT
+  + * (rep:versionStorage) = rep:versionStorage protected sns ABORT
+  + * (rep:activities) = rep:activities protected sns ABORT
+
+[rep:activities]
+  + * (nt:activity) = nt:activity protected sns ABORT
+  + * (rep:activities) = rep:activities protected sns ABORT
+
+// implementation note: because node references are not maintained within the
+// version storage, we store a bidirectional relationship between activities and
+ // the respective versions
+[rep:VersionReference] mix
+  - rep:versions (reference) protected multiple abort
+  
 // -----------------------------------------------------------------------------
 // J A C K R A B B I T  S E C U R I T Y
 // -----------------------------------------------------------------------------
 
 [rep:AccessControllable]
   mixin
-  + rep:policy (rep:Policy) protected ignore
+  + rep:policy (rep:Policy) protected IGNORE
 
-[rep:Policy] abstract
+[rep:Policy]
+  abstract
 
 [rep:ACL] > rep:Policy
-  + * (rep:ACE) = rep:GrantACE protected ignore
+  + * (rep:ACE) = rep:GrantACE protected IGNORE
 
 [rep:ACE]
-  - rep:principalName (string) protected mandatory
-  - rep:privileges (name) protected mandatory multiple
-  - rep:nodePath (path) protected
-  - rep:glob (string) protected
-  - * (undefined) protected
+  - rep:principalName (STRING) protected mandatory
+  - rep:privileges (NAME) protected mandatory multiple
+  - rep:nodePath (PATH) protected
+  - rep:glob (STRING) protected
+  - * (UNDEFINED) protected
 
 [rep:GrantACE] > rep:ACE
 
@@ -237,38 +547,39 @@
 // -----------------------------------------------------------------------------
 
 [rep:AccessControl]
-  + * (rep:AccessControl) protected ignore
-  + * (rep:PrincipalAccessControl) protected ignore
+  + * (rep:AccessControl) protected IGNORE
+  + * (rep:PrincipalAccessControl) protected IGNORE
 
 [rep:PrincipalAccessControl] > rep:AccessControl
-  + rep:policy (rep:Policy) protected ignore
+  + rep:policy (rep:Policy) protected IGNORE
 
 // -----------------------------------------------------------------------------
 // User Management 
 // -----------------------------------------------------------------------------
 
-[rep:Authorizable] > nt:base, mix:referenceable abstract
-  + * (rep:Authorizable) = rep:Authorizable protected version
-  + * (rep:AuthorizableFolder) = rep:AuthorizableFolder protected version
-  - rep:principalName (string) protected mandatory
-  - rep:referees (string) protected multiple
-  - rep:groups (reference) protected multiple < 'rep:Group'
-  - * (undefined)
-  - * (undefined) multiple
+[rep:Authorizable] > mix:referenceable
+  abstract
+  + * (rep:Authorizable) = rep:Authorizable protected VERSION
+  + * (rep:AuthorizableFolder) = rep:AuthorizableFolder protected VERSION
+  - rep:principalName (STRING) protected mandatory
+  - rep:referees (STRING) protected multiple
+  - rep:groups (WEAKREFERENCE) protected multiple < 'rep:Group'
+  - * (UNDEFINED)
+  - * (UNDEFINED) multiple
 
 [rep:Impersonatable]
   mixin
-  - rep:impersonators (string) protected multiple
+  - rep:impersonators (STRING) protected multiple
 
 [rep:User] > rep:Authorizable, rep:Impersonatable
-  - rep:userId (string) protected mandatory
-  - rep:password (string) protected mandatory
+  - rep:userId (STRING) protected mandatory
+  - rep:password (STRING) protected mandatory
 
 [rep:Group] > rep:Authorizable
 
-[rep:AuthorizableFolder] > nt:base, mix:referenceable
-  + * (rep:Authorizable) = rep:User protected version
-  + * (rep:AuthorizableFolder) = rep:AuthorizableFolder protected version
+[rep:AuthorizableFolder] > mix:referenceable
+  + * (rep:Authorizable) = rep:User protected VERSION
+  + * (rep:AuthorizableFolder) = rep:AuthorizableFolder protected VERSION
 
 // -----------------------------------------------------------------------------
 // J A C K R A B B I T  R E T E N T I O N  M A N A G E M E N T
@@ -276,5 +587,5 @@
 
 [rep:RetentionManageable]
   mixin
-  - rep:hold (undefined) protected  multiple ignore
-  - rep:retentionPolicy (undefined) protected ignore
\ No newline at end of file
+  - rep:hold (UNDEFINED) protected  multiple IGNORE
+  - rep:retentionPolicy (UNDEFINED) protected IGNORE
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/principal/PrincipalManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/principal/PrincipalManagerTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/principal/PrincipalManagerTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/principal/PrincipalManagerTest.java Wed Jul  8 13:57:13 2009
@@ -74,7 +74,7 @@
     }
 
     public void testReadOnlyIsEveryOne() throws RepositoryException {
-        Session s = helper.getReadOnlySession();
+        Session s = getHelper().getReadOnlySession();
         try {
             Principal[] pcpls = getPrincipals(s);
             for (int i = 0; i < pcpls.length; i++) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/GroupTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/GroupTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/GroupTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/GroupTest.java Wed Jul  8 13:57:13 2009
@@ -39,7 +39,7 @@
             assertTrue(next instanceof Authorizable);
             contained = ((Authorizable)next).getID().equals(auth.getID());
         }
-        assertTrue("The given set of members must contain " + auth.getID(), contained);
+        assertTrue("The given set of members must contain '" + auth.getID() + "'", contained);
     }
 
     private static void assertFalseIsMember(Iterator members, Authorizable auth) throws RepositoryException {
@@ -49,7 +49,7 @@
             assertTrue(next instanceof Authorizable);
             contained = ((Authorizable)next).getID().equals(auth.getID());
         }
-        assertFalse("The given set of members must not contain " + auth.getID(), contained);
+        assertFalse("The given set of members must not contain '" + auth.getID() + "'", contained);
     }
 
     private static void assertTrueMemberOfContainsGroup(Iterator groups, Group gr) throws RepositoryException {
@@ -279,14 +279,12 @@
     }
 
     /**
-     * TODO: uncomment once membership-relation is stored as weak ref.
      * Removing a GroupImpl must be possible even if there are still existing
      * members present.
      *
      * @throws RepositoryException
      * @throws NotExecutableException
      */
-    /*
     public void testRemoveGroupIfMemberExist() throws RepositoryException, NotExecutableException {
         User auth = getTestUser(superuser);
         String newGroupId = null;
@@ -306,5 +304,4 @@
             }
         }
     }
-    */
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/ImpersonationTest.java Wed Jul  8 13:57:13 2009
@@ -69,7 +69,7 @@
     }
 
     public void testImpersonateGroup() throws RepositoryException, NotExecutableException {
-        Session s = helper.getReadOnlySession();
+        Session s = getHelper().getReadOnlySession();
         try {
             Principal group = getTestGroup(s).getPrincipal();
             Subject subject = createSubject(group);
@@ -80,7 +80,7 @@
     }
 
     public void testGrantImpersonationToGroupPrincipal() throws RepositoryException, NotExecutableException {
-        Session s = helper.getReadOnlySession();
+        Session s = getHelper().getReadOnlySession();
         try {
             Principal group = getTestGroup(s).getPrincipal();
             try {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java?rev=792142&r1=792141&r2=792142&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/api/security/user/UserTest.java Wed Jul  8 13:57:13 2009
@@ -44,7 +44,7 @@
     }
 
     public void testReadOnlyIsntAdmin() throws NotExecutableException, RepositoryException {
-        Session s = helper.getReadOnlySession();
+        Session s = getHelper().getReadOnlySession();
         try {
             User user = getTestUser(s);
             assertFalse(user.isAdmin());
@@ -60,7 +60,7 @@
     }
 
     public void testChangePassword() throws RepositoryException, NotExecutableException {
-        String oldPw = helper.getProperty("javax.jcr.tck.superuser.pwd");
+        String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd");
         if (oldPw == null) {
             // missing property
             throw new NotExecutableException();
@@ -70,7 +70,7 @@
         try {
             user.changePassword("pw");
             // make sure the user can login with the new pw
-            Session s = helper.getRepository().login(new SimpleCredentials(user.getID(), "pw".toCharArray()));
+            Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), "pw".toCharArray()));
             s.logout();
         } finally {
             user.changePassword(oldPw);
@@ -78,7 +78,7 @@
     }
 
     public void testChangePassword2() throws RepositoryException, NotExecutableException {
-        String oldPw = helper.getProperty("javax.jcr.tck.superuser.pwd");
+        String oldPw = getHelper().getProperty("javax.jcr.tck.superuser.pwd");
         if (oldPw == null) {
             // missing property
             throw new NotExecutableException();
@@ -88,7 +88,7 @@
         try {
             user.changePassword("pw");
 
-            Session s = helper.getRepository().login(new SimpleCredentials(user.getID(), oldPw.toCharArray()));
+            Session s = getHelper().getRepository().login(new SimpleCredentials(user.getID(), oldPw.toCharArray()));
             s.logout();
             fail("superuser pw has changed. login must fail.");
         } catch (LoginException e) {



Mime
View raw message