You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by st...@apache.org on 2006/03/01 17:38:06 UTC

svn commit: r382075 - in /incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit: core/ core/state/ core/state/db/ core/state/mem/ core/state/obj/ core/state/xml/ core/version/ core/xml/ uuid/

Author: stefan
Date: Wed Mar  1 08:38:04 2006
New Revision: 382075

URL: http://svn.apache.org/viewcvs?rev=382075&view=rev
Log:
JCR-329: NodeReferencesId.equals() is not symmetric
plus some cleanups/consolidations (mostly cosmetical) of recent changes

Removed:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/uuid/Bytes.java
Modified:
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferencesId.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
    incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java Wed Mar  1 08:38:04 2006
@@ -372,8 +372,8 @@
             Path path = Path.create(getPath(state.getNodeId()), name, index, true);
             insert(path, id);
         } catch (PathNotFoundException e) {
-            log.warn("Unable to get path of node " + state.getNodeId() +
-                    ", event ignored.");
+            log.warn("Unable to get path of node " + state.getNodeId()
+                    + ", event ignored.");
         } catch (MalformedPathException e) {
             log.warn("Unable to create path of " + id, e);
         } catch (ItemNotFoundException e) {
@@ -418,8 +418,8 @@
             Path path = Path.create(getPath(state.getNodeId()), name, index, true);
             remove(path, id);
         } catch (PathNotFoundException e) {
-            log.warn("Unable to get path of node " + state.getNodeId() +
-                    ", event ignored.");
+            log.warn("Unable to get path of node " + state.getNodeId()
+                    + ", event ignored.");
         } catch (MalformedPathException e) {
             log.warn("Unable to create path of " + id, e);
         } catch (ItemNotFoundException e) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java Wed Mar  1 08:38:04 2006
@@ -380,7 +380,7 @@
             NodeState parentState;
             try {
                 NodeState nodeState = (NodeState) getItemState(nodeId);
-                NodeId parentId= getParentId(nodeState);
+                NodeId parentId = getParentId(nodeState);
                 if (parentId == null) {
                     // this is the root or an orphaned node
                     // FIXME

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/ItemId.java Wed Mar  1 08:38:04 2006
@@ -26,7 +26,7 @@
 public abstract class ItemId implements Serializable {
 
     /** Serialization UID of this class. */
-    static final long serialVersionUID = -9147603369595196078L;
+    static final long serialVersionUID = -5138008726453328226L;
 
     /**
      * Returns <code>true</code> if this id denotes a <code>Node</code>.

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeId.java Wed Mar  1 08:38:04 2006
@@ -25,7 +25,7 @@
 public class NodeId extends ItemId {
 
     /** Serial version UID of this class. */
-    static final long serialVersionUID = 7026219091360041109L;
+    static final long serialVersionUID = 7380115476447060008L;
 
     /** UUID of the identified node */
     private final UUID uuid;
@@ -85,8 +85,7 @@
         return new NodeId(new UUID(s));
     }
 
-    //-----------------------------------------< java.lang.Object overrides >---
-
+    //-------------------------------------------< java.lang.Object overrides >
     /**
      * {@inheritDoc}
      */

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/NodeImpl.java Wed Mar  1 08:38:04 2006
@@ -446,13 +446,11 @@
             throw new RepositoryException(msg);
         }
 
-        NodeId parentId = (NodeId) state.getId();
-
         // create a new property state
         PropertyState propState;
         try {
             propState =
-                    stateMgr.createTransientPropertyState(parentId, name,
+                    stateMgr.createTransientPropertyState(getNodeId(), name,
                             ItemState.STATUS_NEW);
             propState.setType(type);
             propState.setMultiValued(def.isMultiple());
@@ -489,7 +487,6 @@
                                                     NodeTypeImpl nodeType,
                                                     NodeId id)
             throws RepositoryException {
-        NodeId parentId = (NodeId) state.getId();
         // create a new node state
         NodeState nodeState;
         try {
@@ -498,7 +495,7 @@
             }
             nodeState =
                     stateMgr.createTransientNodeState(id, nodeType.getQName(),
-                            parentId, ItemState.STATUS_NEW);
+                            getNodeId(), ItemState.STATUS_NEW);
             nodeState.setDefinitionId(def.unwrap().getId());
         } catch (ItemStateException ise) {
             String msg = "failed to add child node " + name + " to "
@@ -1213,7 +1210,7 @@
      * @return the uuid of this node
      */
     public UUID internalGetUUID() {
-        return ((NodeId) state.getId()).getUUID();
+        return ((NodeId) id).getUUID();
     }
 
     /**
@@ -1434,8 +1431,7 @@
         // check state of this instance
         sanityCheck();
 
-        NodeState thisState = (NodeState) state;
-        PropertyId propId = new PropertyId(thisState.getNodeId(), name);
+        PropertyId propId = new PropertyId(getNodeId(), name);
         try {
             return (PropertyImpl) itemMgr.getItem(propId);
         } catch (AccessDeniedException ade) {
@@ -1629,7 +1625,7 @@
     }
 
     /**
-     * Return the id of this <code>Node</code>.
+     * Returns the identifier of this <code>Node</code>.
      *
      * @return the id of this <code>Node</code>
      */
@@ -1652,7 +1648,7 @@
         // check state of this instance
         sanityCheck();
 
-        if (state.getId() == null) {
+        if (state.getParentId() == null) {
             // this is the root node
             return "";
         }
@@ -2686,7 +2682,7 @@
             NodeState parent =
                     (NodeState) stateMgr.getItemState(parentId);
             NodeState.ChildNodeEntry parentEntry =
-                    parent.getChildNodeEntry((NodeId) state.getId());
+                    parent.getChildNodeEntry(getNodeId());
             return parentEntry.getIndex();
         } catch (ItemStateException ise) {
             // should never get here...
@@ -3445,14 +3441,14 @@
         while (niter.hasNext()) {
             NodeImpl child = (NodeImpl) niter.nextNode();
             NodeImpl dstNode = null;
-            NodeId id = (NodeId) child.getId();
+            NodeId childId = child.getNodeId();
             if (hasNode(child.getQName())) {
                 // todo: does not work properly for samename siblings
                 dstNode = getNode(child.getQName());
             } else if (child.isNodeType(QName.MIX_REFERENCEABLE)) {
                 // if child is referenceable, check if correspondance exist in this workspace
                 try {
-                    dstNode = session.getNodeById(id);
+                    dstNode = session.getNodeById(childId);
                     if (removeExisting) {
                         dstNode.internalRemove(false);
                         dstNode = null;
@@ -3466,10 +3462,10 @@
                 }
             } else {
                 // if child is not referenceable, clear uuid
-                id = null;
+                childId = null;
             }
             if (dstNode == null) {
-                dstNode = internalAddChildNode(child.getQName(), (NodeTypeImpl) child.getPrimaryNodeType(), id);
+                dstNode = internalAddChildNode(child.getQName(), (NodeTypeImpl) child.getPrimaryNodeType(), childId);
                 // add mixins
                 NodeType[] mixins = child.getMixinNodeTypes();
                 for (int i = 0; i < mixins.length; i++) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/PropertyId.java Wed Mar  1 08:38:04 2006
@@ -26,9 +26,9 @@
 public class PropertyId extends ItemId {
 
     /** Serial version UID of this class. */
-    static final long serialVersionUID = -3726624437800567892L;
+    static final long serialVersionUID = 1118783735407446009L;
 
-    /** ID of the parent node. */
+    /** id of the parent node. */
     private final NodeId parentId;
 
     /** Qualified name of the property. */
@@ -71,9 +71,9 @@
     }
 
     /**
-     * Returns the Id of the parent node.
+     * Returns the identifier of the parent node.
      *
-     * @return node Id
+     * @return id of parent node
      */
     public NodeId getParentId() {
         return parentId;
@@ -114,8 +114,7 @@
         return new PropertyId(NodeId.valueOf(uuid), name);
     }
 
-    //-----------------------------------------< java.lang.Object overrides >---
-
+    //-------------------------------------------< java.lang.Object overrides >
     /**
      * {@inheritDoc}
      */

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/SessionImpl.java Wed Mar  1 08:38:04 2006
@@ -414,6 +414,47 @@
     }
 
     /**
+     * Retrieves the referenceable node with the given <code>UUID</code>.
+     *
+     * @param uuid uuid of the node to be retrieved
+     * @return referenceable node with the given uuid
+     * @throws ItemNotFoundException if no node exists with the given uuid or
+     * if the existing node is not referenceable.
+     * @throws RepositoryException if another error occurs.
+     * @see #getNodeByUUID(String)
+     * @see #getNodeById(NodeId)
+     */
+    public Node getNodeByUUID(UUID uuid) throws ItemNotFoundException, RepositoryException {
+        NodeImpl node = getNodeById(new NodeId(uuid));
+        if (node.isNodeType(QName.MIX_REFERENCEABLE)) {
+            return node;
+        } else {
+            // there is a node with that uuid but the node does not expose it
+            throw new ItemNotFoundException(uuid.toString());
+        }
+    }
+
+    /**
+     * Retrieves the <code>Node</code> with the given id.
+     *
+     * @param id id of node to be retrieved
+     * @return node with the given <code>NodeId</code>.
+     * @throws ItemNotFoundException if no such node exists or if this
+     * <code>Session</code> does not have permission to access the node.
+     * @throws RepositoryException if another error occurs.
+     */
+    public NodeImpl getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException {
+        // check sanity of this session
+        sanityCheck();
+
+        try {
+            return (NodeImpl) getItemManager().getItem(id);
+        } catch (AccessDeniedException ade) {
+            throw new ItemNotFoundException(id.toString());
+        }
+    }
+
+    /**
      * Returns the names of all workspaces of this repository with respect of the
      * access rights of this session.
      *
@@ -706,47 +747,6 @@
      */
     public Node getNodeByUUID(String uuid) throws ItemNotFoundException, RepositoryException {
         return getNodeByUUID(UUID.fromString(uuid));
-    }
-
-    /**
-     * Retrieve the referenceable node with the given <code>UUID</code>.
-     *
-     * @param uuid
-     * @return referenceable node with the given uuid
-     * @throws ItemNotFoundException if no node exists with the given uuid or
-     * if the existing node is not referenceable.
-     * @throws RepositoryException
-     * @see #getNodeByUUID(String)
-     * @see #getNodeById(NodeId)
-     */
-    public Node getNodeByUUID(UUID uuid) throws ItemNotFoundException, RepositoryException {
-        NodeImpl node = getNodeById(new NodeId(uuid));
-        if (node.isNodeType(QName.MIX_REFERENCEABLE)) {
-            return node;
-        } else {
-            // there is a node with that uuid but the node does not expose it
-            throw new ItemNotFoundException(uuid.toString());
-        }
-    }
-
-    /**
-     * Retrieve the <code>Node</code> with the given id.
-     *
-     * @param id
-     * @return node with the given <code>NodeId</code>.
-     * @throws ItemNotFoundException if no such node exists or if this
-     * <code>Session</code> does not have permission to access the node.
-     * @throws RepositoryException
-     */
-    public NodeImpl getNodeById(NodeId id) throws ItemNotFoundException, RepositoryException {
-        // check sanity of this session
-        sanityCheck();
-
-        try {
-            return (NodeImpl) getItemManager().getItem(id);
-        } catch (AccessDeniedException ade) {
-            throw new ItemNotFoundException(id.toString());
-        }
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/AbstractPersistenceManager.java Wed Mar  1 08:38:04 2006
@@ -84,7 +84,7 @@
             if (refs.hasReferences()) {
                 store(refs);
             } else {
-                if (exists(refs.getTargetId())) {
+                if (exists(refs.getId())) {
                     destroy(refs);
                 }
             }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ChangeLog.java Wed Mar  1 08:38:04 2006
@@ -95,7 +95,7 @@
      * @param refs refs that has been modified
      */
     public void modified(NodeReferences refs) {
-        modifiedRefs.put(refs.getTargetId(), refs);
+        modifiedRefs.put(refs.getId(), refs);
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ItemState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ItemState.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ItemState.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/ItemState.java Wed Mar  1 08:38:04 2006
@@ -33,15 +33,16 @@
 public abstract class ItemState implements ItemStateListener, Serializable {
 
     /** Serialization UID of this class. */
-    static final long serialVersionUID = 2017294661624942639L;
+    static final long serialVersionUID = -1473610775880779769L;
 
     /**
-     * the default logger
+     * Logger instance
      */
     private static Logger log = Logger.getLogger(ItemState.class);
 
+     //------------------< flags defining the current status of this instance >
     /**
-     * undefined state
+     * the status is undefined
      */
     public static final int STATUS_UNDEFINED = 0;
     /**
@@ -117,10 +118,10 @@
     }
 
     /**
-     * Constructs a new node state that is initially connected to an overlayed
+     * Constructs a new item state that is initially connected to an overlayed
      * state.
      *
-     * @param overlayedState the backing node state being overlayed
+     * @param overlayedState the backing item state being overlayed
      * @param initialStatus the initial status of the new <code>ItemState</code> instance
      * @param isTransient   flag indicating whether this state is transient or not
      */
@@ -141,7 +142,7 @@
     }
 
     /**
-     * Copy state information from a state into this state
+     * Copy state information from another state into this state
      * @param state source state information
      */
     abstract protected void copy(ItemState state);
@@ -292,9 +293,9 @@
     public abstract boolean isNode();
 
     /**
-     * Returns the identifier of this item state.
+     * Returns the identifier of this item.
      *
-     * @return the identifier of this item state..
+     * @return the id of this item.
      */
     abstract public ItemId getId();
 
@@ -308,7 +309,6 @@
      */
     public boolean isTransient() {
         return isTransient;
-
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferences.java Wed Mar  1 08:38:04 2006
@@ -17,6 +17,7 @@
 package org.apache.jackrabbit.core.state;
 
 import org.apache.jackrabbit.core.PropertyId;
+import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.uuid.UUID;
 
 import java.io.Serializable;
@@ -36,13 +37,13 @@
     static final long serialVersionUID = 7007727035982680717L;
 
     /**
-     * id of the target node
+     * identifier of this <code>NodeReferences</code> instance.
      */
-    protected NodeReferencesId targetId;
+    protected NodeReferencesId id;
 
     /**
      * list of PropertyId's (i.e. the id's of the properties that refer to
-     * the target node denoted by <code>targetId</code>).
+     * the target node denoted by <code>id.getTargetId()</code>).
      * <p/>
      * note that the list can contain duplicate entries because a specific
      * REFERENCE property can contain multiple references (if it's multi-valued)
@@ -53,32 +54,32 @@
     /**
      * Package private constructor
      *
-     * @param targetId
+     * @param id
      */
-    public NodeReferences(NodeReferencesId targetId) {
-        this.targetId = targetId;
+    public NodeReferences(NodeReferencesId id) {
+        this.id = id;
     }
 
     /**
-     * Return the target id of this node references object.
+     * Returns the identifier of this node references object.
      *
-     * @return target id
+     * @return the id of this node references object.
      */
-    public NodeReferencesId getTargetId() {
-        return targetId;
+    public NodeReferencesId getId() {
+        return id;
     }
 
     /**
-     * Return the UUID of the target id
+     * Returns the identifier of the target node.
      *
-     * @return UUID of the target id
+     * @return the id of the target node
      */
-    public UUID getUUID() {
-        return targetId.getUUID();
+    public NodeId getTargetId() {
+        return id.getTargetId();
     }
 
     /**
-     * Return a flag indicating whether this object holds any references
+     * Returns a flag indicating whether this object holds any references
      *
      * @return <code>true</code> if this object holds references,
      *         <code>false</code> otherwise
@@ -110,7 +111,7 @@
 
     /**
      * @param refId
-     * @return <code>true</code> if the reference was reomved;
+     * @return <code>true</code> if the reference was removed;
      *        <code>false</code> otherwise.
      */
     public boolean removeReference(PropertyId refId) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferencesId.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferencesId.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferencesId.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeReferencesId.java Wed Mar  1 08:38:04 2006
@@ -19,27 +19,51 @@
 import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.uuid.UUID;
 
+import java.io.Serializable;
+
 /**
  * Identifies a <code>NodeReferences</code> object.
  */
-public class NodeReferencesId extends NodeId {
+public class NodeReferencesId implements Serializable {
+
+    /** Serialization UID of this class. */
+    static final long serialVersionUID = -3819311769214730025L;
 
     /**
-     * Create a new instance of this class. Takes a UUID as parameter.
+     * The id of the target node.
+     */
+    private final NodeId targetId;
+
+    /**
+     * Creates a new instance of this class. Takes a UUID as parameter.
      *
      * @param uuid uuid of target node
+     * @throws IllegalArgumentException if <code>uuid</code> is <code>null</code>.
      */
     public NodeReferencesId(UUID uuid) {
-        super(uuid);
+        targetId = new NodeId(uuid);
     }
 
     /**
-     * Create a new instance of this class. Takes a id as parameter.
+     * Creates a new instance of this class. Takes an id as parameter.
      *
      * @param id the id of target node
+     * @throws IllegalArgumentException if <code>id</code> is <code>null</code>.
      */
     public NodeReferencesId(NodeId id) {
-        super(id == null ? null : id.getUUID());
+        if (id == null) {
+            throw new IllegalArgumentException("id must not be null");
+        }
+        targetId = id;
+    }
+
+    /**
+     * Returns the id of the target node.
+     *
+     * @return the id of the target node.
+     */
+    public NodeId getTargetId() {
+        return targetId;
     }
 
     /**
@@ -54,11 +78,41 @@
      *                                  as a <code>NodeReferencesId</code>.
      * @see #toString()
      */
-    public static NodeId valueOf(String s) throws IllegalArgumentException {
+    public static NodeReferencesId valueOf(String s) throws IllegalArgumentException {
         if (s == null) {
             throw new IllegalArgumentException("invalid NodeReferencesId literal");
         }
         return new NodeReferencesId(NodeId.valueOf(s));
     }
 
+    /**
+     * Returns the same as <code>this.getTargetId().toString()</code>.
+     *
+     * @return the same as <code>this.getTargetId().toString()</code>.
+     */
+    public String toString() {
+        return targetId.toString();
+    }
+
+    /**
+     * Returns the same as <code>this.getTargetId().hashCode()</code>.
+     *
+     * @return the same as <code>this.getTargetId().hashCode()</code>.
+     */
+    public int hashCode() {
+        return targetId.hashCode();
+    }
+
+    /**
+     * @inheritDoc
+     */
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+        if (obj instanceof NodeReferencesId) {
+            return targetId.getUUID().equals(((NodeReferencesId) obj).targetId.getUUID());
+        }
+        return false;
+    }
 }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/NodeState.java Wed Mar  1 08:38:04 2006
@@ -48,7 +48,7 @@
     /**
      * Serialization UID of this class.
      */
-    static final long serialVersionUID = -4116945555530446652L;
+    static final long serialVersionUID = 4392375681805781770L;
 
     private static Logger log = Logger.getLogger(NodeState.class);
 
@@ -63,12 +63,13 @@
     private Set mixinTypeNames = Collections.EMPTY_SET;
 
     /**
-     * the id of this node state.
+     * the id of this node.
      */
     private NodeId id;
 
     /**
-     * the id of the parent node or <code>null</code> if this is the root node
+     * the id of the parent node or <code>null</code> if this instance
+     * represents the root node
      */
     private NodeId parentId;
 
@@ -119,11 +120,11 @@
     }
 
     /**
-     * Constructs a new node state this is not connected.
+     * Constructs a new node state that is not connected.
      *
-     * @param id            the Id of the this node
+     * @param id            id of this node
      * @param nodeTypeName  node type of this node
-     * @param parentId      the Id of the parent node
+     * @param parentId      id of the parent node
      * @param initialStatus the initial status of the node state object
      * @param isTransient   flag indicating whether this state is transient or not
      */
@@ -153,12 +154,11 @@
         }
     }
 
-    //-----------------------------------------------------< public methods >---
+    //-------------------------------------------------------< public methods >
     /**
-     * Determines if this item state represents a node.
+     * {@inheritDoc}
      *
      * @return always true
-     * @see ItemState#isNode
      */
     public final boolean isNode() {
         return true;
@@ -179,19 +179,20 @@
     }
 
     /**
-     * Returns the id of this node state.
-     * @return the id of this node state.
+     * Returns the identifier of this node.
+     *
+     * @return the id of this node.
      */
     public NodeId getNodeId() {
         return id;
     }
 
     /**
-     * Sets the Id of the parent <code>NodeState</code>.
+     * Sets the id of this node's parent.
      *
-     * @param parentId the parent <code>NodeState</code>'s Id or <code>null</code>
+     * @param parentId the parent node's id or <code>null</code>
      * if either this node state should represent the root node or this node
-     * state should be 'free floating', i.e. detached from the repository's
+     * state should be 'free floating', i.e. detached from the workspace's
      * hierarchy.
      */
     public void setParentId(NodeId parentId) {
@@ -308,12 +309,12 @@
 
     /**
      * Returns the <code>ChildNodeEntry</code> with the specified name and index
-     * or <code>null</code> if there's no such entry.
+     * or <code>null</code> if there's no matching entry.
      *
      * @param nodeName <code>QName</code> object specifying a node name
      * @param index    1-based index if there are same-name child node entries
      * @return the <code>ChildNodeEntry</code> with the specified name and index
-     *         or <code>null</code> if there's no such entry.
+     *         or <code>null</code> if there's no matching entry.
      */
     public synchronized ChildNodeEntry getChildNodeEntry(QName nodeName, int index) {
         return childNodeEntries.get(nodeName, index);
@@ -321,11 +322,11 @@
 
     /**
      * Returns the <code>ChildNodeEntry</code> with the specified <code>NodeId</code> or
-     * <code>null</code> if there's no such entry.
+     * <code>null</code> if there's no matching entry.
      *
      * @param id the id of the child node
      * @return the <code>ChildNodeEntry</code> with the specified <code>NodeId</code> or
-     *         <code>null</code> if there's no such entry.
+     *         <code>null</code> if there's no matching entry.
      * @see #addChildNodeEntry
      * @see #removeChildNodeEntry
      */
@@ -361,7 +362,7 @@
      * Adds a new <code>ChildNodeEntry</code>.
      *
      * @param nodeName <code>QName</code> object specifying the name of the new entry.
-     * @param id The id the new entry is refering to.
+     * @param id the id the new entry is refering to.
      * @return the newly added <code>ChildNodeEntry</code>
      */
     public synchronized ChildNodeEntry addChildNodeEntry(QName nodeName,
@@ -424,7 +425,7 @@
     /**
      * Removes a <code>ChildNodeEntry</code>.
      *
-     * @param id the Id of the entry to be removed
+     * @param id the id of the entry to be removed
      * @return <code>true</code> if the specified child node entry was found
      *         in the list of child node entries and could be removed.
      */
@@ -678,7 +679,7 @@
         for (int i = 0; i < ours.size();) {
             ChildNodeEntry entry = (ChildNodeEntry) ours.get(i);
             ChildNodeEntry other = (ChildNodeEntry) others.get(i);
-            if (entry == other || entry.id.equals(other.id)) {
+            if (entry == other || entry.getId().equals(other.getId())) {
                 // no reorder, move to next child entry
                 i++;
             } else {
@@ -694,10 +695,10 @@
                 if (i + 1 < ours.size()) {
                     // if entry is the next in the other list then probably
                     // the other entry at position <code>i</code> was reordered
-                    if (entry.id.equals(((ChildNodeEntry) others.get(i + 1)).id)) {
+                    if (entry.getId().equals(((ChildNodeEntry) others.get(i + 1)).getId())) {
                         // scan for the uuid of the other entry in our list
                         for (int j = i; j < ours.size(); j++) {
-                            if (((ChildNodeEntry) ours.get(j)).id.equals(other.id)) {
+                            if (((ChildNodeEntry) ours.get(j)).getId().equals(other.getId())) {
                                 // found it
                                 entry = (ChildNodeEntry) ours.get(j);
                                 break;
@@ -710,12 +711,12 @@
                 // remove the entry from both lists
                 // entries > i are already cleaned
                 for (int j = i; j < ours.size(); j++) {
-                    if (((ChildNodeEntry) ours.get(j)).id.equals(entry.id)) {
+                    if (((ChildNodeEntry) ours.get(j)).getId().equals(entry.getId())) {
                         ours.remove(j);
                     }
                 }
                 for (int j = i; j < ours.size(); j++) {
-                    if (((ChildNodeEntry) others.get(j)).id.equals(entry.id)) {
+                    if (((ChildNodeEntry) others.get(j)).getId().equals(entry.getId())) {
                         others.remove(j);
                     }
                 }
@@ -990,9 +991,10 @@
         }
 
         /**
-         * Removes the child node entry with the given id
-         * @param id
-         * @return the removed entry or <code>null</code>
+         * Removes the child node entry refering to the node with the given id.
+         *
+         * @param id id of node whose entry is to be removed.
+         * @return the removed entry or <code>null</code> if there is no such entry.
          */
         ChildNodeEntry remove(NodeId id) {
             ChildNodeEntry entry = (ChildNodeEntry) entries.get(id);
@@ -1003,9 +1005,10 @@
         }
 
         /**
-         * Removes the child node entry
-         * @param entry
-         * @return the removed entry or <code>null</code>
+         * Removes the given child node entry.
+         *
+         * @param entry entry to be removed.
+         * @return the removed entry or <code>null</code> if there is no such entry.
          */
         public ChildNodeEntry remove(ChildNodeEntry entry) {
             return remove(entry.getName(), entry.getIndex());
@@ -1044,7 +1047,7 @@
             Iterator iter = iterator();
             while (iter.hasNext()) {
                 ChildNodeEntry entry = (ChildNodeEntry) iter.next();
-                ChildNodeEntry otherEntry = other.get(entry.id);
+                ChildNodeEntry otherEntry = other.get(entry.getId());
                 if (entry == otherEntry) {
                     continue;
                 }
@@ -1080,7 +1083,7 @@
             Iterator iter = iterator();
             while (iter.hasNext()) {
                 ChildNodeEntry entry = (ChildNodeEntry) iter.next();
-                ChildNodeEntry otherEntry = other.get(entry.id);
+                ChildNodeEntry otherEntry = other.get(entry.getId());
                 if (entry == otherEntry) {
                     result.add(entry);
                 } else if (otherEntry != null
@@ -1095,7 +1098,7 @@
         //-------------------------------------------< unmodifiable List view >
         public boolean contains(Object o) {
             if (o instanceof ChildNodeEntry) {
-                return entries.containsKey(((ChildNodeEntry) o).id);
+                return entries.containsKey(((ChildNodeEntry) o).getId());
             } else {
                 return false;
             }
@@ -1117,7 +1120,7 @@
 
         public int indexOf(Object o) {
             if (o instanceof ChildNodeEntry) {
-                return entries.indexOf(((ChildNodeEntry) o).id);
+                return entries.indexOf(((ChildNodeEntry) o).getId());
             } else {
                 return -1;
             }
@@ -1234,7 +1237,7 @@
                 NodeState.ChildNodeEntry entry =
                         (NodeState.ChildNodeEntry) iter.next();
                 out.writeUTF(entry.getName().toString());   // name
-                out.writeUTF(entry.getId().toString());  // uuid
+                out.writeUTF(entry.getId().toString());  // id
             }
         }
 
@@ -1246,7 +1249,7 @@
             short count = in.readShort();   // count
             for (int i = 0; i < count; i++) {
                 QName name = QName.valueOf(in.readUTF());    // name
-                String s = in.readUTF();   // nodeid
+                String s = in.readUTF();   // id
                 add(name, NodeId.valueOf(s));
             }
         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/PropertyState.java Wed Mar  1 08:38:04 2006
@@ -39,7 +39,7 @@
     /**
      * Serialization UID of this class.
      */
-    static final long serialVersionUID = 4569719974514326906L;
+    static final long serialVersionUID = 90076676913237139L;
 
     /**
      * the id of this property state
@@ -128,8 +128,9 @@
     }
 
     /**
-     * Returns the id of this property state.
-     * @return the id of this property state.
+     * Returns the identifier of this property.
+     * 
+     * @return the id of this property.
      */
     public PropertyId getPropertyId() {
         return id;
@@ -229,7 +230,8 @@
     private void writeObject(ObjectOutputStream out) throws IOException {
         // important: fields must be written in same order as they are
         // read in readObject(ObjectInputStream)
-        out.writeUTF(getName().toString());
+        out.writeUTF(id.toString());
+        out.writeUTF(defId.toString());
         out.writeInt(type);
         out.writeBoolean(multiValued);
         if (values == null) {
@@ -268,7 +270,8 @@
     private void readObject(ObjectInputStream in) throws IOException {
         // important: fields must be read in same order as they are
         // written in writeObject(ObjectOutputStream)
-        QName name = QName.valueOf(in.readUTF());
+        id = PropertyId.valueOf(in.readUTF());
+        defId = PropDefId.valueOf(in.readUTF());
         type = in.readInt();
         multiValued = in.readBoolean();
         short count = in.readShort(); // # of values

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/SharedItemStateManager.java Wed Mar  1 08:38:04 2006
@@ -511,7 +511,7 @@
                 for (Iterator iter = local.modifiedRefs(); iter.hasNext();) {
                     NodeReferences refs = (NodeReferences) iter.next();
                     boolean virtual = false;
-                    NodeId id = new NodeId(refs.getUUID());
+                    NodeId id = refs.getId().getTargetId();
                     for (int i = 0; i < virtualProviders.length; i++) {
                         if (virtualProviders[i].hasItemState(id)) {
                             List virtualRefs = virtualNodeReferences[i];
@@ -1099,7 +1099,7 @@
         // check whether targets of modified node references exist
         for (Iterator iter = changes.modifiedRefs(); iter.hasNext();) {
             NodeReferences refs = (NodeReferences) iter.next();
-            NodeId id = new NodeId(refs.getUUID());
+            NodeId id = refs.getTargetId();
             // no need to check existence of target if there are no references
             if (refs.hasReferences()) {
                 // please note:

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/XAItemStateManager.java Wed Mar  1 08:38:04 2006
@@ -21,7 +21,6 @@
 import org.apache.jackrabbit.core.TransactionContext;
 import org.apache.jackrabbit.core.InternalXAResource;
 import org.apache.jackrabbit.core.PropertyId;
-import org.apache.jackrabbit.core.NodeId;
 import org.apache.jackrabbit.core.observation.EventStateCollectionFactory;
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.virtual.VirtualItemStateProvider;
@@ -389,18 +388,18 @@
 
     /**
      * Add a virtual reference from some reference property to a virtual node.
-     * Ignored if <code>targetId</code> does not actually point to a virtual
-     * node.
+     * Ignored if <code>refsId.getTargetId()</code> does not denote a
+     * virtual node.
      * @param sourceId property id
-     * @param targetId node references id
+     * @param refsId node references id
      */
     private void addVirtualReference(PropertyId sourceId,
-                                     NodeReferencesId targetId)
+                                     NodeReferencesId refsId)
             throws NoSuchItemStateException, ItemStateException {
 
-        NodeReferences refs = virtualProvider.getNodeReferences(targetId);
-        if (refs == null && virtualProvider.hasItemState(new NodeId(targetId.getUUID()))) {
-            refs = new NodeReferences(targetId);
+        NodeReferences refs = virtualProvider.getNodeReferences(refsId);
+        if (refs == null && virtualProvider.hasItemState(refsId.getTargetId())) {
+            refs = new NodeReferences(refsId);
         }
         if (refs != null) {
             refs.addReference(sourceId);
@@ -410,18 +409,18 @@
 
     /**
      * Remove a virtual reference from some reference property to a virtual node.
-     * Ignored if <code>targetId</code> does not actually point to a virtual
-     * node.
+     * Ignored if <code>refsId.getTargetId()</code> does not denote a
+     * virtual node.
      * @param sourceId property id
-     * @param targetId node references id
+     * @param refsId node references id
      */
     private void removeVirtualReference(PropertyId sourceId,
-                                        NodeReferencesId targetId)
+                                        NodeReferencesId refsId)
             throws NoSuchItemStateException, ItemStateException {
 
-        NodeReferences refs = virtualProvider.getNodeReferences(targetId);
-        if (refs == null && virtualProvider.hasItemState(new NodeId(targetId.getUUID()))) {
-            refs = new NodeReferences(targetId);
+        NodeReferences refs = virtualProvider.getNodeReferences(refsId);
+        if (refs == null && virtualProvider.hasItemState(refsId.getTargetId())) {
+            refs = new NodeReferences(refsId);
         }
         if (refs != null) {
             refs.removeReference(sourceId);

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/db/SimpleDbPersistenceManager.java Wed Mar  1 08:38:04 2006
@@ -762,7 +762,7 @@
         }
 
         // check if insert or update
-        boolean update = exists(refs.getTargetId());
+        boolean update = exists(refs.getId());
         PreparedStatement stmt = (update) ? nodeReferenceUpdate : nodeReferenceInsert;
 
         try {
@@ -775,13 +775,13 @@
             // not have to additionally synchronize on the preparedStatement
 
             stmt.setBytes(1, out.toByteArray());
-            stmt.setString(2, refs.getTargetId().toString());
+            stmt.setString(2, refs.getId().toString());
             stmt.executeUpdate();
 
             // there's no need to close a ByteArrayOutputStream
             //out.close();
         } catch (Exception e) {
-            String msg = "failed to write node references: " + refs.getTargetId();
+            String msg = "failed to write node references: " + refs.getId();
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {
@@ -800,10 +800,10 @@
 
         PreparedStatement stmt = nodeReferenceDelete;
         try {
-            stmt.setString(1, refs.getTargetId().toString());
+            stmt.setString(1, refs.getId().toString());
             stmt.executeUpdate();
         } catch (Exception e) {
-            String msg = "failed to delete node references: " + refs.getTargetId();
+            String msg = "failed to delete node references: " + refs.getId();
             log.error(msg, e);
             throw new ItemStateException(msg, e);
         } finally {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/mem/InMemPersistenceManager.java Wed Mar  1 08:38:04 2006
@@ -521,7 +521,7 @@
             Serializer.deserialize(refs, in);
             return refs;
         } catch (Exception e) {
-            String msg = "failed to load references: " + id.getUUID();
+            String msg = "failed to load references: " + id;
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -542,11 +542,11 @@
             Serializer.serialize(refs, out);
 
             // store in serialized format in map for better memory efficiency
-            stateStore.put(refs.getTargetId(), out.toByteArray());
+            stateStore.put(refs.getId(), out.toByteArray());
             // there's no need to close a ByteArrayOutputStream
             //out.close();
         } catch (Exception e) {
-            String msg = "failed to store references: " + refs.getTargetId();
+            String msg = "failed to store references: " + refs.getId();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -561,7 +561,7 @@
         }
 
         // remove node references
-        stateStore.remove(refs.getTargetId());
+        stateStore.remove(refs.getId());
     }
 
     /**

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/obj/ObjectPersistenceManager.java Wed Mar  1 08:38:04 2006
@@ -126,7 +126,7 @@
     }
 
     private static String buildNodeReferencesFilePath(NodeReferencesId id) {
-        return buildNodeFolderPath(id) + FileSystem.SEPARATOR + NODEREFSFILENAME;
+        return buildNodeFolderPath(id.getTargetId()) + FileSystem.SEPARATOR + NODEREFSFILENAME;
     }
 
     //---------------------------------------------------< PersistenceManager >
@@ -356,7 +356,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String refsFilePath = buildNodeReferencesFilePath(refs.getTargetId());
+        String refsFilePath = buildNodeReferencesFilePath(refs.getId());
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
             refsFile.makeParentDirs();
@@ -367,7 +367,7 @@
                 out.close();
             }
         } catch (Exception e) {
-            String msg = "failed to store references: " + refs.getTargetId();
+            String msg = "failed to store references: " + refs.getId();
             log.debug(msg);
             throw new ItemStateException(msg, e);
         }
@@ -440,7 +440,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        String refsFilePath = buildNodeReferencesFilePath(refs.getTargetId());
+        String refsFilePath = buildNodeReferencesFilePath(refs.getId());
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
             if (refsFile.exists()) {
@@ -448,7 +448,7 @@
                 refsFile.delete(true);
             }
         } catch (FileSystemException fse) {
-            String msg = "failed to delete references: " + refs.getTargetId();
+            String msg = "failed to delete node references: " + refs.getId();
             log.debug(msg);
             throw new ItemStateException(msg, fse);
         }

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/state/xml/XMLPersistenceManager.java Wed Mar  1 08:38:04 2006
@@ -171,8 +171,8 @@
         return buildNodeFolderPath(id) + "/" + NODEFILENAME;
     }
 
-    private String buildNodeReferencesFilePath(NodeId id) {
-        return buildNodeFolderPath(id) + "/" + NODEREFSFILENAME;
+    private String buildNodeReferencesFilePath(NodeReferencesId id) {
+        return buildNodeFolderPath(id.getTargetId()) + "/" + NODEREFSFILENAME;
     }
 
     private void readState(DOMWalker walker, NodeState state)
@@ -360,7 +360,7 @@
             throw new ItemStateException(msg);
         }
         // check targetId
-        if (!refs.getTargetId().equals(NodeReferencesId.valueOf(walker.getAttribute(TARGETID_ATTRIBUTE)))) {
+        if (!refs.getId().equals(NodeReferencesId.valueOf(walker.getAttribute(TARGETID_ATTRIBUTE)))) {
             String msg = "invalid serialized state: targetId  mismatch";
             log.debug(msg);
             throw new ItemStateException(msg);
@@ -796,7 +796,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        NodeReferencesId id = refs.getTargetId();
+        NodeReferencesId id = refs.getId();
         String refsFilePath = buildNodeReferencesFilePath(id);
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {
@@ -815,7 +815,7 @@
                 }
                 writer.write("<?xml version=\"1.0\" encoding=\"" + encoding + "\"?>\n");
                 writer.write("<" + NODEREFERENCES_ELEMENT + " "
-                        + TARGETID_ATTRIBUTE + "=\"" + refs.getTargetId() + "\">\n");
+                        + TARGETID_ATTRIBUTE + "=\"" + refs.getId() + "\">\n");
                 // write references (i.e. the id's of the REFERENCE properties)
                 Iterator iter = refs.getReferences().iterator();
                 while (iter.hasNext()) {
@@ -842,7 +842,7 @@
             throw new IllegalStateException("not initialized");
         }
 
-        NodeReferencesId id = refs.getTargetId();
+        NodeReferencesId id = refs.getId();
         String refsFilePath = buildNodeReferencesFilePath(id);
         FileSystemResource refsFile = new FileSystemResource(itemStateFS, refsFilePath);
         try {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/version/VersionManagerImpl.java Wed Mar  1 08:38:04 2006
@@ -468,7 +468,7 @@
             // check whether targets of modified node references exist
             for (Iterator iter = changes.modifiedRefs(); iter.hasNext();) {
                 NodeReferences refs = (NodeReferences) iter.next();
-                NodeId id = new NodeId(refs.getUUID());
+                NodeId id = refs.getTargetId();
                 // no need to check existence of target if there are no references
                 if (refs.hasReferences()) {
                     if (!changes.has(id) && !hasItemState(id)) {

Modified: incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java
URL: http://svn.apache.org/viewcvs/incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java?rev=382075&r1=382074&r2=382075&view=diff
==============================================================================
--- incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java (original)
+++ incubator/jackrabbit/trunk/jackrabbit/src/main/java/org/apache/jackrabbit/core/xml/SessionImporter.java Wed Mar  1 08:38:04 2006
@@ -123,7 +123,7 @@
         }
 
         // add node
-        UUID uuid = id == null ? UUID.randomUUID() : id.getUUID();
+        UUID uuid = (id == null) ? null : id.getUUID();
         node = parent.addNode(nodeName, nodeTypeName, uuid);
         // add mixins
         if (mixinNames != null) {