Class Package

java.lang.Object
org.fedoraproject.xmvn.tools.install.Package
Direct Known Subclasses:
JavaPackage

public class Package extends Object
Class describing a binary package as a set of files.
Author:
Mikolaj Izdebski
  • Field Details

  • Constructor Details

    • Package

      public Package(String id)
      Create an empty package with given ID.
      Parameters:
      id - package ID
  • Method Details

    • getId

      public String getId()
      Get unique string identifying this package.
      Returns:
      package ID
    • getFiles

      public Set<File> getFiles()
      Get files contained in this package.
      Returns:
      list view of files that will be installed with this package
    • addFile

      public void addFile(File file)
      Add a file to this package. The package must not already contains the file.
      Parameters:
      file - file to be added
    • addFileIfNotExists

      public void addFileIfNotExists(File file)
      Add a file to this package if id doesn't already exist in the package.
      Parameters:
      file - file to be added
    • install

      public void install(Path installRoot) throws IOException
      Install this package into specified root.

      Package installation is equivalent to installation of all files it contains.

      Target directory won't be overwritten if it already exists, which allows installation of multiple packages into the same directory.

      Parameters:
      installRoot - target directory where package files will be installed
      Throws:
      IOException
    • writeDescriptor

      public void writeDescriptor(Path descriptorPath) throws IOException
      Write package descriptor (aka mfiles) into specified file.

      If target file exists then it shall be overwritten.

      Parameters:
      descriptorPath - path to file into which descriptor shall be written
      Throws:
      IOException
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

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

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