KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > ajdoc > rootmakers > Javadoc14


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the debugger and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  */

22 package org.aspectj.tools.ajdoc.rootmakers;
23
24 //import com.sun.javadoc.RootDoc;
25
//import com.sun.javadoc.DocErrorReporter;
26
//
27
//import java.lang.reflect.InvocationTargetException;
28
//import java.lang.reflect.Constructor;
29
//import java.lang.reflect.Method;
30
//import java.util.Iterator;
31
//import java.util.List;
32
//
33
//import org.aspectj.tools.ajdoc.CannotMakeRootDocException;
34
//import org.aspectj.tools.ajdoc.ErrPrinter;
35
//import org.aspectj.tools.ajdoc.RootDocMaker;
36
//import org.aspectj.tools.ajdoc.AccessChecker;
37

38 //XXX
39
//import com.sun.tools.javac.v8.util.Hashtable;
40

41 /**
42  * Makes a RootDoc using javadoc from SDK 1.4 as an example.
43  *
44  * @author Jeff Palm
45  */

46 //public class Javadoc14 extends Javadoc implements RootDocMaker {
47
//
48
// public Javadoc14() {}
49
//
50
// public RootDoc makeRootDoc(String sourcepath,
51
// String classpath,
52
// String bootclasspath,
53
// String extdirs,
54
// long flags,
55
// String encoding,
56
// String locale,
57
// String source,
58
// List classesAndPackages,
59
// List options,
60
// DocErrorReporter docErrorReporter,
61
// String programName,
62
// AccessChecker filter)
63
// throws CannotMakeRootDocException {
64
// this.err = (ErrPrinter)docErrorReporter;
65
// Class hashtableClass = null;
66
// String classname = "com.sun.tools.javac.v8.util.Hashtable";
67
// try {
68
// hashtableClass = Class.forName(classname);
69
// } catch (ClassNotFoundException e) {
70
// err.ex(e, "class_not_found", "Hashtable", classname);
71
// return null;
72
// }
73
// Object hashtable = null;
74
// try {
75
// hashtable = hashtableClass.newInstance();
76
// Method put = hashtableClass.getMethod("put",
77
// new Class[]{Object.class,
78
// Object.class});
79
// if (sourcepath != null) {
80
// put.invoke(hashtable, new Object[]{"-sourcepath",
81
// sourcepath});
82
// }
83
// if (classpath != null) {
84
// put.invoke(hashtable, new Object[]{"-classpath",
85
// classpath});
86
// }
87
// if (bootclasspath != null) {
88
// put.invoke(hashtable, new Object[]{"-bootclasspath",
89
// bootclasspath});
90
// }
91
// if (extdirs != null) {
92
// put.invoke(hashtable, new Object[]{"-extdirs",
93
// extdirs});
94
// }
95
// if (encoding != null) {
96
// put.invoke(hashtable, new Object[]{"-encoding",
97
// encoding});
98
// }
99
// if (true || (flags & 0x1) != 0) {
100
// put.invoke(hashtable, new Object[]{"-verbose",
101
// ""});
102
// }
103
// if (source != null) {
104
// put.invoke(hashtable, new Object[]{"-source",
105
// source});
106
// }
107
// if (filter != null) {
108
// put.invoke(hashtable, new Object[]{"-" + filter.getOption(),
109
// ""});
110
// }
111
// Hashtable h = (Hashtable)hashtable;
112
//
113
// } catch (NoSuchMethodException e) {
114
// err.ex(e, "method_not_found", classname, "put");
115
// return null;
116
// } catch (InvocationTargetException e) {
117
// err.invocationTargetException(e, classname, "put");
118
// return null;
119
// } catch (InstantiationException e) {
120
// err.ex(e, "must_have_default_ctor", classname);
121
// return null;
122
// } catch (IllegalAccessException e) {
123
// err.ex(e, "method_not_accessible", classname, "new()");
124
// return null;
125
// }
126
// Class messagerClass = null;
127
// classname = "com.sun.tools.javadoc.Messager";
128
// try {
129
// messagerClass = Class.forName(classname);
130
// } catch (ClassNotFoundException e) {
131
// err.ex(e, "class_not_found", "Messager", classname);
132
// return null;
133
// }
134
// Object messager = null;
135
// try {
136
// Constructor ctor =
137
// messagerClass.getConstructor(new Class[]{String.class});
138
// messager = ctor.newInstance(new Object[]{programName});
139
// } catch (InstantiationException e) {
140
// err.ex(e, "cant_construct_object", classname);
141
// return null;
142
// } catch (NoSuchMethodException e) {
143
// err.ex(e, "method_not_found", classname, "new(String)");
144
// return null;
145
// } catch (IllegalAccessException e) {
146
// err.ex(e, "method_not_accessible", classname, "new(String)");
147
// return null;
148
// } catch (InvocationTargetException e) {
149
// err.invocationTargetException(e, classname, "new(String)");
150
// return null;
151
// }
152
// Class javadocToolClass = null;
153
// classname = "com.sun.tools.javadoc.JavadocTool";
154
// try {
155
// javadocToolClass = Class.forName(classname);
156
// } catch (ClassNotFoundException e) {
157
// err.ex(e, "class_not_found", "JavadocTool", classname);
158
// return null;
159
// }
160
// Object javadocTool = null;
161
// try {
162
// Method make = javadocToolClass.getMethod("make",
163
// new Class[]{messagerClass,
164
// hashtableClass});
165
// javadocTool = make.invoke(null, new Object[]{messager,
166
// hashtable});
167
// } catch (NoSuchMethodException e) {
168
// err.ex(e, "method_not_found", classname, "make");
169
// return null;
170
// } catch (InvocationTargetException e) {
171
// err.invocationTargetException(e, classname, "make");
172
// return null;
173
// } catch (IllegalAccessException e) {
174
// err.ex(e, "method_not_accessible", classname, "make");
175
// return null;
176
// } catch (Exception e) {
177
// err.ex(e, "exception_thrown", "JavadocTool",
178
// classname, "make", e != null ? e.getMessage() : e+"");
179
// return null;
180
// }
181
// Class modifierFilterClass = null;
182
// classname = "com.sun.tools.javadoc.ModifierFilter";
183
// try {
184
// modifierFilterClass = Class.forName(classname);
185
// } catch (ClassNotFoundException e) {
186
// err.ex(e, "class_not_found", "ModifierFilter", classname);
187
// return null;
188
// }
189
// Object modifierFilter = null;
190
// classname = "com.sun.tools.javadoc.ModifierFilter";
191
// try {
192
// Constructor ctor =
193
// modifierFilterClass.getConstructor(new Class[]{long.class});
194
// modifierFilter = ctor.newInstance(new Object[]{new Long(flags)});
195
// } catch (InstantiationException e) {
196
// err.ex(e, "cant_construct_object", classname);
197
// return null;
198
// } catch (NoSuchMethodException e) {
199
// err.ex(e, "method_not_found", classname, "new()");
200
// return null;
201
// } catch (IllegalAccessException e) {
202
// err.ex(e, "method_not_accessible", classname, "new()");
203
// return null;
204
// } catch (InvocationTargetException e) {
205
// err.invocationTargetException(e, classname, "new()");
206
// return null;
207
// }
208
// Class listClass = null;
209
// classname = "com.sun.tools.javac.v8.util.List";
210
// try {
211
// listClass = Class.forName(classname);
212
// } catch (ClassNotFoundException e) {
213
// err.ex(e, "class_not_found", "List", classname);
214
// return null;
215
// }
216
// RootDoc rootDoc = null;
217
// classname = "com.sun.tools.javadoc.JavadocTool";
218
// try {
219
// Method getRootDocImpl =
220
// javadocToolClass.getMethod("getRootDocImpl",
221
// new Class[]{String.class,
222
// modifierFilterClass,
223
// listClass,
224
// listClass});
225
// Object classesOrPackageList = list(classesAndPackages, listClass);
226
// Object optionsList = list(options, listClass);
227
//
228
// rootDoc =
229
// (RootDoc)getRootDocImpl.invoke(javadocTool,
230
// new Object[]{locale,
231
// modifierFilter,
232
// classesOrPackageList,
233
// optionsList});
234
// } catch (NoSuchMethodException e) {
235
// err.ex(e, "method_not_found", classname, "getRootDocImpl");
236
// return null;
237
// } catch (InvocationTargetException e) {
238
// err.invocationTargetException(e, classname, "getRootDocImpl");
239
// return null;
240
// } catch (IllegalAccessException e) {
241
// err.ex(e, "method_not_accessible", classname, "getRootDocImpl");
242
// return null;
243
// } catch (ClassCastException e) {
244
// err.ex(e, "class_cast_exception", "getRootDocImpl", classname,
245
// "com.sun.javadoc.RootDoc",
246
// rootDoc == null ? "" : rootDoc.getClass().getName());
247
// return null;
248
// }
249
// return rootDoc;
250
// }
251
//
252
//
253
// private final Object list(List list, Class listClass) {
254
// if (listClass == null) return null;
255
// Object newlist = newInstance(listClass);
256
// if (newlist == null) return null;
257
// if (list == null) return newlist;
258
// Class listBufferClass = type("com.sun.tools.javac.v8.util.ListBuffer");
259
// if (listBufferClass == null) return newlist;
260
// Object listBuffer = newInstance(listBufferClass);
261
// if (listBuffer == null) return newlist;
262
// Method append = method("append", new Class[]{Object.class},listBufferClass);
263
// if (append == null) return newlist;
264
// for (Iterator i = list.iterator(); i.hasNext();) {
265
// invoke(append, listBuffer, new Object[]{i.next()});
266
// }
267
//
268
// Method toList = method("toList", new Class[]{}, listBufferClass);
269
// if (toList == null) return newlist;
270
// newlist = invoke(toList, listBuffer, new Object[]{});
271
// return newlist;
272
// }
273
//}
274
Popular Tags