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 Summary
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstruct a newAbstractFileSet.protectedAbstractFileSet(AbstractFileSet fileset) Construct a newAbstractFileSet, shallowly cloned from the specifiedAbstractFileSet. -
Method Summary
Modifier 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.DataType
checkAttributesAllowed, 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.ProjectComponent
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
-
Constructor Details
-
AbstractFileSet
public AbstractFileSet()Construct a newAbstractFileSet. -
AbstractFileSet
Construct a newAbstractFileSet, shallowly cloned from the specifiedAbstractFileSet.- Parameters:
fileset- theAbstractFileSetto use as a template.
-
-
Method Details
-
setRefid
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 classDataType- Parameters:
r- theReferenceto use.- Throws:
BuildException- on error
-
setDir
Sets the base-directory for this instance.- Parameters:
dir- the directory'sFileinstance.- Throws:
BuildException- on error
-
getDir
-
getDir
-
createPatternSet
-
createInclude
Add a name entry to the include list.- Returns:
PatternSet.NameEntry.
-
createIncludesFile
Add a name entry to the include files list.- Returns:
PatternSet.PatternFileNameEntry.
-
createExclude
Add a name entry to the exclude list.- Returns:
PatternSet.NameEntry.
-
createExcludesFile
Add a name entry to the excludes files list.- Returns:
PatternSet.PatternFileNameEntry.
-
setFile
Creates a single file fileset.- Parameters:
file- the singleFileincluded in thisAbstractFileSet.
-
setIncludes
Appendsincludesto the current list of include patterns.Patterns may be separated by a comma or a space.
- Parameters:
includes- theStringcontaining the include patterns.
-
appendIncludes
Appendsincludesto the current list of include patterns.- Parameters:
includes- array containing the include patterns.- Since:
- Ant 1.7
-
setExcludes
Appendsexcludesto the current list of exclude patterns.Patterns may be separated by a comma or a space.
- Parameters:
excludes- theStringcontaining the exclude patterns.
-
appendExcludes
Appendsexcludesto the current list of exclude patterns.- Parameters:
excludes- array containing the exclude patterns.- Since:
- Ant 1.7
-
setIncludesfile
Sets theFilecontaining the includes patterns.- Parameters:
incl-Fileinstance.- Throws:
BuildException- on error
-
setExcludesfile
Sets theFilecontaining the excludes patterns.- Parameters:
excl-Fileinstance.- Throws:
BuildException- on error
-
setDefaultexcludes
public void setDefaultexcludes(boolean useDefaultExcludes) Sets whether default exclusions should be used or not.- Parameters:
useDefaultExcludes-boolean.
-
getDefaultexcludes
public boolean getDefaultexcludes()Whether default exclusions should be used or not.- Returns:
- the default exclusions value.
- Since:
- Ant 1.6.3
-
setCaseSensitive
public void setCaseSensitive(boolean caseSensitive) Sets case sensitivity of the file system.- Parameters:
caseSensitive-boolean.
-
isCaseSensitive
public boolean isCaseSensitive()Find out if the fileset is case sensitive.- Returns:
booleanindicating whether the fileset is case sensitive.- Since:
- Ant 1.7
-
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.
-
isFollowSymlinks
public boolean isFollowSymlinks()Find out if the fileset wants to follow symbolic links.- Returns:
booleanindicating whether symbolic links should be followed.- Since:
- Ant 1.6
-
setMaxLevelsOfSymlinks
public 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
-
getMaxLevelsOfSymlinks
public int getMaxLevelsOfSymlinks()The maximum number of times a symbolic link may be followed during a scan.- Returns:
- int
- Since:
- Ant 1.8.0
-
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.
-
getErrorOnMissingDir
public boolean getErrorOnMissingDir()Gets whether an error is/should be thrown if the base directory does not exist.- Returns:
- boolean
- Since:
- Ant 1.8.2
-
getDirectoryScanner
Returns the directory scanner needed to access the files to process.- Returns:
- a
DirectoryScannerinstance.
-
getDirectoryScanner
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.
-
setupDirectoryScanner
Set up the specified directory scanner against this AbstractFileSet's Project.- Parameters:
ds- aFileScannerinstance.
-
setupDirectoryScanner
Set up the specified directory scanner against the specified project.- Parameters:
ds- aFileScannerinstance.p- an AntProjectinstance.
-
getRef
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.
-
hasSelectors
public boolean hasSelectors()Indicates whether there are any selectors here.- Specified by:
hasSelectorsin interfaceSelectorContainer- Returns:
- whether any selectors are in this container.
-
hasPatterns
public boolean hasPatterns()Indicates whether there are any patterns here.- Returns:
- whether any patterns are in this container.
-
selectorCount
public int selectorCount()Gives the count of the number of selectors in this container.- Specified by:
selectorCountin interfaceSelectorContainer- Returns:
- the number of selectors in this container as an
int.
-
getSelectors
Returns the set of selectors as an array.- Specified by:
getSelectorsin interfaceSelectorContainer- Parameters:
p- the current project- Returns:
- a
FileSelector[]of the selectors in this container.
-
selectorElements
Returns an enumerator for accessing the set of selectors.- Specified by:
selectorElementsin interfaceSelectorContainer- Returns:
- an
Enumerationof selectors.
-
appendSelector
Add a new selector into this container.- Specified by:
appendSelectorin interfaceSelectorContainer- Parameters:
selector- the newFileSelectorto add.
-
addSelector
Add a "Select" selector entry on the selector list.- Specified by:
addSelectorin interfaceSelectorContainer- Parameters:
selector- theSelectSelectorto add.
-
addAnd
Add an "And" selector entry on the selector list.- Specified by:
addAndin interfaceSelectorContainer- Parameters:
selector- theAndSelectorto add.
-
addOr
Add an "Or" selector entry on the selector list.- Specified by:
addOrin interfaceSelectorContainer- Parameters:
selector- theOrSelectorto add.
-
addNot
Add a "Not" selector entry on the selector list.- Specified by:
addNotin interfaceSelectorContainer- Parameters:
selector- theNotSelectorto add.
-
addNone
Add a "None" selector entry on the selector list.- Specified by:
addNonein interfaceSelectorContainer- Parameters:
selector- theNoneSelectorto add.
-
addMajority
Add a majority selector entry on the selector list.- Specified by:
addMajorityin interfaceSelectorContainer- Parameters:
selector- theMajoritySelectorto add.
-
addDate
Add a selector date entry on the selector list.- Specified by:
addDatein interfaceSelectorContainer- Parameters:
selector- theDateSelectorto add.
-
addSize
Add a selector size entry on the selector list.- Specified by:
addSizein interfaceSelectorContainer- Parameters:
selector- theSizeSelectorto add.
-
addDifferent
Add a DifferentSelector entry on the selector list.- Specified by:
addDifferentin interfaceSelectorContainer- Parameters:
selector- theDifferentSelectorto add.
-
addFilename
Add a selector filename entry on the selector list.- Specified by:
addFilenamein interfaceSelectorContainer- Parameters:
selector- theFilenameSelectorto add.
-
addType
Add a selector type entry on the selector list.- Specified by:
addTypein interfaceSelectorContainer- Parameters:
selector- theTypeSelectorto add.
-
addCustom
Add an extended selector entry on the selector list.- Specified by:
addCustomin interfaceSelectorContainer- Parameters:
selector- theExtendSelectorto add.
-
addContains
Add a contains selector entry on the selector list.- Specified by:
addContainsin interfaceSelectorContainer- Parameters:
selector- theContainsSelectorto add.
-
addPresent
Add a present selector entry on the selector list.- Specified by:
addPresentin interfaceSelectorContainer- Parameters:
selector- thePresentSelectorto add.
-
addDepth
Add a depth selector entry on the selector list.- Specified by:
addDepthin interfaceSelectorContainer- Parameters:
selector- theDepthSelectorto add.
-
addDepend
Add a depends selector entry on the selector list.- Specified by:
addDependin interfaceSelectorContainer- Parameters:
selector- theDependSelectorto add.
-
addContainsRegexp
Add a regular expression selector entry on the selector list.- Specified by:
addContainsRegexpin interfaceSelectorContainer- Parameters:
selector- theContainsRegexpSelectorto add.
-
addModified
Add the modified selector.- Specified by:
addModifiedin interfaceSelectorContainer- Parameters:
selector- theModifiedSelectorto 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
-
add
Add an arbitrary selector.- Specified by:
addin interfaceSelectorContainer- Parameters:
selector- theFileSelectorto add.- Since:
- Ant 1.6
-
toString
-
clone
-
mergeIncludes
-
mergeExcludes
-
mergePatterns
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
-
dieOnCircularReference
Description 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 classDataType- Parameters:
stk- the stack of references to check.p- the project to use to dereference the references.- Throws:
BuildException- on error.
-