jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r793613 [7/8] - in /jackrabbit/sandbox/JCR-1456: ./ jackrabbit-core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ jackrabbit-core/src/main/java/org/apache/jackrabbit/core/cluster/ jackrabbit-core/src/main/java/org/apache/jackra...
Date Mon, 13 Jul 2009 15:56:03 GMT
Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryInfo.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryInfo.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionHistoryInfo.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 
 /**
  * Simple data object that carries the identifiers of a version history node

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionImpl.java Mon Jul 13 15:55:55 2009
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.core.ItemManager;
 import org.apache.jackrabbit.core.AbstractNodeData;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import javax.jcr.version.Version;
@@ -108,8 +108,7 @@
         // get base version. this can certainly be optimized
         InternalVersionHistory vh = ((VersionHistoryImpl) getContainingHistory())
                 .getInternalVersionHistory();
-        NodeId id = new NodeId(vh.getVersionableUUID());
-        Node vn = session.getNodeById(id);
+        Node vn = session.getNodeById(vh.getVersionableId());
         InternalVersion base = ((VersionImpl) vn.getBaseVersion()).getInternalVersion();
 
         InternalVersion suc = getInternalVersion().getLinearSuccessor(base);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateManager.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateManager.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateManager.java Mon Jul 13 15:55:55 2009
@@ -16,12 +16,13 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import java.util.Iterator;
+import java.util.HashSet;
+import java.util.Set;
 
 import javax.jcr.ReferentialIntegrityException;
 
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.persistence.PersistenceManager;
 import org.apache.jackrabbit.core.state.ChangeLog;
@@ -30,7 +31,6 @@
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,11 +61,12 @@
         this.pMgr = persistMgr;
     }
 
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    @Override
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
         // check persistence manager
         try {
-            return pMgr.load(id);
+            return pMgr.loadReferencesTo(id);
         } catch (NoSuchItemStateException e) {
             // ignore
         }
@@ -73,10 +74,11 @@
         throw new NoSuchItemStateException(id.toString());
     }
 
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    @Override
+    public boolean hasNodeReferences(NodeId id) {
         // check persistence manager
         try {
-            if (pMgr.exists(id)) {
+            if (pMgr.existsReferencesTo(id)) {
                 return true;
             }
         } catch (ItemStateException e) {
@@ -94,14 +96,10 @@
         try {
             ChangeLog log = new ChangeLog();
 
-            Iterator iterator = references.modifiedRefs();
-            while (iterator.hasNext()) {
+            for (NodeReferences source : references.modifiedRefs()) {
                 // filter out version storage intern ones
-                NodeReferences source = (NodeReferences) iterator.next();
-                NodeReferences target = new NodeReferences(source.getId());
-                Iterator iter = source.getReferences().iterator();
-                while (iter.hasNext()) {
-                    PropertyId id = (PropertyId) iter.next();
+                NodeReferences target = new NodeReferences(source.getTargetId());
+                for (PropertyId id : source.getReferences()) {
                     if (!hasNonVirtualItemState(id.getParentId())) {
                         target.addReference(id);
                     }
@@ -124,16 +122,19 @@
         // only store VV-type references and NV-type references
 
         // check whether targets of modified node references exist
-        for (Iterator iter = changes.modifiedRefs(); iter.hasNext();) {
-            NodeReferences refs = (NodeReferences) iter.next();
-            NodeId id = refs.getTargetId();
+        Set<NodeId> remove = new HashSet<NodeId>();
+        for (NodeReferences refs : changes.modifiedRefs()) {
             // no need to check existence of target if there are no references
             if (refs.hasReferences()) {
+                NodeId id = refs.getTargetId();
                 if (!changes.has(id) && !hasNonVirtualItemState(id)) {
-                    // remove references
-                    iter.remove();
+                    remove.add(refs.getTargetId());
                 }
             }
         }
+        // remove references
+        for (NodeId id : remove) {
+            changes.removeReferencesEntry(id);
+        }
     }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/version/VersionItemStateProvider.java Mon Jul 13 15:55:55 2009
@@ -19,15 +19,14 @@
 import javax.jcr.RepositoryException;
 
 import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
-import org.apache.jackrabbit.core.state.NodeReferencesId;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.core.virtual.VirtualNodeState;
 import org.apache.jackrabbit.core.virtual.VirtualPropertyState;
@@ -130,7 +129,7 @@
     /**
      * @inheritDoc
      */
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
         return stateMgr.getNodeReferences(id);
     }
@@ -138,7 +137,7 @@
     /**
      * @inheritDoc
      */
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    public boolean hasNodeReferences(NodeId id) {
         return stateMgr.hasNodeReferences(id);
     }
 

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.version;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.SessionImpl;
 
 import javax.jcr.RepositoryException;

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -17,7 +17,7 @@
 package org.apache.jackrabbit.core.version;
 
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
 import org.apache.jackrabbit.spi.Name;

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -29,16 +29,17 @@
 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.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.cluster.UpdateEventChannel;
 import org.apache.jackrabbit.core.cluster.UpdateEventListener;
 import org.apache.jackrabbit.core.fs.FileSystem;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.observation.DelegatingObservationDispatcher;
+import org.apache.jackrabbit.core.observation.EventState;
 import org.apache.jackrabbit.core.observation.EventStateCollection;
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.persistence.PersistenceManager;
@@ -50,7 +51,6 @@
 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.NodeReferencesId;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.state.SharedItemStateManager;
@@ -370,10 +370,9 @@
             // 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)) {
+            if (stateMgr.hasNodeReferences(nodeId)) {
                 try {
-                    NodeReferences refs = stateMgr.getNodeReferences(refId);
+                    NodeReferences refs = stateMgr.getNodeReferences(nodeId);
                     if (refs.hasReferences()) {
                         throw new ActivityViolationException("Unable to checkout. " +
                                 "Activity is already used for the same node in " +
@@ -485,7 +484,7 @@
             return null;
         } else {
             return (Version)
-                    ((SessionImpl) history.getSession()).getNodeByUUID(v.getId().getUUID());
+                    ((SessionImpl) history.getSession()).getNodeById(v.getId());
         }
     }
 
@@ -548,7 +547,7 @@
      */
     protected boolean hasItemReferences(NodeId id)
             throws RepositoryException {
-        return stateMgr.hasNodeReferences(new NodeReferencesId(id));
+        return stateMgr.hasNodeReferences(id);
     }
 
     /**
@@ -645,7 +644,7 @@
     /**
      * {@inheritDoc}
      */
-    public void externalUpdate(ChangeLog changes, List events,
+    public void externalUpdate(ChangeLog changes, List<EventState> events,
                                long timestamp, String userData)
             throws RepositoryException {
         EventStateCollection esc = getEscFactory().createEventStateCollection(null);

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -17,7 +17,6 @@
 package org.apache.jackrabbit.core.version;
 
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 import javax.jcr.RepositoryException;
@@ -27,8 +26,8 @@
 import javax.jcr.version.VersionHistory;
 
 import org.apache.jackrabbit.core.InternalXAResource;
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.TransactionContext;
@@ -43,7 +42,6 @@
 import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 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.XAItemStateManager;
 import org.apache.jackrabbit.core.state.ISMLocking.ReadLock;
@@ -322,9 +320,8 @@
     public boolean setNodeReferences(ChangeLog references) {
         ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
         if (changeLog != null) {
-            Iterator iterator = references.modifiedRefs();
-            while (iterator.hasNext()) {
-                changeLog.modified((NodeReferences) iterator.next());
+            for (NodeReferences refs : references.modifiedRefs()) {
+                changeLog.modified(refs);
             }
             return true;
         } else {
@@ -362,12 +359,12 @@
     /**
      * {@inheritDoc}
      */
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
 
         ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
         if (changeLog != null) {
-            return changeLog.get(id);
+            return changeLog.getReferencesTo(id);
         }
         return null;
     }
@@ -375,10 +372,10 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    public boolean hasNodeReferences(NodeId id) {
         ChangeLog changeLog = ((XAItemStateManager) stateMgr).getChangeLog();
         if (changeLog != null) {
-            return changeLog.get(id) != null;
+            return changeLog.getReferencesTo(id) != null;
         }
         return false;
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/AbstractVISProvider.java Mon Jul 13 15:55:55 2009
@@ -16,9 +16,9 @@
  */
 package org.apache.jackrabbit.core.virtual;
 
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeDef;
 import org.apache.jackrabbit.core.nodetype.NodeDefId;
@@ -29,20 +29,17 @@
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 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.ItemStateReferenceMap;
 import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Name;
-import org.apache.jackrabbit.uuid.UUID;
 import org.apache.jackrabbit.util.WeakIdentityCollection;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
-import java.util.Iterator;
 import java.util.Collection;
 
 /**
@@ -78,7 +75,8 @@
     /**
      * Listeners (weak references)
      */
-    private final transient Collection listeners = new WeakIdentityCollection(5);
+    private final transient Collection<ItemStateListener> listeners =
+        new WeakIdentityCollection(5);
 
     /**
      * Creates an abstract virtual item state provider
@@ -142,7 +140,7 @@
     /**
      * {@inheritDoc}
      */
-    public NodeReferences getNodeReferences(NodeReferencesId id)
+    public NodeReferences getNodeReferences(NodeId id)
             throws NoSuchItemStateException, ItemStateException {
         throw new NoSuchItemStateException(id.toString());
     }
@@ -150,7 +148,7 @@
     /**
      * {@inheritDoc}
      */
-    public boolean hasNodeReferences(NodeReferencesId id) {
+    public boolean hasNodeReferences(NodeId id) {
         return false;
     }
 
@@ -288,7 +286,7 @@
         // create a new node state
         VirtualNodeState state;
         if (id == null) {
-            id = new NodeId(UUID.randomUUID());
+            id = new NodeId();
         }
         state = new VirtualNodeState(this, parent.getNodeId(), id, nodeTypeName, new Name[0]);
         state.setDefinitionId(def);
@@ -362,9 +360,7 @@
                 for (int i = 0; i < props.length; i++) {
                     props[i].notifyStateUpdated();
                 }
-                Iterator iter = state.getChildNodeEntries().iterator();
-                while (iter.hasNext()) {
-                    ChildNodeEntry pe = (ChildNodeEntry) iter.next();
+                for (ChildNodeEntry pe : state.getChildNodeEntries()) {
                     invalidateItem(pe.getId(), true);
                 }
             }
@@ -427,7 +423,7 @@
     public void stateCreated(ItemState created) {
         ItemStateListener[] la;
         synchronized (listeners) {
-            la = (ItemStateListener[]) listeners.toArray(new ItemStateListener[listeners.size()]);
+            la = listeners.toArray(new ItemStateListener[listeners.size()]);
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -442,7 +438,7 @@
     public void stateModified(ItemState modified) {
         ItemStateListener[] la;
         synchronized (listeners) {
-            la = (ItemStateListener[]) listeners.toArray(new ItemStateListener[listeners.size()]);
+            la = listeners.toArray(new ItemStateListener[listeners.size()]);
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -466,7 +462,7 @@
 
         ItemStateListener[] la;
         synchronized (listeners) {
-            la = (ItemStateListener[]) listeners.toArray(new ItemStateListener[listeners.size()]);
+            la = listeners.toArray(new ItemStateListener[listeners.size()]);
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {
@@ -490,7 +486,7 @@
 
         ItemStateListener[] la;
         synchronized (listeners) {
-            la = (ItemStateListener[]) listeners.toArray(new ItemStateListener[listeners.size()]);
+            la = listeners.toArray(new ItemStateListener[listeners.size()]);
         }
         for (int i = 0; i < la.length; i++) {
             if (la[i] != null) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualItemStateProvider.java Mon Jul 13 15:55:55 2009
@@ -18,8 +18,8 @@
 
 import javax.jcr.RepositoryException;
 
-import org.apache.jackrabbit.core.ItemId;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.state.ChangeLog;
 import org.apache.jackrabbit.core.state.ItemStateListener;
 import org.apache.jackrabbit.core.state.ItemStateManager;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualNodeState.java Mon Jul 13 15:55:55 2009
@@ -20,7 +20,7 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.value.InternalValue;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 
@@ -41,12 +41,12 @@
 
     /**
      * map of property states of this node state
-     * key=propname, value={@link VirtualPropertyState}
      */
-    private final HashMap properties = new HashMap();
+    private final HashMap<Name, VirtualPropertyState> properties =
+        new HashMap<Name, VirtualPropertyState>();
 
     /** a set of hard references to child states */
-    private HashSet stateRefs = null;
+    private HashSet<NodeState> stateRefs = null;
 
     /**
      * creates a new virtual node state
@@ -78,7 +78,7 @@
      * @return the properties.
      */
     public VirtualPropertyState[] getProperties() {
-        return (VirtualPropertyState[]) properties.values().toArray(new VirtualPropertyState[properties.size()]);
+        return properties.values().toArray(new VirtualPropertyState[properties.size()]);
     }
 
 
@@ -191,7 +191,7 @@
      */
     public void setMixinNodeTypes(Name[] mixins) throws RepositoryException {
         if (mixins != null) {
-            HashSet set = new HashSet();
+            HashSet<Name> set = new HashSet<Name>();
             InternalValue[] values = new InternalValue[mixins.length];
             for (int i = 0; i < mixins.length; i++) {
                 set.add(mixins[i]);
@@ -208,7 +208,7 @@
      */
     public void addStateReference(NodeState state) {
         if (stateRefs == null) {
-            stateRefs = new HashSet();
+            stateRefs = new HashSet<NodeState>();
         }
         stateRefs.add(state);
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/virtual/VirtualPropertyState.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.virtual;
 
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.value.InternalValue;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/DocViewImportHandler.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.commons.conversion.NameParser;
 import org.apache.jackrabbit.spi.commons.conversion.IllegalNameException;
@@ -51,7 +51,7 @@
      * in the startElement method and is popped from the stack in the
      * endElement method.
      */
-    private final Stack stack = new Stack();
+    private final Stack<NodeInfo> stack = new Stack<NodeInfo>();
     // buffer used to merge adjacent character data
     private BufferedStringValue textHandler = null;
 
@@ -156,10 +156,10 @@
                         new NodeInfo(NameConstants.JCR_XMLTEXT, null, null, null);
                 TextValue[] values =
                         new TextValue[]{textHandler};
-                ArrayList props = new ArrayList();
-                PropInfo prop = new PropInfo(
-                        NameConstants.JCR_XMLCHARACTERS, PropertyType.STRING, values);
-                props.add(prop);
+                ArrayList<PropInfo> props = new ArrayList<PropInfo>();
+                props.add(new PropInfo(
+                        NameConstants.JCR_XMLCHARACTERS,
+                        PropertyType.STRING, values));
                 // call Importer
                 importer.startNode(node, props);
                 importer.endNode(node);
@@ -230,7 +230,7 @@
             Name nodeTypeName = null;
             Name[] mixinTypes = null;
 
-            ArrayList props = new ArrayList(atts.getLength());
+            ArrayList<PropInfo> props = new ArrayList<PropInfo>(atts.getLength());
             for (int i = 0; i < atts.getLength(); i++) {
                 if (atts.getURI(i).equals(Name.NS_XMLNS_URI)) {
                     // skip namespace declarations reported as attributes

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/Importer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/Importer.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/Importer.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/Importer.java Mon Jul 13 15:55:55 2009
@@ -47,7 +47,7 @@
      *                  (list of {@link PropInfo} instances)
      * @throws RepositoryException on a repository error
      */
-    void startNode(NodeInfo nodeInfo, List propInfos)
+    void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos)
             throws RepositoryException;
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NamespaceContext.java Mon Jul 13 15:55:55 2009
@@ -20,7 +20,6 @@
 
 import javax.jcr.NamespaceException;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.Map;
 
 /**
@@ -44,12 +43,12 @@
     /**
      * The namespace prefix to namespace URI mapping.
      */
-    private final Map prefixToURI;
+    private final Map<String, String> prefixToURI;
 
     /**
      * The namespace URI to namespace prefix mapping.
      */
-    private final Map uriToPrefix;
+    private final Map<String, String> uriToPrefix;
 
     /**
      * Creates a NamespaceContext instance with the given parent context
@@ -58,14 +57,12 @@
      * @param parent parent context
      * @param mappings local namespace mappings (prefix -> URI)
      */
-    public NamespaceContext(NamespaceContext parent, Map mappings) {
+    public NamespaceContext(NamespaceContext parent, Map<String, String> mappings) {
         this.parent = parent;
-        this.prefixToURI = new HashMap();
-        this.uriToPrefix = new HashMap();
+        this.prefixToURI = new HashMap<String, String>();
+        this.uriToPrefix = new HashMap<String, String>();
 
-        Iterator iterator = mappings.entrySet().iterator();
-        while (iterator.hasNext()) {
-            Map.Entry mapping = (Map.Entry) iterator.next();
+        for (Map.Entry<String, String> mapping : mappings.entrySet()) {
             prefixToURI.put(mapping.getKey(), mapping.getValue());
             uriToPrefix.put(mapping.getValue(), mapping.getKey());
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/NodeInfo.java Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.spi.Name;
 
 /**

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -25,7 +25,7 @@
 
 import org.apache.jackrabbit.core.BatchedItemOperations;
 import org.apache.jackrabbit.core.NodeImpl;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
 import org.apache.jackrabbit.core.nodetype.NodeTypeRegistry;
 import org.apache.jackrabbit.core.nodetype.PropDef;

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -16,7 +16,7 @@
  */
 package org.apache.jackrabbit.core.xml;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.NodeImpl;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.security.authorization.Permission;
@@ -90,8 +90,7 @@
         NodeImpl node;
 
         // add node
-        UUID uuid = (id == null) ? null : id.getUUID();
-        node = parent.addNode(nodeName, nodeTypeName, uuid);
+        node = parent.addNode(nodeName, nodeTypeName, id);
         // add mixins
         if (mixinNames != null) {
             for (int i = 0; i < mixinNames.length; i++) {
@@ -112,7 +111,7 @@
                     nodeInfo.getNodeTypeName(), nodeInfo.getMixinNames(), null);
             // remember uuid mapping
             if (node.isNodeType(NameConstants.MIX_REFERENCEABLE)) {
-                refTracker.mappedUUID(nodeInfo.getId().getUUID(), node.getNodeId().getUUID());
+                refTracker.mappedId(nodeInfo.getId(), node.getNodeId());
             }
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW) {
             // if conflicting node is shareable, then clone it
@@ -290,11 +289,11 @@
                 Value[] newVals = new Value[values.length];
                 for (int i = 0; i < values.length; i++) {
                     Value val = values[i];
-                    UUID original = UUID.fromString(val.getString());
-                    UUID adjusted = refTracker.getMappedUUID(original);
+                    NodeId original = new NodeId(val.getString());
+                    NodeId adjusted = refTracker.getMappedId(original);
                     if (adjusted != null) {
                         newVals[i] = session.getValueFactory().createValue(
-                                session.getNodeByUUID(adjusted),
+                                session.getNodeById(adjusted),
                                 prop.getType() != PropertyType.REFERENCE);
                     } else {
                         // reference doesn't need adjusting, just copy old value
@@ -304,10 +303,10 @@
                 prop.setValue(newVals);
             } else {
                 Value val = prop.getValue();
-                UUID original = UUID.fromString(val.getString());
-                UUID adjusted = refTracker.getMappedUUID(original);
+                NodeId original = new NodeId(val.getString());
+                NodeId adjusted = refTracker.getMappedId(original);
                 if (adjusted != null) {
-                    prop.setValue(session.getNodeByUUID(adjusted));
+                    prop.setValue(session.getNodeById(adjusted).getUUID());
                 }
             }
         }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/SysViewImportHandler.java Mon Jul 13 15:55:55 2009
@@ -20,7 +20,7 @@
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
@@ -31,7 +31,6 @@
 import javax.jcr.ValueFactory;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Iterator;
 import java.util.Stack;
 
 /**
@@ -45,7 +44,7 @@
      * the same instance is popped from the stack in the endElement method
      * when the corresponding sv:node element is encountered.
      */
-    private final Stack stack = new Stack();
+    private final Stack<ImportState> stack = new Stack<ImportState>();
 
     /**
      * fields used temporarily while processing sv:property and sv:value elements
@@ -53,7 +52,8 @@
     private Name currentPropName;
     private int currentPropType = PropertyType.UNDEFINED;
     // list of AppendableValue objects
-    private ArrayList currentPropValues = new ArrayList();
+    private ArrayList<BufferedStringValue> currentPropValues =
+        new ArrayList<BufferedStringValue>();
     private BufferedStringValue currentPropValue;
 
     /**
@@ -72,7 +72,7 @@
         }
         Name[] mixinNames = null;
         if (state.mixinNames != null) {
-            mixinNames = (Name[]) state.mixinNames.toArray(
+            mixinNames = state.mixinNames.toArray(
                     new Name[state.mixinNames.size()]);
         }
         NodeId id = null;
@@ -86,8 +86,7 @@
             if (start) {
                 importer.startNode(node, state.props);
                 // dispose temporary property values
-                for (Iterator iter = state.props.iterator(); iter.hasNext();) {
-                    PropInfo pi = (PropInfo) iter.next();
+                for (PropInfo pi : state.props) {
                     pi.dispose();
                 }
 
@@ -257,7 +256,7 @@
                 }
             } else if (currentPropName.equals(NameConstants.JCR_MIXINTYPES)) {
                 if (state.mixinNames == null) {
-                    state.mixinNames = new ArrayList(currentPropValues.size());
+                    state.mixinNames = new ArrayList<Name>(currentPropValues.size());
                 }
                 for (int i = 0; i < currentPropValues.size(); i++) {
                     BufferedStringValue val =
@@ -317,7 +316,7 @@
         /**
          * list of mixin types of current node
          */
-        ArrayList mixinNames;
+        ArrayList<Name> mixinNames;
         /**
          * uuid of current node
          */
@@ -326,7 +325,7 @@
         /**
          * list of PropInfo instances representing properties of current node
          */
-        ArrayList props = new ArrayList();
+        ArrayList<PropInfo> props = new ArrayList<PropInfo>();
 
         /**
          * flag indicating whether startNode() has been called for current node

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -18,7 +18,7 @@
 
 import org.apache.jackrabbit.core.BatchedItemOperations;
 import org.apache.jackrabbit.core.HierarchyManager;
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.WorkspaceImpl;
 import org.apache.jackrabbit.core.nodetype.EffectiveNodeType;
@@ -36,7 +36,6 @@
 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.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,7 +71,7 @@
     private final int uuidBehavior;
 
     private boolean aborted;
-    private Stack parents;
+    private Stack<NodeState> parents;
 
     /**
      * helper object that keeps track of remapped uuid's and imported reference
@@ -125,7 +124,7 @@
 
         refTracker = new ReferenceChangeTracker();
 
-        parents = new Stack();
+        parents = new Stack<NodeState>();
         parents.push(importTarget);
     }
 
@@ -156,7 +155,7 @@
             // remember uuid mapping
             EffectiveNodeType ent = itemOps.getEffectiveNodeType(node);
             if (ent.includesNodeType(NameConstants.MIX_REFERENCEABLE)) {
-                refTracker.mappedUUID(nodeInfo.getId().getUUID(), node.getNodeId().getUUID());
+                refTracker.mappedId(nodeInfo.getId(), node.getNodeId());
             }
         } else if (uuidBehavior == ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW) {
             // if existing node is shareable, then instead of failing, create
@@ -243,7 +242,7 @@
             // => backup list of child node entries beforehand in order
             // to restore it afterwards
             ChildNodeEntry cneConflicting = parent.getChildNodeEntry(nodeInfo.getId());
-            List cneList = new ArrayList(parent.getChildNodeEntries());
+            List<ChildNodeEntry> cneList = new ArrayList<ChildNodeEntry>(parent.getChildNodeEntries());
             // do remove conflicting (recursive)
             itemOps.removeNodeState(conflicting);
             // create new with given uuid at same location as conflicting:
@@ -270,8 +269,7 @@
                 // replace child node entry with different name
                 // but preserving original position
                 parent.removeAllChildNodeEntries();
-                for (Iterator iter = cneList.iterator(); iter.hasNext();) {
-                    ChildNodeEntry cne = (ChildNodeEntry) iter.next();
+                for (ChildNodeEntry cne : cneList) {
                     if (cne.getId().equals(nodeInfo.getId())) {
                         // replace entry with different name
                         parent.addChildNodeEntry(nodeInfo.getName(), nodeInfo.getId());
@@ -317,9 +315,9 @@
             VersionHistoryInfo history =
                 versionManager.getVersionHistory(session, node, null);
             InternalValue historyId = InternalValue.create(
-                    history.getVersionHistoryId().getUUID());
+                    history.getVersionHistoryId());
             InternalValue versionId = InternalValue.create(
-                    history.getRootVersionId().getUUID());
+                    history.getRootVersionId());
 
             // jcr:isCheckedOut
             conditionalAddProperty(
@@ -389,7 +387,7 @@
     /**
      * {@inheritDoc}
      */
-    public void startNode(NodeInfo nodeInfo, List propInfos)
+    public void startNode(NodeInfo nodeInfo, List<PropInfo> propInfos)
             throws RepositoryException {
         if (aborted) {
             // the import has been aborted, get outta here...
@@ -517,9 +515,7 @@
             }
 
             // process properties
-            Iterator iter = propInfos.iterator();
-            while (iter.hasNext()) {
-                PropInfo pi = (PropInfo) iter.next();
+            for (PropInfo pi : propInfos) {
                 pi.apply(node, itemOps, ntReg, refTracker);
             }
 
@@ -606,9 +602,8 @@
                 InternalValue[] values = prop.getValues();
                 InternalValue[] newVals = new InternalValue[values.length];
                 for (int i = 0; i < values.length; i++) {
-                    InternalValue val = values[i];
-                    UUID original = val.getUUID();
-                    UUID adjusted = refTracker.getMappedUUID(original);
+                    NodeId adjusted =
+                        refTracker.getMappedId(values[i].getNodeId());
                     if (adjusted != null) {
                         newVals[i] = InternalValue.create(
                                 adjusted,
@@ -616,7 +611,7 @@
                         modified = true;
                     } else {
                         // reference doesn't need adjusting, just copy old value
-                        newVals[i] = val;
+                        newVals[i] = values[i];
                     }
                 }
                 if (modified) {

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=793613&r1=793612&r2=793613&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 Mon Jul 13 15:55:55 2009
@@ -338,11 +338,13 @@
 javax.jcr.tck.ExportSysViewTest.testroot=/testdata
 
 # ==============================================================================
-# JAVAX.JCR.QUERY CONFIGURATION
+# JAVAX.JCR.NODETYPE CONFIGURATION
 # ==============================================================================
 
 javax.jcr.tck.nodetype.testroot=/testdata
 
+javax.jcr.tck.NodeTypeCreationTest.testroot=/testroot
+
 # ==============================================================================
 # JAVAX.JCR.QUERY CONFIGURATION
 # ==============================================================================

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/fs/db/mssql.ddl
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/fs/db/mssql.ddl?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/fs/db/mssql.ddl (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/fs/db/mssql.ddl Mon Jul 13 15:55:55 2009
@@ -12,5 +12,5 @@
 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
-create table ${schemaObjectPrefix}FSENTRY (FSENTRY_PATH varchar(2048) not null, FSENTRY_NAME varchar(255) not null, FSENTRY_DATA image null, FSENTRY_LASTMOD bigint not null, FSENTRY_LENGTH bigint not null)
-create unique index ${schemaObjectPrefix}FSENTRY_IDX on ${schemaObjectPrefix}FSENTRY (FSENTRY_PATH, FSENTRY_NAME)
+create table ${schemaObjectPrefix}FSENTRY (FSENTRY_PATH varchar(2048) not null, FSENTRY_NAME varchar(255) not null, FSENTRY_DATA image null, FSENTRY_LASTMOD bigint not null, FSENTRY_LENGTH bigint not null) ${tableSpace}
+create unique index ${schemaObjectPrefix}FSENTRY_IDX on ${schemaObjectPrefix}FSENTRY (FSENTRY_PATH, FSENTRY_NAME) ${tableSpace}

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/db/mssql.ddl
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/db/mssql.ddl?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/db/mssql.ddl (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/main/resources/org/apache/jackrabbit/core/persistence/db/mssql.ddl Mon Jul 13 15:55:55 2009
@@ -12,11 +12,11 @@
 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
-create table ${schemaObjectPrefix}NODE (NODE_ID char(36) not null, NODE_DATA image not null)
-create unique index ${schemaObjectPrefix}NODE_IDX on ${schemaObjectPrefix}NODE (NODE_ID)
-create table ${schemaObjectPrefix}PROP (PROP_ID varchar(1024) not null, PROP_DATA image not null)
-create unique index ${schemaObjectPrefix}PROP_IDX on ${schemaObjectPrefix}PROP (PROP_ID)
-create table ${schemaObjectPrefix}REFS (NODE_ID char(36) not null, REFS_DATA image not null)
-create unique index ${schemaObjectPrefix}REFS_IDX on ${schemaObjectPrefix}REFS (NODE_ID)
-create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(1024) not null, BINVAL_DATA image not null)
-create unique index ${schemaObjectPrefix}BINVAL_IDX on ${schemaObjectPrefix}BINVAL (BINVAL_ID)
+create table ${schemaObjectPrefix}NODE (NODE_ID char(36) not null, NODE_DATA image not null) ${tableSpace} 
+create unique index ${schemaObjectPrefix}NODE_IDX on ${schemaObjectPrefix}NODE (NODE_ID) ${tableSpace}
+create table ${schemaObjectPrefix}PROP (PROP_ID varchar(1024) not null, PROP_DATA image not null) ${tableSpace}
+create unique index ${schemaObjectPrefix}PROP_IDX on ${schemaObjectPrefix}PROP (PROP_ID) ${tableSpace}
+create table ${schemaObjectPrefix}REFS (NODE_ID char(36) not null, REFS_DATA image not null) ${tableSpace}
+create unique index ${schemaObjectPrefix}REFS_IDX on ${schemaObjectPrefix}REFS (NODE_ID) ${tableSpace}
+create table ${schemaObjectPrefix}BINVAL (BINVAL_ID varchar(1024) not null, BINVAL_DATA image not null) ${tableSpace}
+create unique index ${schemaObjectPrefix}BINVAL_IDX on ${schemaObjectPrefix}BINVAL (BINVAL_ID) ${tableSpace}

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/CachingHierarchyManagerTest.java Mon Jul 13 15:55:55 2009
@@ -19,24 +19,25 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 
+import junit.framework.TestCase;
+
+import org.apache.jackrabbit.core.id.ItemId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
+import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.core.state.ItemState;
 import org.apache.jackrabbit.core.state.ItemStateException;
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 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.NodeStateListener;
 import org.apache.jackrabbit.core.state.PropertyState;
-import org.apache.jackrabbit.core.state.ChildNodeEntry;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.commons.name.NameFactoryImpl;
 import org.apache.jackrabbit.spi.commons.name.PathFactoryImpl;
-import org.apache.jackrabbit.uuid.UUID;
-
-import junit.framework.TestCase;
 
 public class CachingHierarchyManagerTest extends TestCase {
 
@@ -339,7 +340,7 @@
          * Create a new instance of this class.
          */
         public StaticItemStateManager() {
-            rootNodeId = new NodeId(nextUUID());
+            rootNodeId = nextNodeId();
         }
 
         /**
@@ -384,7 +385,7 @@
          * @return new node
          */
         public NodeState addNode(NodeState parent, String name) {
-            NodeId id = new NodeId(nextUUID());
+            NodeId id = nextNodeId();
             NodeState child = new NodeState(id, NameConstants.NT_UNSTRUCTURED,
                     parent.getNodeId(), NodeState.STATUS_EXISTING, false);
             if (listener != null) {
@@ -516,13 +517,13 @@
         }
 
         /**
-         * Return the next available UUID. Simply increments the last UUID
+         * Return the next available node id. Simply increments the last UUID
          * returned by <code>1</code>.
          *
          * @return next UUID
          */
-        private UUID nextUUID() {
-            return new UUID(0, lsbGenerator++);
+        private NodeId nextNodeId() {
+            return new NodeId(0, lsbGenerator++);
         }
 
         //----------------------------------------------------- ItemStateManager
@@ -556,7 +557,7 @@
         /**
          * {@inheritDoc}
          */
-        public NodeReferences getNodeReferences(NodeReferencesId id)
+        public NodeReferences getNodeReferences(NodeId id)
                 throws NoSuchItemStateException, ItemStateException {
             return null;
         }
@@ -564,7 +565,7 @@
         /**
          * {@inheritDoc}
          */
-        public boolean hasNodeReferences(NodeReferencesId id) {
+        public boolean hasNodeReferences(NodeId id) {
             return false;
         }
     }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/TransientRepositoryTest.java Mon Jul 13 15:55:55 2009
@@ -44,7 +44,7 @@
                 public RepositoryImpl getRepository() throws RepositoryException {
                     throw new UnsupportedRepositoryOperationException();
                 }
-            });
+            }, null);
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/UserTransactionImpl.java Mon Jul 13 15:55:55 2009
@@ -29,7 +29,6 @@
 import javax.jcr.Session;
 
 import org.apache.jackrabbit.api.XASession;
-import org.apache.jackrabbit.core.state.TimeBomb;
 
 /**
  * Internal {@link javax.transaction.UserTransaction} implementation.
@@ -124,27 +123,20 @@
             status = Status.STATUS_COMMITTING;
             if (distributedThreadAccess) {
                 try {
-                    final Thread t = Thread.currentThread();
-                    final TimeBomb tb = new TimeBomb(100) {
-                        public void explode() {
-                            t.interrupt();
-                        }
-                    };
-                    tb.arm();
                     Thread distributedThread = new Thread() {
                         public void run() {
                             try {
                                 xares.commit(xid, false);
-                                tb.disarm();                
                             } catch (Exception e) {
                                 throw new RuntimeException(e.getMessage());
                             }
                         }
                     };
                     distributedThread.start();
-                    Thread.sleep(200);
+                    distributedThread.join(1000);
                 } catch (InterruptedException e) {
-                    throw new SystemException("commit from different thread but same XID must not block");
+                    throw new SystemException(
+                            "Commit from different thread but same XID must not block");
                 }
             } else {
                 xares.commit(xid, false);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/ClusterRecordTest.java Mon Jul 13 15:55:55 2009
@@ -19,7 +19,7 @@
 import java.util.ArrayList;
 import java.util.Properties;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.cluster.SimpleEventListener.LockEvent;
 import org.apache.jackrabbit.core.cluster.SimpleEventListener.NamespaceEvent;
 import org.apache.jackrabbit.core.cluster.SimpleEventListener.NodeTypeEvent;
@@ -122,7 +122,7 @@
      * @throws Exception
      */
     public void testLockOperation() throws Exception {
-        LockEvent event = new LockEvent(new NodeId(UUID.randomUUID()), true, "admin");
+        LockEvent event = new LockEvent(new NodeId(), true, "admin");
 
         master.createLockChannel(DEFAULT_WORKSPACE).create(event.getNodeId(),
                 event.isDeep(), event.getUserId()).ended(true);
@@ -140,7 +140,7 @@
      * @throws Exception
      */
     public void testUnlockOperation() throws Exception {
-        UnlockEvent event = new UnlockEvent(new NodeId(UUID.randomUUID()));
+        UnlockEvent event = new UnlockEvent(new NodeId());
 
         master.createLockChannel(DEFAULT_WORKSPACE).create(event.getNodeId()).ended(true);
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleEventListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleEventListener.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleEventListener.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/SimpleEventListener.java Mon Jul 13 15:55:55 2009
@@ -27,7 +27,7 @@
 import javax.jcr.RepositoryException;
 import javax.jcr.nodetype.NoSuchNodeTypeException;
 
-import org.apache.jackrabbit.core.NodeId;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.nodetype.InvalidNodeTypeDefException;
 import org.apache.jackrabbit.core.nodetype.NodeTypeDef;
 import org.apache.jackrabbit.core.state.ChangeLog;
@@ -597,9 +597,9 @@
      *         <code>false</code> otherwise.
      */
     private static boolean equals(ChangeLog changes1, ChangeLog changes2) {
-        return equals(changes1.addedStates(), changes2.addedStates()) &&
-            equals(changes1.deletedStates(), changes2.deletedStates()) &&
-            equals(changes1.modifiedStates(), changes2.modifiedStates());
+        return equals(changes1.addedStates().iterator(), changes2.addedStates().iterator()) &&
+            equals(changes1.deletedStates().iterator(), changes2.deletedStates().iterator()) &&
+            equals(changes1.modifiedStates().iterator(), changes2.modifiedStates().iterator());
     }
 
     /**

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/UpdateEventFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/UpdateEventFactory.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/UpdateEventFactory.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/cluster/UpdateEventFactory.java Mon Jul 13 15:55:55 2009
@@ -23,8 +23,8 @@
 import javax.jcr.Session;
 import javax.jcr.observation.Event;
 
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.cluster.SimpleEventListener.UpdateEvent;
 import org.apache.jackrabbit.core.observation.EventState;
@@ -128,7 +128,7 @@
     protected NodeState createNodeState() {
         Name ntName = nameFactory.create("{}testnt");
         NodeState n = new NodeState(
-                new NodeId(UUID.randomUUID()), ntName,
+                new NodeId(), ntName,
                 ROOT_NODE_ID, NodeState.STATUS_EXISTING, false);
         n.setMixinTypeNames(Collections.EMPTY_SET);
         return n;

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/PersistenceManagerIteratorTest.java Mon Jul 13 15:55:55 2009
@@ -16,8 +16,7 @@
  */
 package org.apache.jackrabbit.core.data;
 
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.NodeIdIterator;
+import org.apache.jackrabbit.core.id.NodeId;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
 import org.apache.jackrabbit.core.config.WorkspaceConfig;
@@ -86,18 +85,16 @@
                 log("PM: " + pm.getClass().getName());
 
                 log("All nodes in one step");
-                NodeIdIterator it = apm.getAllNodeIds(null, 0);
                 NodeId after = null;
                 NodeId first = null;
-                while (it.hasNext()) {
-                    NodeId id = it.nextNodeId();
-                    log("  " + id.toString());
+                for (NodeId id : apm.getAllNodeIds(null, 0)) {
+                    log("  " + id);
                     if (first == null) {
                         // initialize first node id
                         first = id;
                     }
                     if (after != null) {
-                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                        assertFalse(id.compareTo(after) == 0);
                     }
                     after = id;
                 }
@@ -107,27 +104,25 @@
                 log("All nodes using batches");
                 while (true) {
                     log(" bigger than: " + after);
-                    it = apm.getAllNodeIds(after, 2);
+                    Iterator<NodeId> it = apm.getAllNodeIds(after, 2).iterator();
                     if (!it.hasNext()) {
                         break;
                     }
                     while (it.hasNext()) {
-                        NodeId id = it.nextNodeId();
-                        log("    " + id.toString());
-                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                        NodeId id = it.next();
+                        log("    " + id);
+                        assertFalse(id.compareTo(after) == 0);
                         after = id;
                     }
                 }
 
                 log("Random access");
                 for (int j = 0; j < 50; j++) {
-                    after = new NodeId(UUID.randomUUID());
+                    after = new NodeId();
                     log(" bigger than: " + after);
-                    it = apm.getAllNodeIds(after, 2);
-                    while (it.hasNext()) {
-                        NodeId id = it.nextNodeId();
-                        log("    " + id.toString());
-                        assertFalse(id.getUUID().compareTo(after.getUUID()) == 0);
+                    for (NodeId id : apm.getAllNodeIds(after, 2)) {
+                        log("    " + id);
+                        assertFalse(id.compareTo(after) == 0);
                         after = id;
                     }
                 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/data/TestTwoGetStreams.java Mon Jul 13 15:55:55 2009
@@ -55,7 +55,12 @@
 
         Node root = superuser.getRootNode();
         ValueFactory vf = superuser.getValueFactory();
+
+        long time = System.currentTimeMillis();
         root.setProperty("p1", vf.createBinary(new RandomInputStream(1, STREAM_LENGTH)));
+        superuser.save();
+        long saveOne = System.currentTimeMillis() - time;
+
         root.setProperty("p2", vf.createBinary(new RandomInputStream(1, STREAM_LENGTH)));
         superuser.save();
 
@@ -71,7 +76,7 @@
         }
 
         // copying a value should not stream the content
-        long time = System.currentTimeMillis();
+        time = System.currentTimeMillis();
         for (int i = 0; i < 100; i++) {
             Value v = root.getProperty("p1").getValue();
             root.setProperty("p3", v);
@@ -80,7 +85,8 @@
         time = System.currentTimeMillis() - time;
         // streaming 1 MB again and again takes about 4.3 seconds
         // on my computer; copying the data identifier takes about 16 ms
-        assertTrue("time: " + time, time < 100);
+        // here we test if copying 100 objects took less than saving 50 new objects
+        assertTrue("time: " + time, time < saveOne * 50);
 
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/GQLTest.java Mon Jul 13 15:55:55 2009
@@ -28,6 +28,8 @@
 import java.io.ByteArrayInputStream;
 import java.io.UnsupportedEncodingException;
 
+import junit.framework.AssertionFailedError;
+
 /**
  * <code>GQLTest</code> performs tests on {@link GQL}.
  */
@@ -109,8 +111,7 @@
         Node file1 = addFile(testRootNode, "file1.txt", SAMPLE_CONTENT);
         superuser.save();
         String stmt = createStatement("\"quick brown\"");
-        RowIterator rows = GQL.execute(stmt, superuser, "jcr:content");
-        checkResult(rows, new Node[]{file1});
+        checkResultWithRetries(stmt, "jcr:content", new Node[]{file1});
     }
 
     public void testExcludeTerm() throws RepositoryException {
@@ -146,11 +147,10 @@
         superuser.save();
         // only nt:resource
         String stmt = createStatement("quick type:\"nt:resource\"");
-        RowIterator rows = GQL.execute(stmt, superuser);
-        checkResult(rows, new Node[]{file.getNode("jcr:content")});
+        checkResultWithRetries(stmt, null, new Node[]{file.getNode("jcr:content")});
         // only nt:unstructured
         stmt = createStatement("quick type:\"nt:unstructured\"");
-        rows = GQL.execute(stmt, superuser);
+        RowIterator rows = GQL.execute(stmt, superuser);
         checkResult(rows, new Node[]{node});
     }
 
@@ -169,8 +169,7 @@
         superuser.save();
         // nt:hierarchyNode and sub types
         String stmt = createStatement("quick type:hierarchyNode");
-        RowIterator rows = GQL.execute(stmt, superuser, "jcr:content");
-        checkResult(rows, new Node[]{file});
+        checkResultWithRetries(stmt, "jcr:content", new Node[]{file});
     }
 
     public void testAutoPrefixType() throws RepositoryException {
@@ -180,11 +179,10 @@
         superuser.save();
         // only nt:resource
         String stmt = createStatement("quick type:resource");
-        RowIterator rows = GQL.execute(stmt, superuser);
-        checkResult(rows, new Node[]{file.getNode("jcr:content")});
+        checkResultWithRetries(stmt, null, new Node[]{file.getNode("jcr:content")});
         // only nt:unstructured
         stmt = createStatement("quick type:unstructured");
-        rows = GQL.execute(stmt, superuser);
+        RowIterator rows = GQL.execute(stmt, superuser);
         checkResult(rows, new Node[]{node});
     }
 
@@ -192,16 +190,14 @@
         Node file1 = addFile(testRootNode, "file1.txt", SAMPLE_CONTENT);
         superuser.save();
         String stmt = createStatement("\"jcr:mimeType\":text/plain");
-        RowIterator rows = GQL.execute(stmt, superuser, "jcr:content");
-        checkResult(rows, new Node[]{file1});
+        checkResultWithRetries(stmt, "jcr:content", new Node[]{file1});
     }
 
     public void testAutoPrefix() throws RepositoryException {
         Node file1 = addFile(testRootNode, "file1.txt", SAMPLE_CONTENT);
         superuser.save();
         String stmt = createStatement("mimeType:text/plain");
-        RowIterator rows = GQL.execute(stmt, superuser, "jcr:content");
-        checkResult(rows, new Node[]{file1});
+        checkResultWithRetries(stmt, "jcr:content", new Node[]{file1});
     }
 
     public void testCommonPathPrefix() throws RepositoryException {
@@ -210,14 +206,14 @@
         Node file3 = addFile(testRootNode, "file3.txt", SAMPLE_CONTENT);
         superuser.save();
         String stmt = createStatement("quick");
-        RowIterator rows = GQL.execute(stmt, superuser, "jcr:content");
-        checkResult(rows, new Node[]{file1, file2, file3});
+        checkResultWithRetries(stmt, "jcr:content", new Node[]{file1, file2, file3});
     }
 
     public void testExcerpt() throws RepositoryException {
-        addFile(testRootNode, "file1.txt", SAMPLE_CONTENT);
+        Node file = addFile(testRootNode, "file1.txt", SAMPLE_CONTENT);
         superuser.save();
         String stmt = createStatement("quick");
+        checkResultWithRetries(stmt, "jcr:content", new Node[]{file});
         RowIterator rows = GQL.execute(stmt, superuser, "jcr:content");
         assertTrue("Expected result", rows.hasNext());
         String excerpt = rows.nextRow().getValue("rep:excerpt()").getString();
@@ -310,4 +306,30 @@
     protected String createStatement(String stmt) {
         return "path:" + testRoot + " " + stmt;
     }
+
+    /**
+     * Checks if the result contains exactly the <code>nodes</code>. If the
+     * result does not contain the
+     *
+     * @param gql the gql statement.
+     * @param cpp the common path prefix or <code>null</code>.
+     * @param nodes the expected nodes in the result set.
+     * @throws RepositoryException if an error occurs while reading from the result.
+     */
+    protected void checkResultWithRetries(String gql, String cpp, Node[] nodes)
+            throws RepositoryException {
+        for (int i = 0; i < 10; i++) {
+            try {
+                checkResult(GQL.execute(gql, superuser, cpp), nodes);
+                break;
+            } catch (AssertionFailedError e) {
+                try {
+                    // sleep for a second and retry
+                    Thread.sleep(1000);
+                } catch (InterruptedException e1) {
+                    // ignore
+                }
+            }
+        }
+    }
 }

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/integration/random/operation/VersionOperation.java Mon Jul 13 15:55:55 2009
@@ -18,6 +18,7 @@
 
 import javax.jcr.Session;
 import javax.jcr.RepositoryException;
+import javax.jcr.Node;
 import javax.jcr.version.VersionIterator;
 import javax.jcr.version.Version;
 import java.util.List;
@@ -43,8 +44,15 @@
      */
     protected Version getRandomVersion(boolean excludeReferenced) throws RepositoryException {
         List allVersions = new ArrayList();
-        for (VersionIterator it = getNode().getVersionHistory().getAllVersions(); it.hasNext(); ) {
+        Node n = getNode();
+        for (VersionIterator it = n.getVersionHistory().getAllVersions(); it.hasNext(); ) {
             Version v = it.nextVersion();
+            if (excludeReferenced) {
+                // quick check if it is the base version
+                if (n.getBaseVersion().isSame(v)) {
+                    continue;
+                }
+            }
             if (v.getPredecessors().length > 0) {
                 if (!excludeReferenced || !v.getReferences().hasNext()) {
                     allVersions.add(v);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/NodeTypesInContentTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/NodeTypesInContentTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/NodeTypesInContentTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/nodetype/NodeTypesInContentTest.java Mon Jul 13 15:55:55 2009
@@ -41,6 +41,7 @@
     private static final String TEST_NODETYPES = "org/apache/jackrabbit/core/nodetype/xml/test_nodetypes.xml";
 
     protected void setUp() throws Exception {
+        isReadOnly = true;
         super.setUp();
         
         InputStream xml = getClass().getClassLoader().getResourceAsStream(TEST_NODETYPES);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/DerefTest.java Mon Jul 13 15:55:55 2009
@@ -148,6 +148,11 @@
 //                new Node[]{testRootNode});
     }
 
+    public void testRewrite() throws RepositoryException {
+        executeXPathQuery("//*[people/jcr:deref(@worksfor, '*')/@foo=1]",
+                new Node[]{});
+    }
+
     /**
      * Checks if jcr:deref works when dereferencing into the version storage.
      */

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SlowQueryHandler.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SlowQueryHandler.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SlowQueryHandler.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/query/lucene/SlowQueryHandler.java Mon Jul 13 15:55:55 2009
@@ -18,8 +18,7 @@
 
 import java.io.IOException;
 
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.uuid.UUID;
+import org.apache.jackrabbit.core.id.NodeId;
 
 /**
  * <code>SlowQueryHandler</code> implements a dummy query handler for testing
@@ -37,8 +36,7 @@
         } catch (InterruptedException e) {
             // ignore
         }
-        NodeId id = new NodeId(UUID.randomUUID());
-        getContext().getItemStateManager().hasItemState(id);
+        getContext().getItemStateManager().hasItemState(new NodeId());
         super.doInit();
     }
 

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/AccessManagerTest.java Mon Jul 13 15:55:55 2009
@@ -16,10 +16,10 @@
  */
 package org.apache.jackrabbit.core.security;
 
-import org.apache.jackrabbit.core.ItemId;
+import org.apache.jackrabbit.core.id.ItemId;
 import org.apache.jackrabbit.core.ItemImpl;
-import org.apache.jackrabbit.core.NodeId;
-import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.id.NodeId;
+import org.apache.jackrabbit.core.id.PropertyId;
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.core.security.authorization.Permission;
 import org.apache.jackrabbit.spi.Path;
@@ -115,7 +115,7 @@
 
     public void testCheckPermissionWithUnknowId() throws RepositoryException, NotExecutableException {
         Session s = getHelper().getReadOnlySession();
-        NodeId id = new NodeId(UUID.randomUUID());
+        NodeId id = new NodeId();
         try {
             AccessManager acMgr = getAccessManager(s);
             acMgr.checkPermission(id, AccessManager.READ);

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/authorization/AbstractWriteTest.java Mon Jul 13 15:55:55 2009
@@ -40,6 +40,9 @@
 import javax.jcr.security.AccessControlPolicy;
 import javax.jcr.security.Privilege;
 import java.security.Principal;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 /**
  * <code>AbstractEvaluationTest</code>...
@@ -924,6 +927,32 @@
         }
     }
 
+    public void testSingleDenyAfterAllAllowed() throws
+            NotExecutableException, RepositoryException {
+
+        /* add 'all' privilege for testSession at path. */
+        Privilege[] allPrivileges = privilegesFromName(Privilege.JCR_ALL);
+        givePrivileges(path, allPrivileges, getRestrictions(superuser, path));
+
+        /* deny a single privilege */
+        Privilege[] lockPrivileges = privilegesFromName(Privilege.JCR_LOCK_MANAGEMENT);
+        withdrawPrivileges(path, lockPrivileges, getRestrictions(superuser, path));
+
+        /* test permissions. expected result:
+           - testSession cannot lock at 'path'
+           - testSession doesn't have ALL privilege at path
+         */
+        Session testSession = getTestSession();
+        AccessControlManager acMgr = testSession.getAccessControlManager();
+
+        assertFalse(acMgr.hasPrivileges(path, allPrivileges));
+        assertFalse(acMgr.hasPrivileges(path, lockPrivileges));
+
+        List<Privilege> remainingprivs = new ArrayList<Privilege>(Arrays.asList(allPrivileges[0].getAggregatePrivileges()));
+        remainingprivs.remove(lockPrivileges[0]);
+        assertTrue(acMgr.hasPrivileges(path, remainingprivs.toArray(new Privilege[remainingprivs.size()])));
+    }
+
     private static Node findPolicyNode(Node start) throws RepositoryException {
         Node policyNode = null;
         if (start.isNodeType("rep:Policy")) {

Modified: jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java?rev=793613&r1=793612&r2=793613&view=diff
==============================================================================
--- jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java (original)
+++ jackrabbit/sandbox/JCR-1456/jackrabbit-core/src/test/java/org/apache/jackrabbit/core/security/user/IndexNodeResolverTest.java Mon Jul 13 15:55:55 2009
@@ -18,11 +18,14 @@
 
 import org.apache.jackrabbit.core.SessionImpl;
 import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.spi.Name;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.RepositoryException;
 import javax.jcr.Session;
+import javax.jcr.Value;
+import javax.jcr.NodeIterator;
 
 /** <code>IndexNodeResolver</code>... */
 public class IndexNodeResolverTest extends NodeResolverTest {
@@ -35,4 +38,30 @@
         }
         return new IndexNodeResolver(session, (SessionImpl) session);
     }
+
+
+    /**
+     * If query value contains backslash the non-exact findNodes method should
+     * return the desired result.
+     *
+     * @throws NotExecutableException
+     * @throws RepositoryException
+     */
+    public void testFindNodesNonExact() throws NotExecutableException, RepositoryException {
+        UserImpl currentUser = getCurrentUser(superuser);
+        Value vs = superuser.getValueFactory().createValue("value \\, containing backslash");
+        currentUser.setProperty(propertyName1, vs);
+
+        Name propName = ((SessionImpl) superuser).getQName(propertyName1);
+        try {
+            NodeResolver nr = createNodeResolver(currentUser.getNode().getSession());
+
+            NodeIterator result = nr.findNodes(propName, "value \\, containing backslash", UserConstants.NT_REP_USER, false);
+            assertTrue("expected result", result.hasNext());
+            assertEquals(currentUser.getNode().getPath(), result.nextNode().getPath());
+            assertFalse("expected no more results", result.hasNext());
+        } finally {
+            currentUser.removeProperty(propertyName1);
+        }
+    }
 }
\ No newline at end of file



Mime
View raw message