1 /*
2 * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.tools.doclets.internal.toolkit;
27
28 import com.sun.javadoc.*;
29 import com.sun.tools.doclets.internal.toolkit.builders.*;
30 import com.sun.tools.doclets.internal.toolkit.util.*;
31 import java.io.File;
32 import java.util.StringTokenizer;
33
34 /**
35 * An abstract implementation of a Doclet.
36 *
37 * <p><b>This is NOT part of any supported API.
38 * If you write code that depends on this, you do so at your own risk.
39 * This code and its internal interfaces are subject to change or
40 * deletion without notice.</b>
41 *
42 * @author Jamie Ho
43 */
44 public abstract class AbstractDoclet {
45
46 /**
47 * The global configuration information for this run.
48 */
49 public Configuration configuration;
50
51 /**
52 * The only doclet that may use this toolkit is {@value}
111 * first and then can be used in the later generation.
112 *
113 * @see com.sun.javadoc.RootDoc
114 */
115 private void startGeneration(RootDoc root) throws Exception {
116 if (root.classes().length == 0) {
117 configuration.message.
118 error("doclet.No_Public_Classes_To_Document");
119 return;
120 }
121 configuration.setOptions();
122 configuration.getDocletSpecificMsg().notice("doclet.build_version",
123 configuration.getDocletSpecificBuildDate());
124 ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
125
126 generateClassFiles(root, classtree);
127 Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
128
129 PackageListWriter.generate(configuration);
130 generatePackageFiles(classtree);
131
132 generateOtherFiles(root, classtree);
133 configuration.tagletManager.printReport();
134 }
135
136 /**
137 * Generate additional documentation that is added to the API documentation.
138 *
139 * @param root the RootDoc of source to document.
140 * @param classtree the data structure representing the class tree.
141 */
142 protected void generateOtherFiles(RootDoc root, ClassTree classtree) throws Exception {
143 BuilderFactory builderFactory = configuration.getBuilderFactory();
144 AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuider();
145 constantsSummaryBuilder.build();
146 AbstractBuilder serializedFormBuilder = builderFactory.getSerializedFormBuilder();
147 serializedFormBuilder.build();
148 }
149
150 /**
151 * Generate the package documentation.
152 *
153 * @param classtree the data structure representing the class tree.
154 */
155 protected abstract void generatePackageFiles(ClassTree classtree) throws Exception;
156
157 /**
158 * Generate the class documentation.
159 *
160 * @param classtree the data structure representing the class tree.
161 */
162 protected abstract void generateClassFiles(ClassDoc[] arr, ClassTree classtree);
163
164 /**
165 * Iterate through all classes and construct documentation for them.
166 *
167 * @param root the RootDoc of source to document.
168 * @param classtree the data structure representing the class tree.
|
1 /*
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.tools.doclets.internal.toolkit;
27
28 import com.sun.javadoc.*;
29 import com.sun.tools.doclets.internal.toolkit.builders.*;
30 import com.sun.tools.doclets.internal.toolkit.util.*;
31
32 /**
33 * An abstract implementation of a Doclet.
34 *
35 * <p><b>This is NOT part of any supported API.
36 * If you write code that depends on this, you do so at your own risk.
37 * This code and its internal interfaces are subject to change or
38 * deletion without notice.</b>
39 *
40 * @author Jamie Ho
41 */
42 public abstract class AbstractDoclet {
43
44 /**
45 * The global configuration information for this run.
46 */
47 public Configuration configuration;
48
49 /**
50 * The only doclet that may use this toolkit is {@value}
109 * first and then can be used in the later generation.
110 *
111 * @see com.sun.javadoc.RootDoc
112 */
113 private void startGeneration(RootDoc root) throws Exception {
114 if (root.classes().length == 0) {
115 configuration.message.
116 error("doclet.No_Public_Classes_To_Document");
117 return;
118 }
119 configuration.setOptions();
120 configuration.getDocletSpecificMsg().notice("doclet.build_version",
121 configuration.getDocletSpecificBuildDate());
122 ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
123
124 generateClassFiles(root, classtree);
125 Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
126
127 PackageListWriter.generate(configuration);
128 generatePackageFiles(classtree);
129 generateProfileFiles();
130
131 generateOtherFiles(root, classtree);
132 configuration.tagletManager.printReport();
133 }
134
135 /**
136 * Generate additional documentation that is added to the API documentation.
137 *
138 * @param root the RootDoc of source to document.
139 * @param classtree the data structure representing the class tree.
140 */
141 protected void generateOtherFiles(RootDoc root, ClassTree classtree) throws Exception {
142 BuilderFactory builderFactory = configuration.getBuilderFactory();
143 AbstractBuilder constantsSummaryBuilder = builderFactory.getConstantsSummaryBuider();
144 constantsSummaryBuilder.build();
145 AbstractBuilder serializedFormBuilder = builderFactory.getSerializedFormBuilder();
146 serializedFormBuilder.build();
147 }
148
149 /**
150 * Generate the profile documentation.
151 *
152 */
153 protected abstract void generateProfileFiles() throws Exception;
154
155 /**
156 * Generate the package documentation.
157 *
158 * @param classtree the data structure representing the class tree.
159 */
160 protected abstract void generatePackageFiles(ClassTree classtree) throws Exception;
161
162 /**
163 * Generate the class documentation.
164 *
165 * @param classtree the data structure representing the class tree.
166 */
167 protected abstract void generateClassFiles(ClassDoc[] arr, ClassTree classtree);
168
169 /**
170 * Iterate through all classes and construct documentation for them.
171 *
172 * @param root the RootDoc of source to document.
173 * @param classtree the data structure representing the class tree.
|