public abstract class AbstractFileSet extends DataType implements java.lang.Cloneable, SelectorContainer
Common base class for DirSet and FileSet.
description, location, project
Modifier | Constructor and Description |
---|---|
|
AbstractFileSet()
Construct a new
AbstractFileSet . |
protected |
AbstractFileSet(AbstractFileSet fileset)
Construct a new
AbstractFileSet , shallowly cloned
from the specified AbstractFileSet . |
Modifier and Type | Method and Description |
---|---|
void |
add(FileSelector selector)
Add an arbitary selector.
|
void |
addAnd(AndSelector selector)
Add an "And" selector entry on the selector list.
|
void |
addContains(ContainsSelector selector)
Add a contains selector entry on the selector list.
|
void |
addContainsRegexp(ContainsRegexpSelector selector)
Add a regular expression selector entry on the selector list.
|
void |
addCustom(ExtendSelector selector)
Add an extended selector entry on the selector list.
|
void |
addDate(DateSelector selector)
Add a selector date entry on the selector list.
|
void |
addDepend(DependSelector selector)
Add a depends selector entry on the selector list.
|
void |
addDepth(DepthSelector selector)
Add a depth selector entry on the selector list.
|
void |
addDifferent(DifferentSelector selector)
Add a DifferentSelector entry on the selector list.
|
void |
addFilename(FilenameSelector selector)
Add a selector filename entry on the selector list.
|
void |
addMajority(MajoritySelector selector)
Add a majority selector entry on the selector list.
|
void |
addModified(ModifiedSelector selector)
Add the modified selector.
|
void |
addNone(NoneSelector selector)
Add a "None" selector entry on the selector list.
|
void |
addNot(NotSelector selector)
Add a "Not" selector entry on the selector list.
|
void |
addOr(OrSelector selector)
Add an "Or" selector entry on the selector list.
|
void |
addPresent(PresentSelector selector)
Add a present selector entry on the selector list.
|
void |
addReadable(ReadableSelector r) |
void |
addSelector(SelectSelector selector)
Add a "Select" selector entry on the selector list.
|
void |
addSize(SizeSelector selector)
Add a selector size entry on the selector list.
|
void |
addType(TypeSelector selector)
Add a selector type entry on the selector list.
|
void |
addWritable(WritableSelector w) |
void |
appendExcludes(java.lang.String[] excludes)
Appends
excludes to the current list of include
patterns. |
void |
appendIncludes(java.lang.String[] includes)
Appends
includes to the current list of include
patterns. |
void |
appendSelector(FileSelector selector)
Add a new selector into this container.
|
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).
|
PatternSet.NameEntry |
createExclude()
Add a name entry to the exclude list.
|
PatternSet.NameEntry |
createExcludesFile()
Add a name entry to the excludes files list.
|
PatternSet.NameEntry |
createInclude()
Add a name entry to the include list.
|
PatternSet.NameEntry |
createIncludesFile()
Add a name entry to the include files list.
|
PatternSet |
createPatternSet()
Creates a nested patternset.
|
protected void |
dieOnCircularReference(java.util.Stack 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).
|
boolean |
getDefaultexcludes()
Whether default exclusions should be used or not.
|
java.io.File |
getDir()
Retrieves the base-directory for this instance.
|
java.io.File |
getDir(Project p)
Retrieves the base-directory for this instance.
|
DirectoryScanner |
getDirectoryScanner()
Returns the directory scanner needed to access the files to process.
|
DirectoryScanner |
getDirectoryScanner(Project p)
Returns the directory scanner needed to access the files to process.
|
boolean |
getErrorOnMissingDir()
Gets whether an error is/shold be thrown if the base directory
does not exist.
|
int |
getMaxLevelsOfSymlinks()
The maximum number of times a symbolic link may be followed
during a scan.
|
protected AbstractFileSet |
getRef(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.
|
boolean |
hasPatterns()
Indicates whether there are any patterns here.
|
boolean |
hasSelectors()
Indicates whether there are any selectors here.
|
boolean |
isCaseSensitive()
Find out if the fileset is case sensitive.
|
boolean |
isFollowSymlinks()
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.
|
PatternSet |
mergePatterns(Project p)
Get the merged patterns for this AbstractFileSet.
|
int |
selectorCount()
Gives the count of the number of selectors in this container.
|
java.util.Enumeration |
selectorElements()
Returns an enumerator for accessing the set of selectors.
|
void |
setCaseSensitive(boolean caseSensitive)
Sets case sensitivity of the file system.
|
void |
setDefaultexcludes(boolean useDefaultExcludes)
Sets whether default exclusions should be used or not.
|
void |
setDir(java.io.File dir)
Sets the base-directory for this instance.
|
void |
setErrorOnMissingDir(boolean errorOnMissingDir)
Sets whether an error is thrown if a directory does not exist.
|
void |
setExcludes(java.lang.String excludes)
Appends
excludes to the current list of exclude
patterns. |
void |
setExcludesfile(java.io.File excl)
Sets the
File containing the excludes patterns. |
void |
setFile(java.io.File file)
Creates a single file fileset.
|
void |
setFollowSymlinks(boolean followSymlinks)
Sets whether or not symbolic links should be followed.
|
void |
setIncludes(java.lang.String includes)
Appends
includes to the current list of include
patterns. |
void |
setIncludesfile(java.io.File incl)
Sets the
File containing the includes patterns. |
void |
setMaxLevelsOfSymlinks(int max)
The maximum number of times a symbolic link may be followed
during a scan.
|
void |
setRefid(Reference r)
Makes this instance in effect a reference to another instance.
|
void |
setupDirectoryScanner(FileScanner ds)
Set up the specified directory scanner against this
AbstractFileSet's Project.
|
void |
setupDirectoryScanner(FileScanner ds,
Project p)
Set up the specified directory scanner against the specified project.
|
java.lang.String |
toString()
Returns included files as a list of semicolon-separated filenames.
|
checkAttributesAllowed, checkChildrenAllowed, circularReference, dieOnCircularReference, dieOnCircularReference, getCheckedRef, getCheckedRef, getCheckedRef, getCheckedRef, getDataTypeName, getRefid, invokeCircularReferenceCheck, isChecked, isReference, noChildrenAllowed, pushAndInvokeCircularReferenceCheck, setChecked, tooManyAttributes
getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
public AbstractFileSet()
AbstractFileSet
.protected AbstractFileSet(AbstractFileSet fileset)
AbstractFileSet
, shallowly cloned
from the specified AbstractFileSet
.fileset
- the AbstractFileSet
to use as a template.public void setRefid(Reference r) throws BuildException
You must not set another attribute or nest elements inside this element if you make it a reference.
setRefid
in class DataType
r
- the Reference
to use.BuildException
- on errorpublic void setDir(java.io.File dir) throws BuildException
dir
- the directory's File
instance.BuildException
- on errorpublic java.io.File getDir()
File
.public java.io.File getDir(Project p)
p
- the Project
against which the
reference is resolved, if set.File
.public PatternSet createPatternSet()
PatternSet
.public PatternSet.NameEntry createInclude()
PatternSet.NameEntry
.public PatternSet.NameEntry createIncludesFile()
PatternSet.NameEntry
.public PatternSet.NameEntry createExclude()
PatternSet.NameEntry
.public PatternSet.NameEntry createExcludesFile()
PatternSet.NameEntry
.public void setFile(java.io.File file)
file
- the single File
included in this
AbstractFileSet
.public void setIncludes(java.lang.String includes)
includes
to the current list of include
patterns.
Patterns may be separated by a comma or a space.
includes
- the String
containing the include patterns.public void appendIncludes(java.lang.String[] includes)
includes
to the current list of include
patterns.includes
- array containing the include patterns.public void setExcludes(java.lang.String excludes)
excludes
to the current list of exclude
patterns.
Patterns may be separated by a comma or a space.
excludes
- the String
containing the exclude patterns.public void appendExcludes(java.lang.String[] excludes)
excludes
to the current list of include
patterns.excludes
- array containing the exclude patterns.public void setIncludesfile(java.io.File incl) throws BuildException
File
containing the includes patterns.incl
- File
instance.BuildException
- on errorpublic void setExcludesfile(java.io.File excl) throws BuildException
File
containing the excludes patterns.excl
- File
instance.BuildException
- on errorpublic void setDefaultexcludes(boolean useDefaultExcludes)
useDefaultExcludes
- boolean
.public boolean getDefaultexcludes()
public void setCaseSensitive(boolean caseSensitive)
caseSensitive
- boolean
.public boolean isCaseSensitive()
boolean
indicating whether the fileset is
case sensitive.public void setFollowSymlinks(boolean followSymlinks)
followSymlinks
- whether or not symbolic links should be followed.public boolean isFollowSymlinks()
boolean
indicating whether symbolic links
should be followed.public void setMaxLevelsOfSymlinks(int max)
public int getMaxLevelsOfSymlinks()
public void setErrorOnMissingDir(boolean errorOnMissingDir)
errorOnMissingDir
- true if missing directories cause errors,
false if not.public boolean getErrorOnMissingDir()
public DirectoryScanner getDirectoryScanner()
DirectoryScanner
instance.public DirectoryScanner getDirectoryScanner(Project p)
p
- the Project against which the DirectoryScanner should be configured.DirectoryScanner
instance.public void setupDirectoryScanner(FileScanner ds)
ds
- a FileScanner
instance.public void setupDirectoryScanner(FileScanner ds, Project p)
ds
- a FileScanner
instance.p
- an Ant Project
instance.protected AbstractFileSet getRef(Project p)
p
- the current projectpublic boolean hasSelectors()
hasSelectors
in interface SelectorContainer
public boolean hasPatterns()
public int selectorCount()
selectorCount
in interface SelectorContainer
int
.public FileSelector[] getSelectors(Project p)
getSelectors
in interface SelectorContainer
p
- the current projectFileSelector[]
of the selectors in this container.public java.util.Enumeration selectorElements()
selectorElements
in interface SelectorContainer
Enumeration
of selectors.public void appendSelector(FileSelector selector)
appendSelector
in interface SelectorContainer
selector
- the new FileSelector
to add.public void addSelector(SelectSelector selector)
addSelector
in interface SelectorContainer
selector
- the SelectSelector
to add.public void addAnd(AndSelector selector)
addAnd
in interface SelectorContainer
selector
- the AndSelector
to add.public void addOr(OrSelector selector)
addOr
in interface SelectorContainer
selector
- the OrSelector
to add.public void addNot(NotSelector selector)
addNot
in interface SelectorContainer
selector
- the NotSelector
to add.public void addNone(NoneSelector selector)
addNone
in interface SelectorContainer
selector
- the NoneSelector
to add.public void addMajority(MajoritySelector selector)
addMajority
in interface SelectorContainer
selector
- the MajoritySelector
to add.public void addDate(DateSelector selector)
addDate
in interface SelectorContainer
selector
- the DateSelector
to add.public void addSize(SizeSelector selector)
addSize
in interface SelectorContainer
selector
- the SizeSelector
to add.public void addDifferent(DifferentSelector selector)
addDifferent
in interface SelectorContainer
selector
- the DifferentSelector
to add.public void addFilename(FilenameSelector selector)
addFilename
in interface SelectorContainer
selector
- the FilenameSelector
to add.public void addType(TypeSelector selector)
addType
in interface SelectorContainer
selector
- the TypeSelector
to add.public void addCustom(ExtendSelector selector)
addCustom
in interface SelectorContainer
selector
- the ExtendSelector
to add.public void addContains(ContainsSelector selector)
addContains
in interface SelectorContainer
selector
- the ContainsSelector
to add.public void addPresent(PresentSelector selector)
addPresent
in interface SelectorContainer
selector
- the PresentSelector
to add.public void addDepth(DepthSelector selector)
addDepth
in interface SelectorContainer
selector
- the DepthSelector
to add.public void addDepend(DependSelector selector)
addDepend
in interface SelectorContainer
selector
- the DependSelector
to add.public void addContainsRegexp(ContainsRegexpSelector selector)
addContainsRegexp
in interface SelectorContainer
selector
- the ContainsRegexpSelector
to add.public void addModified(ModifiedSelector selector)
addModified
in interface SelectorContainer
selector
- the ModifiedSelector
to add.public void addReadable(ReadableSelector r)
public void addWritable(WritableSelector w)
public void add(FileSelector selector)
add
in interface SelectorContainer
selector
- the FileSelector
to add.public java.lang.String toString()
public java.lang.Object clone()
public java.lang.String[] mergeIncludes(Project p)
p
- the project to use.public java.lang.String[] mergeExcludes(Project p)
p
- the project to use.public PatternSet mergePatterns(Project p)
p
- the project to use.protected void dieOnCircularReference(java.util.Stack stk, Project p) throws BuildException
DataType
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
is true and
set it to true on exit.checked
dieOnCircularReference
in class DataType
stk
- the stack of references to check.p
- the project to use to dereference the references.BuildException
- on error.