jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r498015 - in /jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core: BatchedItemOperations.java ItemValidator.java WorkspaceImpl.java xml/WorkspaceImporter.java
Date Sat, 20 Jan 2007 00:25:49 GMT
Author: jukka
Date: Fri Jan 19 16:25:48 2007
New Revision: 498015

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

Modified:
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
    jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.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/xml/WorkspaceImporter.java

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java?view=diff&rev=498015&r1=498014&r2=498015
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/BatchedItemOperations.java
Fri Jan 19 16:25:48 2007
@@ -36,7 +36,6 @@
 import org.apache.jackrabbit.core.value.InternalValue;
 import org.apache.jackrabbit.core.version.VersionManager;
 import org.apache.jackrabbit.name.MalformedPathException;
-import org.apache.jackrabbit.name.NamespaceResolver;
 import org.apache.jackrabbit.name.Path;
 import org.apache.jackrabbit.name.QName;
 import org.apache.jackrabbit.uuid.UUID;
@@ -126,15 +125,13 @@
      * @param lockMgr    lock manager
      * @param session    current session
      * @param hierMgr    hierarchy manager
-     * @param nsResolver namespace resolver
      */
     public BatchedItemOperations(UpdatableItemStateManager stateMgr,
                                  NodeTypeRegistry ntReg,
                                  LockManager lockMgr,
                                  SessionImpl session,
-                                 HierarchyManager hierMgr,
-                                 NamespaceResolver nsResolver) {
-        super(ntReg, hierMgr, nsResolver);
+                                 HierarchyManager hierMgr) {
+        super(ntReg, hierMgr, session);
         this.stateMgr = stateMgr;
         this.lockMgr = lockMgr;
         this.session = session;
@@ -1622,7 +1619,7 @@
                         NodeState existingState = (NodeState) stateMgr.getItemState(id);
                         // make sure existing node is not the parent
                         // or an ancestor thereof
-                        if (id.equals(destParentId) 
+                        if (id.equals(destParentId)
                                 || hierMgr.isAncestor(id, destParentId)) {
                             String msg = "cannot remove ancestor node";
                             log.debug(msg);

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java?view=diff&rev=498015&r1=498014&r2=498015
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/ItemValidator.java
Fri Jan 19 16:25:48 2007
@@ -24,14 +24,13 @@
 import org.apache.jackrabbit.core.state.NodeState;
 import org.apache.jackrabbit.core.state.PropertyState;
 import org.apache.jackrabbit.core.value.InternalValue;
-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.NamespaceException;
 import javax.jcr.PropertyType;
 import javax.jcr.RepositoryException;
 import javax.jcr.ItemNotFoundException;
@@ -61,13 +60,11 @@
      * @see #safeGetJCRPath(ItemId)
      */
     protected final HierarchyManager hierMgr;
+
     /**
-     * namespace resolver used for generating error msg's
-     * that contain human readable paths
-     *
-     * @see #safeGetJCRPath(Path)
+     * Path resolver for outputting user-friendly error messages.
      */
-    protected final NamespaceResolver nsResolver;
+    protected final PathResolver resolver;
 
     /**
      * Creates a new <code>ItemValidator</code> instance.
@@ -78,10 +75,10 @@
      */
     public ItemValidator(NodeTypeRegistry ntReg,
                          HierarchyManager hierMgr,
-                         NamespaceResolver nsResolver) {
+                         PathResolver resolver) {
         this.ntReg = ntReg;
         this.hierMgr = hierMgr;
-        this.nsResolver = nsResolver;
+        this.resolver = resolver;
     }
 
     /**
@@ -219,9 +216,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/WorkspaceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/WorkspaceImpl.java?view=diff&rev=498015&r1=498014&r2=498015
==============================================================================
--- 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:25:48 2007
@@ -278,10 +278,9 @@
             throw new RepositoryException("not an absolute path: " + destAbsPath);
         }
 
-        BatchedItemOperations ops =
-                new BatchedItemOperations(stateMgr, rep.getNodeTypeRegistry(),
-                        session.getLockManager(), session, hierMgr,
-                        session.getNamespaceResolver());
+        BatchedItemOperations ops = new BatchedItemOperations(
+                stateMgr, rep.getNodeTypeRegistry(), session.getLockManager(),
+                session, hierMgr);
 
         try {
             ops.edit();
@@ -505,10 +504,9 @@
             throw new RepositoryException("not an absolute path: " + destAbsPath);
         }
 
-        BatchedItemOperations ops =
-                new BatchedItemOperations(stateMgr, rep.getNodeTypeRegistry(),
-                        session.getLockManager(), session, hierMgr,
-                        session.getNamespaceResolver());
+        BatchedItemOperations ops = new BatchedItemOperations(
+                stateMgr, rep.getNodeTypeRegistry(), session.getLockManager(),
+                session, hierMgr);
 
         try {
             ops.edit();

Modified: jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java?view=diff&rev=498015&r1=498014&r2=498015
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/xml/WorkspaceImporter.java
Fri Jan 19 16:25:48 2007
@@ -114,7 +114,7 @@
 
         itemOps = new BatchedItemOperations(
                 wsp.getItemStateManager(), ntReg, session.getLockManager(),
-                session, wsp.getHierarchyManager(), session.getNamespaceResolver());
+                session, wsp.getHierarchyManager());
         hierMgr = wsp.getHierarchyManager();
 
         // perform preliminary checks



Mime
View raw message