You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by md...@apache.org on 2011/09/15 17:17:53 UTC

svn commit: r1171129 [2/2] - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ hierarchy/ lock/ operation/ security/ state/ version/ xml/

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemState.java Thu Sep 15 15:17:51 2011
@@ -34,7 +34,7 @@ import java.util.Collection;
 /**
  * {@code ItemState} represents the state of an {@code Item}.
  */
-public abstract class ItemState {
+public abstract class ItemState<ENTRY_TYPE extends HierarchyEntry<?>> {
 
     /**
      * Logger instance
@@ -49,7 +49,7 @@ public abstract class ItemState {
     /**
      * The hierarchy entry this state belongs to.
      */
-    private final HierarchyEntry hierarchyEntry;
+    private final ENTRY_TYPE hierarchyEntry;
 
     /**
      * Listeners (weak references)
@@ -71,7 +71,7 @@ public abstract class ItemState {
      * @param isf
      * @param definitionProvider
      */
-    protected ItemState(HierarchyEntry entry, ItemStateFactory isf, ItemDefinitionProvider definitionProvider) {
+    protected ItemState(ENTRY_TYPE entry, ItemStateFactory isf, ItemDefinitionProvider definitionProvider) {
         this(getInitialStatus(entry.getParent()), entry, isf, definitionProvider);
     }
 
@@ -82,7 +82,7 @@ public abstract class ItemState {
      * @param isf
      * @param definitionProvider
      */
-    protected ItemState(Status initialStatus, HierarchyEntry entry, ItemStateFactory isf,
+    protected ItemState(Status initialStatus, ENTRY_TYPE entry, ItemStateFactory isf,
             ItemDefinitionProvider definitionProvider) {
         
         if (entry == null) {
@@ -136,11 +136,19 @@ public abstract class ItemState {
      *
      * @return The {@code HierarchyEntry} corresponding to this {@code ItemState}.
      */
-    public HierarchyEntry getHierarchyEntry() {
+    public ENTRY_TYPE getHierarchyEntry() {
         return hierarchyEntry;
     }
 
     /**
+     * Utility method:
+     * Determines if this item state represents a node.
+     *
+     * @return true if this item state represents a node, otherwise false.
+     */
+    public abstract boolean isNode();
+
+    /**
      * Returns {@code true} if this item state is valid and can be accessed.
      * @return
      * @see Status#isValid(Status)
@@ -152,21 +160,13 @@ public abstract class ItemState {
 
     /**
      * Utility method:
-     * Determines if this item state represents a node.
-     *
-     * @return true if this item state represents a node, otherwise false.
-     */
-    public abstract boolean isNode();
-
-    /**
-     * Utility method:
      * Returns the name of this state. Shortcut for calling 'getName' on the
      * {@link ItemState#getHierarchyEntry() hierarchy entry}.
      *
      * @return name of this state
      */
     public Name getName() {
-        return getHierarchyEntry().getName();
+        return hierarchyEntry.getName();
     }
 
     /**
@@ -196,7 +196,7 @@ public abstract class ItemState {
      * @throws RepositoryException if an error occurs
      */
     public Path getPath() throws RepositoryException {
-        return getHierarchyEntry().getPath();
+        return hierarchyEntry.getPath();
     }
 
     /**
@@ -209,7 +209,7 @@ public abstract class ItemState {
      * @throws RepositoryException
      */
     public NodeState getParent() throws RepositoryException {
-        return getHierarchyEntry().getParent().getNodeState();
+        return hierarchyEntry.getParent().getNodeState();
     }
 
     /**
@@ -220,7 +220,7 @@ public abstract class ItemState {
     public final Status getStatus() {
         // Call calculateStatus to apply a possible pending invalidation
         // in the entry hierarchy.
-        getHierarchyEntry().calculateStatus();
+        hierarchyEntry.calculateStatus();
         return status;
     }
 
@@ -271,7 +271,7 @@ public abstract class ItemState {
      * @param keepChanges
      * @return a MergeResult instance which represent the result of the merge operation
      */
-    public abstract MergeResult merge(ItemState another, boolean keepChanges);
+    public abstract MergeResult merge(ItemState<?> another, boolean keepChanges);
 
     /**
      * Revert all transient modifications made to this ItemState.

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateCreationListener.java Thu Sep 15 15:17:51 2011
@@ -25,5 +25,5 @@ public interface ItemStateCreationListen
      *
      * @param state
      */
-    void created(ItemState state);
+    void created(ItemState<?> state);
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateLifeCycleListener.java Thu Sep 15 15:17:51 2011
@@ -29,5 +29,5 @@ public interface ItemStateLifeCycleListe
      * @param state          the item state, which changed its {@code status}.
      * @param previousStatus the previous status of {@code state}.
      */
-    void statusChanged(ItemState state, Status previousStatus);
+    void statusChanged(ItemState<?> state, Status previousStatus);
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/ItemStateValidator.java Thu Sep 15 15:17:51 2011
@@ -114,7 +114,7 @@ public class ItemStateValidator {
      * @return JCR path
      * @see LogUtil#safeGetJCRPath(ItemState, org.apache.jackrabbit.spi.commons.conversion.PathResolver)
      */
-    private String safeGetJCRPath(ItemState itemState) {
+    private String safeGetJCRPath(ItemState<?> itemState) {
         return LogUtil.safeGetJCRPath(itemState, mgrProvider.getNamePathResolver());
     }
 
@@ -356,7 +356,7 @@ public class ItemStateValidator {
      * @throws ReferentialIntegrityException
      * @throws RepositoryException
      */
-    public void checkRemoveItem(ItemState targetState, int options) throws RepositoryException {
+    public void checkRemoveItem(ItemState<?> targetState, int options) throws RepositoryException {
         if (targetState.isNode() && ((NodeState)targetState).isRoot()) {
             // root node
             throw new ConstraintViolationException("Cannot remove root node.");
@@ -399,7 +399,7 @@ public class ItemStateValidator {
      * @throws VersionException
      * @throws RepositoryException
      */
-    private void checkIsCheckedOut(ItemState itemState) throws RepositoryException {
+    private void checkIsCheckedOut(ItemState<?> itemState) throws RepositoryException {
         NodeState nodeState = itemState.isNode() ? (NodeState)itemState : itemState.getParent();
         mgrProvider.getVersionStateManager().checkIsCheckedOut(nodeState);
     }
@@ -413,7 +413,7 @@ public class ItemStateValidator {
      * @throws LockException         if write access to the specified path is not allowed
      * @throws RepositoryException   if another error occurs
      */
-    private void checkLock(ItemState itemState) throws RepositoryException {
+    private void checkLock(ItemState<?> itemState) throws RepositoryException {
         // make sure there's no foreign lock present the node (or the parent node
         // in case the state represents a PropertyState).
         NodeState nodeState = itemState.isNode() ? (NodeState)itemState : itemState.getParent();
@@ -429,7 +429,7 @@ public class ItemStateValidator {
      * item state indicates that the state is protected.
      * @see QItemDefinition#isProtected()
      */
-    private static void checkProtection(ItemState itemState) throws RepositoryException {
+    private static void checkProtection(ItemState<?> itemState) throws RepositoryException {
         QItemDefinition def;
         if (itemState.isNode()) {
             def = ((NodeState)itemState).getDefinition();
@@ -459,7 +459,7 @@ public class ItemStateValidator {
      * @throws ConstraintViolationException
      * @see #checkProtection(ItemState)
      */
-    private static void checkRemoveConstraints(ItemState itemState) throws RepositoryException {
+    private static void checkRemoveConstraints(ItemState<?> itemState) throws RepositoryException {
         QItemDefinition definition;
         if (itemState.isNode()) {
             definition = ((NodeState)itemState).getDefinition();
@@ -477,7 +477,7 @@ public class ItemStateValidator {
      * @throws RepositoryException
      */
     private static void checkCollision(NodeState parentState, Name propertyName) throws RepositoryException {
-        NodeEntry parentEntry = (NodeEntry) parentState.getHierarchyEntry();
+        NodeEntry parentEntry = parentState.getHierarchyEntry();
          // NOTE: check for name collisions with existing child node has been
          // removed as with JSR 283 having same-named node and property can be
          // allowed. thus delegate the corresponding validation to the underlying

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=1171129&r1=1171128&r2=1171129&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 Thu Sep 15 15:17:51 2011
@@ -39,7 +39,7 @@ import java.util.List;
 /**
  * {@code NodeState} represents the state of a {@code Node}.
  */
-public class NodeState extends ItemState {
+public class NodeState extends ItemState<NodeEntry> {
     private static final Logger log = LoggerFactory.getLogger(NodeState.class);
 
     /**
@@ -114,7 +114,7 @@ public class NodeState extends ItemState
     }
 
     @Override
-    public MergeResult merge(ItemState another, boolean keepChanges) {
+    public MergeResult merge(ItemState<?> another, boolean keepChanges) {
         boolean modified = false;
         if (another != null && another != this) {
             if (!another.isNode()) {
@@ -169,7 +169,7 @@ public class NodeState extends ItemState
      * @return The {@code NodeEntry} associated with this state.
      */
     public NodeEntry getNodeEntry() {
-        return (NodeEntry) getHierarchyEntry();
+        return getHierarchyEntry();
     }
 
     /**

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/PropertyState.java Thu Sep 15 15:17:51 2011
@@ -34,7 +34,7 @@ import javax.jcr.nodetype.ConstraintViol
 /**
  * {@code PropertyState} represents the state of a {@code Property}.
  */
-public class PropertyState extends ItemState {
+public class PropertyState extends ItemState<PropertyEntry> {
     private static final Logger log = LoggerFactory.getLogger(PropertyState.class);
 
     /**
@@ -106,12 +106,12 @@ public class PropertyState extends ItemS
 
     @Override
     public ItemId getId() throws RepositoryException {
-        return ((PropertyEntry) getHierarchyEntry()).getId();
+        return getHierarchyEntry().getId();
     }
 
     @Override
     public ItemId getWorkspaceId() throws RepositoryException {
-        return ((PropertyEntry) getHierarchyEntry()).getWorkspaceId();
+        return getHierarchyEntry().getWorkspaceId();
     }
 
     /**
@@ -122,7 +122,7 @@ public class PropertyState extends ItemS
      *
      */
     @Override
-    public MergeResult merge(ItemState another, boolean keepChanges) {
+    public MergeResult merge(ItemState<?> another, boolean keepChanges) {
         boolean modified = false;
         if (another != null && another != this) {
             if (another.isNode()) {
@@ -205,7 +205,7 @@ public class PropertyState extends ItemS
             // before. The effective NT must be evaluated as if it had been
             // evaluated upon creating the workspace state.
             definition = definitionProvider.getQPropertyDefinition(getParent().getNodeTypeNames(), getName(), getType(),
-                    multiValued, ((PropertyEntry) getHierarchyEntry()).getWorkspaceId());
+                    multiValued, getHierarchyEntry().getWorkspaceId());
         }
         return definition;
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/SessionItemStateManager.java Thu Sep 15 15:17:51 2011
@@ -119,7 +119,7 @@ public class SessionItemStateManager ext
      *
      * @param state the root state of the update operation
      */
-    public void save(ItemState state) throws RepositoryException {
+    public void save(ItemState<?> state) throws RepositoryException {
         // shortcut, if no modifications are present
         if (!transientStateMgr.hasPendingChanges()) {
             return;
@@ -147,7 +147,7 @@ public class SessionItemStateManager ext
      * and descendant items is not a closed set of changes. That is, at least
      * another item needs to be canceled as well in another sub-tree.
      */
-    public void undo(ItemState itemState) throws RepositoryException {
+    public void undo(ItemState<?> itemState) throws RepositoryException {
         // short cut
         if (!transientStateMgr.hasPendingChanges()) {
             return;
@@ -236,7 +236,7 @@ public class SessionItemStateManager ext
         QNodeDefinition def = defProvider.getQNodeDefinition(parent.getAllNodeTypeNames(), operation.getNodeName(),
                 operation.getNodeTypeName());
 
-        List<ItemState> newStates = addNodeState(parent, operation.getNodeName(), operation.getNodeTypeName(),
+        List<ItemState<?>> newStates = addNodeState(parent, operation.getNodeName(), operation.getNodeTypeName(),
                 operation.getUuid(), def, operation.getOptions());
 
         operation.addedState(newStates);
@@ -294,7 +294,7 @@ public class SessionItemStateManager ext
      */
     @Override
     public void visit(Remove operation) throws RepositoryException {
-        ItemState state = operation.getRemoveState();
+        ItemState<?> state = operation.getRemoveState();
         removeItemState(state, operation.getOptions());
 
         transientStateMgr.addOperation(operation);
@@ -425,7 +425,7 @@ public class SessionItemStateManager ext
         return TransientItemStateManager.createNewPropertyState(propertyName, parent, pDef, values, propertyType);
     }
 
-    private List<ItemState> addNodeState(NodeState parent, Name nodeName, Name nodeTypeName, String uuid,
+    private List<ItemState<?>> addNodeState(NodeState parent, Name nodeName, Name nodeTypeName, String uuid,
             QNodeDefinition definition, int options) throws RepositoryException {
 
         // check if add node is possible. note, that the options differ if
@@ -446,7 +446,7 @@ public class SessionItemStateManager ext
             }
         }
 
-        List<ItemState> addedStates = new ArrayList<ItemState>();
+        List<ItemState<?>> addedStates = new ArrayList<ItemState<?>>();
 
         // create new nodeState. NOTE, that the uniqueID is not added to the
         // state for consistency between 'addNode' and importXML
@@ -483,7 +483,7 @@ public class SessionItemStateManager ext
         return addedStates;
     }
 
-    private void removeItemState(ItemState itemState, int options) throws RepositoryException {
+    private void removeItemState(ItemState<?> itemState, int options) throws RepositoryException {
         validator.checkRemoveItem(itemState, options);
         // recursively remove the given state and all child states.
         boolean success = false;

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientISFactory.java Thu Sep 15 15:17:51 2011
@@ -142,7 +142,7 @@ public final class TransientISFactory ex
     //------------------------------------------< ItemStateCreationListener >---
 
     @Override
-    public void created(ItemState state) {
+    public void created(ItemState<?> state) {
         notifyCreated(state);
     }
 
@@ -150,7 +150,7 @@ public final class TransientISFactory ex
      * @see ItemStateCreationListener#statusChanged(ItemState, Status)
      */
     @Override
-    public void statusChanged(ItemState state, Status previousStatus) {
+    public void statusChanged(ItemState<?> state, Status previousStatus) {
         // ignore
     }
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java Thu Sep 15 15:17:51 2011
@@ -56,22 +56,22 @@ public class TransientItemStateManager i
     /**
      * Added states
      */
-    private final Set<ItemState> addedStates = new LinkedHashSet<ItemState>();
+    private final Set<ItemState<?>> addedStates = new LinkedHashSet<ItemState<?>>();
 
     /**
      * Modified states
      */
-    private final Set<ItemState> modifiedStates = new LinkedHashSet<ItemState>();
+    private final Set<ItemState<?>> modifiedStates = new LinkedHashSet<ItemState<?>>();
 
     /**
      * Removed states
      */
-    private final Set<ItemState> removedStates = new LinkedHashSet<ItemState>();
+    private final Set<ItemState<?>> removedStates = new LinkedHashSet<ItemState<?>>();
     
     /**
      * Stale states
      */
-    private final Set<ItemState> staleStates = new LinkedHashSet<ItemState>();
+    private final Set<ItemState<?>> staleStates = new LinkedHashSet<ItemState<?>>();
 
     /**
      * Set of operations
@@ -116,7 +116,7 @@ public class TransientItemStateManager i
      * therefore not reuse the {@code changeLog} if such an exception is thrown.
      * @throws RepositoryException if {@code state} is a new item state.
      */
-    ChangeLog getChangeLog(ItemState target, boolean throwOnStale) throws RepositoryException {
+    ChangeLog getChangeLog(ItemState<?> target, boolean throwOnStale) throws RepositoryException {
         // fail-fast test: check status of this item's state
         if (target.getStatus() == Status.NEW) {
             String msg = "Cannot save/revert an item with status NEW (" +target+ ").";
@@ -130,9 +130,9 @@ public class TransientItemStateManager i
         }
 
         Set<Operation> ops = new LinkedHashSet<Operation>();
-        Set<ItemState> affectedStates = new LinkedHashSet<ItemState>();
+        Set<ItemState<?>> affectedStates = new LinkedHashSet<ItemState<?>>();
 
-        HierarchyEntry he = target.getHierarchyEntry();
+        HierarchyEntry<?> he = target.getHierarchyEntry();
         if (he.getParent() == null) {
             // the root entry -> the complete change log can be used for
             // simplicity. collecting ops, states can be omitted.
@@ -151,7 +151,7 @@ public class TransientItemStateManager i
             // not root entry:
             // - check if there is a stale state in the scope (save only)
             if (throwOnStale) {
-                for (ItemState state : staleStates) {
+                for (ItemState<?> state : staleStates) {
                     if (containedInTree(target, state)) {
                         String msg = "Cannot save changes: States has been modified externally.";
                         log.debug(msg);
@@ -170,7 +170,7 @@ public class TransientItemStateManager i
                 chain.addIterator(staleStates.iterator());
             }
             while (chain.hasNext()) {
-                ItemState state = (ItemState) chain.next();
+                ItemState<?> state = (ItemState<?>) chain.next();
                 if (containedInTree(target, state)) {
                     affectedStates.add(state);
                 }
@@ -180,8 +180,8 @@ public class TransientItemStateManager i
             //   listed in the modified,removed or added states collected by this
             //   change log.
             for (Operation op : operations) {
-                Collection<ItemState> opStates = op.getAffectedItemStates();
-                for (ItemState state : opStates) {
+                Collection<ItemState<?>> opStates = op.getAffectedItemStates();
+                for (ItemState<?> state : opStates) {
                     if (affectedStates.contains(state)) {
                         // operation needs to be included
                         if (!affectedStates.containsAll(opStates)) {
@@ -217,7 +217,7 @@ public class TransientItemStateManager i
     static NodeState createNewNodeState(Name nodeName, String uniqueID, Name nodeTypeName, QNodeDefinition definition,
             NodeState parent) throws RepositoryException {
 
-        NodeEntry ne = ((NodeEntry) parent.getHierarchyEntry()).addNewNodeEntry(nodeName, uniqueID, nodeTypeName, definition);
+        NodeEntry ne = parent.getHierarchyEntry().addNewNodeEntry(nodeName, uniqueID, nodeTypeName, definition);
         try {
             parent.markModified();
         } catch (RepositoryException e) {
@@ -244,7 +244,7 @@ public class TransientItemStateManager i
             QValue[] values, int propertyType) throws RepositoryException {
 
         // NOTE: callers must make sure, the property type is not 'undefined'
-        NodeEntry nodeEntry = (NodeEntry) parent.getHierarchyEntry();
+        NodeEntry nodeEntry = parent.getHierarchyEntry();
         PropertyEntry pe = nodeEntry.addNewPropertyEntry(propName, definition, values, propertyType);
         try {
             parent.markModified();
@@ -275,7 +275,7 @@ public class TransientItemStateManager i
      * @param subChangeLog
      */
     void dispose(ChangeLog subChangeLog) {
-        Set<ItemState> affectedStates = subChangeLog.getAffectedStates();
+        Set<ItemState<?>> affectedStates = subChangeLog.getAffectedStates();
         addedStates.removeAll(affectedStates);
         modifiedStates.removeAll(affectedStates);
         removedStates.removeAll(affectedStates);
@@ -292,7 +292,7 @@ public class TransientItemStateManager i
      *
      * @param state state that has been removed
      */
-    private void removed(ItemState state) {
+    private void removed(ItemState<?> state) {
         if (!addedStates.remove(state)) {
             modifiedStates.remove(state);
         }
@@ -305,9 +305,9 @@ public class TransientItemStateManager i
      * @param state
      * @return
      */
-    private static boolean containedInTree(ItemState parent, ItemState state) {
-        HierarchyEntry he = state.getHierarchyEntry();
-        HierarchyEntry pHe = parent.getHierarchyEntry();
+    private static boolean containedInTree(ItemState<?> parent, ItemState<?> state) {
+        HierarchyEntry<?> he = state.getHierarchyEntry();
+        HierarchyEntry<?> pHe = parent.getHierarchyEntry();
         // short cuts first
         if (he == pHe || he.getParent() == pHe) {
             return true;
@@ -316,7 +316,7 @@ public class TransientItemStateManager i
             return false;
         }
         // none of the simple cases: walk up hierarchy
-        HierarchyEntry pe = he.getParent();
+        NodeEntry pe = he.getParent();
         while (pe != null) {
             if (pe == pHe) {
                 return true;
@@ -339,7 +339,7 @@ public class TransientItemStateManager i
      * @see ItemStateLifeCycleListener#statusChanged(ItemState, Status)
      */
     @Override
-    public void statusChanged(ItemState state, Status previousStatus) {
+    public void statusChanged(ItemState<?> state, Status previousStatus) {
         // Update the collections of states that were transiently modified.
         // NOTE: cleanup of operations is omitted here. this is expected to
         // occur upon {@link ChangeLog#save()} and {@link ChangeLog#undo()}.
@@ -433,7 +433,7 @@ public class TransientItemStateManager i
     //-----------------------------------------< ItemStateCreationListener >---
 
     @Override
-    public void created(ItemState state) {
+    public void created(ItemState<?> state) {
         // new state has been created
         if (state.getStatus() == Status.NEW) {
             addedStates.add(state);

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=1171129&r1=1171128&r2=1171129&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 Thu Sep 15 15:17:51 2011
@@ -130,7 +130,7 @@ public class WorkspaceItemStateFactory e
             }
 
             // Build the hierarchy entry for the item info
-            HierarchyEntry entry = createHierarchyEntries(info, anyParent);
+            HierarchyEntry<?> entry = createHierarchyEntries(info, anyParent);
             if (entry == null || !entry.denotesNode()) {
                 throw new ItemNotFoundException(
                         "HierarchyEntry does not belong to any existing ItemInfo. No ItemState was created.");
@@ -211,7 +211,7 @@ public class WorkspaceItemStateFactory e
             }
 
             // Build the hierarchy entry for the item info
-            HierarchyEntry entry = createHierarchyEntries(info, anyParent);
+            HierarchyEntry<?> entry = createHierarchyEntries(info, anyParent);
             if (entry == null || entry.denotesNode()) {
                 throw new ItemNotFoundException(
                         "HierarchyEntry does not belong to any existing ItemInfo. No ItemState was created.");
@@ -403,7 +403,7 @@ public class WorkspaceItemStateFactory e
      * @return the hierarchy entry for {@code info}
      * @throws RepositoryException
      */
-    private HierarchyEntry createHierarchyEntries(ItemInfo info, NodeEntry anyParent)
+    private HierarchyEntry<?> createHierarchyEntries(ItemInfo info, NodeEntry anyParent)
             throws RepositoryException {
 
         // Calculate relative path of missing entries
@@ -453,7 +453,7 @@ public class WorkspaceItemStateFactory e
      * @return
      * @throws RepositoryException
      */
-    private static boolean isUpToDate(Entry<?> cacheEntry, HierarchyEntry entry) throws RepositoryException {
+    private static boolean isUpToDate(Entry<?> cacheEntry, HierarchyEntry<?> entry) throws RepositoryException {
         return cacheEntry != null &&
             cacheEntry.generation >= entry.getGeneration() &&
             isMatchingPath(cacheEntry.info, entry);
@@ -467,13 +467,13 @@ public class WorkspaceItemStateFactory e
      * @return
      * @throws RepositoryException
      */
-    private static boolean isOutdated(Entry<?> cacheEntry, HierarchyEntry entry) throws RepositoryException {
+    private static boolean isOutdated(Entry<?> cacheEntry, HierarchyEntry<?> entry) throws RepositoryException {
         return cacheEntry != null &&
             (cacheEntry.generation < entry.getGeneration() ||
             !isMatchingPath(cacheEntry.info, entry));
     }
 
-    private static boolean isMatchingPath(ItemInfo info, HierarchyEntry entry) throws RepositoryException {
+    private static boolean isMatchingPath(ItemInfo info, HierarchyEntry<?> entry) throws RepositoryException {
         Path infoPath = info.getPath();
         Path wspPath = entry.getWorkspacePath();
         return infoPath.equals(wspPath);
@@ -488,7 +488,7 @@ public class WorkspaceItemStateFactory e
      * @param entry
      * @throws RepositoryException
      */
-    private static void assertMatchingPath(ItemInfo info, HierarchyEntry entry) throws RepositoryException {
+    private static void assertMatchingPath(ItemInfo info, HierarchyEntry<?> entry) throws RepositoryException {
         if (!isMatchingPath(info, entry)) {
             // TODO: handle external move of nodes (parents) identified by uniqueID
             throw new ItemNotFoundException("HierarchyEntry " + entry.getWorkspacePath() + " does not match ItemInfo " + info.getPath());
@@ -500,7 +500,7 @@ public class WorkspaceItemStateFactory e
      * @param degree
      * @return the ancestor entry at the specified degree.
      */
-    private static NodeEntry getAncestor(HierarchyEntry entry, int degree) {
+    private static NodeEntry getAncestor(HierarchyEntry<?> entry, int degree) {
         NodeEntry parent = entry.getParent();
         degree--;
         while (parent != null && degree > 0) {

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=1171129&r1=1171128&r2=1171129&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 Thu Sep 15 15:17:51 2011
@@ -60,7 +60,7 @@ public class VersionHistoryImpl extends 
             throws RepositoryException {
 
         super(session, state, listener);
-        vhEntry = (NodeEntry) state.getHierarchyEntry();
+        vhEntry = state.getHierarchyEntry();
 
         // retrieve hierarchy entry of the jcr:versionLabels node
         labelNodeEntry = vhEntry.getNodeEntry(NameConstants.JCR_VERSIONLABELS, Path.INDEX_DEFAULT, true);
@@ -155,7 +155,7 @@ public class VersionHistoryImpl extends 
         Name qLabel = getQLabel(label);
         NodeState vState = getVersionState(versionName);
         // delegate to version manager that operates on workspace directly
-        session.getVersionStateManager().addVersionLabel((NodeState) getItemState(), vState, qLabel, moveLabel);
+        session.getVersionStateManager().addVersionLabel(getItemState(), vState, qLabel, moveLabel);
     }
 
     @Override
@@ -165,7 +165,7 @@ public class VersionHistoryImpl extends 
         Version version = getVersionByLabel(qLabel);
         NodeState vState = getVersionState(version.getName());
         // delegate to version manager that operates on workspace directly
-        session.getVersionStateManager().removeVersionLabel((NodeState) getItemState(), vState, qLabel);
+        session.getVersionStateManager().removeVersionLabel(getItemState(), vState, qLabel);
     }
 
     @Override
@@ -231,7 +231,7 @@ public class VersionHistoryImpl extends 
     public void removeVersion(String versionName) throws RepositoryException {
         checkStatus();
         NodeState vState = getVersionState(versionName);
-        session.getVersionStateManager().removeVersion((NodeState) getItemState(), vState);
+        session.getVersionStateManager().removeVersion(getItemState(), vState);
     }
 
     @Override
@@ -385,4 +385,4 @@ public class VersionHistoryImpl extends 
         // TODO: check again.. is this correct? or should NodeEntry be altered
         entry.getNodeState();
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java?rev=1171129&r1=1171128&r2=1171129&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java (original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/xml/SessionImporter.java Thu Sep 15 15:17:51 2011
@@ -152,7 +152,7 @@ public class SessionImporter implements 
            return;
        }
 
-       NodeEntry parentEntry = (NodeEntry) parent.getHierarchyEntry();
+       NodeEntry parentEntry = parent.getHierarchyEntry();
        NodeState nodeState = null;
 
        if (parentEntry.hasNodeEntry(nodeInfo.getName())) {
@@ -453,7 +453,7 @@ public class SessionImporter implements 
         PropertyState propState = null;
         QPropertyDefinition def = null;
 
-        NodeEntry parentEntry = (NodeEntry) parentState.getHierarchyEntry();
+        NodeEntry parentEntry = parentState.getHierarchyEntry();
         PropertyEntry pEntry = parentEntry.getPropertyEntry(propName);
         if (pEntry != null) {
             // a property with that name already exists...