KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > util > depend > DependencyAnalyzer


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */

18 package org.apache.tools.ant.util.depend;
19 import java.io.File JavaDoc;
20 import java.io.IOException JavaDoc;
21 import java.util.Enumeration JavaDoc;
22 import org.apache.tools.ant.types.Path;
23
24 /**
25  * A dependency analyzer analyzes dependencies between Java classes to
26  * determine the minimal set of classes which are required by a set of
27  * "root" classes. Different implementations of this interface can
28  * use different strategies and libraries to determine the required set. For
29  * example, some analyzers will use class files while others might use
30  * source files. Analyzer specific configuration is catered for through a
31  * generic configure method
32  *
33  */

34 public interface DependencyAnalyzer {
35     /**
36      * Add a source path to the source path used by this analyzer. The
37      * elements in the given path contain the source files for the classes
38      * being analyzed. Not all analyzers will use this information.
39      *
40      * @param sourcePath The Path instance specifying the source path
41      * elements.
42      */

43     void addSourcePath(Path sourcePath);
44
45     /**
46      * Add a classpath to the classpath being used by the analyzer. The
47      * classpath contains the binary classfiles for the classes being
48      * analyzed The elements may either be the directories or jar files.Not
49      * all analyzers will use this information.
50      *
51      * @param classpath the Path instance specifying the classpath elements
52      */

53     void addClassPath(Path classpath);
54
55     /**
56      * Add a root class. The root classes are used to drive the
57      * determination of dependency information. The analyzer will start at
58      * the root classes and add dependencies from there.
59      *
60      * @param classname the name of the class in Java dot notation.
61      */

62     void addRootClass(String JavaDoc classname);
63
64     /**
65      * Get the list of files in the file system upon which the root classes
66      * depend. The files will be either the classfiles or jar files upon
67      * which the root classes depend.
68      *
69      * @return an enumeration of File instances.
70      */

71     Enumeration JavaDoc getFileDependencies();
72
73     /**
74      * Get the list of classes upon which root classes depend. This is a
75      * list of Java classnames in dot notation.
76      *
77      * @return an enumeration of Strings, each being the name of a Java
78      * class in dot notation.
79      */

80     Enumeration JavaDoc getClassDependencies();
81
82
83     /**
84      * Reset the dependency list. This will reset the determined
85      * dependencies and the also list of root classes.
86      */

87     void reset();
88
89     /**
90      * Configure an aspect of the analyzer. The set of aspects that are
91      * supported is specific to each analyzer instance.
92      *
93      * @param name the name of the aspect being configured
94      * @param info the configuration information.
95      */

96     void config(String JavaDoc name, Object JavaDoc info);
97
98     /**
99      * Set the closure flag. If this flag is true the analyzer will traverse
100      * all class relationships until it has collected the entire set of
101      * direct and indirect dependencies
102      *
103      * @param closure true if dependencies should be traversed to determine
104      * indirect dependencies.
105      */

106     void setClosure(boolean closure);
107
108
109     /**
110      * Get the file that contains the class definition
111      *
112      * @param classname the name of the required class
113      * @return the file instance, zip or class, containing the
114      * class or null if the class could not be found.
115      * @exception IOException if the files in the classpath cannot be read.
116      */

117     File JavaDoc getClassContainer(String JavaDoc classname) throws IOException JavaDoc;
118
119     /**
120      * Get the file that contains the class source.
121      *
122      * @param classname the name of the required class
123      * @return the file instance, zip or java, containing the
124      * source or null if the source for the class could not be found.
125      * @exception IOException if the files in the sourcepath cannot be read.
126      */

127     File JavaDoc getSourceContainer(String JavaDoc classname) throws IOException JavaDoc;
128 }
129
130
Popular Tags