if (node == null) {
Node parent = toNode(path.getParent());
if (parent == null)
- throw new JcrFsException("No parent directory for " + path);
+ throw new IOException("No parent directory for " + path);
if (parent.getPrimaryNodeType().isNodeType(NodeType.NT_FILE)
|| parent.getPrimaryNodeType().isNodeType(NodeType.NT_LINKED_FILE))
- throw new JcrFsException(path + " parent is a file");
+ throw new IOException(path + " parent is a file");
String fileName = path.getFileName().toString();
fileName = Text.escapeIllegalJcrChars(fileName);
throw new UnsupportedOperationException(node + " must be a file");
return new BinaryChannel(node);
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot read file", e);
+ throw new IOException("Cannot read file", e);
}
}
Node base = toNode(dir);
return new NodeDirectoryStream((JcrFileSystem) dir.getFileSystem(), base.getNodes(), filter);
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot list directory", e);
+ throw new IOException("Cannot list directory", e);
}
}
throw new IOException("Parent of " + dir + " does not exist");
if (parent.getPrimaryNodeType().isNodeType(NodeType.NT_FILE)
|| parent.getPrimaryNodeType().isNodeType(NodeType.NT_LINKED_FILE))
- throw new JcrFsException(dir + " parent is a file");
+ throw new IOException(dir + " parent is a file");
String fileName = dir.getFileName().toString();
fileName = Text.escapeIllegalJcrChars(fileName);
node = parent.addNode(fileName, NodeType.NT_FOLDER);
throw new FileExistsException(dir + " exists and is not a directory");
}
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot create directory " + dir, e);
+ throw new IOException("Cannot create directory " + dir, e);
}
}
}
session.save();
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot delete " + path, e);
+ throw new IOException("Cannot delete " + path, e);
}
}
JcrUtils.copy(sourceNode, targetNode);
sourceNode.getSession().save();
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot copy from " + source + " to " + target, e);
+ throw new IOException("Cannot copy from " + source + " to " + target, e);
}
}
session.move(sourceNode.getPath(), target.toString());
session.save();
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot move from " + source + " to " + target, e);
+ throw new IOException("Cannot move from " + source + " to " + target, e);
}
}
Node node2 = toNode(path2);
return node.isSame(node2);
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot check whether " + path + " and " + path2 + " are same", e);
+ throw new IOException("Cannot check whether " + path + " and " + path2 + " are same", e);
}
}
throw new NoSuchFileException(path + " does not exist");
// TODO check access via JCR api
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot delete " + path, e);
+ throw new IOException("Cannot delete " + path, e);
}
}
try {
// TODO check if assignable
Node node = toNode(path);
+ if (node == null) {
+ throw new IOException("JCR node not found for " + path);
+ }
return (A) new JcrBasicfileAttributes(node);
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot read basic attributes of " + path, e);
+ throw new IOException("Cannot read basic attributes of " + path, e);
}
}
}
return res;
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot read attributes of " + path, e);
+ throw new IOException("Cannot read attributes of " + path, e);
}
}
}
node.getSession().save();
} catch (RepositoryException e) {
- throw new JcrFsException("Cannot set attribute " + attribute + " on " + path, e);
+ throw new IOException("Cannot set attribute " + attribute + " on " + path, e);
}
}
return ((JcrPath) path).getNode();
}
+ /**
+ * To be overriden in order to support the ~ path, with an implementation
+ * specific concept of user home.
+ *
+ * @return null by default
+ */
+ public Node getUserHome(Session session) {
+ return null;
+ }
}