import javax.jcr.nodetype.NodeType;
import javax.jcr.nodetype.PropertyDefinition;
-import org.apache.commons.io.FileExistsException;
import org.argeo.jcr.JcrUtils;
public abstract class JcrFileSystemProvider extends FileSystemProvider {
}
if (!node.isNodeType(NodeType.NT_FILE))
throw new UnsupportedOperationException(node + " must be a file");
- return new BinaryChannel(node);
+ return new BinaryChannel(node, path);
} catch (RepositoryException e) {
discardChanges(node);
throw new IOException("Cannot read file", e);
public DirectoryStream<Path> newDirectoryStream(Path dir, Filter<? super Path> filter) throws IOException {
try {
Node base = toNode(dir);
+ if (base == null)
+ throw new IOException(dir + " is not a JCR node");
return new NodeDirectoryStream((JcrFileSystem) dir.getFileSystem(), base.getNodes(), filter);
} catch (RepositoryException e) {
throw new IOException("Cannot list directory", e);
node.addMixin(NodeType.MIX_LAST_MODIFIED);
node.getSession().save();
} else {
- if (!node.getPrimaryNodeType().isNodeType(NodeType.NT_FOLDER))
- throw new FileExistsException(dir + " exists and is not a directory");
+ // if (!node.getPrimaryNodeType().isNodeType(NodeType.NT_FOLDER))
+ // throw new FileExistsException(dir + " exists and is not a directory");
}
} catch (RepositoryException e) {
discardChanges(node);
@Override
public boolean isHidden(Path path) throws IOException {
- return false;
+ return path.getFileName().toString().charAt(0) == '.';
}
@Override