com.sap.hana.datalake.files.HdlfsFileStatus Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sap-hdlfs Show documentation
Show all versions of sap-hdlfs Show documentation
An implementation of org.apache.hadoop.fs.FileSystem targeting SAP HANA Data Lake Files.
// © 2021-2022 SAP SE or an SAP affiliate company. All rights reserved.
package com.sap.hana.datalake.files;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
import java.net.URI;
public class HdlfsFileStatus extends FileStatus {
private static Path computePath(final URI fileStatusUri, final boolean fsUriRequiresPort, final URI fsUri) {
if (fsUriRequiresPort) {
return new Path(HdlfsFileSystem.SCHEME, fsUri.getAuthority(), fileStatusUri.getPath());
} else {
return new Path(HdlfsFileSystem.SCHEME, fsUri.getHost(), fileStatusUri.getPath());
}
}
public HdlfsFileStatus(final FileStatus fileStatus, final URI fileStatusUri, final boolean fsUriRequiresPort, final URI fsUri) {
super(fileStatus.getLen(), fileStatus.isDirectory(), fileStatus.getReplication(), fileStatus.getBlockSize(), fileStatus.getModificationTime(),
0L, null, fileStatus.getOwner(), fileStatus.getGroup(), computePath(fileStatusUri, fsUriRequiresPort, fsUri));
}
public static HdlfsFileStatus create(final FileStatus fileStatus, final boolean fsUriRequiresPort, final URI fsUri) {
return new HdlfsFileStatus(fileStatus, fileStatus.getPath().toUri(), fsUriRequiresPort, fsUri);
}
}
// © 2021-2022 SAP SE or an SAP affiliate company. All rights reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy