Class Package
- java.lang.Object
-
- org.fedoraproject.xmvn.tools.install.Package
-
- Direct Known Subclasses:
JavaPackage
public class Package extends java.lang.ObjectClass describing a binary package as a set of files.- Author:
- Mikolaj Izdebski
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMAINID of main package.
-
Constructor Summary
Constructors Constructor Description Package(java.lang.String id)Create an empty package with given ID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddFile(File file)Add a file to this package.voidaddFileIfNotExists(File file)Add a file to this package if id doesn't already exist in the package.booleanequals(java.lang.Object rhs)java.util.Set<File>getFiles()Get files contained in this package.java.lang.StringgetId()Get unique string identifying this package.inthashCode()voidinstall(java.nio.file.Path installRoot)Install this package into specified root.java.lang.StringtoString()voidwriteDescriptor(java.nio.file.Path descriptorPath)Write package descriptor (akamfiles) into specified file.
-
-
-
Field Detail
-
MAIN
public static final java.lang.String MAIN
ID of main package.- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public java.lang.String getId()
Get unique string identifying this package.- Returns:
- package ID
-
getFiles
public java.util.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(java.nio.file.Path installRoot) throws java.io.IOExceptionInstall 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:
java.io.IOException
-
writeDescriptor
public void writeDescriptor(java.nio.file.Path descriptorPath) throws java.io.IOExceptionWrite package descriptor (akamfiles) into specified file.If target file exists then it shall be overwritten.
- Parameters:
descriptorPath- path to file into which descriptor shall be written- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object rhs)
- Overrides:
equalsin classjava.lang.Object
-
-