jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1170900 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ hierarchy/ nodetype/ state/ version/
Date Wed, 14 Sep 2011 23:40:43 GMT
Author: mduerig
Date: Wed Sep 14 23:40:42 2011
New Revision: 1170900

URL: http://svn.apache.org/viewvc?rev=1170900&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: remove HierarchyEntry, NodeEntry, PropertyEntry interfaces

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java
      - copied, changed from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java
      - copied, changed from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java
      - copied, changed from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java Wed Sep 14 23:40:42 2011
@@ -429,9 +429,8 @@ public abstract class ItemImpl implement
      * {@code String}.
      *
      * @return the name of this item as {@code Name}
-     * @throws RepositoryException if an error occurs.
      */
-    abstract Name getQName() throws RepositoryException;
+    abstract Name getQName();
 
     /**
      * Returns the primary path to this {@code Item}.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java Wed Sep 14 23:40:42 2011
@@ -1217,7 +1217,7 @@ public class NodeImpl extends ItemImpl i
      * @see ItemImpl#getName()
      */
     @Override
-    Name getQName() throws RepositoryException {
+    Name getQName() {
         if (getNodeState().isRoot()) {
             // shortcut. the given state represents the root or an orphaned node
             return NameConstants.ROOT;
@@ -1368,7 +1368,7 @@ public class NodeImpl extends ItemImpl i
     protected Property getProperty(Name qName) throws RepositoryException {
         checkStatus();
         try {
-            PropertyEntry pEntry = getNodeEntry().getPropertyEntry(qName, true);
+            PropertyEntry pEntry = getNodeEntry().getPropertyEntry(qName);
             if (pEntry == null) {
                 throw new PathNotFoundException(LogUtil.saveGetJCRName(qName, session.getNamePathResolver()));
             }
@@ -1661,7 +1661,7 @@ public class NodeImpl extends ItemImpl i
                 // contain such a property entry, the targetEntry is 'null;
                 Name propName = rp.getName();
                 // check if property entry exists
-                targetEntry = getNodeEntry().getPropertyEntry(propName, true);
+                targetEntry = getNodeEntry().getPropertyEntry(propName);
             } else {
                 // build and resolve absolute path
                 Path p = getPath(rp).getCanonicalPath();

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/ChildNodeAttic.java Wed Sep 14 23:40:42 2011
@@ -17,8 +17,6 @@
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
 import org.apache.jackrabbit.spi.Name;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -29,14 +27,14 @@ import java.util.Set;
  * {@code ChildNodeAttic}...
  */
 class ChildNodeAttic {
-    private final Set<NodeEntryImpl> attic = new HashSet<NodeEntryImpl>();
+    private final Set<NodeEntry> attic = new HashSet<NodeEntry>();
 
     boolean isEmpty() {
         return attic.isEmpty();
     }
 
     boolean contains(Name name, int index) {
-        for (NodeEntryImpl ne : attic) {
+        for (NodeEntry ne : attic) {
             if (ne.matches(name, index)) {
                 return true;
             }
@@ -45,7 +43,7 @@ class ChildNodeAttic {
     }
 
     boolean contains(Name name, int index, String uniqueId) {
-        for (NodeEntryImpl ne : attic) {
+        for (NodeEntry ne : attic) {
             if (uniqueId != null && uniqueId.equals(ne.getUniqueID()) || ne.matches(name, index)) {
                 return true;
             }
@@ -54,9 +52,9 @@ class ChildNodeAttic {
         return false;
     }
 
-    List<NodeEntryImpl> get(Name name) {
-        List<NodeEntryImpl> l = new ArrayList<NodeEntryImpl>();
-        for (NodeEntryImpl ne : attic) {
+    List<NodeEntry> get(Name name) {
+        List<NodeEntry> l = new ArrayList<NodeEntry>();
+        for (NodeEntry ne : attic) {
             if (ne.matches(name)) {
                 l.add(ne);
             }
@@ -71,7 +69,7 @@ class ChildNodeAttic {
      * @return
      */
     NodeEntry get(Name name, int index) {
-        for (NodeEntryImpl ne : attic) {
+        for (NodeEntry ne : attic) {
             if (ne.matches(name, index)) {
                 return ne;
             }
@@ -98,7 +96,7 @@ class ChildNodeAttic {
         return null;
     }
 
-    void add(NodeEntryImpl movedEntry) {
+    void add(NodeEntry movedEntry) {
         attic.add(movedEntry);
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java Wed Sep 14 23:40:42 2011
@@ -74,8 +74,8 @@ public class EntryFactory {
         this.isf = isf;
         this.listener = listener;
 
-        invalidationStrategy = new NodeEntryImpl.LazyInvalidation();
-        rootEntry = NodeEntryImpl.createRootEntry(this);
+        invalidationStrategy = new NodeEntry.LazyInvalidation();
+        rootEntry = NodeEntry.createRootEntry(this);
     }
 
     /**
@@ -86,17 +86,17 @@ public class EntryFactory {
     }
 
     public NodeEntry createNodeEntry(NodeEntry parent, Name qName, String uniqueId) {
-        if (!(parent instanceof NodeEntryImpl)) {
+        if (!(parent instanceof NodeEntry)) {
             throw new IllegalArgumentException();
         }
-        return NodeEntryImpl.createNodeEntry((NodeEntryImpl) parent, qName, uniqueId, this);
+        return NodeEntry.createNodeEntry(parent, qName, uniqueId, this);
     }
 
     public PropertyEntry createPropertyEntry(NodeEntry parent, Name qName) {
-        if (!(parent instanceof NodeEntryImpl)) {
+        if (!(parent instanceof NodeEntry)) {
             throw new IllegalArgumentException();
         }
-        return PropertyEntryImpl.create((NodeEntryImpl) parent, qName, this);
+        return PropertyEntry.create(parent, qName, this);
     }
 
     public IdFactory getIdFactory() {

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java (from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java&r1=1170856&r2=1170900&rev=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntry.java Wed Sep 14 23:40:42 2011
@@ -16,6 +16,7 @@
  */
 package org.apache.jackrabbit.jcr2spi.hierarchy;
 
+import org.apache.jackrabbit.jcr2spi.operation.Operation;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.jcr2spi.state.ItemState.MergeResult;
 import org.apache.jackrabbit.jcr2spi.state.ItemStateFactory;
@@ -39,8 +40,8 @@ import java.lang.ref.SoftReference;
  * {@code HierarchyEntryImpl} implements base functionality for child node
  * and property references.
  */
-abstract class HierarchyEntryImpl implements HierarchyEntry {
-    private static final Logger log = LoggerFactory.getLogger(HierarchyEntryImpl.class);
+public abstract class HierarchyEntry {
+    private static final Logger log = LoggerFactory.getLogger(HierarchyEntry.class);
 
     /**
      * The required generation of this entry. This is used by the
@@ -63,7 +64,7 @@ abstract class HierarchyEntryImpl implem
     /**
      * Hard reference to the parent {@code NodeEntry}.
      */
-    protected NodeEntryImpl parent;
+    protected NodeEntry parent;
 
     /**
      * The item state factory to create the item state.
@@ -79,7 +80,7 @@ abstract class HierarchyEntryImpl implem
      * @param name   the name of the child item.
      * @param factory
      */
-    HierarchyEntryImpl(NodeEntryImpl parent, Name name, EntryFactory factory) {
+    HierarchyEntry(NodeEntry parent, Name name, EntryFactory factory) {
         this.parent = parent;
         this.name = name;
         this.factory = factory;
@@ -167,6 +168,19 @@ abstract class HierarchyEntryImpl implem
     abstract Path buildPath(boolean workspacePath) throws RepositoryException;
 
     /**
+     * True if this {@code HierarchyEntry} would resolve to a {@code NodeState}.
+     * @return
+     */
+    public abstract boolean denotesNode();
+
+    /**
+     * Clean up this entry upon {@link Operation#undo()} or {@link Operation#persisted()}.
+     *
+     * @param operation
+     */
+    public abstract void complete(Operation operation) throws RepositoryException;
+
+    /**
      * @return the item state or {@code null} if the entry isn't resolved.
      */
     ItemState internalGetItemState() {
@@ -195,27 +209,48 @@ abstract class HierarchyEntryImpl implem
 
     //-----------------------------------------------------< HierarchyEntry >---
 
-    @Override
+    /**
+     * @return the name of this hierarchy entry.
+     */
     public Name getName() {
         return name;
     }
 
-    @Override
+    /**
+     * @return the path of this hierarchy entry.
+     */
     public Path getPath() throws RepositoryException {
         return buildPath(false);
     }
 
-    @Override
+    /**
+     * @return If this entry has not been modified this method returns the same
+     * as {@link #getPath()}. In case of moved items this method return the
+     * original path as it is present on the persistent layer.
+     */
     public Path getWorkspacePath() throws RepositoryException {
         return buildPath(true);
     }
 
-    @Override
+    /**
+     * Returns the {@code NodeEntry} being parent to this
+     * {@code HierarchyEntry}.
+     *
+     * @return the parent {@code HierarchyEntry}
+     */
     public NodeEntry getParent() {
         return parent;
     }
 
-    @Override
+    /**
+     * If this {@code HierarchyEntry} provides an underlying
+     * {@code ItemState} this method returns the status of that state,
+     * otherwise it returns {@link org.apache.jackrabbit.jcr2spi.state.Status#_UNDEFINED_}.
+     *
+     * @return Status of the ItemState or {@link org.apache.jackrabbit.jcr2spi.state.Status#_UNDEFINED_} if this
+     * entry has not been resolved yet.
+     * @see ItemState#getStatus()
+     */
     public Status getStatus() {
         ItemState state = internalGetItemState();
         if (state == null) {
@@ -225,23 +260,43 @@ abstract class HierarchyEntryImpl implem
         }
     }
 
-    @Override
+    /**
+     * Returns {@code true} if the referenced {@code ItemState} is
+     * available. That is, the referenced {@code ItemState} has already
+     * been resolved.<br>
+     * Note, that the validity of the ItemState is not checked.
+     *
+     * @return {@code true} if the {@code ItemState} is available;
+     * otherwise {@code false}.
+     * @see #getItemState()
+     */
     public boolean isAvailable() {
         return internalGetItemState() != null;
     }
 
     /**
-     * {@inheritDoc}<br>
+     * If this {@code HierarchyEntry} has already been resolved before
+     * (see {@link #isAvailable()}), that {@code ItemState} is returned.
+     * Note however, that the validity of the State is not asserted.<br>
+     * If the entry has not been resolved yet an attempt is made to resolve this
+     * entry, which may fail if there exists no accessible {@code ItemState}
+     * or if the corresponding state has been removed in the mean time.
+     *
+     * @return the referenced {@code ItemState}.
+     * @throws ItemNotFoundException if the {@code ItemState} does not
+     * exist anymore.
+     * @throws RepositoryException If an error occurs while retrieving the
+     * {@code ItemState}.
      */
-    @Override
     public ItemState getItemState() throws RepositoryException {
         return resolve();
     }
 
     /**
-     * {@inheritDoc}<br>
+     * Set the ItemState this hierarchyEntry will be resolved to.
+     *
+     * @param state
      */
-    @Override
     public synchronized void setItemState(ItemState state) {
         ItemState currentState = internalGetItemState();
         if (state == null || state == currentState || denotesNode() != state.isNode()) {
@@ -268,19 +323,33 @@ abstract class HierarchyEntryImpl implem
     }
 
     /**
-     * {@inheritDoc}<br>
+     * Invalidates the underlying {@code ItemState} if available and if it
+     * is not transiently modified. If the {@code recursive} flag is true,
+     * also invalidates the child entries recursively.<br>
+     * Note, that in contrast to {@link HierarchyEntry#reload(boolean)}
+     * this method only sets the status of this item state to {@link
+     * org.apache.jackrabbit.jcr2spi.state.Status#INVALIDATED} and does not actually update it with the persistent
+     * state in the repository.
      */
-    @Override
     public void invalidate(boolean recursive) {
         getInvalidationStrategy().invalidate(this, recursive);
     }
 
-    @Override
+    /**
+     * Calculates the status of the underlying {@code ItemState}: any pending
+     * changes to the underlying {@code ItemState} are applied.
+     */
     public void calculateStatus() {
         getInvalidationStrategy().applyPending(this);
     }
 
-    @Override
+    /**
+     * Traverses the hierarchy and reverts all transient modifications such as
+     * adding, modifying or removing item states. 'Existing' item states
+     * are reverted to their initial state and their status is reset to {@link org.apache.jackrabbit.jcr2spi.state.Status#EXISTING}.
+     *
+     * @throws RepositoryException if an error occurs.
+     */
     public void revert() throws RepositoryException {
         ItemState state = internalGetItemState();
         if (state == null) {
@@ -328,7 +397,13 @@ abstract class HierarchyEntryImpl implem
         }
     }
 
-    @Override
+    /**
+     * Reloads this hierarchy entry and the corresponding ItemState, if this
+     * entry has already been resolved. If '{@code recursive}' the complete
+     * hierarchy below this entry is reloaded as well.
+     *
+     * @param recursive
+     */
     public void reload(boolean recursive) {
         Status status = getStatus();
         if (status == Status._UNDEFINED_) {
@@ -363,7 +438,18 @@ abstract class HierarchyEntryImpl implem
         }
     }
 
-    @Override
+    /**
+     * Traverses the hierarchy and marks all available item states as transiently
+     * removed. They will change their status to either {@link org.apache.jackrabbit.jcr2spi.state.Status#EXISTING_REMOVED} if
+     * the item is existing in the persistent storage or {@link org.apache.jackrabbit.jcr2spi.state.Status#REMOVED}
+     * if the item has been transiently added before. In the latter case, the
+     * corresponding HierarchyEntries can be removed as well from their parent.
+     *
+     * @throws InvalidItemStateException if this entry has been removed in the
+     * mean time.
+     * @throws RepositoryException if an error occurs while removing any of the item
+     * states e.g. an item state is not valid anymore.
+     */
     public void transientRemove() throws RepositoryException {
         ItemState state = internalGetItemState();
         if (state == null) {
@@ -402,12 +488,22 @@ abstract class HierarchyEntryImpl implem
         }
     }
 
-    @Override
+    /**
+     * Removes this {@code HierarchyEntry} from its parent and sets the
+     * status of the underlying ItemState to {@link org.apache.jackrabbit.jcr2spi.state.Status#REMOVED} or to
+     * {@link org.apache.jackrabbit.jcr2spi.state.Status#STALE_DESTROYED}, respectively. If this entry is a
+     * NodeEntry all descending ItemStates must get their status changed as well.
+     */
     public void remove() {
         internalRemove(false);
     }
 
-    @Override
+    /**
+     * The required generation of this {@code HierarchyEntry} . This is used by the
+     * {@link ItemInfoCache} to determine whether an item info in the cache is up to date or not.
+     * That is whether the generation of the item info in the cache is the same or more recent
+     * as the required generation of this entry.
+     */
     public long getGeneration() {
         calculateStatus();
         return generation;
@@ -477,7 +573,7 @@ abstract class HierarchyEntryImpl implem
          */
         @Override
         public void invalidate(HierarchyEntry entry, boolean recursive) {
-            HierarchyEntryImpl he = (HierarchyEntryImpl) entry;
+            HierarchyEntry he = entry;
             if (recursive) {
                 he.generation = INVALIDATION_PENDING;
                 if (!invalidating) {
@@ -508,7 +604,7 @@ abstract class HierarchyEntryImpl implem
                 currentGeneration += nextGeneration;
                 nextGeneration = 0;
                 try {
-                    HierarchyEntryImpl he = (HierarchyEntryImpl) entry;
+                    HierarchyEntry he = entry;
                     if (he.generation == INVALIDATION_PENDING) {
                         he.invalidateInternal(true);
                         he.generation = currentGeneration;
@@ -528,7 +624,7 @@ abstract class HierarchyEntryImpl implem
          *
          * @param entry
          */
-        private void resolvePendingInvalidation(HierarchyEntryImpl entry) {
+        private void resolvePendingInvalidation(HierarchyEntry entry) {
             if (entry != null) {
 
                 // First recursively travel up to the first parent node

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java Wed Sep 14 23:40:42 2011
@@ -54,8 +54,8 @@ public class HierarchyManagerImpl implem
 
     public void setResolver(NamePathResolver resolver) {
         this.resolver = resolver;
-        if (rootEntry instanceof HierarchyEntryImpl) {
-            ((HierarchyEntryImpl) rootEntry).factory.setResolver(resolver);
+        if (rootEntry instanceof HierarchyEntry) {
+            rootEntry.factory.setResolver(resolver);
         }
     }
 

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java (from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java&r1=1170856&r2=1170900&rev=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntry.java Wed Sep 14 23:40:42 2011
@@ -69,8 +69,8 @@ import static org.apache.jackrabbit.spi.
  * {@code NodeEntryImpl} implements common functionality for child
  * node entry implementations.
  */
-public class NodeEntryImpl extends HierarchyEntryImpl implements NodeEntry {
-    private static final Logger log = LoggerFactory.getLogger(NodeEntryImpl.class);
+public class NodeEntry extends HierarchyEntry {
+    private static final Logger log = LoggerFactory.getLogger(NodeEntry.class);
 
     /**
      * UniqueID identifying this NodeEntry or {@code null} if either
@@ -123,7 +123,7 @@ public class NodeEntryImpl extends Hiera
      * @param name      the name of the child node.
      * @param factory   the entry factory.
      */
-    private NodeEntryImpl(NodeEntryImpl parent, Name name, String uniqueID, EntryFactory factory) {
+    private NodeEntry(NodeEntry parent, Name name, String uniqueID, EntryFactory factory) {
         super(parent, name, factory);
         this.uniqueID = uniqueID; // NOTE: don't use setUniqueID (for mod only)
 
@@ -140,7 +140,7 @@ public class NodeEntryImpl extends Hiera
      * @return the entry corresponding to the root node.
      */
     static NodeEntry createRootEntry(EntryFactory factory) {
-        return new NodeEntryImpl(null, NameConstants.ROOT, null, factory);
+        return new NodeEntry(null, NameConstants.ROOT, null, factory);
     }
 
     /**
@@ -150,15 +150,14 @@ public class NodeEntryImpl extends Hiera
      * @param factory
      * @return the created entry.
      */
-    static NodeEntry createNodeEntry(NodeEntryImpl parent, Name name, String uniqueId, EntryFactory factory) {
-        return new NodeEntryImpl(parent, name, uniqueId, factory);
+    static NodeEntry createNodeEntry(NodeEntry parent, Name name, String uniqueId, EntryFactory factory) {
+        return new NodeEntry(parent, name, uniqueId, factory);
     }
 
     //-----------------------------------------------------< HierarchyEntry >---
+
     /**
      * Returns true.
-     *
-     * @see HierarchyEntry#denotesNode()
      */
     @Override
     public boolean denotesNode() {
@@ -240,7 +239,7 @@ public class NodeEntryImpl extends Hiera
         boolean staleParent = getStatus() == Status.STALE_DESTROYED;
         // now remove all child-entries (or mark them accordingly)
         for (Iterator<HierarchyEntry> it = getAllChildEntries(true); it.hasNext();) {
-            HierarchyEntryImpl ce = (HierarchyEntryImpl) it.next();
+            HierarchyEntry ce = it.next();
             ce.internalRemove(staleParent);
         }
     }
@@ -253,14 +252,11 @@ public class NodeEntryImpl extends Hiera
 
         // now remove all child-entries (or mark them accordingly)
         for (Iterator<HierarchyEntry> it = getAllChildEntries(true); it.hasNext();) {
-            HierarchyEntryImpl ce = (HierarchyEntryImpl) it.next();
+            HierarchyEntry ce = it.next();
             ce.internalRemove(staleParent);
         }
     }
 
-    /**
-     * @see HierarchyEntry#complete(Operation)
-     */
     @Override
     public void complete(Operation operation) throws RepositoryException {
         if (operation instanceof AddNode) {
@@ -284,12 +280,22 @@ public class NodeEntryImpl extends Hiera
 
     //----------------------------------------------------------< NodeEntry >---
 
-    @Override
+    /**
+     * @return the {@code NodeId} of this child node entry.
+     */
     public NodeId getId() throws RepositoryException {
         return getId(false);
     }
 
-    @Override
+    /**
+     * Returns the ID that must be used for resolving this entry OR loading its
+     * children entries from the persistent layer. This is the same as
+     * {@code getId()} unless this entry or any of its ancestors has been
+     * transiently moved.
+     *
+     * @return
+     * @see #getId()
+     */
     public NodeId getWorkspaceId() throws RepositoryException {
         return getId(true);
     }
@@ -306,7 +312,7 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    private static NodeId buildNodeId(NodeEntryImpl entry, PathFactory pathFactory, IdFactory idFactory,
+    private static NodeId buildNodeId(NodeEntry entry, PathFactory pathFactory, IdFactory idFactory,
             boolean wspId) throws RepositoryException {
 
         PathBuilder pathBuilder = new PathBuilder(pathFactory);
@@ -329,12 +335,18 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    @Override
+    /**
+     * @return the unique ID of the node state which is referenced by this
+     * child node entry or {@code null} if the node state cannot be
+     * identified with a unique ID.
+     */
     public String getUniqueID() {
         return uniqueID;
     }
 
-    @Override
+    /**
+     * @param uniqueID
+     */
     public void setUniqueID(String uniqueID) {
         String old = this.uniqueID;
         boolean mod = uniqueID == null ? old != null : !uniqueID.equals(old);
@@ -344,19 +356,41 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    @Override
+    /**
+     * @return the index of this child node entry to support same-name siblings.
+     * If the index of this entry cannot be determined
+     * {@link org.apache.jackrabbit.spi.Path#INDEX_UNDEFINED} is returned.
+     * @throws InvalidItemStateException
+     * @throws RepositoryException
+     */
     public int getIndex() throws RepositoryException {
         return getIndex(false);
     }
 
-    @Override
+    /**
+     * @return the referenced {@code NodeState}.
+     * @throws ItemNotFoundException if the {@code NodeState} does not
+     * exist.
+     * @throws RepositoryException If an error occurs while retrieving the
+     * {@code NodeState}.
+     */
     public NodeState getNodeState() throws RepositoryException {
         return (NodeState) getItemState();
     }
 
-    @Override
+    /**
+     * Traverse the tree below this entry and return the child entry matching
+     * the given path. If that entry has not been loaded yet, try to do so.
+     * NOTE: In contrast to getNodeEntry, getNodeEntries this method may return
+     * invalid entries, i.e. entries connected to a removed or stale ItemState.
+     *
+     * @param path
+     * @return the entry at the given path.
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public NodeEntry getDeepNodeEntry(Path path) throws RepositoryException {
-        NodeEntryImpl entry = this;
+        NodeEntry entry = this;
         Path.Element[] elems = path.getElements();
         for (int i = 0; i < elems.length; i++) {
             Path.Element elem = elems[i];
@@ -374,7 +408,7 @@ public class NodeEntryImpl extends Hiera
             // first try to resolve to known node or property entry
             NodeEntry cne = entry.getNodeEntry(name, index, false);
             if (cne != null) {
-                entry = (NodeEntryImpl) cne;
+                entry = cne;
             } else {
                 // no valid entry
                 // -> if entries are complete -> assume that it doesn't exist.
@@ -427,9 +461,20 @@ public class NodeEntryImpl extends Hiera
         return entry;
     }
 
-    @Override
+    /**
+     * Traverse the tree below this entry and return the child entry matching
+     * the given path. If that entry has not been loaded yet, try to do so.
+     * NOTE: In contrast to getPropertyEntry and getPropertyEntries this method
+     * may return invalid entries, i.e. entries connected to a removed or stale
+     * ItemState.
+     *
+     * @param path
+     * @return the property entry at the given path.
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public PropertyEntry getDeepPropertyEntry(Path path) throws RepositoryException {
-        NodeEntryImpl entry = this;
+        NodeEntry entry = this;
         Path.Element[] elems = path.getElements();
         int i = 0;
         for (; i < elems.length-1; i++) {
@@ -447,7 +492,7 @@ public class NodeEntryImpl extends Hiera
             // first try to resolve to known node or property entry
             NodeEntry cne = entry.getNodeEntry(name, index, false);
             if (cne != null) {
-                entry = (NodeEntryImpl) cne;
+                entry = cne;
             } else {
                 // no valid ancestor node entry
                 // -> if entries are complete -> assume that it doesn't exist.
@@ -501,9 +546,17 @@ public class NodeEntryImpl extends Hiera
         return pe;
     }
 
-    @Override
+    /**
+     * Traverse the tree below this entry and return the child entry matching
+     * the given 'workspacePath', i.e. transient modifications and new entries
+     * are ignored.<p/>
+     * If no matching entry can be found, {@code null} is return.
+     *
+     * @param workspacePath
+     * @return matching entry or {@code null}.
+     */
     public HierarchyEntry lookupDeepEntry(Path workspacePath) {
-        NodeEntryImpl entry = this;
+        NodeEntry entry = this;
         for (int i = 0; i < workspacePath.getLength(); i++) {
             Path.Element elem = workspacePath.getElements()[i];
             // check for root element
@@ -521,7 +574,7 @@ public class NodeEntryImpl extends Hiera
             // first try to resolve node
             NodeEntry cne = entry.lookupNodeEntry(null, childName, index);
             if (cne != null) {
-                entry = (NodeEntryImpl) cne;
+                entry = cne;
             } else if (index == Path.INDEX_DEFAULT && i == workspacePath.getLength() - 1) {
                 // property must not have index && must be final path element
                 return entry.lookupPropertyEntry(childName);
@@ -532,13 +585,28 @@ public class NodeEntryImpl extends Hiera
         return entry;
     }
 
-    @Override
+    /**
+     * Determines if there is a valid {@code NodeEntry} with the
+     * specified {@code nodeName}.
+     *
+     * @param nodeName {@code Name} object specifying a node name
+     * @return {@code true} if there is a {@code NodeEntry} with
+     * the specified {@code nodeName}.
+     */
     public synchronized boolean hasNodeEntry(Name nodeName) {
         List<NodeEntry> namedEntries = childNodeEntries.get(nodeName);
         return !namedEntries.isEmpty() && EntryValidation.containsValidNodeEntry(namedEntries.iterator());
     }
 
-    @Override
+    /**
+     * Determines if there is a valid {@code NodeEntry} with the
+     * specified {@code name} and {@code index}.
+     *
+     * @param nodeName  {@code Name} object specifying a node name.
+     * @param index 1-based index if there are same-name child node entries.
+     * @return {@code true} if there is a {@code NodeEntry} with
+     * the specified {@code name} and {@code index}.
+     */
     public synchronized boolean hasNodeEntry(Name nodeName, int index) {
         try {
             return getNodeEntry(nodeName, index) != null;
@@ -548,12 +616,34 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    @Override
+    /**
+     * Returns the valid {@code NodeEntry} with the specified name
+     * and index or {@code null} if there's no matching entry.
+     *
+     * @param nodeName {@code Name} object specifying a node name.
+     * @param index 1-based index if there are same-name child node entries.
+     * @return The {@code NodeEntry} with the specified name and index
+     * or {@code null} if there's no matching entry.
+     * @throws RepositoryException If an unexpected error occurs.
+     */
     public synchronized NodeEntry getNodeEntry(Name nodeName, int index) throws RepositoryException {
         return getNodeEntry(nodeName, index, false);
     }
 
-    @Override
+    /**
+     * Returns the valid {@code NodeEntry} with the specified name
+     * and index or {@code null} if there's no matching entry. If
+     * {@code loadIfNotFound} is true, the implementation must make
+     * sure, that it's list of child entries is up to date and eventually
+     * try to load the node entry.
+     *
+     * @param nodeName {@code Name} object specifying a node name.
+     * @param index 1-based index if there are same-name child node entries.
+     * @param loadIfNotFound
+     * @return The {@code NodeEntry} with the specified name and index
+     * or {@code null} if there's no matching entry.
+     * @throws RepositoryException If an unexpected error occurs.
+     */
     public NodeEntry getNodeEntry(Name nodeName, int index, boolean loadIfNotFound) throws RepositoryException {
         List<NodeEntry> entries = childNodeEntries.get(nodeName);
         NodeEntry cne = null;
@@ -583,7 +673,13 @@ public class NodeEntryImpl extends Hiera
         return cne;
     }
 
-    @Override
+    /**
+     * Returns a unmodifiable iterator of {@code NodeEntry} objects
+     * denoting the the valid child NodeEntries present on this {@code NodeEntry}.
+     *
+     * @return iterator of {@code NodeEntry} objects
+     * @throws RepositoryException If an unexpected error occurs.
+     */
     public synchronized Iterator<NodeEntry> getNodeEntries() throws RepositoryException {
         Collection<NodeEntry> entries = new ArrayList<NodeEntry>();
         for (Iterator<NodeEntry> it = getCompleteChildNodeEntries().iterator(); it.hasNext();) {
@@ -595,7 +691,14 @@ public class NodeEntryImpl extends Hiera
         return entries.iterator();
     }
 
-    @Override
+    /**
+     * Returns a unmodifiable List of {@code NodeEntry}s with the
+     * specified name.
+     *
+     * @param nodeName name of the child node entries that should be returned
+     * @return list of {@code NodeEntry} objects
+     * @throws RepositoryException If an unexpected error occurs.
+     */
     public synchronized List<NodeEntry> getNodeEntries(Name nodeName) throws RepositoryException {
         List<NodeEntry> namedEntries = getCompleteChildNodeEntries().get(nodeName);
         if (namedEntries.isEmpty()) {
@@ -614,8 +717,12 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    @Override
-    public void setNodeEntries(Iterator<ChildInfo> childInfos) throws RepositoryException {
+    /**
+     * Creates or updates the {@code ChildNodeEntries} of this node.
+     *
+     * @param childInfos
+     */
+    public void setNodeEntries(Iterator<ChildInfo> childInfos) {
         if (childNodeAttic.isEmpty()) {
             childNodeEntries.update(childInfos);
         } else {
@@ -631,8 +738,16 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    @Override
-    public NodeEntry getOrAddNodeEntry(Name nodeName, int index, String uniqueID) throws RepositoryException {
+    /**
+     * Adds a child NodeEntry to this entry if it not yet present with this
+     * node entry.
+     *
+     * @param nodeName
+     * @param index
+     * @param uniqueID
+     * @return the {@code NodeEntry}.
+     */
+    public NodeEntry getOrAddNodeEntry(Name nodeName, int index, String uniqueID) {
         NodeEntry ne = lookupNodeEntry(uniqueID, nodeName, index);
         if (ne == null) {
             ne = internalAddNodeEntry(nodeName, uniqueID, index);
@@ -642,22 +757,44 @@ public class NodeEntryImpl extends Hiera
         return ne;
     }
 
-    @Override
-    public NodeEntry addNewNodeEntry(Name nodeName, String uniqueID,
-                                     Name primaryNodeType, QNodeDefinition definition) throws RepositoryException {
+    /**
+     * Adds a new, transient child {@code NodeEntry}
+     *
+     * @param nodeName
+     * @param uniqueID
+     * @param primaryNodeType
+     * @param definition
+     * @return
+     */
+    public NodeEntry addNewNodeEntry(Name nodeName, String uniqueID, Name primaryNodeType, QNodeDefinition definition) {
+        
         NodeEntry entry = internalAddNodeEntry(nodeName, uniqueID, Path.INDEX_UNDEFINED);
         NodeState state = getItemStateFactory().createNewNodeState(entry, primaryNodeType, definition);
         entry.setItemState(state);
         return entry;
     }
 
-    @Override
+    /**
+     * Determines if there is a property entry with the specified {@code Name}.
+     *
+     * @param propName {@code Name} object specifying a property name
+     * @return {@code true} if there is a property entry with the specified
+     * {@code Name}.
+     */
     public synchronized boolean hasPropertyEntry(Name propName) {
         PropertyEntry entry = properties.get(propName);
         return EntryValidation.isValidPropertyEntry(entry);
     }
 
-    @Override
+    /**
+     * Returns the valid {@code PropertyEntry} with the specified name
+     * or {@code null} if no matching entry exists.
+     *
+     * @param propName {@code Name} object specifying a property name.
+     * @return The {@code PropertyEntry} with the specified name or
+     * {@code null} if no matching entry exists.
+     * @throws RepositoryException If an unexpected error occurs.
+     */
     public synchronized PropertyEntry getPropertyEntry(Name propName) {
         PropertyEntry entry = properties.get(propName);
         if (EntryValidation.isValidPropertyEntry(entry)) {
@@ -668,25 +805,20 @@ public class NodeEntryImpl extends Hiera
     }
 
     /**
-     * Ignores the {@code loadIfNotFound} flag due to the fact, that
-     * {@link org.apache.jackrabbit.spi.NodeInfo#getPropertyIds()} returns the
-     * complete list of property names currently available.
+     * Returns an unmodifiable Iterator over those children that represent valid
+     * PropertyEntries.
+     *
+     * @return an unmodifiable Iterator over those children that represent valid
+     * PropertyEntries.
      */
-    @Override
-    public PropertyEntry getPropertyEntry(Name propName, boolean loadIfNotFound) throws RepositoryException {
-        return getPropertyEntry(propName);
-    }
-
-    @Override
     public synchronized Iterator<PropertyEntry> getPropertyEntries() {
         Collection<PropertyEntry> props;
         if (getStatus() == Status.EXISTING_MODIFIED) {
             // filter out removed properties
             props = new ArrayList<PropertyEntry>();
             // use array since upon validation the entry might be removed.
-            Object[] arr = properties.getPropertyEntries().toArray();
-            for (Object anArr : arr) {
-                PropertyEntry propEntry = (PropertyEntry) anArr;
+            Collection<PropertyEntry> propertyEntries = properties.getPropertyEntries();
+            for (PropertyEntry propEntry : propertyEntries.toArray(new PropertyEntry[propertyEntries.size()])) {
                 if (EntryValidation.isValidPropertyEntry(propEntry)) {
                     props.add(propEntry);
                 }
@@ -698,8 +830,16 @@ public class NodeEntryImpl extends Hiera
         return props.iterator();
     }
 
-    @Override
-    public PropertyEntry getOrAddPropertyEntry(Name propName) throws ItemExistsException {
+    /**
+     * Add an existing {@code PropertyEntry} with the given name if it is
+     * not yet contained in this {@code NodeEntry}.
+     * Please note the difference to {@link #addNewPropertyEntry(Name, QPropertyDefinition, QValue[], int)}
+     * which adds a new, transient entry.
+     *
+     * @param propName
+     * @return the {@code PropertyEntry}
+     */
+    public PropertyEntry getOrAddPropertyEntry(Name propName) {
         PropertyEntry pe = lookupPropertyEntry(propName);
         if (pe == null) {
             pe = internalAddPropertyEntry(propName, true);
@@ -709,8 +849,15 @@ public class NodeEntryImpl extends Hiera
         return pe;
     }
 
-    @Override
-    public void setPropertyEntries(Collection<Name> propNames) throws RepositoryException {
+    /**
+     * Adds property entries for the given {@code Name}s. It depends on
+     * the status of this {@code NodeEntry}, how conflicts are resolved
+     * and whether or not existing entries that are missing in the iterator
+     * get removed.
+     *
+     * @param propNames
+     */
+    public void setPropertyEntries(Collection<Name> propNames) {
         Set<Name> diff = new HashSet<Name>();
         diff.addAll(properties.getPropertyNames());
         boolean containsExtra = diff.removeAll(propNames);
@@ -741,7 +888,18 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    @Override
+    /**
+     * Add a new, transient {@code PropertyEntry} to this {@code NodeEntry}
+     * and return the {@code PropertyState} associated with the new entry.
+     *
+     * @param propName
+     * @param definition
+     * @param values
+     * @param propertyType
+     * @return the new entry.
+     * @throws ItemExistsException
+     * @throws RepositoryException
+     */
     public PropertyEntry addNewPropertyEntry(Name propName, QPropertyDefinition definition, QValue[] values,
             int propertyType) throws RepositoryException {
 
@@ -781,7 +939,14 @@ public class NodeEntryImpl extends Hiera
         return entry;
     }
 
-    @Override
+    /**
+     * Reorders this NodeEntry before the sibling entry specified by the given
+     * {@code beforeEntry}.
+     *
+     * @param beforeEntry the child node where to insert the node before. If
+     * {@code null} this entry is moved to the end of its parents child node entries.
+     * @throws RepositoryException If an unexpected error occurs.
+     */
     public void orderBefore(NodeEntry beforeEntry) throws RepositoryException {
         if (Status.NEW == getStatus()) {
             // new states get remove upon revert
@@ -793,7 +958,20 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-   @Override
+    /**
+     * Moves this {@code NodeEntry} as new child entry of the
+     * {@code NodeEntry} identified by {@code newParent} and/or renames
+     * it to {@code newName}. If {@code transientMove} is true, an
+     * implementation must make sure, that reverting this modification by calling
+     * {@link HierarchyEntry#revert()} on the common ancestor of both parents
+     * moves this NodeEntry back and resets the name to its original value.
+     *
+     * @param newName
+     * @param newParent
+     * @return the moved entry
+     * @throws RepositoryException If the entry to be moved is not a child of this
+     * NodeEntry or if an unexpected error occurs.
+     */
    public NodeEntry move(Name newName, NodeEntry newParent, boolean transientMove) throws RepositoryException {
        if (parent == null) {
            // the root may never be moved
@@ -824,19 +1002,27 @@ public class NodeEntryImpl extends Hiera
            throw new RepositoryException(msg);
        }
        // set name and parent to new values
-       parent = (NodeEntryImpl) newParent;
+       parent = newParent;
        name = newName;
        // register entry with its new parent
        parent.childNodeEntries.add(this);
        return this;
    }
 
-    @Override
+    /**
+     * @return true if this {@code NodeEntry} is transiently moved.
+     */
     public boolean isTransientlyMoved() {
         return revertInfo != null && revertInfo.isMoved();
     }
 
-    @Override
+    /**
+     * The parent entry of a external event gets informed about the modification.
+     * Note, that {@link Event#getParentId()} of the given childEvent must point
+     * to this {@code NodeEntry}.
+     *
+     * @param childEvent
+     */
     public void refresh(Event childEvent) {
         ItemId eventId = childEvent.getItemId();
         Path eventPath = childEvent.getPath();
@@ -894,7 +1080,7 @@ public class NodeEntryImpl extends Hiera
                     } else if (Status.isTransient(child.getStatus())) {
                         // pending changes -> don't reload entry but rather
                         // mark it stale
-                        ((HierarchyEntryImpl) child).internalGetItemState().setStatus(Status.MODIFIED);
+                        child.internalGetItemState().setStatus(Status.MODIFIED);
                     } else {
                         // no pending changes -> invalidate and force reload
                         // upon next access.
@@ -920,7 +1106,7 @@ public class NodeEntryImpl extends Hiera
         }
     }
 
-    //-------------------------------------------------< HierarchyEntryImpl >---
+    //-------------------------------------------------< HierarchyEntry >---
 
     @Override
     ItemState doResolve() throws RepositoryException {
@@ -945,11 +1131,11 @@ public class NodeEntryImpl extends Hiera
      * On exit, {@code builder} contains the path of this entry.
      *
      * @param builder
-     * @param nEntry NodeEntryImpl of the state the path should be built for.
+     * @param nEntry NodeEntry of the state the path should be built for.
      * @param wspPath true if the workspace path should be built
      */
-    private static void buildPath(PathBuilder builder, NodeEntryImpl nEntry, boolean wspPath) throws RepositoryException {
-        NodeEntryImpl parentEntry = wspPath && nEntry.revertInfo != null ? nEntry.revertInfo.oldParent : nEntry.parent;
+    private static void buildPath(PathBuilder builder, NodeEntry nEntry, boolean wspPath) throws RepositoryException {
+        NodeEntry parentEntry = wspPath && nEntry.revertInfo != null ? nEntry.revertInfo.oldParent : nEntry.parent;
         // shortcut for root state
         if (parentEntry == null) {
             builder.addRoot();
@@ -1274,8 +1460,8 @@ public class NodeEntryImpl extends Hiera
         List<NodeEntry> sns = new ArrayList<NodeEntry>(childNodeEntries.get(cne.getName()));
 
         if (wspIndex) {
-            List<NodeEntryImpl> atticSiblings = childNodeAttic.get(cne.getName());
-            for (NodeEntryImpl s : atticSiblings) {
+            List<NodeEntry> atticSiblings = childNodeAttic.get(cne.getName());
+            for (NodeEntry s : atticSiblings) {
                 if (s.revertInfo != null) {
                     sns.add(s.revertInfo.oldIndex - 1, s);
                 } else {
@@ -1340,7 +1526,7 @@ public class NodeEntryImpl extends Hiera
         // special treatment for potentially moved/reordered/removed sns
         // TODO: check again
         if (childIndex > Path.INDEX_DEFAULT) {
-            List<NodeEntryImpl> siblingsInAttic = childNodeAttic.get(childName);
+            List<NodeEntry> siblingsInAttic = childNodeAttic.get(childName);
             if (siblings.size() < childIndex && childIndex <= siblings.size() + siblingsInAttic.size()) {
                 return true;
             }
@@ -1348,8 +1534,8 @@ public class NodeEntryImpl extends Hiera
         if (getStatus() == Status.EXISTING_MODIFIED) {
             for (NodeEntry child : siblings) {
                 if (!EntryValidation.isValidNodeEntry(child) ||
-                        ((NodeEntryImpl) child).revertInfo != null &&
-                                ((NodeEntryImpl) child).revertInfo.oldIndex == childIndex) {
+                        child.revertInfo != null &&
+                                child.revertInfo.oldIndex == childIndex) {
                     
                     return true;
                 }
@@ -1378,7 +1564,7 @@ public class NodeEntryImpl extends Hiera
             if (he.getStatus() == Status.NEW) {
                 switch (operation.getStatus()) {
                     case PERSISTED:
-                        ((HierarchyEntryImpl) he).internalGetItemState().setStatus(Status.EXISTING);
+                        he.internalGetItemState().setStatus(Status.EXISTING);
                         he.invalidate(false);
                         break;
                     case UNDO:
@@ -1402,7 +1588,7 @@ public class NodeEntryImpl extends Hiera
                 case PERSISTED:
                     // for autocreated/protected props, mark to be reloaded
                     // upon next access.
-                    PropertyState addedState = (PropertyState) ((HierarchyEntryImpl) pe).internalGetItemState();
+                    PropertyState addedState = (PropertyState) pe.internalGetItemState();
                     addedState.setStatus(Status.EXISTING);
                     QPropertyDefinition pd = addedState.getDefinition();
                     if (pd.isAutoCreated() || pd.isProtected()) {
@@ -1554,7 +1740,7 @@ public class NodeEntryImpl extends Hiera
     }
 
     private void revertMove() {
-        NodeEntryImpl oldParent = revertInfo.oldParent;
+        NodeEntry oldParent = revertInfo.oldParent;
         if (oldParent == parent) {
             // simple renaming
             parent.childNodeEntries.remove(this);
@@ -1596,7 +1782,7 @@ public class NodeEntryImpl extends Hiera
      */
     private class RevertInfo {
 
-        private final NodeEntryImpl oldParent;
+        private final NodeEntry oldParent;
         private final Name oldName;
         private final int oldIndex;
         private final NodeEntry oldSuccessor;
@@ -1606,8 +1792,8 @@ public class NodeEntryImpl extends Hiera
             oldParent = parent;
             oldName = name;
             oldIndex = getIndex();
-            oldSuccessor = parent.childNodeEntries.getNext(NodeEntryImpl.this);
-            oldPredecessor = parent.childNodeEntries.getPrevious(NodeEntryImpl.this);
+            oldSuccessor = parent.childNodeEntries.getNext(NodeEntry.this);
+            oldPredecessor = parent.childNodeEntries.getPrevious(NodeEntry.this);
         }
 
         private boolean isMoved() {
@@ -1616,7 +1802,7 @@ public class NodeEntryImpl extends Hiera
 
         private void dispose(boolean persisted) {
             if (!persisted) {
-                NodeEntry ne = NodeEntryImpl.this;
+                NodeEntry ne = NodeEntry.this;
                 ChildNodeEntriesImpl parentCNEs = parent.childNodeEntries;
                 parentCNEs.reorderAfter(ne, revertInfo.oldPredecessor);
                 try {

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java (from r1170856, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java&r1=1170856&r2=1170900&rev=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/PropertyEntry.java Wed Sep 14 23:40:42 2011
@@ -25,12 +25,13 @@ import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PropertyId;
 
+import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;
 
 /**
  * {@code PropertyEntryImpl} implements a reference to a property state.
  */
-public class PropertyEntryImpl extends HierarchyEntryImpl implements PropertyEntry {
+public class PropertyEntry extends HierarchyEntry {
 
     /**
      * Creates a new {@code PropertyEntryImpl}.
@@ -40,7 +41,7 @@ public class PropertyEntryImpl extends H
      * @param name      the name of the property.
      * @param factory
      */
-    private PropertyEntryImpl(NodeEntryImpl parent, Name name, EntryFactory factory) {
+    private PropertyEntry(NodeEntry parent, Name name, EntryFactory factory) {
         super(parent, name, factory);
     }
 
@@ -52,11 +53,11 @@ public class PropertyEntryImpl extends H
      * @param factory
      * @return new {@code PropertyEntry}
      */
-    static PropertyEntry create(NodeEntryImpl parent, Name name, EntryFactory factory) {
-        return new PropertyEntryImpl(parent, name, factory);
+    static PropertyEntry create(NodeEntry parent, Name name, EntryFactory factory) {
+        return new PropertyEntry(parent, name, factory);
     }
 
-    //------------------------------------------------------< HierarchyEntryImpl >---
+    //------------------------------------------------------< HierarchyEntry >---
     @Override
     ItemState doResolve() throws RepositoryException {
         return getItemStateFactory().createPropertyState(getWorkspaceId(), this);
@@ -69,35 +70,48 @@ public class PropertyEntryImpl extends H
     }
 
     //------------------------------------------------------< PropertyEntry >---
-    @Override
+
+    /**
+     * @return the {@code NodeId} of this child node entry.
+     */
     public PropertyId getId() throws RepositoryException {
         return getIdFactory().createPropertyId(parent.getId(), getName());
     }
 
-    @Override
+    /**
+     * Returns the ID that must be used for resolving this entry OR loading its
+     * children entries from the persistent layer. This is the same as
+     * {@code getId()} unless any of its ancestors has been transiently
+     * moved.
+     *
+     * @return
+     * @see #getId()
+     */
     public PropertyId getWorkspaceId() throws RepositoryException {
         return getIdFactory().createPropertyId(parent.getWorkspaceId(), getName());
     }
 
-    @Override
+    /**
+     * @return the referenced {@code PropertyState}.
+     * @throws ItemNotFoundException if the {@code PropertyState} does not
+     * exist anymore.
+     * @throws RepositoryException if an error occurs while retrieving the
+     * {@code PropertyState}.
+     */
     public PropertyState getPropertyState() throws RepositoryException {
         return (PropertyState) getItemState();
     }
 
     //-----------------------------------------------------< HierarchyEntry >---
+
     /**
      * Returns false.
-     *
-     * @see HierarchyEntry#denotesNode()
      */
     @Override
     public boolean denotesNode() {
         return false;
     }
 
-    /**
-     * @see HierarchyEntry#complete(Operation)
-     */
     @Override
     public void complete(Operation operation) throws RepositoryException {
         if (!(operation instanceof SetPropertyValue)) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java Wed Sep 14 23:40:42 2011
@@ -65,8 +65,8 @@ public class EffectiveNodeType {
     private Set<Name> supportedMixins;
 
     EffectiveNodeType(TreeSet<Name> mergedNodeTypes, TreeSet<Name> inheritedNodeTypes, TreeSet<Name> allNodeTypes,
-                      Map<Name, List<QItemDefinition>> namedItemDefs, List<QItemDefinition> unnamedItemDefs,
-                      Set<Name> supportedMixins) {
+            Map<Name, List<QItemDefinition>> namedItemDefs, List<QItemDefinition> unnamedItemDefs,
+            Set<Name> supportedMixins) {
 
         this.mergedNodeTypes.addAll(mergedNodeTypes);
         this.inheritedNodeTypes.addAll(inheritedNodeTypes);

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/ItemDefinitionProvider.java Wed Sep 14 23:40:42 2011
@@ -31,7 +31,6 @@ import javax.jcr.nodetype.ConstraintViol
  */
 public interface ItemDefinitionProvider {
 
-
     /**
      * Returns the {@code QNodeDefinition} for the root node.
      *

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/NodeState.java Wed Sep 14 23:40:42 2011
@@ -217,7 +217,7 @@ public class NodeState extends ItemState
     }
 
     /**
-     * Used by NodeEntryImpl and NodeState only
+     * Used by NodeEntry and NodeState only
      *
      * @param mixinTypeNames
      */
@@ -259,7 +259,7 @@ public class NodeState extends ItemState
             Name primaryType = getNodeTypeName();
             allNtNames = new Name[] { primaryType }; // default
             try {
-                PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES, true);
+                PropertyEntry pe = getNodeEntry().getPropertyEntry(NameConstants.JCR_MIXINTYPES);
                 if (pe != null) {
                     PropertyState mixins = pe.getPropertyState();
                     QValue[] values = mixins.getValues();
@@ -372,11 +372,11 @@ public class NodeState extends ItemState
      * @throws RepositoryException If an error occurs while retrieving the
      * property state.
      *
-     * @see NodeEntry#getPropertyEntry(Name, boolean)
+     * @see NodeEntry#getPropertyEntry(org.apache.jackrabbit.spi.Name)
      * @see PropertyEntry#getPropertyState()
      */
     public PropertyState getPropertyState(Name propertyName) throws RepositoryException {
-        PropertyEntry pe = getNodeEntry().getPropertyEntry(propertyName, true);
+        PropertyEntry pe = getNodeEntry().getPropertyEntry(propertyName);
         if (pe != null) {
             return pe.getPropertyState();
         } else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java Wed Sep 14 23:40:42 2011
@@ -38,7 +38,6 @@ import org.apache.jackrabbit.spi.commons
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.RepositoryException;
@@ -329,12 +328,7 @@ public class WorkspaceItemStateFactory e
             Name propertyName = pId.getName();
             propNames.add(propertyName);
         }
-        try {
-            entry.setPropertyEntries(propNames);
-        } catch (ItemExistsException e) {
-            // should not get here
-            log.error("Internal error", e);
-        }
+        entry.setPropertyEntries(propNames);
 
         // unless the child-info are omitted by the SPI impl -> make sure
         // the child entries the node entry are initialized or updated.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java?rev=1170900&r1=1170899&r2=1170900&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/version/VersionHistoryImpl.java Wed Sep 14 23:40:42 2011
@@ -337,7 +337,7 @@ public class VersionHistoryImpl extends 
     private Version getVersionByLabel(Name qLabel) throws RepositoryException {
          refreshEntry(labelNodeEntry);
         // retrieve reference property value -> and retrieve referenced node
-        PropertyEntry pEntry = labelNodeEntry.getPropertyEntry(qLabel, true);
+        PropertyEntry pEntry = labelNodeEntry.getPropertyEntry(qLabel);
         if (pEntry == null) {
             throw new VersionException("Version with label '" + qLabel + "' does not exist.");
         }



Mime
View raw message