com.izforge.izpack
Class PackFile

java.lang.Object
  extended by com.izforge.izpack.PackFile
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
XPackFile

public class PackFile
extends java.lang.Object
implements java.io.Serializable

Encloses information about a packed file. This class abstracts the way file data is stored to package.

Author:
Johannes Lehtinen
See Also:
Serialized Form

Field Summary
private  java.util.Map additionals
          Additional attributes or any else for customisation
private  java.lang.String condition
          condition for this packfile
private  boolean isDirectory
          True if file is a directory (length should be 0 or ignored)
private  long length
          The length of the file in bytes
private  long mtime
          The last-modification time of the file.
 long offsetInPreviousPack
           
private  java.util.List<OsConstraint> osConstraints
          The target operating system constraints of this file
private  int override
          Whether or not this file is going to override any existing ones
static int OVERRIDE_ASK_FALSE
           
static int OVERRIDE_ASK_TRUE
           
static int OVERRIDE_FALSE
           
static int OVERRIDE_TRUE
           
static int OVERRIDE_UPDATE
           
private  boolean pack200Jar
          True if the file is a Jar and pack200 compression us activated.
 java.lang.String previousPackId
           
protected  java.lang.String relativePath
          The Path of the file relative to the given (compiletime's) basedirectory.
(package private) static long serialVersionUID
           
 java.lang.String sourcePath
          Only available when compiling.
private  java.lang.String targetPath
          The full path name of the target file
 
Constructor Summary
PackFile(java.io.File baseDir, java.io.File src, java.lang.String target, java.util.List<OsConstraint> osList, int override)
          Constructs and initializes from a source file.
PackFile(java.io.File baseDir, java.io.File src, java.lang.String target, java.util.List<OsConstraint> osList, int override, java.util.Map additionals)
          Constructs and initializes from a source file.
PackFile(java.io.File src, java.lang.String relativeSourcePath, java.lang.String target, java.util.List<OsConstraint> osList, int override, java.util.Map additionals)
          Constructs and initializes from a source file.
 
Method Summary
static java.lang.String computeRelativePathFrom(java.io.File baseDir, java.io.File file)
          Builds the relative path of file to the baseDir.
 java.util.Map getAdditionals()
          Returns the additionals map.
 java.lang.String getCondition()
           
 java.lang.String getRelativeSourcePath()
          The Path of the file relative to the given (compiletime's) basedirectory.
 java.lang.String getTargetPath()
          The full path name of the target file, using '/' as fileseparator.
 boolean hasCondition()
           
 boolean isBackReference()
           
 boolean isDirectory()
           
 boolean isPack200Jar()
           
 long lastModified()
          The last-modification time of the file.
 long length()
          The length of the file in bytes
 java.util.List<OsConstraint> osConstraints()
          The target operating system constraints of this file
 int override()
          Whether or not this file is going to override any existing ones
 void setCondition(java.lang.String condition)
           
 void setPack200Jar(boolean pack200Jar)
           
 void setPreviousPackFileRef(java.lang.String previousPackId, java.lang.Long offsetInPreviousPack)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

OVERRIDE_FALSE

public static final int OVERRIDE_FALSE
See Also:
Constant Field Values

OVERRIDE_TRUE

public static final int OVERRIDE_TRUE
See Also:
Constant Field Values

OVERRIDE_ASK_FALSE

public static final int OVERRIDE_ASK_FALSE
See Also:
Constant Field Values

OVERRIDE_ASK_TRUE

public static final int OVERRIDE_ASK_TRUE
See Also:
Constant Field Values

OVERRIDE_UPDATE

public static final int OVERRIDE_UPDATE
See Also:
Constant Field Values

sourcePath

public transient java.lang.String sourcePath
Only available when compiling. Makes no sense when installing, use relativePath instead.


relativePath

protected java.lang.String relativePath
The Path of the file relative to the given (compiletime's) basedirectory. Can be resolved while installing with either current working directory or directory of "installer.jar".


targetPath

private java.lang.String targetPath
The full path name of the target file


osConstraints

private java.util.List<OsConstraint> osConstraints
The target operating system constraints of this file


length

private long length
The length of the file in bytes


mtime

private long mtime
The last-modification time of the file.


isDirectory

private boolean isDirectory
True if file is a directory (length should be 0 or ignored)


override

private int override
Whether or not this file is going to override any existing ones


additionals

private java.util.Map additionals
Additional attributes or any else for customisation


previousPackId

public java.lang.String previousPackId

offsetInPreviousPack

public long offsetInPreviousPack

pack200Jar

private boolean pack200Jar
True if the file is a Jar and pack200 compression us activated.


condition

private java.lang.String condition
condition for this packfile

Constructor Detail

PackFile

public PackFile(java.io.File baseDir,
                java.io.File src,
                java.lang.String target,
                java.util.List<OsConstraint> osList,
                int override)
         throws java.io.FileNotFoundException
Constructs and initializes from a source file.

Parameters:
baseDir - the baseDirectory of the Fileselection/compilation or null
src - file which this PackFile describes
target - the path to install the file to
osList - OS constraints
override - what to do when the file already exists
Throws:
java.io.FileNotFoundException - if the specified file does not exist.

PackFile

public PackFile(java.io.File src,
                java.lang.String relativeSourcePath,
                java.lang.String target,
                java.util.List<OsConstraint> osList,
                int override,
                java.util.Map additionals)
         throws java.io.FileNotFoundException
Constructs and initializes from a source file.

Parameters:
src - file which this PackFile describes
relativeSourcePath - the path relative to the compiletime's basedirectory, use computeRelativePathFrom(File, File) to compute this.
target - the path to install the file to
osList - OS constraints
override - what to do when the file already exists
additionals - additional attributes
Throws:
java.io.FileNotFoundException - if the specified file does not exist.

PackFile

public PackFile(java.io.File baseDir,
                java.io.File src,
                java.lang.String target,
                java.util.List<OsConstraint> osList,
                int override,
                java.util.Map additionals)
         throws java.io.FileNotFoundException
Constructs and initializes from a source file.

Parameters:
baseDir - The Base directory that is used to search for the files. This is used to build the relative path's
src - file which this PackFile describes
target - the path to install the file to
osList - OS constraints
override - what to do when the file already exists
additionals - additional attributes
Throws:
java.io.FileNotFoundException - if the specified file does not exist.
Method Detail

computeRelativePathFrom

public static java.lang.String computeRelativePathFrom(java.io.File baseDir,
                                                       java.io.File file)
Builds the relative path of file to the baseDir.

Parameters:
baseDir - The Base Directory to build the relative path from
file - the file inside basDir
Returns:
null if file is not a inside baseDir

setPreviousPackFileRef

public void setPreviousPackFileRef(java.lang.String previousPackId,
                                   java.lang.Long offsetInPreviousPack)

osConstraints

public final java.util.List<OsConstraint> osConstraints()
The target operating system constraints of this file


length

public final long length()
The length of the file in bytes


lastModified

public final long lastModified()
The last-modification time of the file.


override

public final int override()
Whether or not this file is going to override any existing ones


isDirectory

public final boolean isDirectory()

isBackReference

public final boolean isBackReference()

getTargetPath

public final java.lang.String getTargetPath()
The full path name of the target file, using '/' as fileseparator.


getRelativeSourcePath

public java.lang.String getRelativeSourcePath()
The Path of the file relative to the given (compiletime's) basedirectory. Can be resolved while installing with either current working directory or directory of "installer.jar"


getAdditionals

public java.util.Map getAdditionals()
Returns the additionals map.

Returns:
additionals

getCondition

public java.lang.String getCondition()
Returns:
the condition

setCondition

public void setCondition(java.lang.String condition)
Parameters:
condition - the condition to set

hasCondition

public boolean hasCondition()

isPack200Jar

public boolean isPack200Jar()

setPack200Jar

public void setPack200Jar(boolean pack200Jar)