org.apache.tools.ant.types

Class AbstractFileSet

public abstract class AbstractFileSet extends DataType implements Cloneable, SelectorContainer

Class that holds an implicit patternset and supports nested patternsets and creates a DirectoryScanner using these patterns.

Common base class for DirSet and FileSet.

Constructor Summary
AbstractFileSet()
Construct a new AbstractFileSet.
protected AbstractFileSet(AbstractFileSet fileset)
Construct a new AbstractFileSet, shallowly cloned from the specified AbstractFileSet.
Method Summary
voidadd(FileSelector selector)
Add an arbitary selector.
voidaddAnd(AndSelector selector)
Add an "And" selector entry on the selector list.
voidaddContains(ContainsSelector selector)
Add a contains selector entry on the selector list.
voidaddContainsRegexp(ContainsRegexpSelector selector)
Add a regular expression selector entry on the selector list.
voidaddCustom(ExtendSelector selector)
Add an extended selector entry on the selector list.
voidaddDate(DateSelector selector)
Add a selector date entry on the selector list.
voidaddDepend(DependSelector selector)
Add a depends selector entry on the selector list.
voidaddDepth(DepthSelector selector)
Add a depth selector entry on the selector list.
voidaddDifferent(DifferentSelector selector)
Add a DifferentSelector entry on the selector list.
voidaddFilename(FilenameSelector selector)
Add a selector filename entry on the selector list.
voidaddMajority(MajoritySelector selector)
Add a majority selector entry on the selector list.
voidaddModified(ModifiedSelector selector)
Add the modified selector.
voidaddNone(NoneSelector selector)
Add a "None" selector entry on the selector list.
voidaddNot(NotSelector selector)
Add a "Not" selector entry on the selector list.
voidaddOr(OrSelector selector)
Add an "Or" selector entry on the selector list.
voidaddPresent(PresentSelector selector)
Add a present selector entry on the selector list.
voidaddSelector(SelectSelector selector)
Add a "Select" selector entry on the selector list.
voidaddSize(SizeSelector selector)
Add a selector size entry on the selector list.
voidaddType(TypeSelector selector)
Add a selector type entry on the selector list.
voidappendExcludes(String[] excludes)
Appends excludes to the current list of include patterns.
voidappendIncludes(String[] includes)
Appends includes to the current list of include patterns.
voidappendSelector(FileSelector selector)
Add a new selector into this container.
Objectclone()
Creates a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).
PatternSet.NameEntrycreateExclude()
Add a name entry to the exclude list.
PatternSet.NameEntrycreateExcludesFile()
Add a name entry to the excludes files list.
PatternSet.NameEntrycreateInclude()
Add a name entry to the include list.
PatternSet.NameEntrycreateIncludesFile()
Add a name entry to the include files list.
PatternSetcreatePatternSet()
Creates a nested patternset.
booleangetDefaultexcludes()
Whether default exclusions should be used or not.
FilegetDir()
Retrieves the base-directory for this instance.
FilegetDir(Project p)
Retrieves the base-directory for this instance.
DirectoryScannergetDirectoryScanner()
Returns the directory scanner needed to access the files to process.
DirectoryScannergetDirectoryScanner(Project p)
Returns the directory scanner needed to access the files to process.
protected AbstractFileSetgetRef(Project p)
Performs the check for circular references and returns the referenced FileSet.
FileSelector[]getSelectors(Project p)
Returns the set of selectors as an array.
booleanhasPatterns()
Indicates whether there are any patterns here.
booleanhasSelectors()
Indicates whether there are any selectors here.
booleanisCaseSensitive()
Find out if the fileset is case sensitive.
booleanisFollowSymlinks()
Find out if the fileset wants to follow symbolic links.
String[]mergeExcludes(Project p)
Get the merged exclude patterns for this AbstractFileSet.
String[]mergeIncludes(Project p)
Get the merged include patterns for this AbstractFileSet.
PatternSetmergePatterns(Project p)
Get the merged patterns for this AbstractFileSet.
intselectorCount()
Gives the count of the number of selectors in this container.
EnumerationselectorElements()
Returns an enumerator for accessing the set of selectors.
voidsetCaseSensitive(boolean caseSensitive)
Sets case sensitivity of the file system.
voidsetDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.
voidsetDir(File dir)
Sets the base-directory for this instance.
voidsetErrorOnMissingDir(boolean errorOnMissingDir)
Sets whether an error is thrown if a directory does not exist.
voidsetExcludes(String excludes)
Appends excludes to the current list of exclude patterns.
voidsetExcludesfile(File excl)
Sets the File containing the excludes patterns.
voidsetFile(File file)
Creates a single file fileset.
voidsetFollowSymlinks(boolean followSymlinks)
Sets whether or not symbolic links should be followed.
voidsetIncludes(String includes)
Appends includes to the current list of include patterns.
voidsetIncludesfile(File incl)
Sets the File containing the includes patterns.
voidsetRefid(Reference r)
Makes this instance in effect a reference to another instance.
voidsetupDirectoryScanner(FileScanner ds)
Set up the specified directory scanner against this AbstractFileSet's Project.
voidsetupDirectoryScanner(FileScanner ds, Project p)
Set up the specified directory scanner against the specified project.
StringtoString()
Returns included files as a list of semicolon-separated filenames.

Constructor Detail

AbstractFileSet

public AbstractFileSet()
Construct a new AbstractFileSet.

AbstractFileSet

protected AbstractFileSet(AbstractFileSet fileset)
Construct a new AbstractFileSet, shallowly cloned from the specified AbstractFileSet.

Parameters: fileset the AbstractFileSet to use as a template.

Method Detail

add

public void add(FileSelector selector)
Add an arbitary selector.

Parameters: selector the FileSelector to add.

Since: Ant 1.6

addAnd

public void addAnd(AndSelector selector)
Add an "And" selector entry on the selector list.

Parameters: selector the AndSelector to add.

addContains

public void addContains(ContainsSelector selector)
Add a contains selector entry on the selector list.

Parameters: selector the ContainsSelector to add.

addContainsRegexp

public void addContainsRegexp(ContainsRegexpSelector selector)
Add a regular expression selector entry on the selector list.

Parameters: selector the ContainsRegexpSelector to add.

addCustom

public void addCustom(ExtendSelector selector)
Add an extended selector entry on the selector list.

Parameters: selector the ExtendSelector to add.

addDate

public void addDate(DateSelector selector)
Add a selector date entry on the selector list.

Parameters: selector the DateSelector to add.

addDepend

public void addDepend(DependSelector selector)
Add a depends selector entry on the selector list.

Parameters: selector the DependSelector to add.

addDepth

public void addDepth(DepthSelector selector)
Add a depth selector entry on the selector list.

Parameters: selector the DepthSelector to add.

addDifferent

public void addDifferent(DifferentSelector selector)
Add a DifferentSelector entry on the selector list.

Parameters: selector the DifferentSelector to add.

addFilename

public void addFilename(FilenameSelector selector)
Add a selector filename entry on the selector list.

Parameters: selector the FilenameSelector to add.

addMajority

public void addMajority(MajoritySelector selector)
Add a majority selector entry on the selector list.

Parameters: selector the MajoritySelector to add.

addModified

public void addModified(ModifiedSelector selector)
Add the modified selector.

Parameters: selector the ModifiedSelector to add.

Since: ant 1.6

addNone

public void addNone(NoneSelector selector)
Add a "None" selector entry on the selector list.

Parameters: selector the NoneSelector to add.

addNot

public void addNot(NotSelector selector)
Add a "Not" selector entry on the selector list.

Parameters: selector the NotSelector to add.

addOr

public void addOr(OrSelector selector)
Add an "Or" selector entry on the selector list.

Parameters: selector the OrSelector to add.

addPresent

public void addPresent(PresentSelector selector)
Add a present selector entry on the selector list.

Parameters: selector the PresentSelector to add.

addSelector

public void addSelector(SelectSelector selector)
Add a "Select" selector entry on the selector list.

Parameters: selector the SelectSelector to add.

addSize

public void addSize(SizeSelector selector)
Add a selector size entry on the selector list.

Parameters: selector the SizeSelector to add.

addType

public void addType(TypeSelector selector)
Add a selector type entry on the selector list.

Parameters: selector the TypeSelector to add.

appendExcludes

public void appendExcludes(String[] excludes)
Appends excludes to the current list of include patterns.

Parameters: excludes array containing the exclude patterns.

Since: Ant 1.7

appendIncludes

public void appendIncludes(String[] includes)
Appends includes to the current list of include patterns.

Parameters: includes array containing the include patterns.

Since: Ant 1.7

appendSelector

public void appendSelector(FileSelector selector)
Add a new selector into this container.

Parameters: selector the new FileSelector to add.

clone

public Object clone()
Creates a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).

Returns: the cloned object

Since: Ant 1.6

createExclude

public PatternSet.NameEntry createExclude()
Add a name entry to the exclude list.

Returns: PatternSet.NameEntry.

createExcludesFile

public PatternSet.NameEntry createExcludesFile()
Add a name entry to the excludes files list.

Returns: PatternSet.NameEntry.

createInclude

public PatternSet.NameEntry createInclude()
Add a name entry to the include list.

Returns: PatternSet.NameEntry.

createIncludesFile

public PatternSet.NameEntry createIncludesFile()
Add a name entry to the include files list.

Returns: PatternSet.NameEntry.

createPatternSet

public PatternSet createPatternSet()
Creates a nested patternset.

Returns: PatternSet.

getDefaultexcludes

public boolean getDefaultexcludes()
Whether default exclusions should be used or not.

Returns: the default exclusions value.

Since: Ant 1.6.3

getDir

public File getDir()
Retrieves the base-directory for this instance.

Returns: File.

getDir

public File getDir(Project p)
Retrieves the base-directory for this instance.

Parameters: p the Project against which the reference is resolved, if set.

Returns: File.

getDirectoryScanner

public DirectoryScanner getDirectoryScanner()
Returns the directory scanner needed to access the files to process.

Returns: a DirectoryScanner instance.

getDirectoryScanner

public DirectoryScanner getDirectoryScanner(Project p)
Returns the directory scanner needed to access the files to process.

Parameters: p the Project against which the DirectoryScanner should be configured.

Returns: a DirectoryScanner instance.

getRef

protected AbstractFileSet getRef(Project p)
Performs the check for circular references and returns the referenced FileSet.

Parameters: p the current project

Returns: the referenced FileSet

getSelectors

public FileSelector[] getSelectors(Project p)
Returns the set of selectors as an array.

Parameters: p the current project

Returns: a FileSelector[] of the selectors in this container.

hasPatterns

public boolean hasPatterns()
Indicates whether there are any patterns here.

Returns: whether any patterns are in this container.

hasSelectors

public boolean hasSelectors()
Indicates whether there are any selectors here.

Returns: whether any selectors are in this container.

isCaseSensitive

public boolean isCaseSensitive()
Find out if the fileset is case sensitive.

Returns: boolean indicating whether the fileset is case sensitive.

Since: Ant 1.7

isFollowSymlinks

public boolean isFollowSymlinks()
Find out if the fileset wants to follow symbolic links.

Returns: boolean indicating whether symbolic links should be followed.

Since: Ant 1.6

mergeExcludes

public String[] mergeExcludes(Project p)
Get the merged exclude patterns for this AbstractFileSet.

Parameters: p the project to use.

Returns: the exclude patterns of the default pattern set and all nested patternsets.

Since: Ant 1.7

mergeIncludes

public String[] mergeIncludes(Project p)
Get the merged include patterns for this AbstractFileSet.

Parameters: p the project to use.

Returns: the include patterns of the default pattern set and all nested patternsets.

Since: Ant 1.7

mergePatterns

public PatternSet mergePatterns(Project p)
Get the merged patterns for this AbstractFileSet.

Parameters: p the project to use.

Returns: the default patternset merged with the additional sets in a new PatternSet instance.

Since: Ant 1.7

selectorCount

public int selectorCount()
Gives the count of the number of selectors in this container.

Returns: the number of selectors in this container as an int.

selectorElements

public Enumeration selectorElements()
Returns an enumerator for accessing the set of selectors.

Returns: an Enumeration of selectors.

setCaseSensitive

public void setCaseSensitive(boolean caseSensitive)
Sets case sensitivity of the file system.

Parameters: caseSensitive boolean.

setDefaultexcludes

public void setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.

Parameters: useDefaultExcludes boolean.

setDir

public void setDir(File dir)
Sets the base-directory for this instance.

Parameters: dir the directory's File instance.

Throws: BuildException on error

setErrorOnMissingDir

public void setErrorOnMissingDir(boolean errorOnMissingDir)
Sets whether an error is thrown if a directory does not exist.

Parameters: errorOnMissingDir true if missing directories cause errors, false if not.

setExcludes

public void setExcludes(String excludes)
Appends excludes to the current list of exclude patterns.

Patterns may be separated by a comma or a space.

Parameters: excludes the String containing the exclude patterns.

setExcludesfile

public void setExcludesfile(File excl)
Sets the File containing the excludes patterns.

Parameters: excl File instance.

Throws: BuildException on error

setFile

public void setFile(File file)
Creates a single file fileset.

Parameters: file the single File included in this AbstractFileSet.

setFollowSymlinks

public void setFollowSymlinks(boolean followSymlinks)
Sets whether or not symbolic links should be followed.

Parameters: followSymlinks whether or not symbolic links should be followed.

setIncludes

public void setIncludes(String includes)
Appends includes to the current list of include patterns.

Patterns may be separated by a comma or a space.

Parameters: includes the String containing the include patterns.

setIncludesfile

public void setIncludesfile(File incl)
Sets the File containing the includes patterns.

Parameters: incl File instance.

Throws: BuildException on error

setRefid

public void setRefid(Reference r)
Makes this instance in effect a reference to another instance.

You must not set another attribute or nest elements inside this element if you make it a reference.

Parameters: r the Reference to use.

Throws: BuildException on error

setupDirectoryScanner

public void setupDirectoryScanner(FileScanner ds)
Set up the specified directory scanner against this AbstractFileSet's Project.

Parameters: ds a FileScanner instance.

setupDirectoryScanner

public void setupDirectoryScanner(FileScanner ds, Project p)
Set up the specified directory scanner against the specified project.

Parameters: ds a FileScanner instance. p an Ant Project instance.

toString

public String toString()
Returns included files as a list of semicolon-separated filenames.

Returns: a String of included filenames.