jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1170904 - in /jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: SessionImpl.java WorkspaceImpl.java WorkspaceManager.java hierarchy/HierarchyManager.java hierarchy/HierarchyManagerImpl.java
Date Wed, 14 Sep 2011 23:51:11 GMT
Author: mduerig
Date: Wed Sep 14 23:51:11 2011
New Revision: 1170904

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

Added:
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
      - copied, changed from r1170900, jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
Modified:
    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/WorkspaceImpl.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java

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=1170904&r1=1170903&r2=1170904&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 23:51:11 2011
@@ -22,7 +22,7 @@ import org.apache.jackrabbit.commons.Abs
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
 import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
@@ -147,13 +147,10 @@ public class SessionImpl extends Abstrac
         itemStateManager = new SessionItemStateManager(workspace.getUpdateableItemStateManager(),
getValidator(),
                 getQValueFactory(), workspace.getItemStateFactory(), this);
         
-        HierarchyManagerImpl hMgr = getHierarchyManager();
+        HierarchyManager hMgr = getHierarchyManager();
         ItemCache cache = new ItemCache(this.config.getItemCacheSize());
         itemManager = new ItemManager(hMgr, this, cache);
-
-        if (hMgr instanceof HierarchyManagerImpl) {
-            hMgr.setResolver(npResolver);
-        }
+        hMgr.setResolver(npResolver);
     }
 
     public IdFactory getIdFactory() {
@@ -719,7 +716,7 @@ public class SessionImpl extends Abstrac
     }
 
     @Override
-    public final HierarchyManagerImpl getHierarchyManager() {
+    public final HierarchyManager getHierarchyManager() {
         return workspace.getHierarchyManager();
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java?rev=1170904&r1=1170903&r2=1170904&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceImpl.java
Wed Sep 14 23:51:11 2011
@@ -18,7 +18,7 @@ package org.apache.jackrabbit.jcr2spi;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.lock.LockManagerImpl;
 import org.apache.jackrabbit.jcr2spi.lock.LockStateManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
@@ -351,7 +351,7 @@ public class WorkspaceImpl implements Wo
     }
 
     @Override
-    public HierarchyManagerImpl getHierarchyManager() {
+    public HierarchyManager getHierarchyManager() {
         return wspManager.getHierarchyManager();
     }
 

Modified: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=1170904&r1=1170903&r2=1170904&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Wed Sep 14 23:51:11 2011
@@ -19,7 +19,6 @@ package org.apache.jackrabbit.jcr2spi;
 import org.apache.jackrabbit.jcr2spi.config.CacheBehaviour;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEventListener;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
-import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProviderImpl;
@@ -118,7 +117,7 @@ public final class WorkspaceManager impl
     private final PathFactory pathFactory;
 
     private final ItemStateFactory isf;
-    private final HierarchyManagerImpl hierarchyManager;
+    private final HierarchyManager hierarchyManager;
 
     private final CacheBehaviour cacheBehaviour;
     private final int pollTimeout;
@@ -211,7 +210,7 @@ public final class WorkspaceManager impl
         return ntRegistry;
     }
 
-    public HierarchyManagerImpl getHierarchyManager() {
+    public HierarchyManager getHierarchyManager() {
         return hierarchyManager;
     }
 
@@ -463,8 +462,8 @@ public final class WorkspaceManager impl
      * @return a new instance of {@code HierarchyManager}.
      * @throws javax.jcr.RepositoryException If an error occurs.
      */
-    private HierarchyManagerImpl createHierarchyManager(TransientItemStateFactory transientISF,
IdFactory idFactory) {
-        return new HierarchyManagerImpl(transientISF, idFactory, getPathFactory());
+    private HierarchyManager createHierarchyManager(TransientItemStateFactory transientISF,
IdFactory idFactory) {
+        return new HierarchyManager(transientISF, idFactory, getPathFactory());
     }
 
     /**

Copied: jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
(from r1170900, 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/HierarchyManager.java?p2=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java&p1=jackrabbit/sandbox/jackrabbit-mk/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java&r1=1170900&r2=1170904&rev=1170904&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/HierarchyManager.java
Wed Sep 14 23:51:11 2011
@@ -38,15 +38,15 @@ import javax.jcr.RepositoryException;
  * {@code HierarchyManagerImpl} implements the {@code HierarchyManager}
  * interface.
  */
-public class HierarchyManagerImpl implements HierarchyManager {
-    private static final Logger log = LoggerFactory.getLogger(HierarchyManagerImpl.class);
+public class HierarchyManager {
+    private static final Logger log = LoggerFactory.getLogger(HierarchyManager.class);
 
     private final NodeEntry rootEntry;
     private final UniqueIdResolver uniqueIdResolver;
     private final IdFactory idFactory;
     private NamePathResolver resolver;
 
-    public HierarchyManagerImpl(TransientItemStateFactory isf, IdFactory idFactory, PathFactory
pathFactory) {
+    public HierarchyManager(TransientItemStateFactory isf, IdFactory idFactory, PathFactory
pathFactory) {
         uniqueIdResolver = new UniqueIdResolver(isf);
         rootEntry = new EntryFactory(isf, idFactory, uniqueIdResolver, pathFactory).createRootEntry();
         this.idFactory = idFactory;
@@ -61,17 +61,33 @@ public class HierarchyManagerImpl implem
 
     //---------------------------------------------------< HierarchyManager >---
     
-    @Override
+    /**
+     * Dispose this {@code HierarchyManager}
+     */
     public void dispose() {
         uniqueIdResolver.dispose();
     }
 
-    @Override
+    /**
+     * @return the root entry.
+     */
     public NodeEntry getRootEntry() {
         return rootEntry;
     }
 
-    @Override
+    /**
+     * Lookup of {@code HierarchyEntry} by its workspace Id that may be different
+     * if a entry (or any of its ancestors) has been transiently moved or
+     * reordered.<p/>
+     * If the Hierarchy already lists the entry with the given workspaceItemId it is
+     * returned otherwise {@code null}. See {@link #getNodeEntry(NodeId)}
+     * or {@link #getPropertyEntry(PropertyId)} for methods that resolves the
+     * ItemId including lookup in the persistence layer if the entry has not been
+     * loaded yet.
+     *
+     * @param workspaceItemId
+     * @return the HierarchyEntry with the given {@code workspaceItemId}.
+     */
     public HierarchyEntry lookup(ItemId workspaceItemId) {
         String uniqueID = workspaceItemId.getUniqueID();
         if (uniqueID == null) {
@@ -87,12 +103,30 @@ public class HierarchyManagerImpl implem
         }
     }
 
-    @Override
+    /**
+     * Lookup of {@code HierarchyEntry} by its workspace path that may be different
+     * if a entry (or any of its ancestors) has been transiently moved or
+     * reordered.<p/>
+     * If the Hierarchy already lists the entry with the given path it is
+     * returned otherwise {@code null}. See {@link #getNodeEntry(Path)}
+     * or {@link #getPropertyEntry(Path)} for methods that resolves the path
+     * including lookup in the persistence layer if the entry has not been loaded yet.
+     *
+     * @param workspacePath
+     * @return the HierarchyEntry with the given {@code workspacePath}.
+     */
     public HierarchyEntry lookup(Path workspacePath) {
         return rootEntry.lookupDeepEntry(workspacePath);
     }
 
-    @Override
+    /**
+     * Resolves a itemId into a {@code HierarchyEntry}.
+     *
+     * @param nodeId
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public NodeEntry getNodeEntry(NodeId nodeId) throws RepositoryException {
         String uniqueID = nodeId.getUniqueID();
         if (uniqueID == null) {
@@ -107,7 +141,14 @@ public class HierarchyManagerImpl implem
         }
     }
 
-    @Override
+    /**
+     * Resolves a path into a {@code NodeEntry}.
+     *
+     * @param qPath
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public NodeEntry getNodeEntry(Path qPath) throws RepositoryException {
         NodeEntry rootEntry = getRootEntry();
         // shortcut
@@ -122,7 +163,14 @@ public class HierarchyManagerImpl implem
         return rootEntry.getDeepNodeEntry(qPath);
     }
 
-    @Override
+    /**
+     * Resolves a propertyId into a {@code PropertyEntry}.
+     *
+     * @param propertyId
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public PropertyEntry getPropertyEntry(PropertyId propertyId) throws RepositoryException
{
         String uniqueID = propertyId.getUniqueID();
         if (uniqueID == null) {
@@ -138,7 +186,14 @@ public class HierarchyManagerImpl implem
         }
     }
 
-    @Override
+    /**
+     * Resolves a path into a {@code PropertyEntry}.
+     *
+     * @param qPath
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public PropertyEntry getPropertyEntry(Path qPath) throws RepositoryException {
         // shortcut
         if (qPath.denotesRoot()) {
@@ -152,7 +207,15 @@ public class HierarchyManagerImpl implem
         return getRootEntry().getDeepPropertyEntry(qPath);
     }
 
-    @Override
+    /**
+     * Retrieves the {@code NodeEntry} corresponding to the given
+     * path and resolves it to the underlying {@code NodeState}.
+     *
+     * @param qPath
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public NodeState getNodeState(Path qPath) throws RepositoryException {
         NodeEntry entry = getNodeEntry(qPath);
         try {
@@ -167,7 +230,15 @@ public class HierarchyManagerImpl implem
         }
     }
 
-    @Override
+    /**
+     * Retrieves the {@code PropertyEntry} corresponding to the given
+     * path and resolves it to the underlying {@code PropertyState}.
+     *
+     * @param qPath
+     * @return
+     * @throws PathNotFoundException
+     * @throws RepositoryException
+     */
     public PropertyState getPropertyState(Path qPath) throws RepositoryException {
         PropertyEntry entry = getPropertyEntry(qPath);
         try {
@@ -182,8 +253,14 @@ public class HierarchyManagerImpl implem
         }
     }
 
-    @Override
-    public int getDepth(HierarchyEntry hierarchyEntry) throws RepositoryException {
+    /**
+     * Returns the depth of the specified item. The depth reflects the
+     * absolute hierarchy level.
+     *
+     * @param hierarchyEntry
+     * @return the depth of the specified item
+     */
+    public int getDepth(HierarchyEntry hierarchyEntry) {
         int depth = Path.ROOT_DEPTH;
         NodeEntry parentEntry = hierarchyEntry.getParent();
         while (parentEntry != null) {
@@ -194,8 +271,19 @@ public class HierarchyManagerImpl implem
         return depth;
     }
 
-    @Override
-    public int getRelativeDepth(NodeEntry ancestor, HierarchyEntry descendant) throws RepositoryException
{
+    /**
+     * Returns the depth of the specified descendant relative to the given
+     * ancestor. If {@code ancestor} and {@code descendant}
+     * denote the same item 0 is returned. If {@code ancestor} does not
+     * denote an ancestor -1 is returned.
+     *
+     * @param ancestor NodeEntry that must be an ancestor of the descendant
+     * @param descendant HierarchyEntry
+     * @return the relative depth; -1 if {@code ancestor} does not
+     * denote an ancestor of the item denoted by {@code descendant}
+     * (or itself).
+     */
+    public int getRelativeDepth(NodeEntry ancestor, HierarchyEntry descendant) {
         if (ancestor.equals(descendant)) {
             return 0;
         }



Mime
View raw message