org.apache.tools.ant.types

Class ArchiveFileSet

public abstract class ArchiveFileSet extends FileSet

A ArchiveFileSet is a FileSet with extra attributes useful in the context of archiving tasks. It includes a prefix attribute which is prepended to each entry in the output archive file as well as a fullpath ttribute. It also supports Unix file permissions for files and directories.

Since: Ant 1.7

Field Summary
static intDEFAULT_DIR_MODE
Default value for the dirmode attribute.
static intDEFAULT_FILE_MODE
Default value for the filemode attribute.
Constructor Summary
ArchiveFileSet()
Constructor for ArchiveFileSet
protected ArchiveFileSet(FileSet fileset)
Constructor using a fileset arguement.
protected ArchiveFileSet(ArchiveFileSet fileset)
Constructor using a archive fileset arguement.
Method Summary
voidaddConfigured(ResourceCollection a)
Set the source Archive file for the archivefileset.
Objectclone()
Return a ArchiveFileSet that has the same properties as this one.
protected voidconfigureFileSet(ArchiveFileSet zfs)
A ArchiveFileset accepts another ArchiveFileSet or a FileSet as reference FileSets are often used by the war task for the lib attribute
DirectoryScannergetDirectoryScanner(Project p)
Return the DirectoryScanner associated with this FileSet.
intgetDirMode(Project p)
Get the dir mode of the archive fileset
intgetDirMode()
intgetFileMode(Project p)
Get the mode of the archive fileset
intgetFileMode()
StringgetFullpath(Project p)
Return the full pathname of the single entry in this fileset.
StringgetFullpath()
Return the full pathname of the single entryZ in this fileset.
StringgetPrefix(Project p)
Return the prefix prepended to entries in the archive file.
StringgetPrefix()
Return the prefix prepended to entries in the archive file.
FilegetSrc(Project p)
Get the archive from which entries will be extracted.
FilegetSrc()
Get the archive file from which entries will be extracted.
booleanhasDirModeBeenSet()
Whether the user has specified the mode explicitly.
booleanhasFileModeBeenSet()
Whether the user has specified the mode explicitly.
voidintegerSetDirMode(int mode)
specify the user, group and other modes in the standard Unix fashion; optional, default=0755

We use the strange name so this method doesn't appear in IntrospectionHelpers list of attribute setters.

voidintegerSetFileMode(int mode)
specify the user, group and other modes in the standard Unix fashion; optional, default=0644

We use the strange name so this method doesn't appear in IntrospectionHelpers list of attribute setters.

booleanisFilesystemOnly()
Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions.
Iteratoriterator()
Fulfill the ResourceCollection contract.
protected abstract ArchiveScannernewArchiveScanner()
Creates a scanner for this type of archive.
voidsetDir(File dir)
Set the directory for the fileset.
voidsetDirMode(String octalString)
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0755
voidsetFileMode(String octalString)
A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0644
voidsetFullpath(String fullpath)
Set the full pathname of the single entry in this fileset.
voidsetPrefix(String prefix)
Prepend this prefix to the path for each archive entry.
voidsetSrc(File srcFile)
Set the source Archive file for the archivefileset.
voidsetSrcResource(Resource src)
Set the source Archive file for the archivefileset.
intsize()
Fulfill the ResourceCollection contract.
StringtoString()
for file based zipfilesets, return the same as for normal filesets else just return the path of the zip

Field Detail

DEFAULT_DIR_MODE

public static final int DEFAULT_DIR_MODE
Default value for the dirmode attribute.

Since: Ant 1.5.2

DEFAULT_FILE_MODE

public static final int DEFAULT_FILE_MODE
Default value for the filemode attribute.

Since: Ant 1.5.2

Constructor Detail

ArchiveFileSet

public ArchiveFileSet()
Constructor for ArchiveFileSet

ArchiveFileSet

protected ArchiveFileSet(FileSet fileset)
Constructor using a fileset arguement.

Parameters: fileset the fileset to use

ArchiveFileSet

protected ArchiveFileSet(ArchiveFileSet fileset)
Constructor using a archive fileset arguement.

Parameters: fileset the archivefileset to use

Method Detail

addConfigured

public void addConfigured(ResourceCollection a)
Set the source Archive file for the archivefileset. Prevents both "dir" and "src" from being specified.

Parameters: a the archive as a single element Resource collection.

clone

public Object clone()
Return a ArchiveFileSet that has the same properties as this one.

Returns: the cloned archiveFileSet

Since: Ant 1.6

configureFileSet

protected void configureFileSet(ArchiveFileSet zfs)
A ArchiveFileset accepts another ArchiveFileSet or a FileSet as reference FileSets are often used by the war task for the lib attribute

Parameters: zfs the project to use

getDirectoryScanner

public DirectoryScanner getDirectoryScanner(Project p)
Return the DirectoryScanner associated with this FileSet. If the ArchiveFileSet defines a source Archive file, then a ArchiveScanner is returned instead.

Parameters: p the project to use

Returns: a directory scanner

getDirMode

public int getDirMode(Project p)
Get the dir mode of the archive fileset

Parameters: p the project to use

Returns: the mode

getDirMode

public int getDirMode()

Deprecated: since 1.7.

Returns: the dir mode.

getFileMode

public int getFileMode(Project p)
Get the mode of the archive fileset

Parameters: p the project to use

Returns: the mode

getFileMode

public int getFileMode()

Deprecated: since 1.7.

Returns: the file mode.

getFullpath

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

Parameters: p the project to use

Returns: the full path

getFullpath

public String getFullpath()

Deprecated: since 1.7.

Return the full pathname of the single entryZ in this fileset.

Returns: the full pathname.

getPrefix

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

Parameters: p the project to use

Returns: the prefix

getPrefix

public String getPrefix()

Deprecated: since 1.7.

Return the prefix prepended to entries in the archive file.

Returns: the prefix.

getSrc

public File getSrc(Project p)
Get the archive from which entries will be extracted.

Parameters: p the project to use

Returns: the source file

getSrc

public File getSrc()
Get the archive file from which entries will be extracted.

Returns: the archive in case the archive is a file, null otherwise.

hasDirModeBeenSet

public boolean hasDirModeBeenSet()
Whether the user has specified the mode explicitly.

Returns: true if it has been set

hasFileModeBeenSet

public boolean hasFileModeBeenSet()
Whether the user has specified the mode explicitly.

Returns: true if it has been set

integerSetDirMode

public void integerSetDirMode(int mode)
specify the user, group and other modes in the standard Unix fashion; optional, default=0755

We use the strange name so this method doesn't appear in IntrospectionHelpers list of attribute setters.

Parameters: mode a int value

Since: Ant 1.7

integerSetFileMode

public void integerSetFileMode(int mode)
specify the user, group and other modes in the standard Unix fashion; optional, default=0644

We use the strange name so this method doesn't appear in IntrospectionHelpers list of attribute setters.

Parameters: mode a int value

Since: Ant 1.7

isFilesystemOnly

public boolean isFilesystemOnly()
Indicate whether this ResourceCollection is composed entirely of Resources accessible via local filesystem conventions. If true, all Resources returned from this ResourceCollection should be instances of FileResource.

Returns: whether this is a filesystem-only resource collection.

Since: Ant 1.7

iterator

public Iterator iterator()
Fulfill the ResourceCollection contract.

Returns: Iterator of Resources.

Since: Ant 1.7

newArchiveScanner

protected abstract ArchiveScanner newArchiveScanner()
Creates a scanner for this type of archive.

Returns: the scanner.

setDir

public void setDir(File dir)
Set the directory for the fileset.

Parameters: dir the directory for the fileset

Throws: BuildException on error

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

Parameters: octalString a String value

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

Parameters: octalString a String value

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 archive entry. Prevents both prefix and fullpath from being specified

Parameters: prefix The prefix to prepend to entries in the archive file.

setSrc

public void setSrc(File srcFile)
Set the source Archive file for the archivefileset. Prevents both "dir" and "src" from being specified.

Parameters: srcFile The archive from which to extract entries.

setSrcResource

public void setSrcResource(Resource src)
Set the source Archive file for the archivefileset. Prevents both "dir" and "src" from being specified.

Parameters: src The archive from which to extract entries.

size

public int size()
Fulfill the ResourceCollection contract.

Returns: size of the collection as int.

Since: Ant 1.7

toString

public String toString()
for file based zipfilesets, return the same as for normal filesets else just return the path of the zip

Returns: for file based archivefilesets, included files as a list of semicolon-separated filenames. else just the name of the zip.