You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by st...@apache.org on 2003/04/14 17:12:52 UTC

cvs commit: jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/util PathUtil.java

stefan      2003/04/14 08:12:52

  Modified:    proposals/jcrri/src/org/apache/slide/jcr/core
                        ContentNode.java ElementImpl.java
                        ElementManager.java HierarchyNode.java
                        NodeImpl.java PropertyImpl.java
                        RootContentNode.java
               proposals/jcrri/src/org/apache/slide/jcr/util PathUtil.java
  Log:
  jcr ri: changed semantics of path arguments
  
  Revision  Changes    Path
  1.3       +22 -22    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ContentNode.java
  
  Index: ContentNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ContentNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContentNode.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ ContentNode.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -200,11 +200,11 @@
               throws RepositoryException {
           String propPath;
           try {
  -            propPath = PathUtil.makeAbsolutePath(path, name);
  +            propPath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            propPath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            propPath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           PropertyImpl prop = new PropertyImpl(ticket, propPath, propElement);
  @@ -228,11 +228,11 @@
               throws RepositoryException {
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, name);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            nodePath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            nodePath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           ContentNode node = new ContentNode(ticket, nodePath, objectClasses, nodeElement, rootContentNode, rootListener);
  @@ -303,7 +303,7 @@
               }
           }
   
  -        throw new ElementNotFoundException("there's no element named " + name + " at " + path);
  +        throw new ElementNotFoundException("there's no element named " + name + " at " + elementPath);
       }
   
       /**
  @@ -319,8 +319,8 @@
           // check existence
           if (propertyNames.contains(name)) {
               if (!adjustName) {
  -                log.warn("node " + path + " has already a property named " + name);
  -                throw new ElementExistsException("node " + path + " has already a property named " + name);
  +                log.warn("node " + elementPath + " has already a property named " + name);
  +                throw new ElementExistsException("node " + elementPath + " has already a property named " + name);
               }
               name = createUniqueName(name, propertyNames);
           }
  @@ -352,8 +352,8 @@
           // check existence
           if (nodeNames.contains(name)) {
               if (!adjustName) {
  -                log.warn("node " + path + " has already a node named " + name);
  -                throw new ElementExistsException("node " + path + " has already a node named " + name);
  +                log.warn("node " + elementPath + " has already a node named " + name);
  +                throw new ElementExistsException("node " + elementPath + " has already a node named " + name);
               }
               name = createUniqueName(name, nodeNames);
           }
  @@ -366,7 +366,7 @@
   	    for (int i = 0; i < objectClasses.length; i++) {
   		String oc = objectClasses[i];
   		if (oc.equals(OC_FILE) || oc.equals(OC_FOLDER) || oc.equals(OC_HIERARCHY_NODE)) {
  -		    throw new ParentChildMismatchException("can't add hierarchy node to content node " + path);
  +		    throw new ParentChildMismatchException("can't add hierarchy node to content node " + elementPath);
   		}
   	    }
           }
  @@ -402,8 +402,8 @@
                   String elemName = propElement.getAttributeValue(Serializer.NAME_ATTRIBUTE);
                   if (name.equals(elemName)) {
                       if (!domElement.removeContent(propElement)) {
  -                        log.error("failed to remove property " + name + " from node " + path);
  -                        throw new RepositoryException("failed to remove property " + name + " from node " + path);
  +                        log.error("failed to remove property " + name + " from node " + elementPath);
  +                        throw new RepositoryException("failed to remove property " + name + " from node " + elementPath);
                       }
                       // update our list
                       propertyNames.remove(name);
  @@ -424,8 +424,8 @@
                   String elemName = nodeElement.getAttributeValue(Serializer.NAME_ATTRIBUTE);
                   if (name.equals(elemName)) {
                       if (!domElement.removeContent(nodeElement)) {
  -                        log.error("failed to remove node " + name + " from node " + path);
  -                        throw new RepositoryException("failed to remove node " + name + " from node " + path);
  +                        log.error("failed to remove node " + name + " from node " + elementPath);
  +                        throw new RepositoryException("failed to remove node " + name + " from node " + elementPath);
                       }
                       // update our list
                       nodeNames.remove(name);
  @@ -436,8 +436,8 @@
               }
           }
   
  -        log.error("there's no sub-element of " + path + " named " + name);
  -        throw new InvalidPathException("there's no sub-element of " + path + " named " + name);
  +        log.error("there's no sub-element of " + elementPath + " named " + name);
  +        throw new InvalidPathException("there's no sub-element of " + elementPath + " named " + name);
       }
   
       //-----------------------------------------------------------------< Node >
  
  
  
  1.3       +28 -25    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ElementImpl.java
  
  Index: ElementImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ElementImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ElementImpl.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ ElementImpl.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -85,7 +85,7 @@
       protected final TicketImpl ticket;
   
       /** absolute (primary) path to this <code>Element</code> (jcr style, e.g. '/products/rhombus/jcr:Content/details/price') */
  -    protected String path;
  +    protected String elementPath;
   
       /** <code>ElementManager</code> for this repository */
       ElementManager elemMgr;
  @@ -101,7 +101,7 @@
        */
       ElementImpl(TicketImpl ticket, String path) {
           this.ticket = ticket;
  -        this.path = path;
  +        this.elementPath = path;
           this.elemMgr = ticket.getElementManager();
       }
   
  @@ -201,20 +201,23 @@
       }
   
       /**
  -     * Builds an absolute path from this <code>Element</code>'s
  -     * path and a relative path. The special path elements "." and ".."
  -     * are normalized.
  +     * Returns the canonical path of the specified path.
  +     * <p>
  +     * A canonical path is both absolute and unique.
  +     * If the specified path argument is relative (i.e. not starting with  "/")
  +     * then it is interpreted as being relative to this <code>Element</code>'s
  +     * path. The special path elements "." and ".." are normalized.
        *
  -     * @param relativePath relative path to resolve with this <code>Element</code>'s path.
  -     * @return an absolute path
  +     * @param somePath either relative or absolute path
  +     * @return a canonical path
        */
  -    final String getAbsolutePath(String relativePath)
  +    final String getCanonicalPath(String somePath)
               throws RepositoryException {
           try {
  -            return PathUtil.makeAbsolutePath(path, relativePath);
  +            return PathUtil.makeCanonicalPath(elementPath, somePath);
           } catch (MalformedPathException e) {
  -            log.error("failed to determine absolute path of path " + relativePath + " relative to " + path, e);
  -            throw new RepositoryException("failed to determine absolute path of path " + relativePath + " relative to " + path, e);
  +            log.error("failed to determine canonical path of path " + somePath + " relative to " + elementPath, e);
  +            throw new RepositoryException("failed to determine canonical path of path " + somePath + " relative to " + elementPath, e);
           }
       }
   
  @@ -224,10 +227,10 @@
        */
       final int getAncestorCount() {
   	int cnt = 0;
  -        if (path.equals("/")) {
  +        if (elementPath.equals("/")) {
               return cnt;
           }
  -	char[] chars = path.toCharArray();
  +	char[] chars = elementPath.toCharArray();
           for (int i = 0; i < chars.length; i++) {
               if (chars[i] == '/') {
                   cnt++;
  @@ -315,11 +318,11 @@
           try {
               // getAncestorFromPath requires relative degree, i.e. we need
               // to convert absolute to relative ancestor degree
  -            return getAncestorFromPath(elemMgr, path, getAncestorCount() - degree);
  +            return getAncestorFromPath(elemMgr, elementPath, getAncestorCount() - degree);
           } catch (RepositoryException e) {
               // erm, not quite correct...
  -            log.error("error while trying to access " + degree + "nth ancestor of " +  path, e);
  -            throw new ElementNotFoundException("error while trying to access " + degree + "nth ancestor of " + path, e);
  +            log.error("error while trying to access " + degree + "nth ancestor of " +  elementPath, e);
  +            throw new ElementNotFoundException("error while trying to access " + degree + "nth ancestor of " + elementPath, e);
           }
       }
   
  @@ -327,7 +330,7 @@
        * @see Element#getName()
        */
       public String getName() {
  -        return path.substring(path.lastIndexOf('/') != -1 ? path.lastIndexOf('/') + 1 : 0);
  +        return elementPath.substring(elementPath.lastIndexOf('/') != -1 ? elementPath.lastIndexOf('/') + 1 : 0);
       }
   
       /**
  @@ -335,7 +338,7 @@
        */
       public Node getParent()
               throws ElementNotFoundException {
  -        if (path.equals("/")) {
  +        if (elementPath.equals("/")) {
               log.error("'/' doesn't have a parent");
               throw new ElementNotFoundException("parent of /");
           }
  @@ -347,7 +350,7 @@
        */
       public NodeIterator getParents()
               throws ElementNotFoundException {
  -        if (path.equals("/")) {
  +        if (elementPath.equals("/")) {
               log.error("'/' doesn't have a parent");
               throw new ElementNotFoundException("parent of /");
           }
  @@ -373,7 +376,7 @@
        * @see Element#getPath()
        */
       public String getPath() {
  -        return path;
  +        return elementPath;
       }
   
       /**
  @@ -382,7 +385,7 @@
       public StringIterator getPaths() {
           ArrayList paths = new ArrayList();
   
  -        paths.add(path);
  +        paths.add(elementPath);
   
           // @todo implement getPaths(), e.g. resolve hardlinks
   
  
  
  
  1.3       +5 -5      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ElementManager.java
  
  Index: ElementManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/ElementManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ElementManager.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ ElementManager.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -268,7 +268,7 @@
               String name = iter.nextString();
               String path;
               try {
  -                path = PathUtil.makeAbsolutePath(absolutePath, name);
  +                path = PathUtil.makeCanonicalPath(absolutePath, name);
               } catch (MalformedPathException e) {
                   // erm, shouldn't happen...
                   path = absolutePath + "/" + name;
  
  
  
  1.3       +59 -59    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/HierarchyNode.java
  
  Index: HierarchyNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/HierarchyNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HierarchyNode.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ HierarchyNode.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -198,19 +198,19 @@
   
               // list subfolders in fs (i.e. hierarchy nodes)
               try {
  -                String[] folders = fs.listFolders(FileSystemPathUtil.escape(path));
  +                String[] folders = fs.listFolders(FileSystemPathUtil.escape(elementPath));
                   for (int i = 0; i < folders.length; i++) {
                       nodeNames.add(FileSystemPathUtil.unescape(folders[i]));
                   }
               } catch (FileSystemException fse) {
  -                log.warn("failed to enumerate sub-folders of " + path, fse);
  +                log.warn("failed to enumerate sub-folders of " + elementPath, fse);
                   // erm, ignore...
               }
   
               // list xml files (i.e. root content nodes) in current fs folder,
               // excluding .node.xml
               try {
  -                String[] files = fs.listFiles(FileSystemPathUtil.escape(path));
  +                String[] files = fs.listFiles(FileSystemPathUtil.escape(elementPath));
                   for (int i = 0; i < files.length; i++) {
                       String file = files[i];
                       if (file.endsWith(".xml") && !file.equals(NODE_FILE_NAME)) {
  @@ -219,7 +219,7 @@
                       }
                   }
               } catch (FileSystemException fse) {
  -                log.warn("failed to enumerate files of " + path, fse);
  +                log.warn("failed to enumerate files of " + elementPath, fse);
                   // erm, ignore...
               }
   
  @@ -238,11 +238,11 @@
               throws RepositoryException {
           String propPath;
           try {
  -            propPath = PathUtil.makeAbsolutePath(path, name);
  +            propPath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            propPath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            propPath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           PropertyImpl prop = new PropertyImpl(ticket, propPath, propElement);
  @@ -263,11 +263,11 @@
               throws RepositoryException {
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, name);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            nodePath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            nodePath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           ContentNode node = new ContentNode(ticket, nodePath, objectClasses, nodeElement, this);
  @@ -288,11 +288,11 @@
               throws RepositoryException {
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, name);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            nodePath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            nodePath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           RootContentNode node = new RootContentNode(ticket, nodePath, objectClasses, docContent, fs);
  @@ -310,11 +310,11 @@
               throws RepositoryException {
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, name);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            nodePath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            nodePath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           HierarchyNode node = new HierarchyNode(ticket, nodePath, objectClasses, fs);
  @@ -383,7 +383,7 @@
   
               // check subfolders in fs (i.e. hierarchy nodes)
               try {
  -                String[] folders = fs.listFolders(FileSystemPathUtil.escape(path));
  +                String[] folders = fs.listFolders(FileSystemPathUtil.escape(elementPath));
                   for (int i = 0; i < folders.length; i++) {
                       String elemName = FileSystemPathUtil.unescape(folders[i]);
                       if (name.equals(elemName)) {
  @@ -391,20 +391,20 @@
                       }
                   }
               } catch (FileSystemException fse) {
  -                log.error("failed to enumerate folders of " + path, fse);
  -                throw new RepositoryException("failed to enumerate folders of " + path, fse);
  +                log.error("failed to enumerate folders of " + elementPath, fse);
  +                throw new RepositoryException("failed to enumerate folders of " + elementPath, fse);
               }
   
               // check xml files (i.e. root content nodes) in current fs folder,
               // excluding .node.xml
               try {
  -                String[] files = fs.listFiles(FileSystemPathUtil.escape(path));
  +                String[] files = fs.listFiles(FileSystemPathUtil.escape(elementPath));
                   for (int i = 0; i < files.length; i++) {
                       String file = files[i];
                       if (file.endsWith(".xml") && !files.equals(NODE_FILE_NAME)) {
                           String elemName = FileSystemPathUtil.unescape(file.substring(0, file.lastIndexOf(".xml")));
                           if (name.equals(elemName)) {
  -                            String contentFilePath = FileSystemPathUtil.escape((path.equals("/") ? "" : path)) + "/" + file;
  +                            String contentFilePath = FileSystemPathUtil.escape((elementPath.equals("/") ? "" : elementPath)) + "/" + file;
                               try {
                                   org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder();
                                   try {
  @@ -422,8 +422,8 @@
                       }
                   }
               } catch (FileSystemException fse) {
  -                log.error("failed to enumerate files of " + path, fse);
  -                throw new RepositoryException("failed to enumerate files of " + path, fse);
  +                log.error("failed to enumerate files of " + elementPath, fse);
  +                throw new RepositoryException("failed to enumerate files of " + elementPath, fse);
               }
           }
   
  @@ -443,8 +443,8 @@
           // check existence
           if (propertyNames.contains(name)) {
               if (!adjustName) {
  -                log.warn("node " + path + " has already a property named " + name);
  -                throw new ElementExistsException("node " + path + " has already a property named " + name);
  +                log.warn("node " + elementPath + " has already a property named " + name);
  +                throw new ElementExistsException("node " + elementPath + " has already a property named " + name);
               }
               name = createUniqueName(name, propertyNames);
           }
  @@ -476,19 +476,19 @@
           // check existence
           if (nodeNames.contains(name)) {
               if (!adjustName) {
  -                log.warn("node " + path + " has already a node named " + name);
  -                throw new ElementExistsException("node " + path + " has already a node named " + name);
  +                log.warn("node " + elementPath + " has already a node named " + name);
  +                throw new ElementExistsException("node " + elementPath + " has already a node named " + name);
               }
               name = createUniqueName(name, nodeNames);
           }
   
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, name);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, name);
           } catch (MalformedPathException e) {
               // erm, ignore...
  -            nodePath = path + "/" + name;
  -            log.error("failed to resolve path " + name + " relative to " + path, e);
  +            nodePath = elementPath + "/" + name;
  +            log.error("failed to resolve path " + name + " relative to " + elementPath, e);
           }
   
           if (objectClasses != null) {
  @@ -500,8 +500,8 @@
                       if (isFile()) {
                           // simulate semantics of predefined objectclass jcroc:File
                           // @todo implement proper objectclass support
  -                        log.error("can't add hierarchy node to file " + path);
  -                        throw new ParentChildMismatchException("can't add hierarchy node to file " + path);
  +                        log.error("can't add hierarchy node to file " + elementPath);
  +                        throw new ParentChildMismatchException("can't add hierarchy node to file " + elementPath);
                       }
                       String folderPath = FileSystemPathUtil.escape(nodePath);
                       try {
  @@ -525,15 +525,15 @@
   	if (isFolder()) {
   	    // simulate semantics of predefined objectclass jcroc:Folder
   	    // @todo implement proper objectclass support
  -	    log.error("can't add content node to folder " + path);
  -	    throw new ParentChildMismatchException("can't add content node to folder " + path);
  +	    log.error("can't add content node to folder " + elementPath);
  +	    throw new ParentChildMismatchException("can't add content node to folder " + elementPath);
   	}
           if (objectClasses != null) {
   	    for (int i = 0; i < objectClasses.length; i++) {
   		String oc = objectClasses[i];
   		if (oc.equals(OC_FILE) || oc.equals(OC_FILE) || oc.equals(OC_FILE)) {
  -		    log.error("can't add hierarchy node to " + path);
  -		    throw new ParentChildMismatchException("can't add hierarchy node to " + path);
  +		    log.error("can't add hierarchy node to " + elementPath);
  +		    throw new ParentChildMismatchException("can't add hierarchy node to " + elementPath);
   		}
   	    }
           }
  @@ -585,8 +585,8 @@
                   String elemName = propElement.getAttributeValue(Serializer.NAME_ATTRIBUTE);
                   if (name.equals(elemName)) {
                       if (!domElement.removeContent(propElement)) {
  -                        log.error("failed to remove property " + name + " from node " + path);
  -                        throw new RepositoryException("failed to remove property " + name + " from node " + path);
  +                        log.error("failed to remove property " + name + " from node " + elementPath);
  +                        throw new RepositoryException("failed to remove property " + name + " from node " + elementPath);
                       }
                       // update our list
                       propertyNames.remove(name);
  @@ -608,8 +608,8 @@
                   String elemName = nodeElement.getAttributeValue(Serializer.NAME_ATTRIBUTE);
                   if (name.equals(elemName)) {
                       if (!domElement.removeContent(nodeElement)) {
  -                        log.error("failed to remove node " + name + " from node " + path);
  -                        throw new RepositoryException("failed to remove node " + name + " from node " + path);
  +                        log.error("failed to remove node " + name + " from node " + elementPath);
  +                        throw new RepositoryException("failed to remove node " + name + " from node " + elementPath);
                       }
   
                       // update our list
  @@ -622,16 +622,16 @@
   
               String nodePath;
               try {
  -                nodePath = PathUtil.makeAbsolutePath(path, name);
  +                nodePath = PathUtil.makeCanonicalPath(elementPath, name);
               } catch (MalformedPathException e) {
                   // erm, ignore...
  -                nodePath = path + "/" + name;
  -                log.error("failed to resolve path " + name + " relative to " + path, e);
  +                nodePath = elementPath + "/" + name;
  +                log.error("failed to resolve path " + name + " relative to " + elementPath, e);
               }
   
               // check subfolders in fs (i.e. hierarchy nodes)
               try {
  -                String[] folders = fs.listFolders(FileSystemPathUtil.escape(path));
  +                String[] folders = fs.listFolders(FileSystemPathUtil.escape(elementPath));
                   for (int i = 0; i < folders.length; i++) {
                       String elemName = FileSystemPathUtil.unescape(folders[i]);
                       if (name.equals(elemName)) {
  @@ -651,20 +651,20 @@
                       }
                   }
               } catch (FileSystemException fse) {
  -                log.error("failed to enumerate folders of " + path, fse);
  -                throw new RepositoryException("failed to enumerate folders of " + path, fse);
  +                log.error("failed to enumerate folders of " + elementPath, fse);
  +                throw new RepositoryException("failed to enumerate folders of " + elementPath, fse);
               }
   
               // check xml files (i.e. root content nodes) in current fs folder,
               // excluding .node.xml
               try {
  -                String[] files = fs.listFiles(FileSystemPathUtil.escape(path));
  +                String[] files = fs.listFiles(FileSystemPathUtil.escape(elementPath));
                   for (int i = 0; i < files.length; i++) {
                       String file = files[i];
                       if (file.endsWith(".xml") && !files.equals(NODE_FILE_NAME)) {
                           String elemName = FileSystemPathUtil.unescape(file.substring(0, file.lastIndexOf(".xml")));
                           if (name.equals(elemName)) {
  -                            String contentFilePath = FileSystemPathUtil.escape((path.equals("/") ? "" : path)) + "/" + file;
  +                            String contentFilePath = FileSystemPathUtil.escape((elementPath.equals("/") ? "" : elementPath)) + "/" + file;
                               try {
                                   fs.deleteFile(contentFilePath);
                               } catch (FileSystemException fse) {
  @@ -681,13 +681,13 @@
                       }
                   }
               } catch (FileSystemException fse) {
  -                log.error("failed to enumerate files of " + path, fse);
  -                throw new RepositoryException("failed to enumerate files of " + path, fse);
  +                log.error("failed to enumerate files of " + elementPath, fse);
  +                throw new RepositoryException("failed to enumerate files of " + elementPath, fse);
               }
           }
   
  -	log.error("there's no sub-element of " + path + " named " + name);
  -        throw new InvalidPathException("there's no sub-element of " + path + " named " + name);
  +	log.error("there's no sub-element of " + elementPath + " named " + name);
  +        throw new InvalidPathException("there's no sub-element of " + elementPath + " named " + name);
       }
   
       //------------------------------------------------------< ElementListener >
  @@ -710,7 +710,7 @@
   	nestedModificationCount--;
           log.debug("element " + elem.getPath() + " has been modified; nested modification count: " + nestedModificationCount);
           if (nestedModificationCount == 0) {
  -            log.debug("saving state of hierarchy node " + path + " due to modification of sub-element " + elem.getPath());
  +            log.debug("saving state of hierarchy node " + elementPath + " due to modification of sub-element " + elem.getPath());
               // we only care about properties and content nodes
               if (elem.isProperty() || !((Node) elem).isHierarchyNode() ||
                       elem == this) {
  @@ -723,10 +723,10 @@
                       out.close();
                   } catch (FileSystemException fse) {
                       // erm...
  -                    log.error("failed to persist state of node " + path, fse);
  +                    log.error("failed to persist state of node " + elementPath, fse);
                   } catch (IOException ioe) {
                       // erm...
  -                    log.error("failed to persist state of node " + path, ioe);
  +                    log.error("failed to persist state of node " + elementPath, ioe);
                   }
               }
           }
  
  
  
  1.3       +86 -86    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/NodeImpl.java
  
  Index: NodeImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/NodeImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NodeImpl.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ NodeImpl.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -169,7 +169,7 @@
               org.jdom.Element ocElement = (org.jdom.Element) iter.next();
               String oc = ocElement.getTextTrim();
               if (oc.length() == 0) {
  -                log.warn("ignoring empty objectclass entry of node " + path);
  +                log.warn("ignoring empty objectclass entry of node " + elementPath);
               } else {
                   ocs.add(oc);
               }
  @@ -239,94 +239,94 @@
       /**
        * @see Node#addFile(String)
        */
  -    public Node addFile(String relativePath)
  +    public Node addFile(String path)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, new String[]{OC_FILE}, false);
  +        return addNode(path, new String[]{OC_FILE}, false);
       }
   
       /**
        * @see Node#addFile(String, boolean)
        */
  -    public Node addFile(String relativePath, boolean adjustName)
  +    public Node addFile(String path, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, new String[]{OC_FILE}, adjustName);
  +        return addNode(path, new String[]{OC_FILE}, adjustName);
       }
   
       /**
        * @see Node#addFolder(String)
        */
  -    public Node addFolder(String relativePath)
  +    public Node addFolder(String path)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, new String[]{OC_FOLDER}, false);
  +        return addNode(path, new String[]{OC_FOLDER}, false);
       }
   
       /**
        * @see Node#addFolder(String, boolean)
        */
  -    public Node addFolder(String relativePath, boolean adjustName)
  +    public Node addFolder(String path, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, new String[]{OC_FOLDER}, adjustName);
  +        return addNode(path, new String[]{OC_FOLDER}, adjustName);
       }
   
       /**
        * @see Node#addHierarchyNode(String)
        */
  -    public Node addHierarchyNode(String relativePath)
  +    public Node addHierarchyNode(String path)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, new String[]{OC_HIERARCHY_NODE}, false);
  +        return addNode(path, new String[]{OC_HIERARCHY_NODE}, false);
       }
   
       /**
        * @see Node#addHierarchyNode(String, boolean)
        */
  -    public Node addHierarchyNode(String relativePath, boolean adjustName)
  +    public Node addHierarchyNode(String path, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, new String[]{OC_HIERARCHY_NODE}, adjustName);
  +        return addNode(path, new String[]{OC_HIERARCHY_NODE}, adjustName);
       }
   
       /**
        * @see Node#addNode(String)
        */
  -    public Node addNode(String relativePath)
  +    public Node addNode(String path)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addNode(relativePath, false);
  +        return addNode(path, false);
       }
   
       /**
        * @see Node#addNode(String, boolean)
        */
  -    public Node addNode(String relativePath, boolean adjustName)
  +    public Node addNode(String path, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, relativePath);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, path);
           } catch (MalformedPathException e) {
  -            log.error("failed to resolve path " + relativePath + " relative to " + path, e);
  -            throw new InvalidPathException("failed to resolve path " + relativePath + " relative to " + path, e);
  +            log.error("failed to resolve path " + path + " relative to " + elementPath, e);
  +            throw new InvalidPathException("failed to resolve path " + path + " relative to " + elementPath, e);
           }
   
           return elemMgr.createNode(nodePath, null, adjustName);
  @@ -490,19 +490,19 @@
       /**
        * @see Node#addNode(String, String[])
        */
  -    public Node addNode(String relativePath, String[] objectClasses)
  +    public Node addNode(String path, String[] objectClasses)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               NoSuchObjectClassException,
               RepositoryException {
  -        return addNode(relativePath, objectClasses, false);
  +        return addNode(path, objectClasses, false);
       }
   
       /**
        * @see Node#addNode(String, String[], boolean)
        */
  -    public Node addNode(String relativePath, String[] objectClasses, boolean adjustName)
  +    public Node addNode(String path, String[] objectClasses, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
  @@ -510,10 +510,10 @@
               RepositoryException {
           String nodePath;
           try {
  -            nodePath = PathUtil.makeAbsolutePath(path, relativePath);
  +            nodePath = PathUtil.makeCanonicalPath(elementPath, path);
           } catch (MalformedPathException e) {
  -            log.error("failed to resolve path " + relativePath + " relative to " + path, e);
  -            throw new InvalidPathException("failed to resolve path " + relativePath + " relative to " + path, e);
  +            log.error("failed to resolve path " + path + " relative to " + elementPath, e);
  +            throw new InvalidPathException("failed to resolve path " + path + " relative to " + elementPath, e);
           }
   
           return elemMgr.createNode(nodePath, objectClasses, adjustName);
  @@ -522,7 +522,7 @@
       /**
        * @see Node#addNode(String, String[], boolean, String)
        */
  -    public Node addNode(String relativePath, String[] objectClasses, boolean adjustName, String versionLabel)
  +    public Node addNode(String path, String[] objectClasses, boolean adjustName, String versionLabel)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
  @@ -531,24 +531,24 @@
           // FIXME we're ignoring versionLabel for now
           // @todo implement addNode(String, String[], boolean, String)
           log.warn("versioning are not supported yet");
  -        return addNode(relativePath, objectClasses, adjustName);
  +        return addNode(path, objectClasses, adjustName);
       }
   
       /**
        * @see Node#addProperty(String)
        */
  -    public Property addProperty(String relativePath)
  +    public Property addProperty(String path)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               RepositoryException {
  -        return addProperty(relativePath, false);
  +        return addProperty(path, false);
       }
   
       /**
        * @see Node#addProperty(String, boolean)
        */
  -    public Property addProperty(String relativePath, boolean adjustName)
  +    public Property addProperty(String path, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
  @@ -556,10 +556,10 @@
               RepositoryException {
           String propPath;
           try {
  -            propPath = PathUtil.makeAbsolutePath(path, relativePath);
  +            propPath = PathUtil.makeCanonicalPath(elementPath, path);
           } catch (MalformedPathException e) {
  -            log.error("failed to resolve path " + relativePath + " relative to " + path, e);
  -            throw new InvalidPathException("failed to resolve path " + relativePath + " relative to " + path, e);
  +            log.error("failed to resolve path " + path + " relative to " + elementPath, e);
  +            throw new InvalidPathException("failed to resolve path " + path + " relative to " + elementPath, e);
           }
   
           return elemMgr.createProperty(propPath, adjustName);
  @@ -568,69 +568,69 @@
       /**
        * @see Node#addProperty(String, String)
        */
  -    public Property addProperty(String relativePath, String value)
  +    public Property addProperty(String path, String value)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               ValueFormatException,
               RepositoryException {
           // delegate to type-neutral addProperty method
  -        return addProperty(relativePath, new SimpleValue(value));
  +        return addProperty(path, new SimpleValue(value));
       }
   
       /**
        * @see Node#addProperty(String, String, boolean)
        */
  -    public Property addProperty(String relativePath, String value, boolean adjustName)
  +    public Property addProperty(String path, String value, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               ValueFormatException,
               RepositoryException {
           // delegate to type-neutral addProperty method
  -        return addProperty(relativePath, new SimpleValue(value));
  +        return addProperty(path, new SimpleValue(value));
       }
   
       /**
        * @see Node#addProperty(String, Value)
        */
  -    public Property addProperty(String relativePath, Value value)
  +    public Property addProperty(String path, Value value)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               ValueFormatException,
               RepositoryException {
  -        return addProperty(relativePath, value, value.getType(), false);
  +        return addProperty(path, value, value.getType(), false);
       }
   
       /**
        * @see Node#addProperty(String, Value, boolean)
        */
  -    public Property addProperty(String relativePath, Value value, boolean adjustName)
  +    public Property addProperty(String path, Value value, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               ValueFormatException,
               RepositoryException {
  -        return addProperty(relativePath, value, value.getType(), adjustName);
  +        return addProperty(path, value, value.getType(), adjustName);
       }
   
       /**
        * @see Node#addProperty(String, Value, PropertyType)
        */
  -    public Property addProperty(String relativePath, Value value, PropertyType type)
  +    public Property addProperty(String path, Value value, PropertyType type)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
               ValueFormatException,
               RepositoryException {
  -        return addProperty(relativePath, value, type, false);
  +        return addProperty(path, value, type, false);
       }
   
       /**
        * @see Node#addProperty(String, Value, PropertyType, boolean)
        */
  -    public Property addProperty(String relativePath, Value value, PropertyType type, boolean adjustName)
  +    public Property addProperty(String path, Value value, PropertyType type, boolean adjustName)
               throws ElementExistsException,
               InvalidPathException,
               ParentChildMismatchException,
  @@ -641,7 +641,7 @@
           // bulk operation is about to start
           notifyStartModification();
           try {
  -            Property prop = addProperty(relativePath, adjustName);
  +            Property prop = addProperty(path, adjustName);
               if (value.getType() == type) {
                   prop.setValue(value);
               } else {
  @@ -891,7 +891,7 @@
           try {
               accept(new Finder(value));
           } catch (RepositoryException e) {
  -            log.error("error while searching properties of " + path, e);
  +            log.error("error while searching properties of " + elementPath, e);
               // fall through
           }
           return new IteratorHelper(Collections.unmodifiableList(matches).iterator());
  @@ -908,11 +908,11 @@
       /**
        * @see Node#getElement(String)
        */
  -    public Element getElement(String relativePath)
  +    public Element getElement(String path)
               throws ElementNotFoundException,
               RepositoryException {
           try {
  -            return elemMgr.getElement(getAbsolutePath(relativePath));
  +            return elemMgr.getElement(getCanonicalPath(path));
           } catch (InvalidPathException ipe) {
               throw new ElementNotFoundException(ipe.getMessage());
           }
  @@ -921,21 +921,21 @@
       /**
        * @see Node#getElement(String, String)
        */
  -    public Element getElement(String relativePath, String versionLabel)
  +    public Element getElement(String path, String versionLabel)
               throws ElementNotFoundException,
               RepositoryException {
           // FIXME we're ignoring the versionLabel for now
  -        return getElement(relativePath);
  +        return getElement(path);
       }
   
       /**
        * @see Node#getElement(String, Calendar)
        */
  -    public Element getElement(String relativePath, Calendar date)
  +    public Element getElement(String path, Calendar date)
               throws ElementNotFoundException,
               RepositoryException {
           // FIXME we're ignoring the versionLabel for now
  -        return getElement(relativePath);
  +        return getElement(path);
       }
   
       /**
  @@ -948,9 +948,9 @@
           // to traverse the hierarchy because this would lead to an infinite
           // recursion!
           try {
  -            return elemMgr.getChildElements(path);
  +            return elemMgr.getChildElements(elementPath);
           } catch (RepositoryException e) {
  -            log.error("failed to retrieve children of " + path, e);
  +            log.error("failed to retrieve children of " + elementPath, e);
               return new IteratorHelper(Collections.EMPTY_LIST.iterator());
           }
       }
  @@ -964,7 +964,7 @@
           try {
               accept(new ChildrenCollector(elements, true, true, depth));
           } catch (RepositoryException e) {
  -            log.error("error while traversing children of " + path, e);
  +            log.error("error while traversing children of " + elementPath, e);
           }
           return new IteratorHelper(Collections.unmodifiableList(elements).iterator());
       }
  @@ -972,10 +972,10 @@
       /**
        * @see Node#getNode(String)
        */
  -    public Node getNode(String relativePath)
  +    public Node getNode(String path)
               throws ElementNotFoundException,
               RepositoryException {
  -        Element e = getElement(relativePath);
  +        Element e = getElement(path);
           if (e.isNode()) {
               return (Node) e;
           } else {
  @@ -993,7 +993,7 @@
           try {
               accept(new ChildrenCollector(nodes, true, false, 1));
           } catch (RepositoryException e) {
  -            log.error("error while traversing children nodes of " + path, e);
  +            log.error("error while traversing children nodes of " + elementPath, e);
           }
           return new IteratorHelper(Collections.unmodifiableList(nodes).iterator());
       }
  @@ -1007,7 +1007,7 @@
           try {
               accept(new ChildrenCollector(nodes, true, false, depth));
           } catch (RepositoryException e) {
  -            log.error("error while traversing child nodes of " + path, e);
  +            log.error("error while traversing child nodes of " + elementPath, e);
           }
           return new IteratorHelper(Collections.unmodifiableList(nodes).iterator());
       }
  @@ -1021,7 +1021,7 @@
           try {
               accept(new ChildrenCollector(properties, false, true, 1));
           } catch (RepositoryException e) {
  -            log.error("error while traversing children properties of " + path, e);
  +            log.error("error while traversing children properties of " + elementPath, e);
           }
           return new IteratorHelper(Collections.unmodifiableList(properties).iterator());
       }
  @@ -1029,10 +1029,10 @@
       /**
        * @see Node#getProperty(String)
        */
  -    public Property getProperty(String relativePath)
  +    public Property getProperty(String path)
               throws ElementNotFoundException,
               RepositoryException {
  -        Element e = getElement(relativePath);
  +        Element e = getElement(path);
           if (e.isProperty()) {
               return (Property) e;
           } else {
  @@ -1064,14 +1064,14 @@
       /**
        * @see Node#hasNode(String)
        */
  -    public boolean hasNode(String relativePath) {
  +    public boolean hasNode(String path) {
           try {
  -            Element e = getElement(relativePath);
  +            Element e = getElement(path);
               return e.isNode();
           } catch (ElementNotFoundException nsee) {
               return false;
           } catch (RepositoryException re) {
  -            log.error("error while testing existence of child-node " + relativePath + " of parent " + path, re);
  +            log.error("error while testing existence of child-node " + path + " of parent " + elementPath, re);
               return false;
           }
       }
  @@ -1086,7 +1086,7 @@
           try {
               accept(new ChildrenCollector(nodes, true, false, 1));
           } catch (RepositoryException e) {
  -            log.error("error while traversing children nodes of " + path, e);
  +            log.error("error while traversing children nodes of " + elementPath, e);
           }
           return !nodes.isEmpty();
       }
  @@ -1101,7 +1101,7 @@
           try {
               accept(new ChildrenCollector(properties, false, true, 1));
           } catch (RepositoryException e) {
  -            log.error("error while traversing children nodes of " + path, e);
  +            log.error("error while traversing children nodes of " + elementPath, e);
           }
           return !properties.isEmpty();
       }
  @@ -1109,14 +1109,14 @@
       /**
        * @see Node#hasProperty(String)
        */
  -    public boolean hasProperty(String relativePath) {
  +    public boolean hasProperty(String path) {
           try {
  -            Element e = getElement(relativePath);
  +            Element e = getElement(path);
               return e.isProperty();
           } catch (ElementNotFoundException nsee) {
               return false;
           } catch (RepositoryException re) {
  -            log.error("error while testing existence of property " + relativePath + " of parent " + path, re);
  +            log.error("error while testing existence of property " + path + " of parent " + elementPath, re);
               return false;
           }
       }
  @@ -1170,15 +1170,15 @@
       /**
        * @see Node#remove(String)
        */
  -    public void remove(String relativePath)
  +    public void remove(String path)
               throws InvalidPathException,
               RepositoryException {
           String elemPath;
           try {
  -            elemPath = PathUtil.makeAbsolutePath(path, relativePath);
  +            elemPath = PathUtil.makeCanonicalPath(elementPath, path);
           } catch (MalformedPathException e) {
  -            log.error("failed to resolve path " + relativePath + " relative to " + path, e);
  -            throw new InvalidPathException("failed to resolve path " + relativePath + " relative to " + path, e);
  +            log.error("failed to resolve path " + path + " relative to " + elementPath, e);
  +            throw new InvalidPathException("failed to resolve path " + path + " relative to " + elementPath, e);
           }
   
           elemMgr.removeElement(elemPath);
  @@ -1187,13 +1187,13 @@
       /**
        * @see Node#hasElement(String)
        */
  -    public boolean hasElement(String relativePath) {
  +    public boolean hasElement(String path) {
           try {
  -            return (getElement(relativePath) != null);
  +            return (getElement(path) != null);
           } catch (ElementNotFoundException nsee) {
               return false;
           } catch (RepositoryException re) {
  -            log.error("error while testing existence of child-element " + relativePath + " of parent " + path, re);
  +            log.error("error while testing existence of child-element " + path + " of parent " + elementPath, re);
               return false;
           }
       }
  @@ -1380,29 +1380,29 @@
       /**
        * @see Node#getNode(String, String)
        */
  -    public Node getNode(String relativePath, String versionID)
  +    public Node getNode(String path, String versionID)
               throws ElementNotFoundException,
               RepositoryException {
           // FIXME we're ignoring the versionID for now
           // @todo implement getNode(String, String)
  -        return getNode(relativePath);
  +        return getNode(path);
       }
   
       /**
        * @see Node#getNode(String, Calendar)
        */
  -    public Node getNode(String relativePath, Calendar date)
  +    public Node getNode(String path, Calendar date)
               throws ElementNotFoundException,
               RepositoryException {
           // FIXME we're ignoring the date for now
           // @todo implement getNode(String, Calendar)
  -        return getNode(relativePath);
  +        return getNode(path);
       }
   
       /**
        * @see Node#orderElement(String, String)
        */
  -    public void orderElement(String relativePath, String beforeName)
  +    public void orderElement(String path, String beforeName)
               throws InvalidPathException,
               RepositoryException {
           // @todo implement orderElement(String, String)
  
  
  
  1.3       +19 -19    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java
  
  Index: PropertyImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/PropertyImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PropertyImpl.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ PropertyImpl.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -196,7 +196,7 @@
               try {
                   readValue();
               } catch (RepositoryException e) {
  -                log.error("value of " + path + " could not be read", e);
  +                log.error("value of " + elementPath + " could not be read", e);
                   return null;
               }
           }
  @@ -316,8 +316,8 @@
                       base64Out.close();
                       domElement.addContent(bo.toString("US-ASCII"));
                   } catch (IOException ioe) {
  -                    log.error("error while serializing value of property " + path, ioe);
  -                    throw new RepositoryException("error while decoding value of property " + path, ioe);
  +                    log.error("error while serializing value of property " + elementPath, ioe);
  +                    throw new RepositoryException("error while decoding value of property " + elementPath, ioe);
                   }
               } else {
                   // escape '<' and '&'
  @@ -351,9 +351,9 @@
           try {
               return getValue().getDate();
           } catch (NullPointerException npe) {
  -            log.warn("getValue() for " + path + " failed", npe);
  +            log.warn("getValue() for " + elementPath + " failed", npe);
           } catch (RepositoryException re) {
  -            log.error("getValue().getDate() for " + path + " failed", re);
  +            log.error("getValue().getDate() for " + elementPath + " failed", re);
           }
           Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
           cal.setTime(new Date(0));
  @@ -367,9 +367,9 @@
           try {
               return getValue().getBoolean();
           } catch (NullPointerException npe) {
  -            log.warn("getValue() for " + path + " failed", npe);
  +            log.warn("getValue() for " + elementPath + " failed", npe);
           } catch (RepositoryException re) {
  -            log.error("getValue().getBoolean() for " + path + " failed", re);
  +            log.error("getValue().getBoolean() for " + elementPath + " failed", re);
           }
           return false;
       }
  @@ -381,9 +381,9 @@
           try {
               return getValue().getLong();
           } catch (NullPointerException npe) {
  -            log.warn("getValue() for " + path + " failed", npe);
  +            log.warn("getValue() for " + elementPath + " failed", npe);
           } catch (RepositoryException re) {
  -            log.error("getValue().getLong() for " + path + " failed", re);
  +            log.error("getValue().getLong() for " + elementPath + " failed", re);
           }
           return 0;
       }
  @@ -395,9 +395,9 @@
           try {
               return getValue().getDouble();
           } catch (NullPointerException npe) {
  -            log.warn("getValue() for " + path + " failed", npe);
  +            log.warn("getValue() for " + elementPath + " failed", npe);
           } catch (RepositoryException re) {
  -            log.error("getValue().getDouble() for " + path + " failed", re);
  +            log.error("getValue().getDouble() for " + elementPath + " failed", re);
           }
           return Double.NaN;
       }
  @@ -409,9 +409,9 @@
           try {
               return getValue().getStream();
           } catch (NullPointerException npe) {
  -            log.warn("getValue() for " + path + " failed", npe);
  +            log.warn("getValue() for " + elementPath + " failed", npe);
           } catch (RepositoryException re) {
  -            log.error("getValue().getStream() for " + path + " failed", re);
  +            log.error("getValue().getStream() for " + elementPath + " failed", re);
           }
           return new ByteArrayInputStream(new byte[0]);
       }
  @@ -423,9 +423,9 @@
           try {
               return getValue().getString();
           } catch (NullPointerException npe) {
  -            log.warn("getValue() for " + path + " failed", npe);
  +            log.warn("getValue() for " + elementPath + " failed", npe);
           } catch (RepositoryException re) {
  -            log.error("getValue().getString() for " + path + " failed", re);
  +            log.error("getValue().getString() for " + elementPath + " failed", re);
           }
           return "";
       }
  
  
  
  1.3       +7 -7      jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/RootContentNode.java
  
  Index: RootContentNode.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/core/RootContentNode.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RootContentNode.java	18 Mar 2003 15:06:04 -0000	1.2
  +++ RootContentNode.java	14 Apr 2003 15:12:51 -0000	1.3
  @@ -140,7 +140,7 @@
   	nestedModificationCount--;
           log.debug("element " + elem.getPath() + " has been modified; nested modification count: " + nestedModificationCount);
           if (nestedModificationCount == 0) {
  -            log.debug("saving state of root content node " + path + " due to modification of sub-element " + elem.getPath());
  +            log.debug("saving state of root content node " + elementPath + " due to modification of sub-element " + elem.getPath());
               XMLOutputter xmlOut = new XMLOutputter();
               xmlOut.setIndent(4);
               xmlOut.setNewlines(true);
  @@ -150,10 +150,10 @@
                   out.close();
               } catch (FileSystemException fse) {
                   // erm...
  -                log.error("failed to persist state of node " + path, fse);
  +                log.error("failed to persist state of node " + elementPath, fse);
               } catch (IOException ioe) {
                   // erm...
  -                log.error("failed to persist state of node " + path, ioe);
  +                log.error("failed to persist state of node " + elementPath, ioe);
               }
           }
       }
  
  
  
  1.3       +38 -24    jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/util/PathUtil.java
  
  Index: PathUtil.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/proposals/jcrri/src/org/apache/slide/jcr/util/PathUtil.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PathUtil.java	18 Mar 2003 15:06:13 -0000	1.2
  +++ PathUtil.java	14 Apr 2003 15:12:52 -0000	1.3
  @@ -76,29 +76,35 @@
   public final class PathUtil {
   
       /**
  -     * Builds a canonical path, i.e. special path elements "." and ".."
  -     * are normalized.
  +     * Builds a canonical path of the specified path.
  +     * <p>
  +     * A canonical path is both absolute and unique.
  +     * The special path elements "." and ".." are normalized.
        *
  -     * @param path path which should be resolved as a canonical path
  +     * @param absolutePath absolute path which should be resolved as a canonical path
        * @return a canonical path
  -     * @throws MalformedPathException if the path is malformed (e.g. "/../../foo").
  +     * @throws MalformedPathException if the specified path is malformed
  +     * (e.g. "/../../foo") or if it is not an absolute path.
        */
  -    public static String makeCanonicalPath(String path)
  +    public static String makeCanonicalPath(String absolutePath)
               throws MalformedPathException {
  +        if (!absolutePath.startsWith("/")) {
  +            throw new MalformedPathException("'" + absolutePath + "' is not an absolute path");
  +        }
           // check for "." and ".." path elements
           // (just an optimization, not 100% accurate;
           //  e.g. "/foo/.foo1" would incorrectly pass it)
  -        if (path.indexOf("./") >= 0 || path.indexOf("/.") >= 0) {
  +        if (absolutePath.indexOf("./") >= 0 || absolutePath.indexOf("/.") >= 0) {
               LinkedList queue = new LinkedList();
               int start = 0;
               while (start >= 0) {
  -                int end = path.indexOf('/', start + 1);
  -                String element = path.substring(start + 1, end == -1 ? path.length() : end);
  +                int end = absolutePath.indexOf('/', start + 1);
  +                String element = absolutePath.substring(start + 1, end == -1 ? absolutePath.length() : end);
                   if (element.equals(".")) {
                       // ignore
                   } else if (element.equals("..")) {
                       if (queue.isEmpty()) {
  -                        throw new MalformedPathException("'" + path + "' is not a valid path");
  +                        throw new MalformedPathException("'" + absolutePath + "' is not a valid path");
                       }
                       queue.removeLast();
                   } else {
  @@ -114,28 +120,36 @@
               }
               return buf.toString();
           } else {
  -            return path;
  +            return absolutePath;
           }
       }
   
       /**
  -     * Builds an absolute path from a parent path and a relative path.
  +     * Builds a canonical path of the specified paths.
  +     * <p>
  +     * A canonical path is both absolute and unique.
        * The special path elements "." and ".." are normalized.
  +     * <p>
  +     * If <code>somePath</code> specifies a relative path (i.e. one not
  +     * starting with  "/") then it is interpreted as being relative to
  +     * <code>parentPath</code>; otherwise <code>parentPath</code> is ignored.
        *
  -     * @param parentPath parent path used to resolve the relative path with.
  -     * @param relativePath relative path to resolve with the parent path.
  -     * @return an absolute path
  +     * @param parentPath parent path used to resolve a relative path with.
  +     * @param somePath either relative or absolute path.
  +     * @return a canonical path
        * @throws MalformedPathException if at least one of the specified paths
        * is malformed or if the resulting absolute path is malformed (e.g. "/../../foo")
        */
  -    public static String makeAbsolutePath(String parentPath, String relativePath)
  +    public static String makeCanonicalPath(String parentPath, String somePath)
           throws MalformedPathException {
  -        if (relativePath.startsWith("/")) {
  -            throw new MalformedPathException("'" + relativePath + "' is not a valid relative path");
  +        // @todo add additonal validations
  +        if (somePath.startsWith("/")) {
  +            return makeCanonicalPath(somePath);
  +        } else {
  +            // make absolute path
  +            String absPath = (parentPath.equals("/") ? "" : parentPath) + "/" + somePath;
  +            return makeCanonicalPath(absPath);
           }
  -	// @todo add additonal validations
  -        String absPath = (parentPath.equals("/") ? "" : parentPath) + "/" + relativePath;
  -        return makeCanonicalPath(absPath);
       }
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: slide-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-dev-help@jakarta.apache.org