use of org.geotoolkit.gml.xml.v321.FileType in project jackrabbit by apache.
the class VFSTestUtils method deleteAllDescendantFiles.
/**
* Deletes all the descendant files under the folder.
* @param folderObject folder object
* @throws FileSystemException if any file system exception occurs
* @throws DataStoreException if any file system exception occurs
*/
static void deleteAllDescendantFiles(FileObject folderObject) throws FileSystemException, DataStoreException {
List<FileObject> children = VFSUtils.getChildFileOrFolders(folderObject);
FileType fileType;
for (FileObject child : children) {
fileType = child.getType();
if (fileType == FileType.FILE) {
boolean deleted = child.delete();
if (!deleted) {
LOG.warn("File not deleted: {}", child.getName().getFriendlyURI());
}
} else if (fileType == FileType.FOLDER) {
deleteAllDescendantFiles(child);
}
}
}
use of org.geotoolkit.gml.xml.v321.FileType in project pentaho-kettle by pentaho.
the class ConnectionFileNameParser method parseUri.
public static AbstractFileName parseUri(String uri, FileNameParser fileNameParser) throws FileSystemException {
StringBuilder name = new StringBuilder();
String scheme = UriParser.extractScheme(uri, name);
UriParser.canonicalizePath(name, 0, name.length(), fileNameParser);
UriParser.fixSeparators(name);
FileType fileType = UriParser.normalisePath(name);
// Extract the named connection name
final String connection = UriParser.extractFirstElement(name);
String path = name.toString();
return new ConnectionFileName(scheme, connection, path, fileType);
}
use of org.geotoolkit.gml.xml.v321.FileType in project pentaho-kettle by pentaho.
the class GoogleDriveFileObject method resolveFileMetadata.
private void resolveFileMetadata() throws Exception {
String parentId = null;
if (getName().getParent() != null) {
File parent = searchFile(getName().getParent().getBaseName(), null);
if (parent != null) {
FileType mime = MIME_TYPES.get(parent.getMimeType());
if (mime.equals(FileType.FOLDER)) {
parentId = parent.getId();
}
}
}
String fileName = getName().getBaseName();
File file = searchFile(fileName, parentId);
if (file != null) {
mimeType = MIME_TYPES.get(file.getMimeType());
id = file.getId();
} else {
if (getName().getURI().equals(GoogleDriveFileProvider.SCHEME + ":///")) {
mimeType = FileType.FOLDER;
}
}
}
use of org.geotoolkit.gml.xml.v321.FileType in project pentaho-platform by pentaho.
the class SolutionRepositoryVfsFileObject method getName.
public FileName getName() {
initFile();
FileType fileType = null;
try {
fileType = getType();
} catch (Exception ex) {
fileType = FileType.FOLDER;
}
return new SolutionRepositoryFileName(fileRef, fileType);
}
use of org.geotoolkit.gml.xml.v321.FileType in project spoofax by metaborg.
the class ResourceAgent method isDirectory.
@Override
public boolean isDirectory(String fn) {
try {
final FileObject resource = resourceService.resolve(workingDir, fn);
final FileType type = resource.getType();
return type == FileType.FOLDER || type == FileType.FILE_OR_FOLDER;
} catch (FileSystemException e) {
throw new RuntimeException("Could not check if file " + fn + " is a directory", e);
}
}
Aggregations