org.apache.tools.ant.util.depend
Class AbstractAnalyzer
java.lang.Object
org.apache.tools.ant.util.depend.AbstractAnalyzer
- DependencyAnalyzer
public abstract class AbstractAnalyzer
extends java.lang.Object
An abstract implementation of the analyzer interface providing support
for the bulk of interface methods.
static int | MAX_LOOPS - Maximum number of loops for looking for indirect dependencies.
|
void | addClassPath(Path classPath) - Add a classpath to the classpath being used by the analyzer.
|
void | addRootClass(String className) - Add a root class.
|
void | addSourcePath(Path sourcePath) - Add a source path to the source path used by this analyzer.
|
void | config(String name, Object info) - Configure an aspect of the analyzer.
|
protected abstract void | determineDependencies(Vector files, Vector classes) - Determine the dependencies of the current set of root classes
|
File | getClassContainer(String classname) - Get the file that contains the class definition
|
Enumeration | getClassDependencies() - Get the list of classes upon which root classes depend.
|
Enumeration | getFileDependencies() - Get the list of files in the file system upon which the root classes
depend.
|
protected Enumeration | getRootClasses() - Get an enumeration of the root classes
|
File | getSourceContainer(String classname) - Get the file that contains the class source.
|
protected boolean | isClosureRequired() - Indicate if the analyzer is required to follow
indirect class relationships.
|
void | reset() - Reset the dependency list.
|
void | setClosure(boolean closure) - Set the closure flag.
|
protected abstract boolean | supportsFileDependencies() - Indicate if the particular subclass supports file dependency
information.
|
MAX_LOOPS
public static final int MAX_LOOPS
Maximum number of loops for looking for indirect dependencies.
AbstractAnalyzer
protected AbstractAnalyzer()
Setup the analyzer
addClassPath
public void addClassPath(Path classPath)
Add a classpath to the classpath being used by the analyzer. The
classpath contains the binary classfiles for the classes being
analyzed The elements may either be the directories or jar files.Not
all analyzers will use this information.
- addClassPath in interface DependencyAnalyzer
classPath
- the Path instance specifying the classpath elements
addRootClass
public void addRootClass(String className)
Add a root class. The root classes are used to drive the
determination of dependency information. The analyzer will start at
the root classes and add dependencies from there.
- addRootClass in interface DependencyAnalyzer
className
- the name of the class in Java dot notation.
addSourcePath
public void addSourcePath(Path sourcePath)
Add a source path to the source path used by this analyzer. The
elements in the given path contain the source files for the classes
being analyzed. Not all analyzers will use this information.
- addSourcePath in interface DependencyAnalyzer
sourcePath
- The Path instance specifying the source path
elements.
config
public void config(String name,
Object info)
Configure an aspect of the analyzer. The set of aspects that are
supported is specific to each analyzer instance.
- config in interface DependencyAnalyzer
name
- the name of the aspect being configuredinfo
- the configuration info.
determineDependencies
protected abstract void determineDependencies(Vector files,
Vector classes)
Determine the dependencies of the current set of root classes
files
- a vector into which Files upon which the root classes
depend should be placed.classes
- a vector of Strings into which the names of classes
upon which the root classes depend should be placed.
getClassContainer
public File getClassContainer(String classname)
throws IOException
Get the file that contains the class definition
- getClassContainer in interface DependencyAnalyzer
classname
- the name of the required class
- the file instance, zip or class, containing the
class or null if the class could not be found.
getClassDependencies
public Enumeration getClassDependencies()
Get the list of classes upon which root classes depend. This is a
list of Java classnames in dot notation.
- getClassDependencies in interface DependencyAnalyzer
- an enumeration of Strings, each being the name of a Java
class in dot notation.
getFileDependencies
public Enumeration getFileDependencies()
Get the list of files in the file system upon which the root classes
depend. The files will be either the classfiles or jar files upon
which the root classes depend.
- getFileDependencies in interface DependencyAnalyzer
- an enumeration of File instances.
getRootClasses
protected Enumeration getRootClasses()
Get an enumeration of the root classes
- an enumeration of Strings, each of which is a class name
for a root class.
getSourceContainer
public File getSourceContainer(String classname)
throws IOException
Get the file that contains the class source.
- getSourceContainer in interface DependencyAnalyzer
classname
- the name of the required class
- the file instance, zip or java, containing the
source or null if the source for the class could not be found.
isClosureRequired
protected boolean isClosureRequired()
Indicate if the analyzer is required to follow
indirect class relationships.
- true if indirect relationships should be followed.
reset
public void reset()
Reset the dependency list. This will reset the determined
dependencies and the also list of root classes.
- reset in interface DependencyAnalyzer
setClosure
public void setClosure(boolean closure)
Set the closure flag. If this flag is true the analyzer will traverse
all class relationships until it has collected the entire set of
direct and indirect dependencies
- setClosure in interface DependencyAnalyzer
closure
- true if dependencies should be traversed to determine
indirect dependencies.
supportsFileDependencies
protected abstract boolean supportsFileDependencies()
Indicate if the particular subclass supports file dependency
information.
- true if file dependencies are supported.
Copyright B) 2000-2006 Apache Software Foundation. All Rights Reserved.