jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r766754 - in /jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi: ./ hierarchy/ operation/ query/ state/ util/
Date Mon, 20 Apr 2009 16:58:12 GMT
Author: mduerig
Date: Mon Apr 20 16:58:12 2009
New Revision: 766754

URL: http://svn.apache.org/viewvc?rev=766754&view=rev
Log:
1.5: Backported revision 719282 (JCR-1871)

Modified:
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
    jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/LogUtil.java

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemImpl.java
Mon Apr 20 16:58:12 2009
@@ -108,13 +108,14 @@
         if (depth == 0) {
             return session.getRootNode();
         }
+        String msg = "No ancestor at depth = " + depth;
         try {
             // Path.getAncestor requires relative degree, i.e. we need
             // to convert absolute to relative ancestor degree
             Path path = getQPath();
             int relDegree = path.getAncestorCount() - depth;
             if (relDegree < 0) {
-                throw new ItemNotFoundException();
+                throw new ItemNotFoundException(msg);
             }
             Path ancestorPath = path.getAncestor(relDegree);
             if (relDegree == 0) {
@@ -122,8 +123,8 @@
             } else {
                 return getItemManager().getNode(ancestorPath);
             }
-        } catch (PathNotFoundException pnfe) {
-            throw new ItemNotFoundException();
+        } catch (PathNotFoundException e) {
+            throw new ItemNotFoundException(msg);
         }
     }
 

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/ItemManagerImpl.java
Mon Apr 20 16:58:12 2009
@@ -200,7 +200,7 @@
         session.checkIsAlive();
         ItemState state = hierarchyEntry.getItemState();
         if (!state.isValid()) {
-            throw new ItemNotFoundException();
+            throw new ItemNotFoundException(LogUtil.safeGetJCRPath(state, session.getPathResolver()));
         }
 
         // first try to access item from cache

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/NodeImpl.java
Mon Apr 20 16:58:12 2009
@@ -556,7 +556,8 @@
      * qualified name.
      *
      * @param propertyName
-     * @return
+     * @return <code>true</code>, if this <code>Node</code> has a
property with
+     * the given name.
      */
     private boolean hasProperty(Name propertyName) {
         return getNodeEntry().hasPropertyEntry(propertyName);
@@ -678,7 +679,7 @@
      * NOTE, that the result of this method, does NOT represent the list of
      * mixin-types that currently affect this node.
      *
-     * @return
+     * @return mixin names present with the jcr:mixinTypes property.
      */
     private List getMixinTypes() {
         Name[] mixinValue;
@@ -1285,11 +1286,11 @@
         try {
             PropertyEntry pEntry = getNodeEntry().getPropertyEntry(qName, true);
             if (pEntry == null) {
-                throw new PathNotFoundException(qName.toString());
+                throw new PathNotFoundException(LogUtil.saveGetJCRName(qName, session.getNameResolver()));
             }
             return (Property) getItemManager().getItem(pEntry);
         } catch (AccessDeniedException e) {
-            throw new PathNotFoundException(qName.toString());
+            throw new PathNotFoundException(LogUtil.saveGetJCRName(qName, session.getNameResolver()));
         }
     }
 

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/SessionImpl.java
Mon Apr 20 16:58:12 2009
@@ -23,6 +23,7 @@
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry;
 import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManager;
 import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
+import org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl;
 import org.apache.jackrabbit.jcr2spi.lock.LockManager;
 import org.apache.jackrabbit.jcr2spi.nodetype.EffectiveNodeTypeProvider;
 import org.apache.jackrabbit.jcr2spi.nodetype.ItemDefinitionProvider;
@@ -40,6 +41,7 @@
 import org.apache.jackrabbit.jcr2spi.xml.ImportHandler;
 import org.apache.jackrabbit.jcr2spi.xml.Importer;
 import org.apache.jackrabbit.jcr2spi.xml.SessionImporter;
+import org.apache.jackrabbit.jcr2spi.util.LogUtil;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.NameFactory;
 import org.apache.jackrabbit.spi.NodeId;
@@ -143,7 +145,12 @@
         validator = new ItemStateValidator(this, getPathFactory());
 
         itemStateManager = createSessionItemStateManager(workspace.getUpdatableItemStateManager(),
workspace.getItemStateFactory());
-        itemManager = createItemManager(getHierarchyManager());
+        HierarchyManager hMgr = getHierarchyManager();
+        itemManager = createItemManager(hMgr);
+
+        if (hMgr instanceof HierarchyManagerImpl) {
+            ((HierarchyManagerImpl) hMgr).setResolver(npResolver);
+        }
     }
 
     //--------------------------------------------------< Session interface >---
@@ -253,10 +260,10 @@
                 return (Node) item;
             } else {
                 log.error("NodeId '" + id + " does not point to a Node");
-                throw new ItemNotFoundException(id.toString());
+                throw new ItemNotFoundException(LogUtil.saveGetIdString(id, getPathResolver()));
             }
         } catch (AccessDeniedException e) {
-            throw new ItemNotFoundException(id.toString());
+            throw new ItemNotFoundException(LogUtil.saveGetIdString(id, getPathResolver()));
         }
     }
 

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/WorkspaceManager.java
Mon Apr 20 16:58:12 2009
@@ -404,8 +404,7 @@
     }
 
     /**
-     *
-     * @return
+     * @return a new instance of <code>TransientItemStateFactory</code>.
      */
     private TransientItemStateFactory createItemStateFactory() {
         WorkspaceItemStateFactory isf = new WorkspaceItemStateFactory(service, sessionInfo,
getItemDefinitionProvider());
@@ -414,16 +413,14 @@
     }
 
     /**
-     *
-     * @return
+     * @return a new instance of <code>HierarchyManager</code>.
      */
     private HierarchyManager createHierarchyManager(TransientItemStateFactory tisf, IdFactory
idFactory) throws RepositoryException {
         return new HierarchyManagerImpl(tisf, idFactory, getPathFactory());
     }
 
     /**
-     *
-     * @return
+     * @return a new InternalEventListener
      */
     private InternalEventListener createHierarchyListener(HierarchyManager hierarchyMgr)
{
         InternalEventListener listener = new HierarchyEventListener(this, hierarchyMgr, cacheBehaviour);
@@ -431,9 +428,8 @@
     }
 
     /**
-     *
      * @param nsRegistry
-     * @return
+     * @return an instance of <code>NodeTypeRegistryImpl</code>.
      */
     private NodeTypeRegistryImpl createNodeTypeRegistry(NamespaceRegistry nsRegistry) {
         NodeTypeStorage ntst = new NodeTypeStorage() {
@@ -459,9 +455,8 @@
     }
 
     /**
-     *
      * @param entProvider
-     * @return
+     * @return  a new instance of <code>ItemDefinitionProvider</code>.
      */
     private ItemDefinitionProvider createDefinitionProvider(EffectiveNodeTypeProvider entProvider)
{
         return new ItemDefinitionProviderImpl(entProvider, service, sessionInfo);

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/EntryFactory.java
Mon Apr 20 16:58:12 2009
@@ -19,9 +19,12 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.jcr2spi.state.TransientItemStateFactory;
+import org.apache.jackrabbit.jcr2spi.util.LogUtil;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.PathFactory;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 
 /**
  * <code>EntryFactory</code>...
@@ -49,7 +52,21 @@
      */
     private final TransientItemStateFactory isf;
 
-    public EntryFactory(TransientItemStateFactory isf, IdFactory idFactory, NodeEntryListener
listener, PathFactory pathFactory) {
+    /**
+     * NamePathResolver used to generate human readable error messages.
+     */
+    private NamePathResolver resolver;
+
+    /**
+     * Create a new instance of the <code>EntryFactory</code>.
+     *
+     * @param isf
+     * @param idFactory
+     * @param listener
+     * @param pathFactory
+     */
+    public EntryFactory(TransientItemStateFactory isf, IdFactory idFactory,
+                        NodeEntryListener listener, PathFactory pathFactory) {
         this.idFactory = idFactory;
         this.pathFactory = pathFactory;
         this.isf = isf;
@@ -58,8 +75,7 @@
     }
 
     /**
-     *
-     * @return
+     * @return the root entry.
      */
     public NodeEntry createRootEntry() {
         return rootEntry;
@@ -100,10 +116,30 @@
     }
 
     //--------------------------------------------------------------------------
+    /**
+     * @param resolver
+     */
+    void setResolver(NamePathResolver resolver) {
+        this.resolver = resolver;
+    }
+
+    /**
+     * @param path
+     * @return jcr presentation of the specified path.
+     */
+    String saveGetJCRPath(Path path) {
+        if (resolver == null) {
+            return path.toString();
+        } else {
+            return LogUtil.safeGetJCRPath(path, resolver);
+        }
+    }
+    
+    //--------------------------------------------------------------------------
     public interface NodeEntryListener {
 
         public void entryCreated(NodeEntry entry);
 
         public void uniqueIdChanged (NodeEntry entry, String previousUniqueID);
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyEntryImpl.java
Mon Apr 20 16:58:12 2009
@@ -131,7 +131,7 @@
     abstract Path buildPath(boolean workspacePath) throws RepositoryException;
 
     /**
-     * @return
+     * @return the item state or <code>null</code> if the entry isn't resolved.
      */
     ItemState internalGetItemState() {
         ItemState state = null;
@@ -374,8 +374,7 @@
 
     //--------------------------------------------------------------------------
     /**
-     *
-     * @param keepNew
+     * @param staleParent
      */
     void internalRemove(boolean staleParent) {
         ItemState state = internalGetItemState();

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManager.java
Mon Apr 20 16:58:12 2009
@@ -38,8 +38,7 @@
     public void dispose();
 
     /**
-     *
-     * @return
+     * @return the root entry.
      */
     public NodeEntry getRootEntry();
 
@@ -54,7 +53,7 @@
      * loaded yet.
      *
      * @param workspaceItemId
-     * @return
+     * @return the HierarchyEntry with the given <code>workspaceItemId</code>.
      */
     public HierarchyEntry lookup(ItemId workspaceItemId);
 
@@ -67,8 +66,8 @@
      * 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 workspaceItemId
-     * @return
+     * @param workspacePath
+     * @return the HierarchyEntry with the given <code>workspacePath</code>.
      */
     public HierarchyEntry lookup(Path workspacePath);
 
@@ -160,4 +159,4 @@
      * @throws RepositoryException If another error occurs.
      */
     public int getRelativeDepth(NodeEntry ancestor, HierarchyEntry descendant) throws ItemNotFoundException,
RepositoryException;
-}
\ No newline at end of file
+}

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/HierarchyManagerImpl.java
Mon Apr 20 16:58:12 2009
@@ -19,12 +19,14 @@
 import org.apache.jackrabbit.jcr2spi.state.NodeState;
 import org.apache.jackrabbit.jcr2spi.state.PropertyState;
 import org.apache.jackrabbit.jcr2spi.state.TransientItemStateFactory;
+import org.apache.jackrabbit.jcr2spi.util.LogUtil;
 import org.apache.jackrabbit.spi.IdFactory;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.NodeId;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.PathFactory;
 import org.apache.jackrabbit.spi.PropertyId;
+import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -38,11 +40,12 @@
  */
 public class HierarchyManagerImpl implements HierarchyManager {
 
-    private static Logger log = LoggerFactory.getLogger(org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyManagerImpl.class);
+    private static Logger log = LoggerFactory.getLogger(HierarchyManagerImpl.class);
 
     private final NodeEntry rootEntry;
     private final UniqueIdResolver uniqueIdResolver;
     private final IdFactory idFactory;
+    private NamePathResolver resolver;
 
     public HierarchyManagerImpl(TransientItemStateFactory isf, IdFactory idFactory,
                                 PathFactory pathFactory) {
@@ -51,6 +54,13 @@
         this.idFactory = idFactory;
     }
 
+    public void setResolver(NamePathResolver resolver) {
+        this.resolver = resolver;
+        if (rootEntry instanceof HierarchyEntryImpl) {
+            ((HierarchyEntryImpl) rootEntry).factory.setResolver(resolver);
+        }
+    }
+
     //---------------------------------------------------< HierarchyManager >---
     /**
      * @see HierarchyManager#dispose()
@@ -138,7 +148,7 @@
         } else {
             if (propertyId.getPath() == null) {
                 // a property id always contains a Path part.
-                throw new ItemNotFoundException();
+                throw new ItemNotFoundException("No property found for id " + LogUtil.saveGetIdString(propertyId,
resolver));
             } else {
                 NodeEntry nEntry = uniqueIdResolver.resolve(idFactory.createNodeId(uniqueID),
rootEntry);
                 return nEntry.getDeepPropertyEntry(propertyId.getPath());
@@ -173,7 +183,7 @@
             if (state.isValid()) {
                 return state;
             } else {
-                throw new PathNotFoundException();
+                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, resolver));
             }
         } catch (ItemNotFoundException e) {
             throw new PathNotFoundException(e);
@@ -190,7 +200,7 @@
             if (state.isValid()) {
                 return state;
             } else {
-                throw new PathNotFoundException();
+                throw new PathNotFoundException(LogUtil.safeGetJCRPath(qPath, resolver));
             }
         } catch (ItemNotFoundException e) {
             throw new PathNotFoundException(e);

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/hierarchy/NodeEntryImpl.java
Mon Apr 20 16:58:12 2009
@@ -397,18 +397,18 @@
                 //    refresh will bring up new entries added in the mean time
                 //    on the persistent layer.
                 if (entry.childNodeEntries.isComplete()) {
-                    throw new PathNotFoundException(path.toString());
+                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
                 }
                 // -> check for moved child entry in node-attic
                 // -> check if child points to a removed/moved sns
                 List siblings = entry.childNodeEntries.get(name);
                 if (entry.containsAtticChild(siblings, name, index)) {
-                    throw new PathNotFoundException(path.toString());
+                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
                 }
                 // shortcut: entry is NEW and still unresolved remaining path
                 // elements -> hierarchy doesn't exist anyway.
                 if (entry.getStatus() == Status.NEW) {
-                    throw new PathNotFoundException(path.toString());
+                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
                 }
                /*
                 * Unknown entry (not-existing or not yet loaded):
@@ -435,7 +435,7 @@
                 if (ne != null) {
                     return ne;
                 } else {
-                    throw new PathNotFoundException(path.toString());
+                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
                 }
             }
         }
@@ -471,13 +471,13 @@
                 //    refresh will bring up new entries added in the mean time
                 //    on the persistent layer.
                 if (entry.childNodeEntries.isComplete()) {
-                    throw new PathNotFoundException(path.toString());
+                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
                 }
                 // -> check for moved child entry in node-attic
                 // -> check if child points to a removed/moved sns
                 List siblings = entry.childNodeEntries.get(name);
                 if (entry.containsAtticChild(siblings, name, index)) {
-                    throw new PathNotFoundException(path.toString());
+                    throw new PathNotFoundException(factory.saveGetJCRPath(path));
                 }
                 // break out of the loop and start deep loading the property
                 break;
@@ -513,7 +513,7 @@
         }
 
         if (pe == null) {
-            throw new PathNotFoundException(path.toString());
+            throw new PathNotFoundException(factory.saveGetJCRPath(path));
         }
         return pe;
     }
@@ -669,7 +669,7 @@
     }
 
     /**
-     * @see NodeEntry#addNodeEntry(Name, String, int)
+     * @see NodeEntry#getOrAddNodeEntry(Name, int, String)
      */
     public NodeEntry getOrAddNodeEntry(Name nodeName, int index, String uniqueID) throws
RepositoryException {
         NodeEntry ne = lookupNodeEntry(uniqueID, nodeName, index);
@@ -747,7 +747,7 @@
     }
 
     /**
-     * @see NodeEntry#addPropertyEntry(Name)
+     * @see NodeEntry#getOrAddPropertyEntry(Name)
      */
     public PropertyEntry getOrAddPropertyEntry(Name propName) throws ItemExistsException
{
         PropertyEntry pe = lookupPropertyEntry(propName);
@@ -796,7 +796,7 @@
     }
 
     /**
-     * @see NodeEntry#addNewPropertyEntry(Name, QPropertyDefinition)
+     * @see NodeEntry#addNewPropertyEntry(Name, QPropertyDefinition, QValue[], int)
      */
     public PropertyEntry addNewPropertyEntry(Name propName, QPropertyDefinition definition,
QValue[] values, int propertyType)
             throws ItemExistsException, RepositoryException {
@@ -1088,7 +1088,7 @@
      * @param oldName
      * @param oldIndex
      * @return <code>true</code> if the given oldName and oldIndex match
-     * {@link #getWorkspaceName()} and {@link #getWorkspaceIndex()}, respectively.
+     * {@link #getName(boolean)} and {@link #getIndex(boolean)}, respectively.
      */
     boolean matches(Name oldName, int oldIndex) {
         try {
@@ -1102,7 +1102,7 @@
     /**
      * @param oldName
      * @return <code>true</code> if the given oldName matches
-     * {@link #getWorkspaceName()}.
+     * {@link #getName(boolean)}.
      */
     boolean matches(Name oldName) {
         return getName(true).equals(oldName);

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetMixin.java
Mon Apr 20 16:58:12 2009
@@ -46,7 +46,9 @@
         // add the jcr:mixinTypes property state as affected if it already exists
         // and therefore gets modified by this operation.
         try {
-            addAffectedItemState(nodeState.getPropertyState(NameConstants.JCR_MIXINTYPES));
+            if (nodeState.hasPropertyName(NameConstants.JCR_MIXINTYPES)) {
+                addAffectedItemState(nodeState.getPropertyState(NameConstants.JCR_MIXINTYPES));
+            }
         } catch (RepositoryException e) {
             // jcr:mixinTypes does not exist -> ignore
         }
@@ -104,4 +106,4 @@
         SetMixin sm = new SetMixin(nodeState, mixinNames);
         return sm;
     }
-}
\ No newline at end of file
+}

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/QueryImpl.java
Mon Apr 20 16:58:12 2009
@@ -26,6 +26,7 @@
 import org.apache.jackrabbit.spi.commons.name.NameConstants;
 import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NameException;
 
 import javax.jcr.ItemExistsException;
 import javax.jcr.ItemNotFoundException;
@@ -218,7 +219,7 @@
             queryNode.setProperty(resolver.getJCRName(NameConstants.JCR_STATEMENT), statement);
             node = queryNode;
             return node;
-        } catch (org.apache.jackrabbit.spi.commons.conversion.NameException e) {
+        } catch (NameException e) {
             throw new RepositoryException(e.getMessage(), e);
         }
     }

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/query/RowIteratorImpl.java
Mon Apr 20 16:58:12 2009
@@ -30,11 +30,13 @@
 import javax.jcr.query.RowIterator;
 
 import org.apache.jackrabbit.spi.commons.conversion.NamePathResolver;
+import org.apache.jackrabbit.spi.commons.conversion.NameException;
 import org.apache.jackrabbit.spi.Name;
 import org.apache.jackrabbit.spi.QueryInfo;
 import org.apache.jackrabbit.spi.QueryResultRow;
 import org.apache.jackrabbit.spi.QValue;
 import org.apache.jackrabbit.spi.commons.value.ValueFormat;
+import org.apache.jackrabbit.jcr2spi.util.LogUtil;
 
 /**
  * Implements the {@link javax.jcr.query.RowIterator} interface returned by
@@ -55,7 +57,7 @@
     /**
      * The <code>NamePathResolver</code> of the user <code>Session</code>.
      */
-    private final org.apache.jackrabbit.spi.commons.conversion.NamePathResolver resolver;
+    private final NamePathResolver resolver;
 
     /**
      * The JCR value factory.
@@ -256,7 +258,7 @@
                     getValues();
                 }
                 return values[idx.intValue()];
-            } catch (org.apache.jackrabbit.spi.commons.conversion.NameException e) {
+            } catch (NameException e) {
                 throw new RepositoryException(e.getMessage(), e);
             }
         }

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/state/WorkspaceItemStateFactory.java
Mon Apr 20 16:58:12 2009
@@ -95,7 +95,7 @@
             }
             return nodeState;
         } catch (PathNotFoundException e) {
-            throw new ItemNotFoundException(e.getMessage(), e);
+            throw new ItemNotFoundException(e.getMessage());
         }
     }
 
@@ -108,7 +108,7 @@
             Iterator infos = service.getItemInfos(sessionInfo, nodeId);
             return createItemStates(nodeId, infos, anyParent, true);
         } catch (PathNotFoundException e) {
-            throw new ItemNotFoundException(e.getMessage(), e);
+            throw new ItemNotFoundException(e.getMessage());
         }
     }
 
@@ -363,7 +363,7 @@
             }
             return createNodeState(info, entry);
         } catch (PathNotFoundException e) {
-            throw new ItemNotFoundException(e.getMessage(), e);
+            throw new ItemNotFoundException(e.getMessage());
         }
     }
 
@@ -474,7 +474,7 @@
      * See also #JCR-1797 for the corresponding enhancement request.
      *
      * @param missingElems
-     * @return
+     * @return true if the first element doesn't denote a named element.
      */
     private static boolean startsWithIllegalElement(Path.Element[] missingElems) {
         if (missingElems.length > 0) {

Modified: jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/LogUtil.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/LogUtil.java?rev=766754&r1=766753&r2=766754&view=diff
==============================================================================
--- jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/LogUtil.java
(original)
+++ jackrabbit/branches/1.5/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/util/LogUtil.java
Mon Apr 20 16:58:12 2009
@@ -20,6 +20,7 @@
 import org.slf4j.LoggerFactory;
 import org.apache.jackrabbit.spi.Path;
 import org.apache.jackrabbit.spi.Name;
+import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.jcr2spi.state.ItemState;
 import org.apache.jackrabbit.spi.ItemId;
 import org.apache.jackrabbit.spi.commons.conversion.NameResolver;
@@ -87,4 +88,33 @@
             return qName.toString();
         }
     }
-}
\ No newline at end of file
+
+    /**
+     * Failsafe conversion of an <code>ItemId</code> to a human readable string
+     * resolving the path part of the specified id using the given path resolver.
+     *
+     * @param itemId
+     * @param pathResolver
+     * @return a String representation of the given <code>ItemId</code>.
+     */
+    public static String saveGetIdString(ItemId itemId, PathResolver pathResolver) {
+        Path p = itemId.getPath();
+        if (p == null || pathResolver == null) {
+            return itemId.toString();
+        } else {
+            StringBuffer bf = new StringBuffer();
+            String uniqueID = itemId.getUniqueID();
+            if (uniqueID != null) {
+                bf.append(uniqueID).append(" - ");
+            }
+            String jcrPath;
+            try {
+                jcrPath = pathResolver.getJCRPath(p);
+            } catch (NamespaceException e) {
+                jcrPath = p.toString();
+            }
+            bf.append(jcrPath);
+            return bf.toString();
+        }
+    }
+}



Mime
View raw message