jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r498012 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: ./ observation/ state/
Date Sat, 20 Jan 2007 00:08:59 GMT
Author: jukka
Date: Fri Jan 19 16:08:58 2007
New Revision: 498012

URL: http://svn.apache.org/viewvc?view=rev&rev=498012
Log:
JCR-688: Use PathResolver instead of NamespaceResolver in HierarcyManagers.

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/CachingHierarchyManager.java
Fri Jan 19 16:08:58 2007
@@ -24,8 +24,8 @@
 import org.apache.jackrabbit.core.state.NodeStateListener;
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathResolver;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.util.PathMap;
 import org.slf4j.Logger;
@@ -102,8 +102,8 @@
      */
     public CachingHierarchyManager(NodeId rootNodeId,
                                    ItemStateManager provider,
-                                   NamespaceResolver nsResolver) {
-        super(rootNodeId, provider, nsResolver);
+                                   PathResolver resolver) {
+        super(rootNodeId, provider, resolver);
         upperLimit = DEFAULT_UPPER_LIMIT;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/HierarchyManagerImpl.java
Fri Jan 19 16:08:58 2007
@@ -23,15 +23,14 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.NoPrefixDeclaredException;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathResolver;
 import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import javax.jcr.ItemNotFoundException;
+import javax.jcr.NamespaceException;
 import javax.jcr.RepositoryException;
 
 /**
@@ -49,26 +48,26 @@
 
     protected final NodeId rootNodeId;
     protected final ItemStateManager provider;
-    // used for outputting user-friendly paths and names
-    protected final NamespaceResolver nsResolver;
+
+    /**
+     * Path resolver for outputting user-friendly paths in error messages.
+     */
+    protected final PathResolver resolver;
 
     public HierarchyManagerImpl(NodeId rootNodeId,
                                 ItemStateManager provider,
-                                NamespaceResolver nsResolver) {
+                                PathResolver resolver) {
         this.rootNodeId = rootNodeId;
         this.provider = provider;
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
     }
 
     public NodeId getRootNodeId() {
         return rootNodeId;
     }
 
-    public NamespaceResolver getNamespaceResolver() {
-        return nsResolver;
-    }
-
     //-------------------------------------------------< misc. helper methods >
+
     /**
      * Failsafe conversion of internal <code>Path</code> to JCR path for use
in
      * error messages etc.
@@ -78,9 +77,9 @@
      */
     public String safeGetJCRPath(Path path) {
         try {
-            return PathFormat.format(path, nsResolver);
-        } catch (NoPrefixDeclaredException npde) {
-            log.error("failed to convert " + path.toString() + " to JCR path.");
+            return resolver.getJCRPath(path);
+        } catch (NamespaceException e) {
+            log.error("failed to convert {} to a JCR path", path);
             // return string representation of internal path as a fallback
             return path.toString();
         }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SearchManager.java
Fri Jan 19 16:08:58 2007
@@ -197,7 +197,8 @@
         }
 
         if (excludedNodeId != null) {
-            HierarchyManagerImpl hmgr = new HierarchyManagerImpl(rootNodeId, itemMgr, nsReg);
+            HierarchyManagerImpl hmgr = new HierarchyManagerImpl(
+                    rootNodeId, itemMgr, nsReg.getPathResolver());
             excludePath = hmgr.getPath(excludedNodeId);
         }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/SessionImpl.java
Fri Jan 19 16:08:58 2007
@@ -38,16 +38,12 @@
 import org.apache.jackrabbit.core.xml.SysViewSAXEventGenerator;
 import org.apache.jackrabbit.core.util.Dumpable;
 import org.apache.jackrabbit.core.lock.LockManager;
-import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.NameResolver;
 import org.apache.jackrabbit.name.NamespaceResolver;
-import org.apache.jackrabbit.name.ParsingNameResolver;
-import org.apache.jackrabbit.name.ParsingPathResolver;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.PathResolver;
 import org.apache.jackrabbit.name.QName;
-import org.apache.jackrabbit.name.PathFormat;
 import org.apache.jackrabbit.uuid.UUID;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -266,8 +262,7 @@
      * @return session item state manager
      */
     protected SessionItemStateManager createSessionItemStateManager(LocalItemStateManager
manager) {
-        return new SessionItemStateManager(rep.getRootNodeId(),
-                manager, getNamespaceResolver());
+        return new SessionItemStateManager(rep.getRootNodeId(), manager, this);
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java
Fri Jan 19 16:08:58 2007
@@ -31,10 +31,8 @@
 import org.apache.jackrabbit.core.xml.ImportHandler;
 import org.apache.jackrabbit.core.xml.Importer;
 import org.apache.jackrabbit.core.xml.WorkspaceImporter;
-import org.apache.jackrabbit.name.MalformedPathException;
 import org.apache.jackrabbit.name.NameException;
 import org.apache.jackrabbit.name.Path;
-import org.apache.jackrabbit.name.PathFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.ContentHandler;
@@ -133,8 +131,8 @@
         this.wspConfig = wspConfig;
         this.rep = rep;
         this.stateMgr = createItemStateManager(stateMgr);
-        this.hierMgr = new CachingHierarchyManager(rep.getRootNodeId(),
-                this.stateMgr, session.getNamespaceResolver());
+        this.hierMgr = new CachingHierarchyManager(
+                rep.getRootNodeId(), this.stateMgr, session);
         this.stateMgr.addListener(hierMgr);
         this.session = session;
     }

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ZombieHierarchyManager.java
Fri Jan 19 16:08:58 2007
@@ -21,7 +21,6 @@
 import org.apache.jackrabbit.core.state.ItemStateManager;
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeState;
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.QName;
 
 import java.util.Iterator;
@@ -40,11 +39,10 @@
      */
     protected ItemStateManager attic;
 
-    public ZombieHierarchyManager(NodeId rootNodeId,
+    public ZombieHierarchyManager(HierarchyManagerImpl parent,
                                   ItemStateManager provider,
-                                  ItemStateManager attic,
-                                  NamespaceResolver nsResolver) {
-        super(rootNodeId, provider, nsResolver);
+                                  ItemStateManager attic) {
+        super(parent.getRootNodeId(), provider, parent.resolver);
         this.attic = attic;
     }
 

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/ChangeLogBasedHierarchyMgr.java
Fri Jan 19 16:08:58 2007
@@ -28,8 +28,8 @@
 import org.apache.jackrabbit.core.state.NoSuchItemStateException;
 import org.apache.jackrabbit.core.state.NodeReferences;
 import org.apache.jackrabbit.core.state.NodeReferencesId;
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.Path;
+import org.apache.jackrabbit.name.PathResolver;
 
 import javax.jcr.ItemNotFoundException;
 import javax.jcr.RepositoryException;
@@ -56,18 +56,17 @@
      * @param rootNodeId the id of the root node.
      * @param manager the item state manager.
      * @param changes the changes that will be applied on the item state manager.
-     * @param resolver the namespace resolver of the current session.
+     * @param resolver path resolver for outputting user friendly paths
      */
     ChangeLogBasedHierarchyMgr(NodeId rootNodeId,
                                ItemStateManager manager,
                                ChangeLog changes,
-                               NamespaceResolver resolver) {
+                               PathResolver resolver) {
         super(rootNodeId,
                 new ChangeLogItemStateManager(manager, changes),
                 resolver);
-        zombieHierMgr =
-                new ZombieHierarchyManager(rootNodeId, provider,
-                        new AtticItemStateManager(changes), resolver);
+        zombieHierMgr = new ZombieHierarchyManager(
+                this, provider, new AtticItemStateManager(changes));
     }
 
     /**

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventStateCollection.java
Fri Jan 19 16:08:58 2007
@@ -123,9 +123,8 @@
         // create a hierarchy manager, that is based on the ChangeLog and
         // the ItemStateProvider
         // todo use CachingHierarchyManager ?
-        ChangeLogBasedHierarchyMgr hmgr =
-                new ChangeLogBasedHierarchyMgr(rootNodeId, stateMgr, changes,
-                        session.getNamespaceResolver());
+        ChangeLogBasedHierarchyMgr hmgr = new ChangeLogBasedHierarchyMgr(
+                rootNodeId, stateMgr, changes, session);
 
         /**
          * Important:

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java?view=diff&rev=498012&r1=498011&r2=498012
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/state/SessionItemStateManager.java
Fri Jan 19 16:08:58 2007
@@ -24,7 +24,7 @@
 import org.apache.jackrabbit.core.PropertyId;
 import org.apache.jackrabbit.core.ZombieHierarchyManager;
 import org.apache.jackrabbit.core.util.Dumpable;
-import org.apache.jackrabbit.name.NamespaceResolver;
+import org.apache.jackrabbit.name.PathResolver;
 import org.apache.jackrabbit.name.QName;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -85,11 +85,11 @@
      *
      * @param rootNodeId the root node id
      * @param stateMgr the local item state manager
-     * @param nsResolver the namespace resolver
+     * @param resolver path resolver for outputting user-friendly paths
      */
     public SessionItemStateManager(NodeId rootNodeId,
                                    LocalItemStateManager stateMgr,
-                                   NamespaceResolver nsResolver) {
+                                   PathResolver resolver) {
         transientStore = new ItemStateMap();
         atticStore = new ItemStateMap();
 
@@ -97,7 +97,7 @@
         stateMgr.addListener(this);
 
         // create hierarchy manager that uses both transient and persistent state
-        hierMgr = new CachingHierarchyManager(rootNodeId, this, nsResolver);
+        hierMgr = new CachingHierarchyManager(rootNodeId, this, resolver);
         addListener(hierMgr);
     }
 
@@ -447,10 +447,7 @@
 
         // use a special attic-aware hierarchy manager
         ZombieHierarchyManager zombieHierMgr =
-                new ZombieHierarchyManager(hierMgr.getRootNodeId(),
-                        this,
-                        getAttic(),
-                        hierMgr.getNamespaceResolver());
+            new ZombieHierarchyManager(hierMgr, this, getAttic());
 
         // use an array of lists to group the descendants by relative depth;
         // the depth is used as array index



Mime
View raw message