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:
- Cloneable,- SelectorContainer
- Direct Known Subclasses:
- DirSet,- FileSet,- MultiRootFileSet,- Sync.SyncTarget
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 SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructorsModifierConstructorDescriptionConstruct a newAbstractFileSet.protectedAbstractFileSet(AbstractFileSet fileset) Construct a newAbstractFileSet, shallowly cloned from the specifiedAbstractFileSet.
- 
Method SummaryModifier and TypeMethodDescriptionvoidadd(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.voidvoidaddFilename(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.voidvoidvoidvoidaddPresent(PresentSelector selector) Add a present selector entry on the selector list.voidvoidaddSelector(SelectSelector selector) Add a "Select" selector entry on the selector list.voidaddSize(SizeSelector selector) Add a selector size entry on the selector list.voidvoidaddType(TypeSelector selector) Add a selector type entry on the selector list.voidvoidappendExcludes(String[] excludes) Appendsexcludesto the current list of exclude patterns.voidappendIncludes(String[] includes) Appendsincludesto the current list of include patterns.voidappendSelector(FileSelector selector) Add a new selector into this container.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).Add a name entry to the exclude list.Add a name entry to the excludes files list.Add a name entry to the include list.Add a name entry to the include files list.Creates a nested patternset.protected voiddieOnCircularReference(Stack<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).booleanWhether default exclusions should be used or not.getDir()Retrieves the base-directory for this instance.Retrieves the base-directory for this instance.Returns the directory scanner needed to access the files to process.Returns the directory scanner needed to access the files to process.booleanGets whether an error is/should be thrown if the base directory does not exist.intThe maximum number of times a symbolic link may be followed during a scan.protected AbstractFileSetPerforms the check for circular references and returns the referenced FileSet.Returns the set of selectors as an array.booleanIndicates whether there are any patterns here.booleanIndicates whether there are any selectors here.booleanFind out if the fileset is case sensitive.booleanFind out if the fileset wants to follow symbolic links.String[]Get the merged exclude patterns for this AbstractFileSet.String[]Get the merged include patterns for this AbstractFileSet.Get the merged patterns for this AbstractFileSet.intGives the count of the number of selectors in this container.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.voidSets the base-directory for this instance.voidsetErrorOnMissingDir(boolean errorOnMissingDir) Sets whether an error is thrown if a directory does not exist.voidsetExcludes(String excludes) Appendsexcludesto the current list of exclude patterns.voidsetExcludesfile(File excl) Sets theFilecontaining the excludes patterns.voidCreates a single file fileset.voidsetFollowSymlinks(boolean followSymlinks) Sets whether or not symbolic links should be followed.voidsetIncludes(String includes) Appendsincludesto the current list of include patterns.voidsetIncludesfile(File incl) Sets theFilecontaining the includes patterns.voidsetMaxLevelsOfSymlinks(int max) The maximum number of times a symbolic link may be followed during a scan.voidMakes this instance in effect a reference to another instance.voidSet up the specified directory scanner against this AbstractFileSet's Project.voidSet up the specified directory scanner against the specified project.toString()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, tooManyAttributesMethods inherited from class org.apache.tools.ant.ProjectComponentgetDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
- 
Constructor Details- 
AbstractFileSetpublic AbstractFileSet()Construct a newAbstractFileSet.
- 
AbstractFileSetConstruct a newAbstractFileSet, shallowly cloned from the specifiedAbstractFileSet.- Parameters:
- fileset- the- AbstractFileSetto use as a template.
 
 
- 
- 
Method Details- 
setRefidMakes 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
 
- 
setDirSets the base-directory for this instance.- Parameters:
- dir- the directory's- Fileinstance.
- Throws:
- BuildException- on error
 
- 
getDirRetrieves the base-directory for this instance.- Returns:
- File.
 
- 
getDirRetrieves the base-directory for this instance.- Parameters:
- p- the- Projectagainst which the reference is resolved, if set.
- Returns:
- File.
 
- 
createPatternSetCreates a nested patternset.- Returns:
- PatternSet.
 
- 
createIncludeAdd a name entry to the include list.- Returns:
- PatternSet.NameEntry.
 
- 
createIncludesFileAdd a name entry to the include files list.- Returns:
- PatternSet.PatternFileNameEntry.
 
- 
createExcludeAdd a name entry to the exclude list.- Returns:
- PatternSet.NameEntry.
 
- 
createExcludesFileAdd a name entry to the excludes files list.- Returns:
- PatternSet.PatternFileNameEntry.
 
- 
setFileCreates a single file fileset.- Parameters:
- file- the single- Fileincluded in this- AbstractFileSet.
 
- 
setIncludesAppendsincludesto the current list of include patterns.Patterns may be separated by a comma or a space. - Parameters:
- includes- the- Stringcontaining the include patterns.
 
- 
appendIncludesAppendsincludesto the current list of include patterns.- Parameters:
- includes- array containing the include patterns.
- Since:
- Ant 1.7
 
- 
setExcludesAppendsexcludesto the current list of exclude patterns.Patterns may be separated by a comma or a space. - Parameters:
- excludes- the- Stringcontaining the exclude patterns.
 
- 
appendExcludesAppendsexcludesto the current list of exclude patterns.- Parameters:
- excludes- array containing the exclude patterns.
- Since:
- Ant 1.7
 
- 
setIncludesfileSets theFilecontaining the includes patterns.- Parameters:
- incl-- Fileinstance.
- Throws:
- BuildException- on error
 
- 
setExcludesfileSets 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
 
- 
getDirectoryScannerReturns the directory scanner needed to access the files to process.- Returns:
- a DirectoryScannerinstance.
 
- 
getDirectoryScannerReturns the directory scanner needed to access the files to process.- Parameters:
- p- the Project against which the DirectoryScanner should be configured.
- Returns:
- a DirectoryScannerinstance.
 
- 
setupDirectoryScannerSet up the specified directory scanner against this AbstractFileSet's Project.- Parameters:
- ds- a- FileScannerinstance.
 
- 
setupDirectoryScannerSet up the specified directory scanner against the specified project.- Parameters:
- ds- a- FileScannerinstance.
- p- an Ant- Projectinstance.
 
- 
getRefPerforms 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.
 
- 
getSelectorsReturns 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.
 
- 
selectorElementsReturns an enumerator for accessing the set of selectors.- Specified by:
- selectorElementsin interface- SelectorContainer
- Returns:
- an Enumerationof selectors.
 
- 
appendSelectorAdd a new selector into this container.- Specified by:
- appendSelectorin interface- SelectorContainer
- Parameters:
- selector- the new- FileSelectorto add.
 
- 
addSelectorAdd a "Select" selector entry on the selector list.- Specified by:
- addSelectorin interface- SelectorContainer
- Parameters:
- selector- the- SelectSelectorto add.
 
- 
addAndAdd an "And" selector entry on the selector list.- Specified by:
- addAndin interface- SelectorContainer
- Parameters:
- selector- the- AndSelectorto add.
 
- 
addOrAdd an "Or" selector entry on the selector list.- Specified by:
- addOrin interface- SelectorContainer
- Parameters:
- selector- the- OrSelectorto add.
 
- 
addNotAdd a "Not" selector entry on the selector list.- Specified by:
- addNotin interface- SelectorContainer
- Parameters:
- selector- the- NotSelectorto add.
 
- 
addNoneAdd a "None" selector entry on the selector list.- Specified by:
- addNonein interface- SelectorContainer
- Parameters:
- selector- the- NoneSelectorto add.
 
- 
addMajorityAdd a majority selector entry on the selector list.- Specified by:
- addMajorityin interface- SelectorContainer
- Parameters:
- selector- the- MajoritySelectorto add.
 
- 
addDateAdd a selector date entry on the selector list.- Specified by:
- addDatein interface- SelectorContainer
- Parameters:
- selector- the- DateSelectorto add.
 
- 
addSizeAdd a selector size entry on the selector list.- Specified by:
- addSizein interface- SelectorContainer
- Parameters:
- selector- the- SizeSelectorto add.
 
- 
addDifferentAdd a DifferentSelector entry on the selector list.- Specified by:
- addDifferentin interface- SelectorContainer
- Parameters:
- selector- the- DifferentSelectorto add.
 
- 
addFilenameAdd a selector filename entry on the selector list.- Specified by:
- addFilenamein interface- SelectorContainer
- Parameters:
- selector- the- FilenameSelectorto add.
 
- 
addTypeAdd a selector type entry on the selector list.- Specified by:
- addTypein interface- SelectorContainer
- Parameters:
- selector- the- TypeSelectorto add.
 
- 
addCustomAdd an extended selector entry on the selector list.- Specified by:
- addCustomin interface- SelectorContainer
- Parameters:
- selector- the- ExtendSelectorto add.
 
- 
addContainsAdd a contains selector entry on the selector list.- Specified by:
- addContainsin interface- SelectorContainer
- Parameters:
- selector- the- ContainsSelectorto add.
 
- 
addPresentAdd a present selector entry on the selector list.- Specified by:
- addPresentin interface- SelectorContainer
- Parameters:
- selector- the- PresentSelectorto add.
 
- 
addDepthAdd a depth selector entry on the selector list.- Specified by:
- addDepthin interface- SelectorContainer
- Parameters:
- selector- the- DepthSelectorto add.
 
- 
addDependAdd a depends selector entry on the selector list.- Specified by:
- addDependin interface- SelectorContainer
- Parameters:
- selector- the- DependSelectorto add.
 
- 
addContainsRegexpAdd a regular expression selector entry on the selector list.- Specified by:
- addContainsRegexpin interface- SelectorContainer
- Parameters:
- selector- the- ContainsRegexpSelectorto add.
 
- 
addModifiedAdd the modified selector.- Specified by:
- addModifiedin interface- SelectorContainer
- Parameters:
- selector- the- ModifiedSelectorto add.
- Since:
- Ant 1.6
 
- 
addReadable
- 
addWritable
- 
addExecutable- Parameters:
- e- ExecutableSelector
- Since:
- 1.10.0
 
- 
addSymlink- Parameters:
- e- SymlinkSelector
- Since:
- 1.10.0
 
- 
addOwnedBy- Parameters:
- o- OwnedBySelector
- Since:
- 1.10.0
 
- 
addPosixGroup- Parameters:
- o- PosixGroupSelector
- Since:
- 1.10.4
 
- 
addPosixPermissions- Parameters:
- o- PosixPermissionsSelector
- Since:
- 1.10.4
 
- 
addAdd an arbitrary selector.- Specified by:
- addin interface- SelectorContainer
- Parameters:
- selector- the- FileSelectorto add.
- Since:
- Ant 1.6
 
- 
toStringReturns included files as a list of semicolon-separated filenames.
- 
cloneCreates a deep clone of this instance, except for the nested selectors (the list of selectors is a shallow clone of this instance's list).
- 
mergeIncludesGet 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
 
- 
mergeExcludesGet 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
 
- 
mergePatternsGet 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
 
- 
dieOnCircularReferenceDescription 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.
 
 
-