All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.sap.hana.datalake.files.HdlfsFileStatus Maven / Gradle / Ivy

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 final Path computePath(final URI fileStatusUri, final boolean fsUriRequiresPort) {
    if (fsUriRequiresPort) {
      return new Path(HdlfsFileSystem.SCHEME, fileStatusUri.getAuthority(), fileStatusUri.getPath());
    } else {
      return new Path(HdlfsFileSystem.SCHEME, fileStatusUri.getHost(), fileStatusUri.getPath());
    }
  }

  public HdlfsFileStatus(final FileStatus fileStatus, final URI fileStatusUri, final boolean fsUriRequiresPort) {
    super(fileStatus.getLen(), fileStatus.isDirectory(), fileStatus.getReplication(), fileStatus.getBlockSize(), fileStatus.getModificationTime(),
            0L, null, fileStatus.getOwner(), fileStatus.getGroup(), computePath(fileStatusUri, fsUriRequiresPort));
  }

  public static HdlfsFileStatus create(final FileStatus fileStatus, final boolean fsUriRequiresPort) {
    return new HdlfsFileStatus(fileStatus, fileStatus.getPath().toUri(), fsUriRequiresPort);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy