use of org.geotoolkit.gml.xml.v321.FileType in project hop by apache.
the class S3AFileNameParser method parseUri.
@Override
public FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException {
StringBuilder name = new StringBuilder();
String scheme = UriParser.extractScheme(uri, name);
UriParser.canonicalizePath(name, 0, name.length(), this);
// Normalize separators in the path
UriParser.fixSeparators(name);
// Normalise the path
FileType fileType = UriParser.normalisePath(name);
// Extract bucket name
final String bucketName = UriParser.extractFirstElement(name);
return new S3AFileName(scheme, bucketName, name.toString(), fileType);
}
use of org.geotoolkit.gml.xml.v321.FileType in project hop by apache.
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 big-data-plugin by pentaho.
the class S3FileNameParser method parseUri.
public FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException {
StringBuilder buffer = new StringBuilder();
String scheme = UriParser.extractScheme(uri, buffer);
UriParser.canonicalizePath(buffer, 0, buffer.length(), this);
// Normalize separators in the path
UriParser.fixSeparators(buffer);
// Normalise the path
FileType fileType = UriParser.normalisePath(buffer);
// URI includes credentials
String keys = S3Util.getFullKeysFromURI(buffer.toString());
if (keys != null) {
buffer.replace(buffer.indexOf(keys), buffer.indexOf(keys) + keys.length(), "");
}
String path = buffer.toString();
// Extract bucket name
String bucketName = UriParser.extractFirstElement(buffer);
if (keys != null) {
bucketName = keys + bucketName;
return new S3FileName(scheme, bucketName, buffer.length() == 0 ? path : buffer.toString(), fileType, keys);
}
return new S3FileName(scheme, bucketName, path, fileType);
}
use of org.geotoolkit.gml.xml.v321.FileType in project big-data-plugin by pentaho.
the class S3AFileNameParser method parseUri.
public FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException {
StringBuilder buffer = new StringBuilder();
String scheme = UriParser.extractScheme(uri, buffer);
UriParser.canonicalizePath(buffer, 0, buffer.length(), this);
// Normalize separators in the path
UriParser.fixSeparators(buffer);
// Normalise the path
FileType fileType = UriParser.normalisePath(buffer);
// URI includes credentials
String keys = S3Util.getFullKeysFromURI(buffer.toString());
if (keys != null) {
buffer.replace(buffer.indexOf(keys), buffer.indexOf(keys) + keys.length(), "");
}
String path = buffer.toString();
// Extract bucket name
String bucketName = UriParser.extractFirstElement(buffer);
if (keys != null) {
bucketName = keys + bucketName;
return new S3AFileName(scheme, bucketName, buffer.length() == 0 ? path : buffer.toString(), fileType, keys);
}
return new S3AFileName(scheme, bucketName, path, fileType);
}
use of org.geotoolkit.gml.xml.v321.FileType in project big-data-plugin by pentaho.
the class S3NFileNameParser method parseUri.
public FileName parseUri(VfsComponentContext context, FileName base, String uri) throws FileSystemException {
StringBuilder buffer = new StringBuilder();
String scheme = UriParser.extractScheme(uri, buffer);
UriParser.canonicalizePath(buffer, 0, buffer.length(), this);
// Normalize separators in the path
UriParser.fixSeparators(buffer);
// Normalise the path
FileType fileType = UriParser.normalisePath(buffer);
// URI includes credentials
String keys = S3Util.getFullKeysFromURI(buffer.toString());
if (keys != null) {
buffer.replace(buffer.indexOf(keys), buffer.indexOf(keys) + keys.length(), "");
}
String path = buffer.toString();
// Extract bucket name
String bucketName = UriParser.extractFirstElement(buffer);
if (keys != null) {
bucketName = keys + bucketName;
return new S3NFileName(scheme, bucketName, buffer.length() == 0 ? path : buffer.toString(), fileType, keys);
}
return new S3NFileName(scheme, bucketName, path, fileType);
}
Aggregations