public Directory addDirectory(ServerResourcePath path) { if (null == path) { throw new IllegalArgumentException(); } Directory result = this.directory; ServerResourcePath subPath = path; String fileName; while (subPath != null && (fileName = subPath.getFileName()) != null) { result = adapter.addDirectory(result, fileName); subPath = subPath.getNextPath(); } return result; }
public Directory addDirectory(ServerResourcePath path) { if (null == path) { throw new IllegalArgumentException(); } Directory result = this.directory; ServerResourcePath subPath = path; String fileName; while (subPath != null && (fileName = subPath.getFileName()) != null) { result = adapter.addDirectory(result, fileName); subPath = subPath.getNextPath(); } return result; }
public Resource getResource(ServerResourcePath path) { if (null == path) { throw new NullPointerException(); } Resource resource = null; //children.get(path.getName()); String fileName = path.getFileName(); if (fileName == null) { // Path points to the resource itself. resource = this.directory; } else { resource = children.get(fileName); if (resource != null && path.hasNextPath()) { // Get next resource in the tree, if exists. resource = adapter.getResource(resource, path.getNextPath()); } } return resource; }
public Resource getResource(ServerResourcePath path) { if (null == path) { throw new NullPointerException(); } Resource resource = null; //children.get(path.getName()); String fileName = path.getFileName(); if (fileName == null) { // Path points to the resource itself. resource = this.directory; } else { resource = children.get(fileName); if (resource != null && path.hasNextPath()) { // Get next resource in the tree, if exists. resource = adapter.getResource(resource, path.getNextPath()); } } return resource; }
public void addResource(ServerResourcePath path, Resource resource) { if (null == path) { throw new IllegalArgumentException(); } String fileName = path.getFileName(); if (fileName == null) { throw new IllegalArgumentException(); } if (path.hasNextPath()) { Directory childResource = addDirectory(fileName); adapter.addResource(childResource, path.getNextPath(), resource); } else { putChild(fileName, resource); } }
public void addResource(ServerResourcePath path, Resource resource) { if (null == path) { throw new IllegalArgumentException(); } String fileName = path.getFileName(); if (fileName == null) { throw new IllegalArgumentException(); } if (path.hasNextPath()) { Directory childResource = addDirectory(fileName); adapter.addResource(childResource, path.getNextPath(), resource); } else { putChild(fileName, resource); } }