jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1171166 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ state/
Date Thu, 15 Sep 2011 16:34:46 GMT
Author: mduerig
Date: Thu Sep 15 16:34:46 2011
New Revision: 1171166

URL: http://svn.apache.org/viewvc?rev=1171166&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: specialise ItemManager and ItemCache to reduce down casting

Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemCache.java
    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/ItemLifeCycleListener.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.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/SessionImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/TransientItemStateManager.java

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemCache.java?rev=1171166&r1=1171165&r2=1171166&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemCache.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemCache.java
Thu Sep 15 16:34:46 2011
@@ -23,9 +23,6 @@ import org.apache.jackrabbit.jcr2spi.sta
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.Item;
-import javax.jcr.Node;
-import javax.jcr.Property;
 import javax.jcr.RepositoryException;
 import java.util.Map;
 
@@ -37,7 +34,7 @@ import static org.apache.jackrabbit.spi.
 public class ItemCache implements ItemLifeCycleListener {
     private static final Logger log = LoggerFactory.getLogger(ItemCache.class);
 
-    private final Map<ItemState<?>, Item> cache;
+    private final Map<ItemState<?>, ItemImpl<?>> cache;
 
     ItemCache(int maxSize) {
         cache = cast(new LRUMap(maxSize));
@@ -54,7 +51,7 @@ public class ItemCache implements ItemLi
      * @return The item reference stored in the corresponding cache entry
      * or {@code null} if there's no corresponding cache entry.
      */
-    public Item getItem(ItemState<?> state) {
+    public ItemImpl<?> getItem(ItemState<?> state) {
         return cache.get(state);
     }
 
@@ -67,8 +64,8 @@ public class ItemCache implements ItemLi
      * @return The node reference stored in the corresponding cache entry
      * or {@code null} if there's no corresponding cache entry.
      */
-    public Node getNode(NodeState state) {
-        return (Node) cache.get(state);
+    public NodeImpl getNode(NodeState state) {
+        return (NodeImpl) cache.get(state);
     }
 
     /**
@@ -80,8 +77,8 @@ public class ItemCache implements ItemLi
      * @return The property reference stored in the corresponding cache entry
      * or {@code null} if there's no corresponding cache entry.
      */
-    public Property getProperty(PropertyState state) {
-        return (Property) cache.get(state);
+    public PropertyImpl getProperty(PropertyState state) {
+        return (PropertyImpl) cache.get(state);
     }
 
     /**
@@ -94,19 +91,19 @@ public class ItemCache implements ItemLi
     //----------------------------------------------< ItemLifeCycleListener >---
 
     @Override
-    public void itemCreated(Item item, ItemState<?> state) {
-        cacheItem(state, item);
+    public void itemCreated(ItemImpl<?> item) {
+        cacheItem(item.getItemState(), item);
     }
 
     @Override
-    public void itemUpdated(Item item, ItemState<?> state, boolean modified) {
+    public void itemUpdated(ItemImpl<?> item, boolean modified) {
         // do nothing: we don't touch the cache here since the LRU
         // should only be affected by client side operations.
     }
 
     @Override
-    public void itemDestroyed(Item item, ItemState<?> state) {
-        evictItem(state);
+    public void itemDestroyed(ItemImpl<?> item) {
+        evictItem(item.getItemState());
     }
 
     //-------------------------------------------------< item cache methods >---
@@ -117,7 +114,7 @@ public class ItemCache implements ItemLi
      *
      * @param item the item to cache
      */
-    private synchronized void cacheItem(ItemState<?> state, Item item) {
+    private synchronized void cacheItem(ItemState<?> state, ItemImpl<?> item)
{
         if (log.isDebugEnabled()) {
             if (cache.containsKey(state)) {
                 log.debug("overwriting cached item " + state);
@@ -148,9 +145,9 @@ public class ItemCache implements ItemLi
      */
     public String toString() {
         StringBuilder builder = new StringBuilder();
-        for (Map.Entry<ItemState<?>, Item> entry : cache.entrySet()) {
+        for (Map.Entry<ItemState<?>, ItemImpl<?>> entry : cache.entrySet())
{
             ItemState<?> state = entry.getKey();
-            Item item = entry.getValue();
+            ItemImpl<?> item = entry.getValue();
             if (item.isNode()) {
                 builder.append("Node: ");
             } else {

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=1171166&r1=1171165&r2=1171166&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
Thu Sep 15 16:34:46 2011
@@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory;
 import javax.jcr.InvalidItemStateException;
 import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
 import javax.jcr.PathNotFoundException;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
@@ -104,7 +103,7 @@ public abstract class ItemImpl<STATE_TYP
     }
 
     @Override
-    public Node getParent() throws RepositoryException {
+    public NodeImpl getParent() throws RepositoryException {
         checkStatus();
 
         // special treatment for root node
@@ -304,7 +303,7 @@ public abstract class ItemImpl<STATE_TYP
      */
     private void notifyCreated() {
         if (listener != null) {
-            listener.itemCreated(this, state);
+            listener.itemCreated(this);
         }
     }
 
@@ -313,7 +312,7 @@ public abstract class ItemImpl<STATE_TYP
      */
     private void notifyUpdated(boolean modified) {
         if (listener != null) {
-            listener.itemUpdated(this, state, modified);
+            listener.itemUpdated(this, modified);
         }
     }
 
@@ -322,7 +321,7 @@ public abstract class ItemImpl<STATE_TYP
      */
     private void notifyDestroyed() {
         if (listener != null) {
-            listener.itemDestroyed(this, state);
+            listener.itemDestroyed(this);
             listener = null;  // item is gone for good
         }
     }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java?rev=1171166&r1=1171165&r2=1171166&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemLifeCycleListener.java
Thu Sep 15 16:34:46 2011
@@ -16,10 +16,6 @@
  */
 package org.apache.jackrabbit.jcr2spi;
 
-import org.apache.jackrabbit.jcr2spi.state.ItemState;
-
-import javax.jcr.Item;
-
 /**
  * The {@code ItemLifeCycleListener} interface allows an implementing
  * object to be informed about changes on an {@code Item} instance.
@@ -31,7 +27,7 @@ public interface ItemLifeCycleListener {
      *
      * @param item the instance which has been created
      */
-    void itemCreated(Item item, ItemState<?> state);
+    void itemCreated(ItemImpl<?> item);
 
     /**
      * Called when an {@code Item} instance has been refreshed. If
@@ -40,7 +36,7 @@ public interface ItemLifeCycleListener {
      *
      * @param item the instance which has been refreshed
      */
-    void itemUpdated(Item item, ItemState<?> state, boolean modified);
+    void itemUpdated(ItemImpl<?> item, boolean modified);
 
     /**
      * Called when an {@code ItemImpl} instance has been destroyed
@@ -53,5 +49,5 @@ public interface ItemLifeCycleListener {
      *
      * @param item the instance which has been destroyed
      */
-    void itemDestroyed(Item item, ItemState<?> state);
+    void itemDestroyed(ItemImpl<?> item);
 }

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java?rev=1171166&r1=1171165&r2=1171166&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
Thu Sep 15 16:34:46 2011
@@ -33,12 +33,9 @@ import org.apache.jackrabbit.spi.commons
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.jcr.Item;
 import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.PathNotFoundException;
-import javax.jcr.Property;
 import javax.jcr.PropertyIterator;
 import javax.jcr.RepositoryException;
 import java.util.Iterator;
@@ -195,7 +192,7 @@ public class ItemManager implements Item
      * @throws PathNotFoundException
      * @throws RepositoryException
      */
-    public synchronized Node getNode(Path path) throws RepositoryException {
+    public synchronized NodeImpl getNode(Path path) throws RepositoryException {
         NodeEntry nodeEntry = hierarchyManager.getNodeEntry(path);
         try {
             return getItem(nodeEntry);
@@ -210,7 +207,7 @@ public class ItemManager implements Item
      * @throws PathNotFoundException
      * @throws RepositoryException
      */
-    public synchronized Property getProperty(Path path) throws RepositoryException {
+    public synchronized PropertyImpl getProperty(Path path) throws RepositoryException {
         PropertyEntry propertyEntry = hierarchyManager.getPropertyEntry(path);
         try {
             return getItem(propertyEntry);
@@ -224,7 +221,7 @@ public class ItemManager implements Item
      * @return
      * @throws RepositoryException
      */
-    public Node getItem(NodeEntry nodeEntry) throws RepositoryException {
+    public NodeImpl getItem(NodeEntry nodeEntry) throws RepositoryException {
         session.checkIsAlive();
         NodeState state = nodeEntry.getItemState();
         if (!state.isValid()) {
@@ -232,7 +229,7 @@ public class ItemManager implements Item
         }
 
         // first try to access node from cache
-        Node node = itemCache.getNode(state);
+        NodeImpl node = itemCache.getNode(state);
         // not yet in cache, need to create instance
         if (node == null) {
         // create instance of node
@@ -246,7 +243,7 @@ public class ItemManager implements Item
      * @return
      * @throws RepositoryException
      */
-    public Property getItem(PropertyEntry propertyEntry) throws RepositoryException {
+    public PropertyImpl getItem(PropertyEntry propertyEntry) throws RepositoryException {
         session.checkIsAlive();
         PropertyState state = propertyEntry.getItemState();
         if (!state.isValid()) {
@@ -254,7 +251,7 @@ public class ItemManager implements Item
         }
 
         // first try to access property from cache
-        Property property = itemCache.getProperty(state);
+        PropertyImpl property = itemCache.getProperty(state);
         // not yet in cache, need to create instance
         if (property == null) {
         // create instance of property
@@ -269,7 +266,7 @@ public class ItemManager implements Item
      * @throws ItemNotFoundException
      * @throws RepositoryException
      */
-    public Item getItem(HierarchyEntry<?> hierarchyEntry) throws RepositoryException
{
+    public ItemImpl<?> getItem(HierarchyEntry<?> hierarchyEntry) throws RepositoryException
{
         if (hierarchyEntry.denotesNode()) {
             return getItem((NodeEntry) hierarchyEntry);
         } else {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java?rev=1171166&r1=1171165&r2=1171166&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
Thu Sep 15 16:34:46 2011
@@ -21,6 +21,7 @@ import org.apache.jackrabbit.spi.commons
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.lock.Lock;
 import javax.jcr.lock.LockManager;
 
 /**
@@ -40,7 +41,7 @@ public class JcrLockManager implements L
     //--------------------------------------------------------< LockManager >---
 
     @Override
-    public javax.jcr.lock.Lock getLock(String absPath) throws RepositoryException {
+    public Lock getLock(String absPath) throws RepositoryException {
         Node n = itemManager.getNode(resolver.getQPath(absPath));
         return n.getLock();
     }
@@ -58,11 +59,11 @@ public class JcrLockManager implements L
     }
 
     @Override
-    public javax.jcr.lock.Lock lock(String absPath, boolean isDeep, boolean isSessionScoped,
long timeoutHint,
+    public Lock lock(String absPath, boolean isDeep, boolean isSessionScoped, long timeoutHint,
             String ownerInfo) throws RepositoryException {
-        
-        Node n = itemManager.getNode(resolver.getQPath(absPath));
-        return ((NodeImpl) n).lock(isDeep, isSessionScoped, timeoutHint, ownerInfo);
+
+        NodeImpl n = itemManager.getNode(resolver.getQPath(absPath));
+        return n.lock(isDeep, isSessionScoped, timeoutHint, ownerInfo);
     }
 
     @Override

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java?rev=1171166&r1=1171165&r2=1171166&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrVersionManager.java
Thu Sep 15 16:34:46 2011
@@ -87,7 +87,7 @@ public class JcrVersionManager implement
     public Version checkpoint(String absPath) throws RepositoryException {
         session.checkIsAlive();
 
-        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        NodeImpl n = itemManager.getNode(resolver.getQPath(absPath));
         return n.checkpoint();
     }
 
@@ -170,7 +170,7 @@ public class JcrVersionManager implement
 
         session.checkIsAlive();        
 
-        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        NodeImpl n = itemManager.getNode(resolver.getQPath(absPath));
         n.checkIsWritable();
         session.checkHasPendingChanges();
 
@@ -207,7 +207,7 @@ public class JcrVersionManager implement
     public Node createConfiguration(String absPath) throws RepositoryException {
         session.checkIsAlive();
 
-        NodeImpl n = (NodeImpl) itemManager.getNode(resolver.getQPath(absPath));
+        NodeImpl n = itemManager.getNode(resolver.getQPath(absPath));
         NodeEntry entry = vMgr.createConfiguration(n.getItemState());
         return itemManager.getItem(entry);
     }

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=1171166&r1=1171165&r2=1171166&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
Thu Sep 15 16:34:46 2011
@@ -166,7 +166,7 @@ public class NodeImpl extends ItemImpl<N
             Path parentPath = nodePath.getAncestor(1);
             ItemManager itemMgr = getItemManager();
             if (itemMgr.nodeExists(parentPath)) {
-                parentNode = (NodeImpl) itemMgr.getNode(parentPath);
+                parentNode = itemMgr.getNode(parentPath);
             } else if (itemMgr.propertyExists(parentPath)) {
                 String msg = "Cannot add a node to property " + LogUtil.safeGetJCRPath(parentPath,
session.getNamePathResolver());
                 log.debug(msg);
@@ -933,7 +933,7 @@ public class NodeImpl extends ItemImpl<N
             NodeImpl referenceableNode = this;
             while (referenceableNode.getDepth() != Path.ROOT_DEPTH
                 && !referenceableNode.isNodeType(NameConstants.MIX_REFERENCEABLE))
{
-                referenceableNode = (NodeImpl) referenceableNode.getParent();
+                referenceableNode = referenceableNode.getParent();
             }
 
             // if root is common ancestor, corresponding path is same as ours
@@ -1008,9 +1008,9 @@ public class NodeImpl extends ItemImpl<N
             Path parentPath = nPath.getAncestor(1);
             ItemManager itemMgr = getItemManager();
             if (itemMgr.nodeExists(parentPath)) {
-                Node parent = itemMgr.getNode(parentPath);
+                NodeImpl parent = itemMgr.getNode(parentPath);
                 Path relQPath = parentPath.computeRelativePath(nPath);
-                NodeImpl parentNode = (NodeImpl) parent;
+                NodeImpl parentNode = parent;
                 // call the restore
                 restore(parentNode, relQPath, version, removeExisting);
             } else if (itemMgr.propertyExists(parentPath)) {

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=1171166&r1=1171165&r2=1171166&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Thu Sep 15 16:34:46 2011
@@ -244,8 +244,8 @@ public class SessionImpl extends Abstrac
     @Override
     public Node getNodeByUUID(String uuid) throws RepositoryException {
         // sanity check performed by getNodeById
-        Node node = getNodeById(getIdFactory().createNodeId(uuid));
-        if (node instanceof NodeImpl && ((NodeImpl)node).isNodeType(NameConstants.MIX_REFERENCEABLE))
{
+        NodeImpl node = getNodeById(getIdFactory().createNodeId(uuid));
+        if (node.isNodeType(NameConstants.MIX_REFERENCEABLE)) {
             return node;
         } else {
             // fall back
@@ -267,18 +267,12 @@ public class SessionImpl extends Abstrac
      * {@code Session} does not have permission to access the node.
      * @throws RepositoryException
      */
-    private Node getNodeById(NodeId id) throws RepositoryException {
+    private NodeImpl getNodeById(NodeId id) throws RepositoryException {
         // check sanity of this session
         checkIsAlive();
         try {
             NodeEntry nodeEntry = getHierarchyManager().getNodeEntry(id);
-            Item item = itemManager.getItem(nodeEntry);
-            if (item.isNode()) {
-                return (Node) item;
-            } else {
-                log.error("NodeId '" + id + " does not point to a Node");
-                throw new ItemNotFoundException(LogUtil.saveGetIdString(id, getNamePathResolver()));
-            }
+            return itemManager.getItem(nodeEntry);
         } catch (AccessDeniedException e) {
             throw new ItemNotFoundException(LogUtil.saveGetIdString(id, getNamePathResolver()));
         }

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=1171166&r1=1171165&r2=1171166&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 16:34:46 2011
@@ -37,6 +37,8 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
+import static org.apache.jackrabbit.spi.commons.util.Unchecked.cast;
+
 /**
  * {@code TransientItemStateManager} adds support for transient changes on
  * {@link ItemState}s and also provides methods to create new item states.
@@ -170,7 +172,7 @@ public class TransientItemStateManager i
                 chain.addIterator(staleStates.iterator());
             }
             while (chain.hasNext()) {
-                ItemState<?> state = (ItemState<?>) chain.next();
+                ItemState<?> state = cast(chain.next());
                 if (containedInTree(target, state)) {
                     affectedStates.add(state);
                 }



Mime
View raw message