org.apache.tools.ant.types

Class ZipFileSet

Implemented Interfaces:
Cloneable, SelectorContainer

public class ZipFileSet
extends FileSet

A ZipFileSet is a FileSet with extra attributes useful in the context of Zip/Jar tasks. A ZipFileSet extends FileSets with the ability to extract a subset of the entries of a Zip file for inclusion in another Zip file. It also includes a prefix attribute which is prepended to each entry in the output Zip file. Since ant 1.6 ZipFileSet can be defined with an id and referenced in packaging tasks

Field Summary

static int
DEFAULT_DIR_MODE
Default value for the dirmode attribute.
static int
DEFAULT_FILE_MODE
Default value for the filemode attribute.

Fields inherited from class org.apache.tools.ant.types.DataType

checked, description, ref

Fields inherited from class org.apache.tools.ant.ProjectComponent

project

Constructor Summary

ZipFileSet()
Sole constructor.
ZipFileSet(FileSet fileset)
ZipFileSet(ZipFileSet fileset)

Method Summary

Object
clone()
Return a ZipFileSet that has the same properties as this one.
int
getDirMode(Project p)
DirectoryScanner
getDirectoryScanner(Project p)
Return the DirectoryScanner associated with this FileSet.
int
getFileMode(Project p)
String
getFullpath(Project p)
Return the full pathname of the single entry in this fileset.
String
getPrefix(Project p)
Return the prefix prepended to entries in the zip file.
protected AbstractFileSet
getRef(Project p)
A ZipFileset accepts another ZipFileSet or a FileSet as reference FileSets are often used by the war task for the lib attribute
File
getSrc(Project p)
Get the zip file from which entries will be extracted.
boolean
hasDirModeBeenSet()
Whether the user has specified the mode explicitly.
boolean
hasFileModeBeenSet()
Whether the user has specified the mode explicitly.
void
setDir(File dir)
Set the directory for the fileset.
void
setDirMode(String octalString)
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0755
void
setFileMode(String octalString)
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0644
void
setFullpath(String fullpath)
Set the full pathname of the single entry in this fileset.
void
setPrefix(String prefix)
Prepend this prefix to the path for each zip entry.
void
setSrc(File srcFile)
Set the source Zip file for the zipfileset.

Methods inherited from class org.apache.tools.ant.types.FileSet

clone

Methods inherited from class org.apache.tools.ant.types.AbstractFileSet

add, addAnd, addContains, addContainsRegexp, addCustom, addDate, addDepend, addDepth, addDifferent, addFilename, addMajority, addModified, addNone, addNot, addOr, addPresent, addSelector, addSize, addType, appendSelector, clone, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDataTypeName, getDefaultexcludes, getDir, getDirectoryScanner, getRef, getSelectors, hasPatterns, hasSelectors, isFollowSymlinks, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setDir, setExcludes, setExcludesfile, setFile, setFollowSymlinks, setIncludes, setIncludesfile, setRefid, setupDirectoryScanner, toString

Methods inherited from class org.apache.tools.ant.types.DataType

checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, getCheckedRef, getDescription, getRefid, isChecked, isReference, noChildrenAllowed, setChecked, setDescription, setRefid, tooManyAttributes

Methods inherited from class org.apache.tools.ant.ProjectComponent

getProject, log, log, setProject

Field Details

DEFAULT_DIR_MODE

public static final int DEFAULT_DIR_MODE
Default value for the dirmode attribute.
Field Value:
16877
Since:
Ant 1.5.2

DEFAULT_FILE_MODE

public static final int DEFAULT_FILE_MODE
Default value for the filemode attribute.
Field Value:
33188
Since:
Ant 1.5.2

Constructor Details

ZipFileSet

public ZipFileSet()
Sole constructor.

ZipFileSet

protected ZipFileSet(FileSet fileset)

ZipFileSet

protected ZipFileSet(ZipFileSet fileset)

Method Details

clone

public Object clone()
Return a ZipFileSet that has the same properties as this one.
Overrides:
clone in interface FileSet
Since:
Ant 1.6

getDirMode

public int getDirMode(Project p)
Since:
Ant 1.5.2

getDirectoryScanner

public DirectoryScanner getDirectoryScanner(Project p)
Return the DirectoryScanner associated with this FileSet. If the ZipFileSet defines a source Zip file, then a ZipScanner is returned instead.
Overrides:
getDirectoryScanner in interface AbstractFileSet

getFileMode

public int getFileMode(Project p)
Since:
Ant 1.5.2

getFullpath

public String getFullpath(Project p)
Return the full pathname of the single entry in this fileset.

getPrefix

public String getPrefix(Project p)
Return the prefix prepended to entries in the zip file.

getRef

protected AbstractFileSet getRef(Project p)
A ZipFileset accepts another ZipFileSet or a FileSet as reference FileSets are often used by the war task for the lib attribute
Overrides:
getRef in interface AbstractFileSet

getSrc

public File getSrc(Project p)
Get the zip file from which entries will be extracted. References are not followed, since it is not possible to have a reference to a ZipFileSet, only to a FileSet.

hasDirModeBeenSet

public boolean hasDirModeBeenSet()
Whether the user has specified the mode explicitly.
Since:
Ant 1.6

hasFileModeBeenSet

public boolean hasFileModeBeenSet()
Whether the user has specified the mode explicitly.
Since:
Ant 1.6

setDir

public void setDir(File dir)
            throws BuildException
Set the directory for the fileset. Prevents both "dir" and "src" from being specified.
Overrides:
setDir in interface AbstractFileSet

setDirMode

public void setDirMode(String octalString)
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0755
Since:
Ant 1.5.2

setFileMode

public void setFileMode(String octalString)
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0644
Since:
Ant 1.5.2

setFullpath

public void setFullpath(String fullpath)
Set the full pathname of the single entry in this fileset. Prevents both prefix and fullpath from being specified
Parameters:
fullpath - the full pathname of the single entry in this fileset.

setPrefix

public void setPrefix(String prefix)
Prepend this prefix to the path for each zip entry. Prevents both prefix and fullpath from being specified
Parameters:
prefix - The prefix to prepend to entries in the zip file.

setSrc

public void setSrc(File srcFile)
Set the source Zip file for the zipfileset. Prevents both "dir" and "src" from being specified.
Parameters:
srcFile - The zip file from which to extract entries.

Copyright B) 2000-2007 Apache Software Foundation. All Rights Reserved.