org.apache.tools.ant.types
Class ZipFileSet

java.lang.Object
  extended byorg.apache.tools.ant.ProjectComponent
      extended byorg.apache.tools.ant.types.DataType
          extended byorg.apache.tools.ant.types.AbstractFileSet
              extended byorg.apache.tools.ant.types.FileSet
                  extended byorg.apache.tools.ant.types.ZipFileSet
All Implemented Interfaces:
java.lang.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. At present, ZipFileSets are not surfaced in the public API. FileSets nested in a Zip task are instantiated as ZipFileSets, and their attributes are only recognized in the context of the the Zip task. It is not possible to define a ZipFileSet outside of the Zip task and refer to it via a refid. However a standard FileSet may be included by reference in the Zip task, and attributes in the refering ZipFileSet can augment FileSet definition.

Author:
Don Ferguson don@bea.com

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()
           
protected ZipFileSet(FileSet fileset)
           
protected ZipFileSet(ZipFileSet fileset)
           
 
Method Summary
 DirectoryScanner getDirectoryScanner(Project p)
          Return the DirectoryScanner associated with this FileSet.
 int getDirMode()
           
 int getFileMode()
           
 java.lang.String getFullpath()
          Return the full pathname of the single entry in this fileset.
 java.lang.String getPrefix()
          Return the prefix prepended to entries in the zip file.
protected  AbstractFileSet getRef(Project p)
          A ZipFileset can accept any fileset as a reference as it just uses the standard directory scanner.
 java.io.File getSrc()
          Get the zip file from which entries will be extracted.
 void setDir(java.io.File dir)
          Set the directory for the fileset.
 void setDirMode(java.lang.String octalString)
          A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0755
 void setFileMode(java.lang.String octalString)
          A 3 digit octal string, specify the user, group and other modes in the standard Unix fashion; optional, default=0644
 void setFullpath(java.lang.String fullpath)
          Set the full pathname of the single entry in this fileset.
 void setPrefix(java.lang.String prefix)
          Prepend this prefix to the path for each zip entry.
 void setSrc(java.io.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
addAnd, addContains, addCustom, addDate, addDepend, addDepth, addFilename, addMajority, addNone, addNot, addOr, addPresent, addSelector, addSize, appendSelector, createExclude, createExcludesFile, createInclude, createIncludesFile, createPatternSet, getDataTypeName, getDir, getSelectors, hasPatterns, hasSelectors, selectorCount, selectorElements, setCaseSensitive, setDefaultexcludes, setExcludes, setExcludesfile, setFile, setFollowSymlinks, setIncludes, setIncludesfile, setRefid, setupDirectoryScanner
 
Methods inherited from class org.apache.tools.ant.types.DataType
circularReference, dieOnCircularReference, getCheckedRef, getDescription, isReference, noChildrenAllowed, setDescription, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DIR_MODE

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

Since:
Ant 1.5.2
See Also:
Constant Field Values

DEFAULT_FILE_MODE

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

Since:
Ant 1.5.2
See Also:
Constant Field Values
Constructor Detail

ZipFileSet

public ZipFileSet()

ZipFileSet

protected ZipFileSet(FileSet fileset)

ZipFileSet

protected ZipFileSet(ZipFileSet fileset)
Method Detail

setDir

public void setDir(java.io.File dir)
            throws BuildException
Set the directory for the fileset. Prevents both "dir" and "src" from being specified.

Overrides:
setDir in class AbstractFileSet
Throws:
BuildException

setSrc

public void setSrc(java.io.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.

getSrc

public java.io.File getSrc()
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.


setPrefix

public void setPrefix(java.lang.String prefix)
Prepend this prefix to the path for each zip entry. Does not perform reference test; the referenced file set can be augmented with a prefix.

Parameters:
prefix - The prefix to prepend to entries in the zip file.

getPrefix

public java.lang.String getPrefix()
Return the prefix prepended to entries in the zip file.


setFullpath

public void setFullpath(java.lang.String fullpath)
Set the full pathname of the single entry in this fileset.

Parameters:
fullpath - the full pathname of the single entry in this fileset.

getFullpath

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


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 class AbstractFileSet

setFileMode

public void setFileMode(java.lang.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

getFileMode

public int getFileMode()
Since:
Ant 1.5.2

setDirMode

public void setDirMode(java.lang.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.6

getDirMode

public int getDirMode()
Since:
Ant 1.6

getRef

protected AbstractFileSet getRef(Project p)
A ZipFileset can accept any fileset as a reference as it just uses the standard directory scanner.

Overrides:
getRef in class AbstractFileSet


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.