java.lang.Object
org.fedoraproject.xmvn.tools.install.File
Direct Known Subclasses:
Directory, RegularFile, SymbolicLink

public abstract class File extends Object
An abstract class denoting a file entry in a package with all relevant attributes.

A file does not necessarily mean a regular file, it could be for example a directory or a device file.

Author:
Mikolaj Izdebski
  • Constructor Details

    • File

      public File(Path targetPath)
      Create a file object with specified path and default access mode of 0644.
      Parameters:
      targetPath - file path, relative to installation root
    • File

      public File(Path targetPath, int accessMode)
      Create a file object with specified path and access mode.
      Parameters:
      targetPath - file path, relative to installation root
      accessMode - Unix access mode of the file (must be an integer in range from 0 to 0777)
  • Method Details

    • installContents

      protected abstract void installContents(Path targetAbsolutePath) throws IOException
      Install the file into specified location.

      Implementations of this method can assume that all parent directory of target file already exists. Access mode of target file doesn't have to be set as it will be manipulated with other means.

      Parameters:
      targetAbsolutePath - absolute path to the target file
      Throws:
      IOException
    • getDescriptorExtra

      protected String getDescriptorExtra()
      Get additional file attributes to be added to file descriptor.

      By default there are no extra attributes, but subclasses can override this method and specify it.

      Returns:
      extra descriptor data (can be null)
    • getTargetPath

      public Path getTargetPath()
      Return path to target file. Returned path is always relative to buildroot (never absolute).
      Returns:
      file target path (never null)
    • getAccessMode

      public int getAccessMode()
      Get Unix access mode for this file.
      Returns:
      Unix access mode (an integer in range from 0 to 0777)
    • install

      public void install(Path installRoot) throws IOException
      Install file into specified root directory.
      Parameters:
      installRoot -
      Throws:
      IOException
    • getDescriptor

      public String getDescriptor()
      Get descriptor string for given file.

      Descriptor is a line containing file path and some attributes. In other words, descriptor is a single line from .mfiles describing the file.

      Returns:
      descriptor string
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object rhs)
      Overrides:
      equals in class Object