Package org.apache.tools.ant.types
Class AbstractFileSet
- java.lang.Object
- 
- org.apache.tools.ant.ProjectComponent
- 
- org.apache.tools.ant.types.DataType
- 
- org.apache.tools.ant.types.AbstractFileSet
 
 
 
- 
- All Implemented Interfaces:
- java.lang.Cloneable,- SelectorContainer
 - Direct Known Subclasses:
- DirSet,- FileSet,- MultiRootFileSet,- Sync.SyncTarget
 
 public abstract class AbstractFileSet extends DataType implements java.lang.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. 
- 
- 
Field Summary- 
Fields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
 
- 
 - 
Constructor SummaryConstructors Modifier Constructor Description AbstractFileSet()Construct a newAbstractFileSet.protectedAbstractFileSet(AbstractFileSet fileset)Construct a newAbstractFileSet, shallowly cloned from the specifiedAbstractFileSet.
 - 
Method SummaryModifier and Type Method Description voidadd(FileSelector selector)Add an arbitrary 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.voidaddExecutable(ExecutableSelector e)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.voidaddOwnedBy(OwnedBySelector o)voidaddPosixGroup(PosixGroupSelector o)voidaddPosixPermissions(PosixPermissionsSelector o)voidaddPresent(PresentSelector selector)Add a present selector entry on the selector list.voidaddReadable(ReadableSelector r)voidaddSelector(SelectSelector selector)Add a "Select" selector entry on the selector list.voidaddSize(SizeSelector selector)Add a selector size entry on the selector list.voidaddSymlink(SymlinkSelector e)voidaddType(TypeSelector selector)Add a selector type entry on the selector list.voidaddWritable(WritableSelector w)voidappendExcludes(java.lang.String[] excludes)Appendsexcludesto the current list of exclude patterns.voidappendIncludes(java.lang.String[] includes)Appendsincludesto the current list of include patterns.voidappendSelector(FileSelector selector)Add a new selector into this container.java.lang.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.protected voiddieOnCircularReference(java.util.Stack<java.lang.Object> stk, Project p)Check to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).booleangetDefaultexcludes()Whether default exclusions should be used or not.java.io.FilegetDir()Retrieves the base-directory for this instance.java.io.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.booleangetErrorOnMissingDir()Gets whether an error is/should be thrown if the base directory does not exist.intgetMaxLevelsOfSymlinks()The maximum number of times a symbolic link may be followed during a scan.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.java.lang.String[]mergeExcludes(Project p)Get the merged exclude patterns for this AbstractFileSet.java.lang.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.java.util.Enumeration<FileSelector>selectorElements()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(java.io.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(java.lang.String excludes)Appendsexcludesto the current list of exclude patterns.voidsetExcludesfile(java.io.File excl)Sets theFilecontaining the excludes patterns.voidsetFile(java.io.File file)Creates a single file fileset.voidsetFollowSymlinks(boolean followSymlinks)Sets whether or not symbolic links should be followed.voidsetIncludes(java.lang.String includes)Appendsincludesto the current list of include patterns.voidsetIncludesfile(java.io.File incl)Sets theFilecontaining the includes patterns.voidsetMaxLevelsOfSymlinks(int max)The maximum number of times a symbolic link may be followed during a scan.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.java.lang.StringtoString()Returns included files as a list of semicolon-separated filenames.- 
Methods inherited from class org.apache.tools.ant.types.DataTypecheckAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
 - 
Methods inherited from class org.apache.tools.ant.ProjectComponentgetDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
 
- 
 
- 
- 
- 
Constructor Detail- 
AbstractFileSetpublic AbstractFileSet() Construct a newAbstractFileSet.
 - 
AbstractFileSetprotected AbstractFileSet(AbstractFileSet fileset) Construct a newAbstractFileSet, shallowly cloned from the specifiedAbstractFileSet.- Parameters:
- fileset- the- AbstractFileSetto use as a template.
 
 
- 
 - 
Method Detail- 
setRefidpublic void setRefid(Reference r) throws BuildException 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. - Overrides:
- setRefidin class- DataType
- Parameters:
- r- the- Referenceto use.
- Throws:
- BuildException- on error
 
 - 
setDirpublic void setDir(java.io.File dir) throws BuildExceptionSets the base-directory for this instance.- Parameters:
- dir- the directory's- Fileinstance.
- Throws:
- BuildException- on error
 
 - 
getDirpublic java.io.File getDir() Retrieves the base-directory for this instance.- Returns:
- File.
 
 - 
getDirpublic java.io.File getDir(Project p) Retrieves the base-directory for this instance.- Parameters:
- p- the- Projectagainst which the reference is resolved, if set.
- Returns:
- File.
 
 - 
createPatternSetpublic PatternSet createPatternSet() Creates a nested patternset.- Returns:
- PatternSet.
 
 - 
createIncludepublic PatternSet.NameEntry createInclude() Add a name entry to the include list.- Returns:
- PatternSet.NameEntry.
 
 - 
createIncludesFilepublic PatternSet.NameEntry createIncludesFile() Add a name entry to the include files list.- Returns:
- PatternSet.PatternFileNameEntry.
 
 - 
createExcludepublic PatternSet.NameEntry createExclude() Add a name entry to the exclude list.- Returns:
- PatternSet.NameEntry.
 
 - 
createExcludesFilepublic PatternSet.NameEntry createExcludesFile() Add a name entry to the excludes files list.- Returns:
- PatternSet.PatternFileNameEntry.
 
 - 
setFilepublic void setFile(java.io.File file) Creates a single file fileset.- Parameters:
- file- the single- Fileincluded in this- AbstractFileSet.
 
 - 
setIncludespublic void setIncludes(java.lang.String includes) Appendsincludesto the current list of include patterns.Patterns may be separated by a comma or a space. - Parameters:
- includes- the- Stringcontaining the include patterns.
 
 - 
appendIncludespublic void appendIncludes(java.lang.String[] includes) Appendsincludesto the current list of include patterns.- Parameters:
- includes- array containing the include patterns.
- Since:
- Ant 1.7
 
 - 
setExcludespublic void setExcludes(java.lang.String excludes) Appendsexcludesto the current list of exclude patterns.Patterns may be separated by a comma or a space. - Parameters:
- excludes- the- Stringcontaining the exclude patterns.
 
 - 
appendExcludespublic void appendExcludes(java.lang.String[] excludes) Appendsexcludesto the current list of exclude patterns.- Parameters:
- excludes- array containing the exclude patterns.
- Since:
- Ant 1.7
 
 - 
setIncludesfilepublic void setIncludesfile(java.io.File incl) throws BuildExceptionSets theFilecontaining the includes patterns.- Parameters:
- incl-- Fileinstance.
- Throws:
- BuildException- on error
 
 - 
setExcludesfilepublic void setExcludesfile(java.io.File excl) throws BuildExceptionSets theFilecontaining the excludes patterns.- Parameters:
- excl-- Fileinstance.
- Throws:
- BuildException- on error
 
 - 
setDefaultexcludespublic void setDefaultexcludes(boolean useDefaultExcludes) Sets whether default exclusions should be used or not.- Parameters:
- useDefaultExcludes-- boolean.
 
 - 
getDefaultexcludespublic boolean getDefaultexcludes() Whether default exclusions should be used or not.- Returns:
- the default exclusions value.
- Since:
- Ant 1.6.3
 
 - 
setCaseSensitivepublic void setCaseSensitive(boolean caseSensitive) Sets case sensitivity of the file system.- Parameters:
- caseSensitive-- boolean.
 
 - 
isCaseSensitivepublic boolean isCaseSensitive() Find out if the fileset is case sensitive.- Returns:
- booleanindicating whether the fileset is case sensitive.
- Since:
- Ant 1.7
 
 - 
setFollowSymlinkspublic void setFollowSymlinks(boolean followSymlinks) Sets whether or not symbolic links should be followed.- Parameters:
- followSymlinks- whether or not symbolic links should be followed.
 
 - 
isFollowSymlinkspublic boolean isFollowSymlinks() Find out if the fileset wants to follow symbolic links.- Returns:
- booleanindicating whether symbolic links should be followed.
- Since:
- Ant 1.6
 
 - 
setMaxLevelsOfSymlinkspublic void setMaxLevelsOfSymlinks(int max) The maximum number of times a symbolic link may be followed during a scan.- Parameters:
- max- int
- Since:
- Ant 1.8.0
 
 - 
getMaxLevelsOfSymlinkspublic int getMaxLevelsOfSymlinks() The maximum number of times a symbolic link may be followed during a scan.- Returns:
- int
- Since:
- Ant 1.8.0
 
 - 
setErrorOnMissingDirpublic 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.
 
 - 
getErrorOnMissingDirpublic boolean getErrorOnMissingDir() Gets whether an error is/should be thrown if the base directory does not exist.- Returns:
- boolean
- Since:
- Ant 1.8.2
 
 - 
getDirectoryScannerpublic DirectoryScanner getDirectoryScanner() Returns the directory scanner needed to access the files to process.- Returns:
- a DirectoryScannerinstance.
 
 - 
getDirectoryScannerpublic 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 DirectoryScannerinstance.
 
 - 
setupDirectoryScannerpublic void setupDirectoryScanner(FileScanner ds) Set up the specified directory scanner against this AbstractFileSet's Project.- Parameters:
- ds- a- FileScannerinstance.
 
 - 
setupDirectoryScannerpublic void setupDirectoryScanner(FileScanner ds, Project p) Set up the specified directory scanner against the specified project.- Parameters:
- ds- a- FileScannerinstance.
- p- an Ant- Projectinstance.
 
 - 
getRefprotected AbstractFileSet getRef(Project p) Performs the check for circular references and returns the referenced FileSet. This method can be overridden together withgetRef()providing implementations containing the special support for FileSet references, which can be handled by all ArchiveFileSets. NB! This method must be overridden in subclasses such as FileSet and DirSet to distinguish between the data types.- Parameters:
- p- the current project
- Returns:
- the dereferenced object.
 
 - 
hasSelectorspublic boolean hasSelectors() Indicates whether there are any selectors here.- Specified by:
- hasSelectorsin interface- SelectorContainer
- Returns:
- whether any selectors are in this container.
 
 - 
hasPatternspublic boolean hasPatterns() Indicates whether there are any patterns here.- Returns:
- whether any patterns are in this container.
 
 - 
selectorCountpublic int selectorCount() Gives the count of the number of selectors in this container.- Specified by:
- selectorCountin interface- SelectorContainer
- Returns:
- the number of selectors in this container as an int.
 
 - 
getSelectorspublic FileSelector[] getSelectors(Project p) Returns the set of selectors as an array.- Specified by:
- getSelectorsin interface- SelectorContainer
- Parameters:
- p- the current project
- Returns:
- a FileSelector[]of the selectors in this container.
 
 - 
selectorElementspublic java.util.Enumeration<FileSelector> selectorElements() Returns an enumerator for accessing the set of selectors.- Specified by:
- selectorElementsin interface- SelectorContainer
- Returns:
- an Enumerationof selectors.
 
 - 
appendSelectorpublic void appendSelector(FileSelector selector) Add a new selector into this container.- Specified by:
- appendSelectorin interface- SelectorContainer
- Parameters:
- selector- the new- FileSelectorto add.
 
 - 
addSelectorpublic void addSelector(SelectSelector selector) Add a "Select" selector entry on the selector list.- Specified by:
- addSelectorin interface- SelectorContainer
- Parameters:
- selector- the- SelectSelectorto add.
 
 - 
addAndpublic void addAnd(AndSelector selector) Add an "And" selector entry on the selector list.- Specified by:
- addAndin interface- SelectorContainer
- Parameters:
- selector- the- AndSelectorto add.
 
 - 
addOrpublic void addOr(OrSelector selector) Add an "Or" selector entry on the selector list.- Specified by:
- addOrin interface- SelectorContainer
- Parameters:
- selector- the- OrSelectorto add.
 
 - 
addNotpublic void addNot(NotSelector selector) Add a "Not" selector entry on the selector list.- Specified by:
- addNotin interface- SelectorContainer
- Parameters:
- selector- the- NotSelectorto add.
 
 - 
addNonepublic void addNone(NoneSelector selector) Add a "None" selector entry on the selector list.- Specified by:
- addNonein interface- SelectorContainer
- Parameters:
- selector- the- NoneSelectorto add.
 
 - 
addMajoritypublic void addMajority(MajoritySelector selector) Add a majority selector entry on the selector list.- Specified by:
- addMajorityin interface- SelectorContainer
- Parameters:
- selector- the- MajoritySelectorto add.
 
 - 
addDatepublic void addDate(DateSelector selector) Add a selector date entry on the selector list.- Specified by:
- addDatein interface- SelectorContainer
- Parameters:
- selector- the- DateSelectorto add.
 
 - 
addSizepublic void addSize(SizeSelector selector) Add a selector size entry on the selector list.- Specified by:
- addSizein interface- SelectorContainer
- Parameters:
- selector- the- SizeSelectorto add.
 
 - 
addDifferentpublic void addDifferent(DifferentSelector selector) Add a DifferentSelector entry on the selector list.- Specified by:
- addDifferentin interface- SelectorContainer
- Parameters:
- selector- the- DifferentSelectorto add.
 
 - 
addFilenamepublic void addFilename(FilenameSelector selector) Add a selector filename entry on the selector list.- Specified by:
- addFilenamein interface- SelectorContainer
- Parameters:
- selector- the- FilenameSelectorto add.
 
 - 
addTypepublic void addType(TypeSelector selector) Add a selector type entry on the selector list.- Specified by:
- addTypein interface- SelectorContainer
- Parameters:
- selector- the- TypeSelectorto add.
 
 - 
addCustompublic void addCustom(ExtendSelector selector) Add an extended selector entry on the selector list.- Specified by:
- addCustomin interface- SelectorContainer
- Parameters:
- selector- the- ExtendSelectorto add.
 
 - 
addContainspublic void addContains(ContainsSelector selector) Add a contains selector entry on the selector list.- Specified by:
- addContainsin interface- SelectorContainer
- Parameters:
- selector- the- ContainsSelectorto add.
 
 - 
addPresentpublic void addPresent(PresentSelector selector) Add a present selector entry on the selector list.- Specified by:
- addPresentin interface- SelectorContainer
- Parameters:
- selector- the- PresentSelectorto add.
 
 - 
addDepthpublic void addDepth(DepthSelector selector) Add a depth selector entry on the selector list.- Specified by:
- addDepthin interface- SelectorContainer
- Parameters:
- selector- the- DepthSelectorto add.
 
 - 
addDependpublic void addDepend(DependSelector selector) Add a depends selector entry on the selector list.- Specified by:
- addDependin interface- SelectorContainer
- Parameters:
- selector- the- DependSelectorto add.
 
 - 
addContainsRegexppublic void addContainsRegexp(ContainsRegexpSelector selector) Add a regular expression selector entry on the selector list.- Specified by:
- addContainsRegexpin interface- SelectorContainer
- Parameters:
- selector- the- ContainsRegexpSelectorto add.
 
 - 
addModifiedpublic void addModified(ModifiedSelector selector) Add the modified selector.- Specified by:
- addModifiedin interface- SelectorContainer
- Parameters:
- selector- the- ModifiedSelectorto add.
- Since:
- Ant 1.6
 
 - 
addReadablepublic void addReadable(ReadableSelector r) 
 - 
addWritablepublic void addWritable(WritableSelector w) 
 - 
addExecutablepublic void addExecutable(ExecutableSelector e) - Parameters:
- e- ExecutableSelector
- Since:
- 1.10.0
 
 - 
addSymlinkpublic void addSymlink(SymlinkSelector e) - Parameters:
- e- SymlinkSelector
- Since:
- 1.10.0
 
 - 
addOwnedBypublic void addOwnedBy(OwnedBySelector o) - Parameters:
- o- OwnedBySelector
- Since:
- 1.10.0
 
 - 
addPosixGrouppublic void addPosixGroup(PosixGroupSelector o) - Parameters:
- o- PosixGroupSelector
- Since:
- 1.10.4
 
 - 
addPosixPermissionspublic void addPosixPermissions(PosixPermissionsSelector o) - Parameters:
- o- PosixPermissionsSelector
- Since:
- 1.10.4
 
 - 
addpublic void add(FileSelector selector) Add an arbitrary selector.- Specified by:
- addin interface- SelectorContainer
- Parameters:
- selector- the- FileSelectorto add.
- Since:
- Ant 1.6
 
 - 
toStringpublic java.lang.String toString() Returns included files as a list of semicolon-separated filenames.
 - 
clonepublic java.lang.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).
 - 
mergeIncludespublic java.lang.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
 
 - 
mergeExcludespublic java.lang.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
 
 - 
mergePatternspublic 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
 
 - 
dieOnCircularReferenceprotected void dieOnCircularReference(java.util.Stack<java.lang.Object> stk, Project p) throws BuildExceptionDescription copied from class:DataTypeCheck to see whether any DataType we hold references to is included in the Stack (which holds all DataType instances that directly or indirectly reference this instance, including this instance itself).If one is included, throw a BuildException created by circularReference.This implementation is appropriate only for a DataType that cannot hold other DataTypes as children. The general contract of this method is that it shouldn't do anything if DataType.checkedis true and set it to true on exit.- Overrides:
- dieOnCircularReferencein class- DataType
- Parameters:
- stk- the stack of references to check.
- p- the project to use to dereference the references.
- Throws:
- BuildException- on error.
 
 
- 
 
-