You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by th...@apache.org on 2007/07/17 00:17:48 UTC
svn commit: r556752 [1/3] - in
/forrest/trunk/whiteboard/forrestdoc/src/java: ./
org/apache/forrest/forrestdoc/java/doc/
org/apache/forrest/forrestdoc/java/src/
org/apache/forrest/forrestdoc/java/src/symtab/
org/apache/forrest/forrestdoc/java/src/util/...
Author: thorsten
Date: Mon Jul 16 15:17:40 2007
New Revision: 556752
URL: http://svn.apache.org/viewvc?view=rev&rev=556752
Log:
FOR-1025
Applying patch from Vincent Siveton. Thanks.
Added:
forrest/trunk/whiteboard/forrestdoc/src/java/log4j.properties (with props)
Modified:
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/doc/XMLDoclet.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/HTMLOutputWriter.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/JavaSrcTask.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/LineOutputWriter.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass1.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass2.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ArrayDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/BlockDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDefProxy.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassTag.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Definition.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/DummyClass.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/HTMLTag.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/HTMLTagContainer.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/HasImports.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/JavaHashtable.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/JavaStack.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/JavaVector.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/LabelDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/MethodDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/MultiDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Occurrence.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/PackageDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/PrimitiveDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferencePersistor.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferenceTypes.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ScopedDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/StringTable.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/SymbolTable.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Taggable.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/TypedDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/VariableDef.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Visitor.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSCollections.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSComparable.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/QuickSort.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SkipCRInputStream.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SortableString.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/FileListener.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/JavaToken.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLDoc.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLIndex.java
forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/JSDocTask.java
Added: forrest/trunk/whiteboard/forrestdoc/src/java/log4j.properties
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/log4j.properties?view=auto&rev=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/log4j.properties (added)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/log4j.properties Mon Jul 16 15:17:40 2007
@@ -0,0 +1,24 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+log4j.rootCategory=INFO, stdout
+
+log4j.appender.stdout=org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.stdout.layout.ConversionPattern=[%5p] %m%n
+
+log4j.logger.org.apache.forrest.forrestdoc=INFO
Propchange: forrest/trunk/whiteboard/forrestdoc/src/java/log4j.properties
------------------------------------------------------------------------------
svn:eol-style = native
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/doc/XMLDoclet.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/doc/XMLDoclet.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/doc/XMLDoclet.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/doc/XMLDoclet.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,27 +17,46 @@
package org.apache.forrest.forrestdoc.java.doc;
-import com.sun.javadoc.*;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.AttributesImpl;
+import java.io.File;
+import java.util.Enumeration;
+import java.util.Vector;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
-import java.io.File;
-import java.util.Enumeration;
-import java.util.Vector;
+
+import org.apache.log4j.Logger;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+import com.sun.javadoc.ClassDoc;
+import com.sun.javadoc.ConstructorDoc;
+import com.sun.javadoc.Doc;
+import com.sun.javadoc.Doclet;
+import com.sun.javadoc.ExecutableMemberDoc;
+import com.sun.javadoc.FieldDoc;
+import com.sun.javadoc.MethodDoc;
+import com.sun.javadoc.PackageDoc;
+import com.sun.javadoc.Parameter;
+import com.sun.javadoc.RootDoc;
+import com.sun.javadoc.Tag;
+import com.sun.javadoc.ThrowsTag;
+import com.sun.javadoc.Type;
/**
* Main Doclet class to generate JavaDocXML. This doclet generates the
* document conforming to DTD specified in javadoc-v04draft.dtd.
+ *
+ * @version $Id: $
*/
-
public class XMLDoclet extends Doclet {
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( XMLDoclet.class );
+
private String xmlns = "jvx";
private String encodingFormat = "ISO-8859-1";
private String localName = "javadoc";
@@ -56,8 +75,8 @@
}
File writer = new File(targetFileName);
- StreamResult result = new StreamResult(writer);
-
+ StreamResult result = new StreamResult(writer);
+
// SAX2.0 ContentHandler.
handler = tFactory.newTransformerHandler();
@@ -668,8 +687,7 @@
new XMLDoclet(root);
return true;
} catch (Exception e) {
- e.printStackTrace();
- System.exit(1);
+ log.error( "Exception: " + e.getMessage(), e );
return false;
}
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/HTMLOutputWriter.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/HTMLOutputWriter.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/HTMLOutputWriter.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/HTMLOutputWriter.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,15 +22,15 @@
/**
* Class HTMLOutputWriter
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class HTMLOutputWriter extends OutputStreamWriter {
/**
* Constructor HTMLOutputWriter
- *
- * @param output
+ *
+ * @param output
*/
public HTMLOutputWriter(OutputStream output) {
super(output);
@@ -38,9 +38,9 @@
/**
* Method writeHTML
- *
- * @param c
- * @throws IOException
+ *
+ * @param c
+ * @throws IOException
*/
public void writeHTML(int c) throws IOException {
@@ -62,9 +62,9 @@
/**
* Method writeHTML
- *
- * @param s
- * @throws IOException
+ *
+ * @param s
+ * @throws IOException
*/
public void writeHTML(String s) throws IOException {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/JavaSrcTask.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/JavaSrcTask.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/JavaSrcTask.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/JavaSrcTask.java Mon Jul 16 15:17:40 2007
@@ -32,6 +32,9 @@
/**
* Runs the javasrc converter as a task inside
* the well known build tool "ant" (see ant.apache.org).
+ *
+ * @see <a href="http://ant.apache.org">http://ant.apache.org</a>
+ * @version $Id: $
*/
public class JavaSrcTask extends MatchingTask {
@@ -59,7 +62,7 @@
/**
* Returns the directory where the Java sources are stored.
- *
+ *
* @return String directory name
*/
public File getSrcDir() {
@@ -68,7 +71,7 @@
/**
* Sets the directory where the Java sources are stored.
- *
+ *
* @param javaDir directory name
*/
public void setSrcDir(File javaDir) {
@@ -77,7 +80,7 @@
/**
* Returns the directory where the HTML output is written.
- *
+ *
* @return String directory name
*/
public File getDestDir() {
@@ -86,7 +89,7 @@
/**
* Sets the directory where the HTML output is written.
- *
+ *
* @param htmlDir directory name
*/
public void setDestDir(File htmlDir) {
@@ -94,7 +97,7 @@
}
/**
- * @throws BuildException
+ * @throws BuildException
* @see org.apache.tools.ant.Task#execute()
*/
public void execute() throws BuildException {
@@ -161,8 +164,8 @@
/**
* Method getRecurse
- *
- * @return
+ *
+ * @return
*/
public boolean getRecurse() {
return recurse;
@@ -170,8 +173,8 @@
/**
* Method setRecurse
- *
- * @param recurse
+ *
+ * @param recurse
*/
public void setRecurse(boolean recurse) {
this.recurse = recurse;
@@ -179,8 +182,8 @@
/**
* Method getTitle
- *
- * @return
+ *
+ * @return
*/
public String getTitle() {
return title;
@@ -188,8 +191,8 @@
/**
* Method setTitle
- *
- * @param title
+ *
+ * @param title
*/
public void setTitle(String title) {
this.title = title;
@@ -197,8 +200,8 @@
/**
* Method getVerbose
- *
- * @return
+ *
+ * @return
*/
public boolean getVerbose() {
return verbose;
@@ -206,8 +209,8 @@
/**
* Method setVerbose
- *
- * @param verbose
+ *
+ * @param verbose
*/
public void setVerbose(boolean verbose) {
this.verbose = verbose;
@@ -311,8 +314,8 @@
"}";
/**
* Method printCSSFile
- *
- * @throws IOException
+ *
+ * @throws IOException
*/
private void printCSSFile() throws IOException {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/LineOutputWriter.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/LineOutputWriter.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/LineOutputWriter.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/LineOutputWriter.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,8 +21,8 @@
/**
* Class LineOutputWriter
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class LineOutputWriter extends HTMLOutputWriter {
@@ -39,8 +39,8 @@
/**
* Constructor LineOutputWriter
- *
- * @param output
+ *
+ * @param output
*/
public LineOutputWriter(OutputStream output) {
@@ -48,15 +48,10 @@
_lineNumber = 1;
_firstLine = true;
- _oldLength = 1;
- _spaceString = "";
}
/**
- * Method write
- *
- * @param c
- * @throws IOException
+ * @see java.io.OutputStreamWriter#write(int)
*/
public void write(int c) throws IOException {
@@ -74,10 +69,7 @@
}
/**
- * Method writeHTML
- *
- * @param c
- * @throws IOException
+ * @see org.apache.forrest.forrestdoc.java.src.HTMLOutputWriter#writeHTML(int)
*/
public void writeHTML(int c) throws IOException {
@@ -95,10 +87,7 @@
}
/**
- * Method write
- *
- * @param s
- * @throws IOException
+ * @see java.io.Writer#write(java.lang.String)
*/
public void write(String s) throws IOException {
@@ -110,10 +99,7 @@
}
/**
- * Method writeHTML
- *
- * @param s
- * @throws IOException
+ * @see org.apache.forrest.forrestdoc.java.src.HTMLOutputWriter#writeHTML(java.lang.String)
*/
public void writeHTML(String s) throws IOException {
@@ -126,8 +112,8 @@
/**
* Method writeLineNumber
- *
- * @throws IOException
+ *
+ * @throws IOException
*/
public void writeLineNumber() throws IOException {
@@ -154,10 +140,4 @@
/** Field _firstLine */
private boolean _firstLine;
-
- /** Field _oldLength */
- private int _oldLength;
-
- /** Field _spaceString */
- private String _spaceString;
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass1.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass1.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass1.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass1.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,6 +16,8 @@
*/
package org.apache.forrest.forrestdoc.java.src;
+import org.apache.log4j.Logger;
+
import org.apache.forrest.forrestdoc.java.src.symtab.HTMLTag;
import org.apache.forrest.forrestdoc.java.src.symtab.HTMLTagContainer;
import org.apache.forrest.forrestdoc.java.src.symtab.PackageDef;
@@ -40,11 +42,14 @@
/**
* Class Pass1
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class Pass1 implements FileListener {
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( Pass1.class );
+
/** Field DEFAULT_DIR */
public static final String DEFAULT_DIR = ".";
@@ -65,8 +70,8 @@
/**
* Method getOutDir
- *
- * @return
+ *
+ * @return
*/
public String getOutDir() {
return _outDir;
@@ -74,8 +79,8 @@
/**
* Method setOutDir
- *
- * @param d
+ *
+ * @param d
*/
public void setOutDir(String d) {
_outDir = d;
@@ -83,8 +88,8 @@
/**
* Method getTitle
- *
- * @return
+ *
+ * @return
*/
public String getTitle() {
return _title;
@@ -92,8 +97,8 @@
/**
* Method setTitle
- *
- * @param t
+ *
+ * @param t
*/
public void setTitle(String t) {
_title = t;
@@ -101,8 +106,8 @@
/**
* Method getRecurse
- *
- * @return
+ *
+ * @return
*/
public boolean getRecurse() {
return _doRecurse;
@@ -110,8 +115,8 @@
/**
* Method setRecurse
- *
- * @param recurse
+ *
+ * @param recurse
*/
public void setRecurse(boolean recurse) {
_doRecurse = recurse;
@@ -119,8 +124,8 @@
/**
* Method setVerbose
- *
- * @param verbose
+ *
+ * @param verbose
*/
public void setVerbose(boolean verbose) {
_verbose = verbose;
@@ -128,17 +133,15 @@
/**
* Method getVerbose
- *
- * @return
+ *
+ * @return
*/
public boolean getVerbose() {
return _verbose;
}
/**
- * Method notify
- *
- * @param path
+ * @see org.apache.forrest.forrestdoc.java.src.xref.FileListener#notify(java.lang.String)
*/
public void notify(String path) {
printAdvancement(path);
@@ -147,8 +150,8 @@
/**
* Method run
- *
- * @param args
+ *
+ * @param args
*/
public void run(String[] args) {
@@ -160,9 +163,11 @@
// if we have at least one command-line argument
if (args.length > 0) {
- System.out.println("\noutDirPath is " + getOutDir());
+ print("outDirPath is " + getOutDir());
+
symbolTable.setOutDirPath(getOutDir());
- System.out.print("\nParsing");
+
+ println("Parsing");
// for each directory/file specified on the command line
for (int i = 0; i < args.length; i++) {
@@ -170,21 +175,22 @@
getRecurse(), this); // parse it
}
- System.out.print("\nResolving types");
+ println("Resolving types");
// resolve the types of all symbols in the symbol table
symbolTable.resolveTypes();
symbolTable.resolveRefs();
} else {
- System.out.println(USAGE);
+ println(USAGE);
+ return;
}
// Iterate through each package
Hashtable packageTable = symbolTable.getPackages();
Enumeration pEnum = packageTable.elements();
- System.out.print("\nPersisting definitions");
-
+ println("Persisting definitions");
+
while (pEnum.hasMoreElements()) {
PackageDef pDef = (PackageDef) pEnum.nextElement();
@@ -229,12 +235,12 @@
pDef.persistDefinitions(getOutDir());
}
- System.out.print("\nPersisting references");
+ println("Persisting references");
+
symbolTable.persistRefs(getOutDir());
} catch (Exception e) {
- System.err.println("exception: " + e);
- e.printStackTrace(System.err); // so we can get stack trace
- System.exit(1); // make this behavior an option?
+ log.error( "Exception: " + e.getMessage(), e );
+ //System.exit(1); // make this behavior an option?
}
}
@@ -243,7 +249,7 @@
*/
public void initializeDefaults() {
- String outdir = (String) System.getProperty("outdir");
+ String outdir = System.getProperty("outdir");
if (outdir == null) {
outdir = DEFAULT_DIR;
@@ -251,7 +257,7 @@
setOutDir(outdir);
- String title = (String) System.getProperty("title");
+ String title = System.getProperty("title");
if (title == null) {
title = "Pass1: " + outdir;
@@ -260,7 +266,7 @@
setTitle(title);
boolean doRecurse = true;
- String recurseStr = (String) System.getProperty("recurse");
+ String recurseStr = System.getProperty("recurse");
if (recurseStr != null) {
recurseStr = recurseStr.trim();
@@ -276,7 +282,7 @@
setRecurse(doRecurse);
boolean verbose = false;
- String verboseStr = (String) System.getProperty("verbose");
+ String verboseStr = System.getProperty("verbose");
if (verboseStr != null) {
verboseStr = verboseStr.trim();
@@ -294,8 +300,8 @@
/**
* Method createDirs
- *
- * @param f
+ *
+ * @param f
*/
public void createDirs(File f) {
@@ -309,10 +315,10 @@
/**
* Method getBackupPath
- *
- * @param tagList
- * @param element
- * @return
+ *
+ * @param tagList
+ * @param element
+ * @return
*/
public String getBackupPath(Object[] tagList, int element) {
@@ -344,9 +350,9 @@
/**
* Returns the path to the top level of the source hierarchy from the files
* og\f a given class.
- *
+ *
* @param packageName the package to get the backup path for
- * @return
+ * @return
* @returns the path from the package to the top level, as a string
*/
public static String getBackupPath(String packageName) {
@@ -356,7 +362,11 @@
int dirs = 0;
String newPath = "";
- // System.out.println("gBP Package Name for BackupPath: "+ packageName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("getBackupPath(String) - Package Name for BackupPath=" + packageName);
+ }
+
dirs = st.countTokens();
for (int j = 0; j < dirs; j++) {
@@ -365,17 +375,21 @@
newPath = backup;
- // System.out.println("gBP Package Name for newpath: "+newPath);
+ if (log.isDebugEnabled())
+ {
+ log.debug("getBackupPath(String) - Package Name for newPath=" + newPath);
+ }
+
return (newPath);
}
/**
* Method createClassFile
- *
- * @param tagList
- * @param element
- * @return
- * @throws IOException
+ *
+ * @param tagList
+ * @param element
+ * @return
+ * @throws IOException
*/
public HTMLOutputWriter createClassFile(Object[] tagList, int element)
throws IOException {
@@ -404,15 +418,15 @@
String fileName = t.getFile().toString();
- if (debug) {
- System.out.println("Package name=" + t.getPackageName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("createClassFile(Object[], int) - Package name=" + t.getPackageName());
}
String packagePath = packageName.replace('.', File.separatorChar);
- String htmlPackagePath = packageName.replace('.', '/');
+ //String htmlPackagePath = packageName.replace('.', '/');
String pathName = getOutDir() + File.separatorChar + packagePath;
- // System.out.println("fileName="+fileName);
int position = fileName.lastIndexOf(File.separatorChar);
if (position == -1) {
@@ -420,8 +434,8 @@
}
String baseName = fileName.substring(position, fileName.length());
- String className = baseName.substring(
- 0, baseName.lastIndexOf('.')).replace(File.separatorChar, '.');
+ //String className = baseName.substring(
+ // 0, baseName.lastIndexOf('.')).replace(File.separatorChar, '.');
baseName = baseName.replace('.', '_');
baseName = baseName + ".html";
@@ -451,10 +465,10 @@
/**
* Method finishFile
- *
- * @param input
- * @param output
- * @throws IOException
+ *
+ * @param input
+ * @param output
+ * @throws IOException
*/
public void finishFile(LineNumberReader input, HTMLOutputWriter output)
throws IOException {
@@ -473,26 +487,28 @@
/**
* Method writeUntilNextTag
- *
- * @param t
- * @param input
- * @param output
- * @throws IOException
+ *
+ * @param t
+ * @param input
+ * @param output
+ * @throws IOException
*/
public void writeUntilNextTag(
HTMLTag t, LineNumberReader input, HTMLOutputWriter output)
throws IOException {
- if (debug) {
- System.out.print("\nLooking for next tag line:|");
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeUntilNextTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - Looking for next tag line:|");
}
while ((_currentChar != -1)
&& (input.getLineNumber() + 1) != t.getLine()) {
output.writeHTML(_currentChar);
- if (debug) {
- System.out.write(_currentChar);
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeUntilNextTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - _currentChar" + _currentChar);
}
_currentChar = input.read();
@@ -501,24 +517,26 @@
// Write out last carriage return
output.writeHTML(_currentChar);
- if (debug) {
- System.out.write(_currentChar);
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeUntilNextTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - _currentChar" + _currentChar);
}
_currentChar = input.read();
- if (debug) {
- System.out.println("|");
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeUntilNextTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - |");
}
}
/**
* Method writeComment
- *
- * @param t
- * @param input
- * @param output
- * @throws IOException
+ *
+ * @param t
+ * @param input
+ * @param output
+ * @throws IOException
*/
public void writeComment(
HTMLTag t, LineNumberReader input, HTMLOutputWriter output)
@@ -526,7 +544,6 @@
int length = t.getLength();
int i = 0;
- StringBuffer sb = new StringBuffer(length);
output.write("<span class=\"comment\">");
@@ -556,20 +573,21 @@
/**
* Method writeHTMLTag
- *
- * @param t
- * @param input
- * @param output
- * @throws IOException
+ *
+ * @param t
+ * @param input
+ * @param output
+ * @throws IOException
*/
public void writeHTMLTag(
HTMLTag t, LineNumberReader input, HTMLOutputWriter output)
throws IOException {
// Write out line from current column to tag start column
- if (debug) {
- System.out.println("\nCurrent column=" + _currentColumn);
- System.out.print("\nWriting up to tag start:|");
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - Current column=" + _currentColumn);
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - Writing up to tag start:|");
}
while (_currentColumn < t.getStartColumn()) {
@@ -579,8 +597,9 @@
_currentColumn = 0;
}
- if (debug) {
- System.out.write(_currentChar);
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - _currentChar=" + _currentChar);
}
_currentChar = input.read();
@@ -588,8 +607,9 @@
_currentColumn++;
}
- if (debug) {
- System.out.println("|");
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - |");
}
// Check for comment
@@ -604,8 +624,9 @@
// Write HTML tag
output.write(t.getText());
- if (debug) {
- System.out.println("Wrote tag:" + t.getText());
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - Wrote tag:" + t.getText());
}
// Read past original token
@@ -613,13 +634,15 @@
length = length - t.getNumBreaks();
- if (debug) {
- System.out.print("\nSkipping:\"");
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - Skipping:\"");
}
for (int j = 0; j < length; j++) {
- if (debug) {
- System.out.write(_currentChar);
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeHTMLTag(HTMLTag, LineNumberReader, HTMLOutputWriter) - _currentChar=" + _currentChar);
}
if (_currentChar == '\n') {
@@ -643,7 +666,6 @@
int length = t.getLength();
int i = 0;
- StringBuffer sb = new StringBuffer(length);
output.write("<span class=\"string\">");
@@ -673,7 +695,6 @@
int length = t.getLength();
int i = 0;
- StringBuffer sb = new StringBuffer(length);
output.write("<strong>");
@@ -698,17 +719,15 @@
}
/**
* Method createClassFiles
- *
- * @param tagList
+ *
+ * @param tagList
*/
public void createClassFiles(Vector tagList) {
HTMLTag t;
File javaFile;
- File htmlFile = null;
LineNumberReader input;
HTMLOutputWriter output;
- String line;
Object[] sortedList;
sortedList = JSCollections.sortVector(tagList);
@@ -718,7 +737,7 @@
javaFile = t.getFile();
printAdvancement("Writing tags for file " + javaFile.toString());
-
+
// Create first file
try {
output = createClassFile(sortedList, 0);
@@ -728,22 +747,18 @@
_currentChar = input.read();
_currentColumn = 1;
} catch (Exception e) {
- e.printStackTrace();
- System.out.println("1: Could not open file:"
- + javaFile.getAbsolutePath());
- System.out.println(" or html file.");
- System.exit(1);
+ log.error( "1: Could not open file:" + javaFile.getAbsolutePath() + " or html file.", e );
return;
}
for (int i = 0; i < sortedList.length; i++) {
t = (HTMLTag) sortedList[i];
- if (debug) {
- System.out.println("\nTag Text=\"" + t.getText() + "\"");
- System.out.println("Length=" + t.getOrigLength());
- System.out.println("Line,col=" + t.getLine() + ","
- + t.getStartColumn());
+ if (log.isDebugEnabled())
+ {
+ log.debug("createClassFiles(Vector) - nTag Text=\"" + t.getText() + "\"");
+ log.debug("createClassFiles(Vector) - Length=" + t.getOrigLength());
+ log.debug("createClassFiles(Vector) - Line,col=" + t.getLine() + "," + t.getStartColumn());
}
// Check for new java file encountered.
@@ -751,12 +766,10 @@
String currentFile = javaFile.toString();
String newFile = t.getFile().toString();
- if (debug) {
- System.out.println("cur file=|" + currentFile + "|");
- }
-
- if (debug) {
- System.out.println("new file=|" + newFile + "|");
+ if (log.isDebugEnabled())
+ {
+ log.debug("createClassFiles(Vector) - cur file=|" + currentFile + "|");
+ log.debug("createClassFiles(Vector) - new file=|" + newFile + "|");
}
if (!newFile.equals(currentFile)) {
@@ -774,12 +787,8 @@
output = createClassFile(sortedList, i);
_currentColumn = 1;
_currentChar = input.read();
-
- // System.out.println("javaFile="+javaFile);
} catch (Exception e) {
- System.out.println("2: Error handling tag:" + t);
- System.out.println(e);
- e.printStackTrace();
+ log.error( "2: Error handling tag:" + t, e );
continue;
}
@@ -793,9 +802,7 @@
try {
writeUntilNextTag(t, input, output);
} catch (Exception e) {
- System.out.println("3: Error handling tag:" + t);
- System.out.println(e);
- e.printStackTrace();
+ log.error( "3: Error handling tag:" + t, e );
continue;
}
@@ -804,9 +811,7 @@
try {
writeHTMLTag(t, input, output);
} catch (Exception e) {
- System.out.println("4: Error handling tag:" + t);
- System.out.println(e);
- e.printStackTrace();
+ log.error( "4: Error handling tag:" + t, e );
continue;
}
@@ -815,9 +820,18 @@
// Finish writing out the file
try {
finishFile(input, output);
- } catch (Exception e) {
+ } catch (IOException e) {
+ log.error( "IOException: " + e.getMessage(), e );
}
- ;
+ }
+
+ private void print(String description) {
+ System.out.print(description);
+ }
+
+ private void println(String description) {
+ System.out.print("\n");
+ System.out.print(description);
}
private void printAdvancement(String description) {
@@ -827,10 +841,11 @@
System.out.print(".");
}
}
+
/**
* Method main
- *
- * @param args
+ *
+ * @param args
*/
public static void main(String args[]) {
@@ -857,7 +872,4 @@
/** Field _verbose */
private boolean _verbose;
-
- /** Field debug */
- private boolean debug = false;
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass2.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass2.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass2.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/Pass2.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
package org.apache.forrest.forrestdoc.java.src;
import org.apache.forrest.forrestdoc.java.src.symtab.ReferenceTypes;
+import org.apache.log4j.Logger;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
@@ -48,11 +49,13 @@
* Load reference.txt
* Sort references
* Generate HTML one public class at a time.
+ *
+ * @version $Id: $
*/
public class Pass2 {
- /** Field debug */
- public static final boolean debug = false;
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( Pass2.class );
/** Field DEFAULT_DIR */
public static final String DEFAULT_DIR = ".";
@@ -64,8 +67,8 @@
/**
* Method getOutDir
- *
- * @return
+ *
+ * @return
*/
public String getOutDir() {
return _outDir;
@@ -73,8 +76,8 @@
/**
* Method setOutDir
- *
- * @param d
+ *
+ * @param d
*/
public void setOutDir(String d) {
_outDir = d;
@@ -82,8 +85,8 @@
/**
* Method getTitle
- *
- * @return
+ *
+ * @return
*/
public String getTitle() {
return _title;
@@ -91,8 +94,8 @@
/**
* Method setTitle
- *
- * @param t
+ *
+ * @param t
*/
public void setTitle(String t) {
_title = t;
@@ -100,8 +103,8 @@
/**
* Method getVerbose
- *
- * @return
+ *
+ * @return
*/
public boolean getVerbose() {
return _verbose;
@@ -109,8 +112,8 @@
/**
* Method setVerbose
- *
- * @param val
+ *
+ * @param val
*/
public void setVerbose(boolean val) {
_verbose = val;
@@ -126,21 +129,28 @@
/**
* Method run
- *
- * @param args
- * @throws IOException
+ *
+ * @param args
+ * @throws IOException
*/
public void run(String[] args) throws IOException {
- // System.out.println("outdir="+getOutDir());
File outDir = new File(getOutDir());
+ if (log.isDebugEnabled())
+ {
+ log.debug("run(String[]) - File outDir=" + outDir);
+ }
+
walkDirectories(null, outDir);
Collections.sort(packageNames, stringComparator());
// Create package files
// I.e. generate HTML list of classes in each package
- // System.out.println("\nWriting package files...");
+ if (log.isDebugEnabled())
+ {
+ log.debug("run(String[]) - Writing package files");
+ }
createPackageFiles();
createPackageSummaryFiles();
@@ -155,10 +165,10 @@
/**
* Method walkDirectories
- *
- * @param packageName
- * @param outDir
- * @throws IOException
+ *
+ * @param packageName
+ * @param outDir
+ * @throws IOException
*/
private void walkDirectories(String packageName, File outDir)
throws IOException {
@@ -194,15 +204,18 @@
/**
* Method processRefFile
- *
- * @param packageName
- * @param refFile
- * @throws IOException
+ *
+ * @param packageName
+ * @param refFile
+ * @throws IOException
*/
private void processRefFile(String packageName, File refFile)
throws IOException {
+ if (log.isDebugEnabled())
+ {
+ log.debug("processRefFile(String, File) - File refFile=" + refFile);
+ }
- // System.out.println("process "+refFile.getAbsolutePath());
HashMap classes = (HashMap) packageClasses.get(packageName);
if (classes == null) {
@@ -291,16 +304,20 @@
closeOutputFile(bw, prevReferentFileClass);
}
- // System.out.println("class list for "+packageName+" is "+classes);
+ if (log.isDebugEnabled())
+ {
+ log.debug("processRefFile(String, File) - class list for "+packageName+" is "+classes);
+ }
+
packageClasses.put(packageName, classes);
}
/**
* Method closeOutputFile
- *
- * @param bw
- * @param referentFileClass
- * @throws IOException
+ *
+ * @param bw
+ * @param referentFileClass
+ * @throws IOException
*/
private void closeOutputFile(BufferedWriter bw, String referentFileClass)
throws IOException {
@@ -309,21 +326,27 @@
bw.flush();
bw.close();
- // System.out.println("close output file");
+ if (log.isDebugEnabled())
+ {
+ log.debug("closeOutputFile(BufferedWriter, String) - close output file");
+ }
}
/**
* Method openOutputFile
- *
- * @param packageName
- * @param ref
- * @return
- * @throws IOException
+ *
+ * @param packageName
+ * @param ref
+ * @return
+ * @throws IOException
*/
private BufferedWriter openOutputFile(String packageName, Reference ref)
throws IOException {
+ if (log.isDebugEnabled())
+ {
+ log.debug("openOutputFile(String, Reference) - Reference ref=" + ref.referentFileClass);
+ }
- // System.out.println("open output file for referent class "+ref.referentFileClass);
File rootDir = new File(getOutDir());
String relPath = (packageName == null)
? ref.referentFileClass
@@ -347,26 +370,29 @@
/**
* Method closeSection
- *
- * @param bw
- * @param referentTag
- * @throws IOException
+ *
+ * @param bw
+ * @param referentTag
+ * @throws IOException
*/
private void closeSection(BufferedWriter bw, String referentTag)
throws IOException {
bw.write("</p>");
- // System.out.println("close section for referent "+referentTag);
+ if (log.isDebugEnabled())
+ {
+ log.debug("closeSection(BufferedWriter, String) - close section for referent " + referentTag);
+ }
}
/**
* Method openSection
- *
- * @param bw
- * @param referentPackage
- * @param ref
- * @throws IOException
+ *
+ * @param bw
+ * @param referentPackage
+ * @param ref
+ * @throws IOException
*/
private void openSection(
BufferedWriter bw, String referentPackage, Reference ref)
@@ -407,16 +433,19 @@
bw.write("<p>open section " + ref.referentType + "</p>");
}
- // System.out.println("open section for referent "+ref.referentTag);
+ if (log.isDebugEnabled())
+ {
+ log.debug("openSection(BufferedWriter, String, Reference) - open section for referent=" + ref.referentTag);
+ }
}
/**
* Method writeLink
- *
- * @param bw
- * @param referentPackage
- * @param ref
- * @throws IOException
+ *
+ * @param bw
+ * @param referentPackage
+ * @param ref
+ * @throws IOException
*/
private void writeLink(
BufferedWriter bw, String referentPackage, Reference ref)
@@ -461,10 +490,10 @@
/**
* Return path to referring X_java.html file, relative to referent directory.
- *
- * @param referentPackage
- * @param ref
- * @return
+ *
+ * @param referentPackage
+ * @param ref
+ * @return
*/
private String sourceName(String referentPackage, Reference ref) {
@@ -479,9 +508,9 @@
/**
* Method getBackupPath
- *
- * @param packageName
- * @return
+ *
+ * @param packageName
+ * @return
*/
private String getBackupPath(String packageName) {
@@ -490,7 +519,10 @@
int dirs = 0;
String newPath;
- // System.out.println("gBP Package Name for BackupPath: "+ packageName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("getBackupPath(String) - String packageName=" + packageName);
+ }
dirs = st.countTokens();
for (int j = 0; j < dirs; j++) {
@@ -499,7 +531,11 @@
newPath = backup;
- // System.out.println("gBP Package Name for newpath: "+newPath);
+ if (log.isDebugEnabled())
+ {
+ log.debug("getBackupPath(String) - String newPath=" + newPath);
+ }
+
return (newPath);
}
@@ -510,7 +546,6 @@
String packageName;
String fileName;
- Vector tags;
File file;
PrintWriter pw;
@@ -523,7 +558,11 @@
List classes = orderedPackageClasses(packageName);
- // System.out.println(packageName+" has "+classes.size()+" classes");
+ if (log.isDebugEnabled())
+ {
+ log.debug("createPackageFiles() - " + packageName+" has "+classes.size()+" classes");
+ }
+
totalClassCount += classes.size();
fileName = getOutDir() + File.separatorChar
+ packageName.replace('.', File.separatorChar)
@@ -554,10 +593,9 @@
while (iter.hasNext()) {
ClassFile cf = (ClassFile) iter.next();
String className = cf.className;
- String fileClassName = (String) cf.fileName;
- int j = className.indexOf('.');
+ String fileClassName = cf.fileName;
+ //int j = className.indexOf('.');
String anchor;
- String filePrefix;
// if (j == -1)
// {
@@ -579,19 +617,18 @@
pw.println("</body></html>");
pw.close();
} catch (Exception ex) {
- System.err.println("Error writing file:" + fileName);
- ex.printStackTrace();
+ log.error( "Error writing file:" + fileName, ex );
}
}
- System.out.println(totalClassCount + " classes total");
+ println(totalClassCount + " classes total");
}
/**
* Return alphabetized list of all classes in a package, including inner classes.
- *
- * @param packageName
- * @return
+ *
+ * @param packageName
+ * @return
*/
private List orderedPackageClasses(String packageName) {
@@ -617,8 +654,8 @@
/**
* Method orderedAllClasses
- *
- * @return
+ *
+ * @return
*/
private List orderedAllClasses() {
@@ -656,8 +693,8 @@
/**
* Method stringComparator
- *
- * @return
+ *
+ * @return
*/
private Comparator stringComparator() {
@@ -675,8 +712,8 @@
/**
* Method classFileComparator
- *
- * @return
+ *
+ * @return
*/
private Comparator classFileComparator() {
@@ -726,7 +763,7 @@
pw.println("</FRAMESET>");
pw.close();
} catch (Exception e) {
- e.printStackTrace();
+ log.error( "Exception: " + e.getMessage(), e );
}
}
@@ -766,7 +803,7 @@
pw.println("</body></html>");
pw.close();
} catch (Exception e) {
- e.printStackTrace();
+ log.error( "Exception: " + e.getMessage(), e );
}
}
@@ -793,7 +830,7 @@
while (iter.hasNext()) {
ClassFile cf = (ClassFile) iter.next();
String className = cf.className;
- String fileClassName = (String) cf.fileName;
+ String fileClassName = cf.fileName;
String anchor = className;
String tag =
"<p class=\"classListItem\"><a href=\"" + fileClassName
@@ -806,7 +843,7 @@
pw.println("</body></html>");
pw.close();
} catch (Exception e) {
- e.printStackTrace();
+ log.error( "Exception: " + e.getMessage(), e );
}
}
@@ -817,7 +854,6 @@
String packageName;
String fileName;
- Vector tags;
File file;
PrintWriter pw;
@@ -830,7 +866,11 @@
List classes = orderedPackageClasses(packageName);
- // System.out.println(packageName+" has "+classes.size()+" classes");
+ if (log.isDebugEnabled())
+ {
+ log.debug("createPackageSummaryFiles() - " + packageName+" has "+classes.size()+" classes" );
+ }
+
totalClassCount += classes.size();
fileName = getOutDir() + File.separatorChar
+ packageName.replace('.', File.separatorChar)
@@ -861,16 +901,14 @@
pw.println("</tr>");
pw.println("</thead>");
pw.println("<tbody>");
-
+
Iterator iter = classes.iterator();
while (iter.hasNext()) {
ClassFile cf = (ClassFile) iter.next();
String className = cf.className;
- String fileClassName = (String) cf.fileName;
- int j = className.indexOf('.');
+ String fileClassName = cf.fileName;
String anchor;
- String filePrefix;
anchor = className;
pw.println("<tr>");
@@ -884,19 +922,18 @@
}
pw.println("</tbody>");
pw.println("</table>");
-
+
createPackageSummaryFilesExtras(pw, getBackupPath(packageName), "package-summary.html");
pw.println(" <hr></hr>\n" +
" Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.");
pw.println("</body></html>");
pw.close();
} catch (Exception ex) {
- System.err.println("Error writing file:" + fileName);
- ex.printStackTrace();
+ log.error( "Error writing file:" + fileName, ex);
}
}
}
-
+
private void createPackageSummaryFilesExtras(PrintWriter pw, String root, String current) {
pw.println("<div class=\"overview\">");
pw.println("<ul>");
@@ -915,8 +952,8 @@
pw.println("</ul>");
pw.println("</div>");
}
-
-
+
+
/**
* Method createOverviewSummaryFrame
*/
@@ -967,7 +1004,7 @@
pw.println("</body></html>");
pw.close();
} catch (Exception e) {
- e.printStackTrace();
+ log.error( "Error writing file:" + fileName, e);
}
}
@@ -995,7 +1032,7 @@
*/
public void initializeDefaults() {
- String outdir = (String) System.getProperty("outdir");
+ String outdir = System.getProperty("outdir");
if (outdir == null) {
outdir = DEFAULT_DIR;
@@ -1003,7 +1040,7 @@
setOutDir(outdir);
- String title = (String) System.getProperty("title");
+ String title = System.getProperty("title");
if (title == null) {
title = "Pass2: " + outdir;
@@ -1012,7 +1049,7 @@
setTitle(title);
boolean verbose = false;
- String verboseStr = (String) System.getProperty("verbose");
+ String verboseStr = System.getProperty("verbose");
if (verboseStr != null) {
verboseStr = verboseStr.trim();
@@ -1030,8 +1067,8 @@
/**
* Method createDirs
- *
- * @param f
+ *
+ * @param f
*/
private void createDirs(File f) {
@@ -1043,11 +1080,16 @@
}
}
+ private void println(String description) {
+ System.out.print("\n");
+ System.out.println(description);
+ }
+
/**
* Method main
- *
- * @param args
- * @throws Exception
+ *
+ * @param args
+ * @throws Exception
*/
public void main(String args[]) throws Exception {
@@ -1080,8 +1122,8 @@
/**
* Constructor Reference
- *
- * @param line
+ *
+ * @param line
*/
Reference(String line) {
@@ -1128,8 +1170,6 @@
/**
* Class ClassFile
- *
- * @version %I%, %G%
*/
class ClassFile {
@@ -1141,9 +1181,9 @@
/**
* Constructor ClassFile
- *
- * @param className
- * @param fileName
+ *
+ * @param className
+ * @param fileName
*/
public ClassFile(String className, String fileName) {
this.className = className;
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ArrayDef.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ArrayDef.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ArrayDef.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ArrayDef.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,13 @@
* Definition of an array type. Note that this is not currently used in the
* cross reference tool, but you would define something like this if you
* wanted to make the tool complete.
+ *
+ * @version $Id: $
*/
class ArrayDef extends Definition implements TypedDef {
+ private static final long serialVersionUID = -6748362770029804744L;
+
// ==========================================================================
// == Class Variables
// ==========================================================================
@@ -36,33 +40,27 @@
/**
* Constructor to create a new array type
- *
- * @param name
- * @param occ
- * @param parentScope
+ *
+ * @param name
+ * @param occ
+ * @param parentScope
*/
ArrayDef(String name, // the name of the symbol
Occurrence occ, // the location of its def
ScopedDef parentScope) { // scope containing the def
super(name, occ, parentScope);
-
- // System.out.println("new ArrayDef");
}
/**
- * return the base type of the array
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.TypedDef#getType()
*/
public Definition getType() {
return type;
}
/**
- * Write information about the array to the taglist
- *
- * @param tagList
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#generateTags(org.apache.forrest.forrestdoc.java.src.symtab.HTMLTagContainer)
*/
public void generateTags(HTMLTagContainer tagList) {
@@ -81,19 +79,14 @@
}
/**
- * Return a String representation of the class
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#toString()
*/
public String toString() {
return "ArrayDef [" + type.getQualifiedName() + "]";
}
/**
- * Method getOccurrenceTag
- *
- * @param occ
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getOccurrenceTag(org.apache.forrest.forrestdoc.java.src.symtab.Occurrence)
*/
public HTMLTag getOccurrenceTag(Occurrence occ) {
return null;
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/BlockDef.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/BlockDef.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/BlockDef.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/BlockDef.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,43 +18,40 @@
/**
* Definition of a curly-brace-delimited block in a file.
+ *
+ * @version $Id: $
*/
public class BlockDef extends ScopedDef {
+ private static final long serialVersionUID = -3751610407040600613L;
+
// ==========================================================================
// == Methods
// ==========================================================================
/**
* Constructor to set up a block
- *
- * @param name
- * @param occ
- * @param parentScope
+ *
+ * @param name
+ * @param occ
+ * @param parentScope
*/
BlockDef(String name, // name of the block (dummy)
Occurrence occ, // where it's defined
ScopedDef parentScope) { // which scope owns it
super(name, occ, parentScope);
-
- // System.out.println("new BlockDef");
}
/**
- * Write information about this block to the tagList
- *
- * @param tagList
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#generateTags(org.apache.forrest.forrestdoc.java.src.symtab.HTMLTagContainer)
*/
public void generateTags(HTMLTagContainer tagList) {
tagElements(tagList);
}
/**
- * Method getOccurrenceTag
- *
- * @param occ
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#getOccurrenceTag(org.apache.forrest.forrestdoc.java.src.symtab.Occurrence)
*/
public HTMLTag getOccurrenceTag(Occurrence occ) {
return null;
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDef.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDef.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDef.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDef.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,6 +16,8 @@
*/
package org.apache.forrest.forrestdoc.java.src.symtab;
+import org.apache.log4j.Logger;
+
import java.io.Externalizable;
import java.io.FileWriter;
import java.io.IOException;
@@ -32,9 +34,14 @@
* These are merged together because there are places where we just don't
* know if something is an interface or class (because we are not looking
* at the classes/interfaces that are imported.)
+ *
+ * @version $Id: $
*/
public class ClassDef extends HasImports implements Externalizable {
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( ClassDef.class );
+
// ==========================================================================
// == Class Variables
// ==========================================================================
@@ -95,22 +102,25 @@
/**
* Method findLoadedClass
- *
- * @param packageName
- * @param name
- * @return
+ *
+ * @param packageName
+ * @param name
+ * @return
*/
protected static ClassDef findLoadedClass(String packageName, String name) {
String qualifiedName = packageName + "." + name;
+ if (log.isDebugEnabled())
+ {
+ log.debug("findLoadedClass(String, String) - String qualifiedName=" + qualifiedName);
+ Enumeration keys = allClassDefs.keys();
+ StringBuffer sb = new StringBuffer("allClassDefs={");
+ while (keys.hasMoreElements()) {
+ sb.append( ((String)keys.nextElement())+", ");
+ }
+ log.debug("findLoadedClass(String, String) - " + sb.toString());
+ }
- // System.out.println("looking for ClassDef "+qualifiedName);
- // Enumeration keys = allClassDefs.keys();
- // System.out.print("allClassDefs={");
- // while (keys.hasMoreElements()) {
- // System.out.print(((String)keys.nextElement())+", ");
- // }
- // System.out.println("}");
return (ClassDef) allClassDefs.get(qualifiedName);
}
@@ -122,12 +132,12 @@
/**
* Constructor to set up a class
- *
- * @param name
- * @param occ
- * @param superClass
- * @param interfaces
- * @param parentScope
+ *
+ * @param name
+ * @param occ
+ * @param superClass
+ * @param interfaces
+ * @param parentScope
*/
ClassDef(String name, // thhe name of the class
Occurrence occ, // where it was defined
@@ -148,8 +158,8 @@
/**
* Adds a reference to the list of classes that implement this interface
- *
- * @param def
+ *
+ * @param def
*/
void addImplementer(ClassDef def) {
@@ -161,8 +171,8 @@
/**
* Add a reference to a class that extends this class
* (or an interface that extends this interface
- *
- * @param subclass
+ *
+ * @param subclass
*/
void addSubclass(ClassDef subclass) {
getSubClasses().addElement(subclass);
@@ -170,8 +180,8 @@
/**
* get the list of classes that implement this interface
- *
- * @return
+ *
+ * @return
*/
JavaVector getImplementers() {
@@ -185,8 +195,8 @@
/**
* Return the list of interfaces that this class implements
* (or the interfaces that this interface extends)
- *
- * @return
+ *
+ * @return
*/
public JavaVector getInterfaces() {
return interfaces;
@@ -194,8 +204,8 @@
/**
* return a list of all subclasses/subinterfaces of this
- *
- * @return
+ *
+ * @return
*/
JavaVector getSubClasses() {
@@ -208,8 +218,8 @@
/**
* Return a reference to the superclass of this class
- *
- * @return
+ *
+ * @return
*/
public ClassDef getSuperClass() {
return superClass;
@@ -217,8 +227,8 @@
/**
* Does this represent a Java class?
- *
- * @return
+ *
+ * @return
*/
public boolean isClass() {
return classOrInterface == CLASS;
@@ -226,8 +236,8 @@
/**
* Does this represent a Java interface?
- *
- * @return
+ *
+ * @return
*/
public boolean isInterface() {
return classOrInterface == INTERFACE;
@@ -239,12 +249,7 @@
private static Set goals = new HashSet();
/**
- * Lookup a method in the class or its superclasses
- *
- * @param name
- * @param numParams
- * @param type
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#lookup(java.lang.String, int, java.lang.Class)
*/
Definition lookup(String name, int numParams, Class type) {
@@ -252,8 +257,7 @@
+ type;
if (goals.contains(goal)) {
- System.out.println("detected infinite loop: " + goal);
- new Exception().printStackTrace();
+ log.error( "detected infinite loop: " + goal, new Exception("infinite loop") );
return null;
}
@@ -269,7 +273,10 @@
setType(CLASS);
getSuperClass().setType(CLASS);
- // System.out.println("ClassDef.lookup: "+getName()+" looking for name="+name+" numParams="+numParams+" type="+type);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - " + getName()+" looking for name="+name+" numParams="+numParams+" type="+type);
+ }
d = getSuperClass().lookup(name, numParams, type);
}
}
@@ -288,18 +295,16 @@
return d;
}
- //
- // Generate all references to this class (and to things in this class).
- //
-
/**
- * Method generateReferences
- *
- * @param output
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#generateReferences(java.io.FileWriter)
*/
public void generateReferences(FileWriter output) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("generateReferences(FileWriter) - FileWriter output=" + output);
+ log.debug("generateReferences(FileWriter) - Generating references for:"+getName());
+ }
- // System.out.println("Generating references for:"+getName());
try {
output.write("<p class=\"classReflist\">");
@@ -369,16 +374,14 @@
}
}
} catch (Exception ex) {
- ex.printStackTrace();
+ log.error( "Exception: " + ex.getMessage(), ex );
return;
}
}
/**
- * Write information about the class to the tagList
- *
- * @param tagList
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#generateTags(org.apache.forrest.forrestdoc.java.src.symtab.HTMLTagContainer)
*/
public void generateTags(HTMLTagContainer tagList) {
@@ -397,10 +400,7 @@
}
/**
- * Method getOccurrenceTag
- *
- * @param occ
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#getOccurrenceTag(org.apache.forrest.forrestdoc.java.src.symtab.Occurrence)
*/
public HTMLTag getOccurrenceTag(Occurrence occ) {
@@ -412,20 +412,22 @@
linkFileName = getRelativePath(occ) + getSourceName();
linkString = "<a class=\"classRef\" href=" + linkFileName + "#"
+ getClassScopeName() + ">" + getName() + "</a>";
-
+
t = new HTMLTag(occ, getName(), linkString);
}
return t;
}
/**
- * resolve referenced symbols
- *
- * @param symbolTable
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.HasImports#resolveTypes(org.apache.forrest.forrestdoc.java.src.symtab.SymbolTable)
*/
void resolveTypes(SymbolTable symbolTable) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("resolveTypes(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug("resolveTypes(SymbolTable) - resolving: "+getQualifiedName());
+ }
- // System.err.println("resolving: "+getQualifiedName());
// resolve superclass laundry
super.resolveTypes(symbolTable);
@@ -444,7 +446,7 @@
// get its package name and look up the class/interace
String pkg = ((DummyClass) newSuperClass).getPackage();
- newSuperClass = (ClassDef) symbolTable.lookupDummy(newSuperClass);
+ newSuperClass = symbolTable.lookupDummy(newSuperClass);
if (newSuperClass == null) {
newSuperClass = new DummyClass(
@@ -482,9 +484,7 @@
}
/**
- * Method resolveRefs
- *
- * @param symbolTable
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.HasImports#resolveRefs(org.apache.forrest.forrestdoc.java.src.symtab.SymbolTable)
*/
void resolveRefs(SymbolTable symbolTable) {
@@ -502,8 +502,8 @@
/**
* Method generateClassList
- *
- * @param tagList
+ *
+ * @param tagList
*/
public void generateClassList(Vector tagList) {
@@ -549,8 +549,8 @@
/**
* Set the list of interfaces that this class implements
- *
- * @param interfaces
+ *
+ * @param interfaces
*/
void setInterfaces(JavaVector interfaces) {
this.interfaces = interfaces;
@@ -558,8 +558,8 @@
/**
* set the superclass of this class
- *
- * @param superClass
+ *
+ * @param superClass
*/
void setSuperClass(ClassDef superClass) {
@@ -571,17 +571,15 @@
/**
* Specify if this is a class or interface once we know
- *
- * @param type
+ *
+ * @param type
*/
void setType(int type) {
classOrInterface = type;
}
/**
- * Method getClassScopeName
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getClassScopeName()
*/
String getClassScopeName() {
@@ -598,14 +596,15 @@
}
/**
- * Method writeExternal
- *
- * @param out
- * @throws java.io.IOException
+ * @see java.io.Externalizable#writeExternal(java.io.ObjectOutput)
*/
public void writeExternal(ObjectOutput out) throws java.io.IOException {
- // System.out.println("externalizing "+getName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeExternal(ObjectOutput) - externalizing "+getName());
+ }
+
out.writeObject(getName());
out.writeObject(getPackageName());
out.writeObject(getOccurrence());
@@ -617,7 +616,10 @@
}
if ((parentScopeOut == null) && (getPackageName() == null)) {
- new Exception().printStackTrace(); // DEBUG
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeExternal(ObjectOutput) - parentScopeOut and getPackageName() are null");
+ }
}
out.writeObject(parentScopeOut);
@@ -638,11 +640,7 @@
}
/**
- * Method readExternal
- *
- * @param in
- * @throws IOException
- * @throws ClassNotFoundException
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
@@ -670,17 +668,17 @@
setupFileNames();
String qualifiedName = packageName + "." + getName();
+ if (log.isDebugEnabled())
+ {
+ log.debug("readExternal(ObjectInput) - String qualifiedName=" + qualifiedName);
+ }
- // System.out.println("ClassDef.readExternal: registering class "+qualifiedName);
allClassDefs.put(qualifiedName, this);
SymbolTable.endReadExternal();
}
/**
- * Visitor design pattern. Allow visitor to visit this definition,
- * then call accept method on its elements.
- *
- * @param visitor
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#accept(org.apache.forrest.forrestdoc.java.src.symtab.Visitor)
*/
public void accept(Visitor visitor) {
visitor.visit(this);
@@ -688,9 +686,7 @@
}
/**
- * Method toString
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#toString()
*/
public String toString() {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDefProxy.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDefProxy.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDefProxy.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ClassDefProxy.java Mon Jul 16 15:17:40 2007
@@ -5,9 +5,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,6 +16,8 @@
*/
package org.apache.forrest.forrestdoc.java.src.symtab;
+import org.apache.log4j.Logger;
+
import java.io.Externalizable;
import java.io.FileWriter;
import java.io.IOException;
@@ -25,44 +27,42 @@
/**
* Class ClassDefProxy
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class ClassDefProxy extends ClassDef implements Externalizable {
- /** Field whereCreated */
- private Throwable whereCreated = null;
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( ClassDefProxy.class );
/**
* Default constructor is public for deserialization.
*/
public ClassDefProxy() {
- whereCreated = new Throwable();
}
/**
* Constructor ClassDefProxy
- *
- * @param ref
+ *
+ * @param ref
*/
public ClassDefProxy(ClassDef ref) {
- whereCreated = new Throwable();
-
if (ref.getName().equals("RuntimeException")) {
- new Exception("what's up with this: " + ref).printStackTrace();
+ log.error( "ClassDefProxy(ClassDef) - what's up with this: " + ref );
}
- // System.out.println("ref="+ref);
+ if (log.isDebugEnabled())
+ {
+ log.debug("ClassDefProxy(ClassDef) - ClassDef ref=" + ref);
+ }
setName(ref.getName());
this.packageName = ref.getPackageName();
}
/**
- * Method getSuperClass
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#getSuperClass()
*/
public ClassDef getSuperClass() {
@@ -72,9 +72,7 @@
}
/**
- * Method isClass
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#isClass()
*/
public boolean isClass() {
@@ -84,9 +82,7 @@
}
/**
- * Method isInterface
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#isInterface()
*/
public boolean isInterface() {
@@ -97,9 +93,9 @@
/**
* Method getOccurenceTag
- *
- * @param occ
- * @return
+ *
+ * @param occ
+ * @return
*/
public HTMLTag getOccurenceTag(Occurrence occ) {
@@ -109,9 +105,7 @@
}
/**
- * Method getSourceName
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getSourceName()
*/
public String getSourceName() {
@@ -121,9 +115,7 @@
}
/**
- * Method getRefName
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getRefName()
*/
public String getRefName() {
@@ -133,10 +125,7 @@
}
/**
- * Method getRelativePath
- *
- * @param occ
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getRelativePath(org.apache.forrest.forrestdoc.java.src.symtab.Occurrence)
*/
String getRelativePath(Occurrence occ) {
@@ -146,9 +135,7 @@
}
/**
- * Method getOccurrence
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getOccurrence()
*/
public Occurrence getOccurrence() {
@@ -158,9 +145,7 @@
}
/**
- * Method getParentScope
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getParentScope()
*/
public ScopedDef getParentScope() {
@@ -170,9 +155,7 @@
}
/**
- * Method getPackagePath
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getPackagePath()
*/
public String getPackagePath() {
@@ -182,9 +165,7 @@
}
/**
- * Method getReferences
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getReferences()
*/
public JavaVector getReferences() {
@@ -194,34 +175,29 @@
}
/**
- * Method lookup
- *
- * @param name
- * @param numParams
- * @param type
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#lookup(java.lang.String, int, java.lang.Class)
*/
Definition lookup(String name, int numParams, Class type) {
load();
- // System.out.println("ClassDefProxy.lookup: "+getName()+" lookup name="+name+" numParams="+numParams+" type="+type);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - " + getName()+" lookup name="+name+" numParams="+numParams+" type="+type);
+ }
+
return ref.lookup(name, numParams, type);
}
/**
- * Method getSymbols
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#getSymbols()
*/
public Hashtable getSymbols() {
return null;
}
/**
- * Method getElements
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#getElements()
*/
public JavaHashtable getElements() {
@@ -231,9 +207,7 @@
}
/**
- * Method hasElements
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#hasElements()
*/
boolean hasElements() {
@@ -243,9 +217,7 @@
}
/**
- * Method isDefaultOrBaseScope
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ScopedDef#isDefaultOrBaseScope()
*/
public boolean isDefaultOrBaseScope() {
@@ -270,22 +242,21 @@
* Method closeImports
*/
void closeImports() {
- new Exception().printStackTrace();
+ if (log.isDebugEnabled())
+ {
+ log.debug("closeImports() - closed");
+ }
}
/**
- * Method isTopLevel
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.HasImports#isTopLevel()
*/
boolean isTopLevel() {
return packageName != null;
}
/**
- * Method setImports
- *
- * @param imports
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.HasImports#setImports(org.apache.forrest.forrestdoc.java.src.symtab.JavaHashtable)
*/
void setImports(JavaHashtable imports) {
load();
@@ -293,9 +264,7 @@
}
/**
- * Method addImplementer
- *
- * @param def
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#addImplementer(org.apache.forrest.forrestdoc.java.src.symtab.ClassDef)
*/
void addImplementer(ClassDef def) {
@@ -304,9 +273,7 @@
}
/**
- * Method addSubclass
- *
- * @param subclass
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#addSubclass(org.apache.forrest.forrestdoc.java.src.symtab.ClassDef)
*/
void addSubclass(ClassDef subclass) {
@@ -315,35 +282,27 @@
}
/**
- * Method getImplementers
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#getImplementers()
*/
public JavaVector getImplementers() {
return null;
}
/**
- * Method getSubClasses
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#getSubClasses()
*/
JavaVector getSubClasses() {
return null;
}
/**
- * Method generateReferences
- *
- * @param output
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#generateReferences(java.io.FileWriter)
*/
public void generateReferences(FileWriter output) {
}
/**
- * Method generateTags
- *
- * @param tagList
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#generateTags(org.apache.forrest.forrestdoc.java.src.symtab.HTMLTagContainer)
*/
public void generateTags(HTMLTagContainer tagList) {
load();
@@ -351,9 +310,7 @@
}
/**
- * Method addReference
- *
- * @param occ
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#addReference(org.apache.forrest.forrestdoc.java.src.symtab.Occurrence)
*/
public void addReference(Occurrence occ) {
load();
@@ -361,10 +318,7 @@
}
/**
- * Visitor design pattern. Allow visitor to visit this definition,
- * then call accept method on its elements.
- *
- * @param visitor
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#accept(org.apache.forrest.forrestdoc.java.src.symtab.Visitor)
*/
public void accept(Visitor visitor) {
load();
@@ -372,24 +326,21 @@
}
/**
- * serialize
- *
- * @param out
- * @throws IOException
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#writeExternal(java.io.ObjectOutput)
*/
public void writeExternal(ObjectOutput out) throws IOException {
- // System.out.println("writeExternal "+getName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeExternal(ObjectOutput) - getName()=" + getName());
+ }
+
out.writeObject(getName());
out.writeObject(packageName);
}
/**
- * deserialize
- *
- * @param in
- * @throws IOException
- * @throws ClassNotFoundException
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.ClassDef#readExternal(java.io.ObjectInput)
*/
public void readExternal(ObjectInput in)
throws IOException, ClassNotFoundException {
@@ -409,8 +360,7 @@
private void load() {
if (packageName == null) {
- System.out.println("null packageName, name=" + getName());
- System.exit(1);
+ log.error( "null packageName, name=" + getName());
}
if (ref == null) {
@@ -418,7 +368,10 @@
if (ref == null) {
- // System.out.println("apparently not yet loaded: "+packageName+"."+getName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("load() - apparently not yet loaded: "+packageName+"."+getName());
+ }
PackageDef packageDef =
SymbolTable.getSymbolTable().lookupPackage(packageName);
@@ -427,8 +380,7 @@
}
if (ref == null) {
- new Exception("cannot load ClassDef for "
- + getName()).printStackTrace();
+ log.error("cannot load ClassDef for " + getName());
}
}