org.apache.tools.ant.taskdefs.optional

Class Cab

public class Cab extends MatchingTask

Create a CAB archive.
Field Summary
protected StringarchiveType
Method Summary
voidaddFileset(FileSet set)
Adds a set of files to archive.
protected voidappendFiles(Vector files, DirectoryScanner ds)
Append all files found by a directory scanner to a vector.
protected voidcheckConfiguration()
Check if the attributes and nested elements are correct.
protected ExecTaskcreateExec()
Create a new exec delegate.
protected FilecreateListFile(Vector files)
Creates a list file.
voidexecute()
execute this task.
protected VectorgetFileList()
Get the complete list of files to be included in the cab.
protected booleanisUpToDate(Vector files)
Check to see if the target is up to date with respect to input files.
voidsetBasedir(File baseDir)
Base directory to look in for files to CAB.
voidsetCabfile(File cabFile)
The name/location of where to create the .cab file.
voidsetCompress(boolean compress)
If true, compress the files otherwise only store them.
voidsetOptions(String options)
Sets additional cabarc options that are not supported directly.
voidsetVerbose(boolean verbose)
If true, display cabarc output.

Field Detail

archiveType

protected String archiveType

Method Detail

addFileset

public void addFileset(FileSet set)
Adds a set of files to archive.

Parameters: set a set of files to archive.

appendFiles

protected void appendFiles(Vector files, DirectoryScanner ds)
Append all files found by a directory scanner to a vector.

Parameters: files the vector to append the files to. ds the scanner to get the files from.

checkConfiguration

protected void checkConfiguration()
Check if the attributes and nested elements are correct.

Throws: BuildException on error.

createExec

protected ExecTask createExec()
Create a new exec delegate. The delegate task is populated so that it appears in the logs to be the same task as this one.

Returns: the delegate.

Throws: BuildException on error.

createListFile

protected File createListFile(Vector files)
Creates a list file. This temporary file contains a list of all files to be included in the cab, one file per line.

This method expects to only be called on Windows and thus quotes the file names.

Parameters: files the list of files to use.

Returns: the list file created.

Throws: IOException if there is an error.

execute

public void execute()
execute this task.

Throws: BuildException on error.

getFileList

protected Vector getFileList()
Get the complete list of files to be included in the cab. Filenames are gathered from the fileset if it has been added, otherwise from the traditional include parameters.

Returns: the list of files.

Throws: BuildException if there is an error.

isUpToDate

protected boolean isUpToDate(Vector files)
Check to see if the target is up to date with respect to input files.

Parameters: files the list of files to check.

Returns: true if the cab file is newer than its dependents.

setBasedir

public void setBasedir(File baseDir)
Base directory to look in for files to CAB.

Parameters: baseDir base directory for files to cab.

setCabfile

public void setCabfile(File cabFile)
The name/location of where to create the .cab file.

Parameters: cabFile the location of the cab file.

setCompress

public void setCompress(boolean compress)
If true, compress the files otherwise only store them.

Parameters: compress a boolean value.

setOptions

public void setOptions(String options)
Sets additional cabarc options that are not supported directly.

Parameters: options cabarc command line options.

setVerbose

public void setVerbose(boolean verbose)
If true, display cabarc output.

Parameters: verbose a boolean value.