Top Description Fields Constructors Methods
org.apache.tools.ant.util.depend

public abstract Class AbstractAnalyzer

extends Object
implements DependencyAnalyzer
Class Inheritance
All Implemented Interfaces
org.apache.tools.ant.util.depend.DependencyAnalyzer
Known Direct Subclasses
org.apache.tools.ant.taskdefs.optional.depend.AntAnalyzer
Imports
java.io.File, .IOException, java.util.Enumeration, .Vector, java.util.zip.ZipFile, org.apache.tools.ant.BuildException, org.apache.tools.ant.types.Path, org.apache.tools.ant.util.VectorSet

An abstract implementation of the analyzer interface providing support for the bulk of interface methods.

Field Summary

Modifier and TypeField and Description
private Vector<String>
classDependencies

the list of java classes the root classes depend upon

private Path
classPath

The classpath containing dirs and jars of class files

private boolean
closure

true if indirect dependencies should be gathered

private boolean
determined

true if dependencies have been determined

private Vector<File>
fileDependencies

the list of File objects that the root classes depend upon

public static final int
MAX_LOOPS

Maximum number of loops for looking for indirect dependencies.

private final Vector<String>
rootClasses

The list of root classes

private Path
sourcePath

The source path for the source files

Constructor Summary

AccessConstructor and Description
protected
AbstractAnalyzer()

Setup the analyzer

Method Summary

Modifier and TypeMethod and Description
public void
addClassPath(Path
the Path instance specifying the classpath elements
classPath
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.addClassPath.

Add a classpath to the classpath being used by the analyzer.
public void
addRootClass(String
the name of the class in Java dot notation.
className
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.addRootClass.

Add a root class.
public void
addSourcePath(Path
The Path instance specifying the source path elements.
sourcePath
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.addSourcePath.

Add a source path to the source path used by this analyzer.
public void
config(String
the name of the aspect being configured
name
,
Object
the configuration info.
info
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.config.

Configure an aspect of the analyzer.
protected abstract void
determineDependencies(Vector<File>
a vector into which Files upon which the root classes depend should be placed.
files
,
Vector<String>
a vector of Strings into which the names of classes upon which the root classes depend should be placed.
classes
)

Determine the dependencies of the current set of root classes

public File

Returns:

the file instance, zip or class, containing the class or null if the class could not be found.
getClassContainer
(String
the name of the required class
classname
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getClassContainer.

Get the file that contains the class definition
public Enumeration<String>

Returns:

an enumeration of Strings, each being the name of a Java class in dot notation.
getClassDependencies
()

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getClassDependencies.

Get the list of classes upon which root classes depend.
public Enumeration<File>

Returns:

an enumeration of File instances.
getFileDependencies
()

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getFileDependencies.

Get the list of files in the file system upon which the root classes depend.
private File

Returns:

the file instance, zip or class, containing the class or null if the class could not be found.
getResourceContainer
(String
the name of the required resource.
resourceLocation
,
String[]
the paths which will be searched for the resource.
paths
)

Get the file that contains the resource

protected Enumeration<String>

Returns:

an enumeration of Strings, each of which is a class name for a root class.
getRootClasses
()

Get an enumeration of the root classes

public File

Returns:

the file instance, zip or java, containing the source or null if the source for the class could not be found.
getSourceContainer
(String
the name of the required class
classname
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getSourceContainer.

Get the file that contains the class source.
protected boolean

Returns:

true if indirect relationships should be followed.
isClosureRequired
()

Indicate if the analyzer is required to follow indirect class relationships.

public void
reset()

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.reset.

Reset the dependency list.
public void
setClosure(boolean
true if dependencies should be traversed to determine indirect dependencies.
closure
)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.setClosure.

Set the closure flag.
protected abstract boolean

Returns:

true if file dependencies are supported.
supportsFileDependencies
()

Indicate if the particular subclass supports file dependency information.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classDependenciesback to summary
private Vector<String> classDependencies

the list of java classes the root classes depend upon

classPathback to summary
private Path classPath

The classpath containing dirs and jars of class files

closureback to summary
private boolean closure

true if indirect dependencies should be gathered

determinedback to summary
private boolean determined

true if dependencies have been determined

fileDependenciesback to summary
private Vector<File> fileDependencies

the list of File objects that the root classes depend upon

MAX_LOOPSback to summary
public static final int MAX_LOOPS

Maximum number of loops for looking for indirect dependencies.

rootClassesback to summary
private final Vector<String> rootClasses

The list of root classes

sourcePathback to summary
private Path sourcePath

The source path for the source files

Constructor Detail

AbstractAnalyzerback to summary
protected AbstractAnalyzer()

Setup the analyzer

Method Detail

addClassPathback to summary
public void addClassPath(Path classPath)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.addClassPath.

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.

Parameters
classPath:Path

the Path instance specifying the classpath elements

Annotations
@Override
addRootClassback to summary
public void addRootClass(String className)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.addRootClass.

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.

Parameters
className:String

the name of the class in Java dot notation.

Annotations
@Override
addSourcePathback to summary
public void addSourcePath(Path sourcePath)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.addSourcePath.

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.

Parameters
sourcePath:Path

The Path instance specifying the source path elements.

Annotations
@Override
configback to summary
public void config(String name, Object info)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.config.

Configure an aspect of the analyzer. The set of aspects that are supported is specific to each analyzer instance.

Parameters
name:String

the name of the aspect being configured

info:Object

the configuration info.

Annotations
@Override
determineDependenciesback to summary
protected abstract void determineDependencies(Vector<File> files, Vector<String> classes)

Determine the dependencies of the current set of root classes

Parameters
files:Vector<File>

a vector into which Files upon which the root classes depend should be placed.

classes:Vector<String>

a vector of Strings into which the names of classes upon which the root classes depend should be placed.

getClassContainerback to summary
public File getClassContainer(String classname) throws IOException

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getClassContainer.

Get the file that contains the class definition

Parameters
classname:String

the name of the required class

Returns:File

the file instance, zip or class, containing the class or null if the class could not be found.

Annotations
@Override
Exceptions
IOException:
if the files in the classpath cannot be read.
getClassDependenciesback to summary
public Enumeration<String> getClassDependencies()

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getClassDependencies.

Get the list of classes upon which root classes depend. This is a list of Java classnames in dot notation.

Returns:Enumeration<String>

an enumeration of Strings, each being the name of a Java class in dot notation.

Annotations
@Override
getFileDependenciesback to summary
public Enumeration<File> getFileDependencies()

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.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.

Returns:Enumeration<File>

an enumeration of File instances.

Annotations
@Override
getResourceContainerback to summary
private File getResourceContainer(String resourceLocation, String[] paths) throws IOException

Get the file that contains the resource

Parameters
resourceLocation:String

the name of the required resource.

paths:String[]

the paths which will be searched for the resource.

Returns:File

the file instance, zip or class, containing the class or null if the class could not be found.

Exceptions
IOException:
if the files in the given paths cannot be read.
getRootClassesback to summary
protected Enumeration<String> getRootClasses()

Get an enumeration of the root classes

Returns:Enumeration<String>

an enumeration of Strings, each of which is a class name for a root class.

getSourceContainerback to summary
public File getSourceContainer(String classname) throws IOException

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.getSourceContainer.

Get the file that contains the class source.

Parameters
classname:String

the name of the required class

Returns:File

the file instance, zip or java, containing the source or null if the source for the class could not be found.

Annotations
@Override
Exceptions
IOException:
if the files in the sourcepath cannot be read.
isClosureRequiredback to summary
protected boolean isClosureRequired()

Indicate if the analyzer is required to follow indirect class relationships.

Returns:boolean

true if indirect relationships should be followed.

resetback to summary
public void reset()

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.reset.

Reset the dependency list. This will reset the determined dependencies and the also list of root classes.

Annotations
@Override
setClosureback to summary
public void setClosure(boolean closure)

Implements org.apache.tools.ant.util.depend.DependencyAnalyzer.setClosure.

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

Parameters
closure:boolean

true if dependencies should be traversed to determine indirect dependencies.

Annotations
@Override
supportsFileDependenciesback to summary
protected abstract boolean supportsFileDependencies()

Indicate if the particular subclass supports file dependency information.

Returns:boolean

true if file dependencies are supported.