source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/util/depend/DependencyAnalyzer.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 4.7 KB
Line 
1/*
2 * Copyright 2002,2004 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17package org.apache.tools.ant.util.depend;
18import java.io.File;
19import java.io.IOException;
20import java.util.Enumeration;
21import org.apache.tools.ant.types.Path;
22
23/**
24 * A dependency analyzer analyzes dependencies between Java classes to
25 * determine the minimal set of classes which are required by a set of
26 * "root" classes. Different implementations of this interface can
27 * use different strategies and libraries to determine the required set. For
28 * example, some analyzers will use class files while others might use
29 * source files. Analyzer specific configuration is catered for through a
30 * generic configure method
31 *
32 */
33public interface DependencyAnalyzer {
34 /**
35 * Add a source path to the source path used by this analyzer. The
36 * elements in the given path contain the source files for the classes
37 * being analyzed. Not all analyzers will use this information.
38 *
39 * @param sourcePath The Path instance specifying the source path
40 * elements.
41 */
42 void addSourcePath(Path sourcePath);
43
44 /**
45 * Add a classpath to the classpath being used by the analyzer. The
46 * classpath contains the binary classfiles for the classes being
47 * analyzed The elements may either be the directories or jar files.Not
48 * all analyzers will use this information.
49 *
50 * @param classpath the Path instance specifying the classpath elements
51 */
52 void addClassPath(Path classpath);
53
54 /**
55 * Add a root class. The root classes are used to drive the
56 * determination of dependency information. The analyzer will start at
57 * the root classes and add dependencies from there.
58 *
59 * @param classname the name of the class in Java dot notation.
60 */
61 void addRootClass(String classname);
62
63 /**
64 * Get the list of files in the file system upon which the root classes
65 * depend. The files will be either the classfiles or jar files upon
66 * which the root classes depend.
67 *
68 * @return an enumeration of File instances.
69 */
70 Enumeration getFileDependencies();
71
72 /**
73 * Get the list of classes upon which root classes depend. This is a
74 * list of Java classnames in dot notation.
75 *
76 * @return an enumeration of Strings, each being the name of a Java
77 * class in dot notation.
78 */
79 Enumeration getClassDependencies();
80
81
82 /**
83 * Reset the dependency list. This will reset the determined
84 * dependencies and the also list of root classes.
85 */
86 void reset();
87
88 /**
89 * Configure an aspect of the analyzer. The set of aspects that are
90 * supported is specific to each analyzer instance.
91 *
92 * @param name the name of the aspect being configured
93 * @param info the configuration information.
94 */
95 void config(String name, Object info);
96
97 /**
98 * Set the closure flag. If this flag is true the analyzer will traverse
99 * all class relationships until it has collected the entire set of
100 * direct and indirect dependencies
101 *
102 * @param closure true if dependencies should be traversed to determine
103 * indirect dependencies.
104 */
105 void setClosure(boolean closure);
106
107
108 /**
109 * Get the file that contains the class definition
110 *
111 * @param classname the name of the required class
112 * @return the file instance, zip or class, containing the
113 * class or null if the class could not be found.
114 * @exception IOException if the files in the classpath cannot be read.
115 */
116 File getClassContainer(String classname) throws IOException;
117
118 /**
119 * Get the file that contains the class source.
120 *
121 * @param classname the name of the required class
122 * @return the file instance, zip or java, containing the
123 * source or null if the source for the class could not be found.
124 * @exception IOException if the files in the sourcepath cannot be read.
125 */
126 File getSourceContainer(String classname) throws IOException;
127}
128
Note: See TracBrowser for help on using the repository browser.