use of org.apache.commons.vfs2.FileName in project jackrabbit by apache.
the class VFSDataStore method init.
@Override
public void init(String homeDir) throws RepositoryException {
overridePropertiesFromConfig();
if (baseFolderUri == null) {
throw new RepositoryException("VFS base folder URI must be set.");
}
fileSystemManager = createFileSystemManager();
FileName baseFolderName = null;
try {
baseFolderName = fileSystemManager.resolveURI(baseFolderUri);
FileSystemOptions fso = getFileSystemOptions();
if (fso != null) {
baseFolder = fileSystemManager.resolveFile(baseFolderUri, fso);
} else {
baseFolder = fileSystemManager.resolveFile(baseFolderUri);
}
baseFolder.createFolder();
} catch (FileSystemException e) {
throw new RepositoryException("Could not initialize the VFS base folder at '" + (baseFolderName == null ? "" : baseFolderName.getFriendlyURI()) + "'.", e);
}
super.init(homeDir);
}
use of org.apache.commons.vfs2.FileName in project zeppelin by apache.
the class VFSNotebookRepo method list.
@Override
public List<NoteInfo> list(AuthenticationInfo subject) throws IOException {
FileObject rootDir = getRootDir();
FileObject[] children = rootDir.getChildren();
List<NoteInfo> infos = new LinkedList<>();
for (FileObject f : children) {
String fileName = f.getName().getBaseName();
if (f.isHidden() || fileName.startsWith(".") || fileName.startsWith("#") || fileName.startsWith("~")) {
// skip hidden, temporary files
continue;
}
if (!isDirectory(f)) {
// so it must be a directory
continue;
}
NoteInfo info = null;
try {
info = getNoteInfo(f);
if (info != null) {
infos.add(info);
}
} catch (Exception e) {
LOG.error("Can't read note " + f.getName().toString(), e);
}
}
return infos;
}
Aggregations