jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1170850 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ItemManager.java ItemManagerImpl.java SessionImpl.java query/RowIteratorImpl.java
Date Wed, 14 Sep 2011 21:20:13 GMT
Author: mduerig
Date: Wed Sep 14 21:20:13 2011
New Revision: 1170850

URL: http://svn.apache.org/viewvc?rev=1170850&view=rev
Log:
Microkernel based Jackrabbit prototype (WIP) 
refactor: remove ItemManager interface

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
      - copied, changed from r1170733, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
Modified:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.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/query/RowIteratorImpl.java

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
(from r1170733, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java)
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java&r1=1170733&r2=1170850&rev=1170850&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManager.java
Wed Sep 14 21:20:13 2011
@@ -44,10 +44,29 @@ import javax.jcr.RepositoryException;
 import java.util.Iterator;
 
 /**
- * {@code ItemManagerImpl} implements the {@code ItemManager} interface.
+ * There's one {@code ItemManager} instance per {@code Session}
+ * instance. It is the factory for {@code Node} and {@code Property}
+ * instances.
+ * <p/>
+ * The {@code ItemManager}'s responsibilities are:
+ * <ul>
+ * <li>providing access to {@code Item} instances by {@code ItemState}
+ * whereas {@code Node} and {@code Item} are only providing relative access.
+ * <li>returning the instance of an existing {@code Node} or {@code Property},
+ * given its absolute path.
+ * <li>creating the per-session instance of a {@code Node}
+ * or {@code Property} that doesn't exist yet and needs to be created first.
+ * <li>guaranteeing that there aren't multiple instances representing the same
+ * {@code Node} or {@code Property} associated with the same
+ * {@code Session} instance.
+ * <li>maintaining a cache of the item instances it created.
+ * </ul>
+ * <p/>
+ * If the parent {@code Session} is an {@code XASession}, there is
+ * one {@code ItemManager} instance per started global transaction.
  */
-public class ItemManagerImpl implements ItemManager, ItemStateCreationListener {
-    private static final Logger log = LoggerFactory.getLogger(ItemManagerImpl.class);
+public class ItemManager implements ItemStateCreationListener {
+    private static final Logger log = LoggerFactory.getLogger(ItemManager.class);
 
     private final SessionImpl session;
 
@@ -69,7 +88,7 @@ public class ItemManagerImpl implements 
      * @param session the session associated with the new instance
      * @param cache the ItemCache to be used.
      */
-    ItemManagerImpl(HierarchyManager hierarchyManager, SessionImpl session, ItemCache cache)
{
+    ItemManager(HierarchyManager hierarchyManager, SessionImpl session, ItemCache cache)
{
         this.hierarchyManager = hierarchyManager;
         this.session = session;
         itemCache = cache;
@@ -82,7 +101,9 @@ public class ItemManagerImpl implements 
 
     //--------------------------------------------------------< ItemManager >---
 
-    @Override
+    /**
+     * Disposes this {@code ItemManager} and frees resources.
+     */
     public void dispose() {
         // stop listening
         WorkspaceImpl wsp = session.getWorkspace();
@@ -91,7 +112,12 @@ public class ItemManagerImpl implements 
         itemCache.clear();
     }
 
-    @Override
+    /**
+     * Checks if the node with the given path exists.
+     *
+     * @param path path to the node to be checked
+     * @return true if the specified item exists
+     */
     public boolean nodeExists(Path path) {
         try {
             // session-sanity & permissions are checked upon itemExists(ItemState)
@@ -106,7 +132,12 @@ public class ItemManagerImpl implements 
         }
     }
 
-    @Override
+    /**
+     * Checks if the property with the given path exists.
+     *
+     * @param path path to the property to be checked
+     * @return true if the specified item exists
+     */
     public boolean propertyExists(Path path) {
         try {
             // session-sanity & permissions are checked upon itemExists(ItemState)
@@ -121,7 +152,12 @@ public class ItemManagerImpl implements 
         }
     }
 
-    @Override
+    /**
+     * Checks if the item for given HierarchyEntry exists.
+     *
+     * @param hierarchyEntry
+     * @return true if the specified item exists
+     */
     public boolean itemExists(HierarchyEntry hierarchyEntry) {
         try {
             // session-sanity & permissions are checked upon itemExists(ItemState)
@@ -153,7 +189,12 @@ public class ItemManagerImpl implements 
         }
     }
 
-    @Override
+    /**
+     * @param path
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public synchronized Node getNode(Path path) throws RepositoryException {
         NodeEntry nodeEntry = hierarchyManager.getNodeEntry(path);
         try {
@@ -163,7 +204,12 @@ public class ItemManagerImpl implements 
         }
     }
 
-    @Override
+    /**
+     * @param path
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public synchronized Property getProperty(Path path) throws RepositoryException {
         PropertyEntry propertyEntry = hierarchyManager.getPropertyEntry(path);
         try {
@@ -173,7 +219,12 @@ public class ItemManagerImpl implements 
         }
     }
 
-    @Override
+    /**
+     * @param hierarchyEntry
+     * @return
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
+     */
     public Item getItem(HierarchyEntry hierarchyEntry) throws RepositoryException {
         session.checkIsAlive();
         ItemState state = hierarchyEntry.getItemState();
@@ -195,7 +246,12 @@ public class ItemManagerImpl implements 
         return item;
     }
 
-    @Override
+    /**
+     * @param parentEntry
+     * @return
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
+     */
     public synchronized boolean hasChildNodes(NodeEntry parentEntry) throws RepositoryException
{
         // check sanity of session
         session.checkIsAlive();
@@ -215,7 +271,12 @@ public class ItemManagerImpl implements 
         return false;
     }
 
-    @Override
+    /**
+     * @param parentEntry
+     * @return
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
+     */
     public synchronized NodeIterator getChildNodes(NodeEntry parentEntry) throws RepositoryException
{
         // check sanity of session
         session.checkIsAlive();
@@ -224,7 +285,12 @@ public class ItemManagerImpl implements 
         return LazyItemIterator.nodeIterator(this, it);
     }
 
-    @Override
+    /**
+     * @param parentEntry
+     * @return
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
+     */
     public synchronized boolean hasProperties(NodeEntry parentEntry) throws RepositoryException
{
         // check sanity of session
         session.checkIsAlive();
@@ -244,7 +310,12 @@ public class ItemManagerImpl implements 
         return false;
     }
 
-    @Override
+    /**
+     * @param parentEntry
+     * @return
+     * @throws ItemNotFoundException
+     * @throws RepositoryException
+     */
     public synchronized PropertyIterator getProperties(NodeEntry parentEntry) throws RepositoryException
{
         // check sanity of session
         session.checkIsAlive();

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=1170850&r1=1170849&r2=1170850&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
Wed Sep 14 21:20:13 2011
@@ -149,7 +149,7 @@ public class SessionImpl extends Abstrac
         
         HierarchyManagerImpl hMgr = getHierarchyManager();
         ItemCache cache = new ItemCacheImpl(this.config.getItemCacheSize());
-        itemManager = new ItemManagerImpl(hMgr, this, cache);
+        itemManager = new ItemManager(hMgr, this, cache);
 
         if (hMgr instanceof HierarchyManagerImpl) {
             hMgr.setResolver(npResolver);

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java?rev=1170850&r1=1170849&r2=1170850&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
Wed Sep 14 21:20:13 2011
@@ -16,10 +16,15 @@
  */
 package org.apache.jackrabbit.jcr2spi.query;
 
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.NoSuchElementException;
+import org.apache.jackrabbit.jcr2spi.ItemManager;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import org.apache.jackrabbit.spi.NodeId;
+import org.apache.jackrabbit.spi.QValue;
+import org.apache.jackrabbit.spi.QueryInfo;
+import org.apache.jackrabbit.spi.QueryResultRow;
+import org.apache.jackrabbit.spi.commons.conversion.NameException;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.value.ValueFormat;
 
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.Node;
@@ -29,16 +34,10 @@ import javax.jcr.Value;
 import javax.jcr.ValueFactory;
 import javax.jcr.query.Row;
 import javax.jcr.query.RowIterator;
-
-import org.apache.jackrabbit.spi.QValue;
-import org.apache.jackrabbit.spi.QueryInfo;
-import org.apache.jackrabbit.spi.QueryResultRow;
-import org.apache.jackrabbit.spi.NodeId;
-import org.apache.jackrabbit.spi.commons.conversion.NameException;
-import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
-import org.apache.jackrabbit.spi.commons.value.ValueFormat;
-import org.apache.jackrabbit.jcr2spi.ItemManager;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
 
 /**
  * Implements the {@link javax.jcr.query.RowIterator} interface returned by



Mime
View raw message