Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferencePersistor.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferencePersistor.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferencePersistor.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferencePersistor.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.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
@@ -27,9 +29,14 @@
* A visitor (in the Visitor design pattern sense) for persisting
* references. All references to anything in a package are stored
* in that package's references.txt file.
+ *
+ * @version $Id: $
*/
public class ReferencePersistor implements Visitor, ReferenceTypes {
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( ReferencePersistor.class );
+
/**
* @param outDirPath the root of the output directory tree
*/
@@ -52,9 +59,7 @@
}
/**
- * Prepare to process this package. Close the previous package's file.
- *
- * @param def
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Visitor#visit(org.apache.forrest.forrestdoc.java.src.symtab.PackageDef)
*/
public void visit(PackageDef def) {
@@ -65,7 +70,11 @@
String finalDirPath = outDirPath + File.separatorChar
+ def.getName().replace('.', File.separatorChar);
- // System.out.println("visit:finalDirPath="+finalDirPath);
+ if (log.isDebugEnabled())
+ {
+ log.debug("visit(PackageDef) - String finalDirPath=" + finalDirPath);
+ }
+
File dir = new File(finalDirPath);
dir.mkdirs();
@@ -77,7 +86,7 @@
fw = new FileWriter(filePath, append);
} catch (IOException ex) {
- ex.printStackTrace();
+ log.error( "IOException: " + ex.getMessage(), ex );
fw = null; // TBD: fix this hack
}
@@ -89,33 +98,35 @@
// ReferentType -- Class Method, or Variable
// ReferentClass - name of this referent's class. If that class is an inner class, format is outer.inner
// ReferentTag - referent's name as used below [TBD: change usage in Pass1]
- //
+ //
// Referent's URL in source code is {ReferentFileClass}_java.html#{ReferentTag}
// Referent's URL in referent list is {ReferentFileClass}_java_ref.html#{ReferentTag}
// Referent class's name in package list is {ReferentClass}
- //
+ //
pw.println(
"# ReferentFileClass | ReferentClass | ReferentType | ReferentTag | ReferringPackage | ReferringClass | ReferringMethod | ReferringFile | ReferringLineNumber");
}
/**
* Method getReferentFileClass
- *
- * @param def
- * @return
+ *
+ * @param def
+ * @return
*/
private String getReferentFileClass(Definition def) {
String temp = def.getOccurrence().getFile().getName(); // HACK!
- // System.out.println("name="+def.getClassScopeName()+" temp="+temp);
+ if (log.isDebugEnabled())
+ {
+ log.debug("getReferentFileClass(Definition) - name="+def.getClassScopeName()+" temp="+temp);
+ }
+
return temp.substring(0, temp.length() - ".java".length());
}
/**
- * Method visit
- *
- * @param def
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Visitor#visit(org.apache.forrest.forrestdoc.java.src.symtab.ClassDef)
*/
public void visit(ClassDef def) {
@@ -123,8 +134,12 @@
return;
}
- // System.out.println(def.getName()+" is defined in "+def.getOccurrence().getFile().getName());
- // System.out.println("persist "+def.getName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("visit(ClassDef) - " + def.getName()+" is defined in "+def.getOccurrence().getFile().getName());
+ log.debug("visit(ClassDef) - persist "+def.getName());
+ }
+
String referentFileClass = getReferentFileClass(def);
String referentTag = def.getClassScopeName();
String referentClass;
@@ -142,9 +157,7 @@
}
/**
- * Method visit
- *
- * @param def
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Visitor#visit(org.apache.forrest.forrestdoc.java.src.symtab.MethodDef)
*/
public void visit(MethodDef def) {
@@ -166,9 +179,7 @@
}
/**
- * Method visit
- *
- * @param def
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Visitor#visit(org.apache.forrest.forrestdoc.java.src.symtab.VariableDef)
*/
public void visit(VariableDef def) {
@@ -207,23 +218,23 @@
/**
* Method persist
- *
- * @param referentFileClass
- * @param referentType
- * @param referentTag
- * @param referentClass
- * @param def
+ *
+ * @param referentFileClass
+ * @param referentType
+ * @param referentTag
+ * @param referentClass
+ * @param def
*/
private void persist(String referentFileClass, String referentType,
String referentTag, String referentClass,
Definition def) {
- // System.out.println("persist: referentType="+referentType+" referentTag="+referentTag);
- // boolean debugFlag = referentClass.equals("ReferencePersistor") && referentTag.equals("ReferencePersistor");
- // if (debugFlag) {
- // System.out.println("references "+references);
- // System.out.println("output file "+filePath);
- // }
+ if (log.isDebugEnabled())
+ {
+ log.debug("persist(String, String, String, String, Definition) - String referentFileClass=" + referentFileClass);
+ log.debug("persist(String, String, String, String, Definition) - String referentType=" + referentType);
+ }
+
JavaVector refs = def.getReferences();
if (refs != null) {
@@ -232,7 +243,6 @@
while (enumList.hasMoreElements()) {
Occurrence occ = (Occurrence) enumList.nextElement();
- // if (debugFlag) System.out.println("occ="+occ);
persist(referentFileClass, referentType, referentTag,
referentClass, occ);
}
@@ -244,12 +254,12 @@
/**
* Method persist
- *
- * @param referentFileClass
- * @param referentType
- * @param referentTag
- * @param referentClass
- * @param occ
+ *
+ * @param referentFileClass
+ * @param referentType
+ * @param referentTag
+ * @param referentClass
+ * @param occ
*/
private void persist(String referentFileClass, String referentType,
String referentTag, String referentClass,
@@ -284,8 +294,7 @@
bw.close();
fw.close();
} catch (IOException ex) {
- System.err.println("Hell has frozen over.");
- ex.printStackTrace();
+ log.error( "Hell has frozen over.", ex);
}
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferenceTypes.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferenceTypes.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferenceTypes.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ReferenceTypes.java Mon Jul 16 15:17:40 2007
@@ -19,7 +19,7 @@
/**
* Interface ReferenceTypes
*
- * @version %I%, %G%
+ * @version $Id: $
*/
public interface ReferenceTypes {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ScopedDef.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ScopedDef.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ScopedDef.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/ScopedDef.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 org.apache.forrest.forrestdoc.java.src.xref.JavaToken;
import java.util.Hashtable;
@@ -23,11 +25,13 @@
/**
* An abstract class representing a symbol that provides a scope that
* contains other symbols.
+ *
+ * @version $Id: $
*/
public abstract class ScopedDef extends Definition {
- /** Field debug */
- public static final boolean debug = false;
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( ScopedDef.class );
// ==========================================================================
// == Class Variables
@@ -65,10 +69,10 @@
/**
* Constructor to create the base part of a scoped definition
- *
- * @param name
- * @param occ
- * @param parentScope
+ *
+ * @param name
+ * @param occ
+ * @param parentScope
*/
ScopedDef(String name, // the scoped name
Occurrence occ, // where it's defined
@@ -82,8 +86,8 @@
/**
* Method getSymbols
- *
- * @return
+ *
+ * @return
*/
public Hashtable getSymbols() {
return elements;
@@ -91,8 +95,8 @@
/**
* Add a symbol to our scope
- *
- * @param def
+ *
+ * @param def
*/
void add(Definition def) {
@@ -133,14 +137,17 @@
/**
* Add a token to the list of unresolved references
- *
- * @param t
+ *
+ * @param t
*/
void addUnresolved(JavaToken t) {
// be lazy in our creation of the reference vector
// (many definitions might not contain refs to other symbols)
- // System.out.println("Adding unresolved reference to:"+getQualifiedName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("addUnresolved(JavaToken) - Adding unresolved reference to:"+getQualifiedName());
+ }
if (unresolvedStuff == null) {
unresolvedStuff = new JavaVector();
}
@@ -150,8 +157,8 @@
/**
* Return whether or not this scope actually contains any elements
- *
- * @return
+ *
+ * @return
*/
public JavaHashtable getElements() {
return elements;
@@ -159,8 +166,8 @@
/**
* Return whether or not this scope actually contains any elements
- *
- * @return
+ *
+ * @return
*/
boolean hasElements() {
return !elements.isEmpty();
@@ -170,22 +177,15 @@
* Return if this is a base or default scope. This is used when printing
* information to the report so we won't prefix elements in these
* scopes.
- *
- * @return
+ *
+ * @return
*/
public boolean isDefaultOrBaseScope() {
return iAmDefaultOrBaseScope;
}
/**
- * Lookup a method in the scope
- * This is usually just a hashtable lookup, but if the element returned
- * is a MultiDef, we need to ask it to find the best match
- *
- * @param name
- * @param numParams
- * @param type
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#lookup(java.lang.String, int, java.lang.Class)
*/
Definition lookup(String name, int numParams, Class type) {
@@ -214,8 +214,8 @@
/**
* Create tag info about elements
- *
- * @param tagList
+ *
+ * @param tagList
*/
void tagElements(HTMLTagContainer tagList) {
@@ -228,16 +228,15 @@
static private int resolveLevel = 0;
/**
- * Resolve referenced names
- *
- * @param symbolTable
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#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 types for "+this.getQualifiedName());
+ }
- // for (int i=0; i<resolveLevel; i++) {
- // System.out.print("\t");
- // }
- // System.out.println("resolving types for "+this.getQualifiedName());
resolveLevel++;
symbolTable.pushScope(this); // push the current scope
@@ -249,19 +248,18 @@
}
/**
- * Resolve referenced names
- *
- * @param symbolTable
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#resolveRefs(org.apache.forrest.forrestdoc.java.src.symtab.SymbolTable)
*/
void resolveRefs(SymbolTable symbolTable) {
- // for (int i=0; i<resolveLevel; i++) {
- // System.out.print("\t");
- // }
- // System.out.println("resolving refs for "+this.getQualifiedName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("resolveRefs(SymbolTable) - SymbolTable symbolTable=" + symbolTable);
+ log.debug("resolveRefs(SymbolTable) - resolving types for "+this.getQualifiedName());
+ }
+
resolveLevel++;
- // System.out.println("!ScopedDef:resolveRefs:"+getQualifiedName());
symbolTable.pushScope(this); // push the current scope
if (unresolvedStuff != null) { // resolve refs to other syms
@@ -279,18 +277,15 @@
/**
* Indicate that this scope is a base scope or default package
- *
- * @param val
+ *
+ * @param val
*/
void setDefaultOrBaseScope(boolean val) {
iAmDefaultOrBaseScope = val;
}
/**
- * 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/StringTable.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/StringTable.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/StringTable.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/StringTable.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,6 +22,8 @@
* Keeps track of all strings encountered in the file that represent
* identifiers. This way we only ever keep a single copy of a string
* and all symbols refer to it.
+ *
+ * @version $Id: $
*/
class StringTable {
@@ -42,9 +44,9 @@
/**
* Get a name from the StringTable
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
String getName(String name) {
@@ -64,9 +66,7 @@
}
/**
- * Write out that this is a string table...
- *
- * @return
+ * @see java.lang.Object#toString()
*/
public String toString() {
return "StringTable";
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/SymbolTable.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/SymbolTable.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/SymbolTable.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/SymbolTable.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 org.apache.forrest.forrestdoc.java.src.util.JSCollections;
import org.apache.forrest.forrestdoc.java.src.util.SortableString;
import org.apache.forrest.forrestdoc.java.src.xref.JavaToken;
@@ -31,11 +33,13 @@
* parsing a file. It's main components are a list of all packages
* that have been parsed or imported, and a stack of symbols that represent
* the syntactical scope of a source file as it is being parsed.
+ *
+ * @version $Id: $
*/
public class SymbolTable {
- /** Field debug */
- public static final boolean debug = false;
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( SymbolTable.class );
/** Field singleton */
public static SymbolTable singleton = null;
@@ -101,18 +105,18 @@
/** Hashtable holds Vectors mapping literals to files */
private static Hashtable _fileLiterals = new Hashtable();
-
+
/** Hashtable holds Vectors mapping keywords to files */
private static Hashtable _fileKeywords = new Hashtable();
-
+
// ==========================================================================
// == Methods
// ==========================================================================
/**
* Method getPackages
- *
- * @return
+ *
+ * @return
*/
public Hashtable getPackages() {
return packages;
@@ -120,9 +124,9 @@
/**
* Method createReferenceTags
- *
- * @param f
- * @param tagList
+ *
+ * @param f
+ * @param tagList
*/
public static void createReferenceTags(File f, Vector tagList) {
@@ -144,8 +148,8 @@
/**
* Method addFileReference
- *
- * @param occ
+ *
+ * @param occ
*/
public static void addFileReference(Occurrence occ) {
@@ -163,9 +167,9 @@
/**
* Method getCommentTags
- *
- * @param f
- * @param tagList
+ *
+ * @param f
+ * @param tagList
*/
public static void getCommentTags(File f, Vector tagList) {
@@ -178,9 +182,9 @@
/**
* Method getLiteralTags
- *
- * @param f
- * @param tagList
+ *
+ * @param f
+ * @param tagList
*/
public static void getLiteralTags(File f, Vector tagList) {
@@ -193,9 +197,9 @@
/**
* Method getKeywordTags
- *
- * @param f
- * @param tagList
+ *
+ * @param f
+ * @param tagList
*/
public static void getKeywordTags(File f, Vector tagList) {
@@ -208,8 +212,8 @@
/**
* Method getImports
- *
- * @return
+ *
+ * @return
*/
public JavaHashtable getImports() {
return importedClasses;
@@ -217,8 +221,8 @@
/**
* Method setImports
- *
- * @param imp
+ *
+ * @param imp
*/
public void setImports(JavaHashtable imp) {
importedClasses = imp;
@@ -226,8 +230,8 @@
/**
* Method getDemand
- *
- * @return
+ *
+ * @return
*/
public JavaVector getDemand() {
return demand;
@@ -235,8 +239,8 @@
/**
* Method setDemand
- *
- * @param dem
+ *
+ * @param dem
*/
public void setDemand(JavaVector dem) {
demand = dem;
@@ -244,8 +248,8 @@
/**
* Method getSymbolTable
- *
- * @return
+ *
+ * @return
*/
public static SymbolTable getSymbolTable() {
@@ -317,8 +321,8 @@
/**
* Method setOutDirPath
- *
- * @param outDirPath
+ *
+ * @param outDirPath
*/
public void setOutDirPath(String outDirPath) {
this.outDirPath = outDirPath;
@@ -326,8 +330,8 @@
/**
* Method getOutDirPath
- *
- * @return
+ *
+ * @return
*/
public String getOutDirPath() {
return outDirPath;
@@ -340,8 +344,8 @@
* import java.awt.*;
* is an on-demand import that says "if we don't find a class anywhere
* else, try to find it in the java.awt.* package.
- *
- * @param pkg
+ *
+ * @param pkg
*/
void addDemand(PackageDef pkg) {
demand.addElement(pkg);
@@ -349,8 +353,8 @@
/**
* Method createDirs
- *
- * @param f
+ *
+ * @param f
*/
public static void createDirs(File f) {
@@ -364,9 +368,9 @@
/**
* Method addFileClassDef
- *
- * @param f
- * @param classDef
+ *
+ * @param f
+ * @param classDef
*/
public static void addFileClassDef(File f, ClassDef classDef) {
@@ -387,9 +391,9 @@
/**
* Method getClassList
- *
- * @param f
- * @return
+ *
+ * @param f
+ * @return
*/
public static String getClassList(File f) {
@@ -421,14 +425,19 @@
/**
* Add a package that has been imported
- *
- * @param tok
- * @param className
- * @param packageName
+ *
+ * @param tok
+ * @param className
+ * @param packageName
*/
public void addImport(JavaToken tok, String className, String packageName) {
- // System.out.println("addImport:"+packageName+","+className);
+ if (log.isDebugEnabled())
+ {
+ log.debug("addImport(JavaToken, String, String) - String className=" + className);
+ log.debug("addImport(JavaToken, String, String) - String packageName=" + packageName);
+ }
+
if (importedClasses == null) { // lazy instantiation
importedClasses = new JavaHashtable();
}
@@ -469,7 +478,11 @@
// otherwise, create a placeholder class for class/interface ref
else {
- // System.out.println("Created placeholder for:"+getUniqueName(className));
+ if (log.isDebugEnabled())
+ {
+ log.debug("addImport(JavaToken, String, String) - Created placeholder for:"+getUniqueName(className));
+ }
+
importedClasses.put(
getUniqueName(className),
new DummyClass(
@@ -483,8 +496,8 @@
/**
* Add an element to the current scope
- *
- * @param def
+ *
+ * @param def
*/
void addToCurrentScope(Definition def) {
@@ -505,9 +518,9 @@
/**
* Define a curly-brace-delimited block of code
- *
- * @param tok
- * @return
+ *
+ * @param tok
+ * @return
*/
public Definition defineBlock(JavaToken tok) {
@@ -523,10 +536,10 @@
/**
* Define a class object
- *
- * @param theClass
- * @param superClass
- * @param interfaces
+ *
+ * @param theClass
+ * @param superClass
+ * @param interfaces
*/
public void defineClass(JavaToken theClass, // class being created
JavaToken superClass, // its superclass
@@ -557,9 +570,9 @@
/**
* Define an interface object
- *
- * @param theInterface
- * @param superInterfaces
+ *
+ * @param theInterface
+ * @param superInterfaces
*/
public void defineInterface(JavaToken theInterface,
JavaVector superInterfaces) {
@@ -584,8 +597,8 @@
/**
* Define a new label object
- *
- * @param theLabel
+ *
+ * @param theLabel
*/
public void defineLabel(JavaToken theLabel) {
@@ -596,10 +609,10 @@
/**
* Define a new comment object
- *
- * @param line
- * @param column
- * @param text
+ *
+ * @param line
+ * @param column
+ * @param text
*/
public void defineComment(int line, int column, String text) {
@@ -629,10 +642,10 @@
/**
* Define a new literal object
- *
- * @param line
- * @param column
- * @param text
+ *
+ * @param line
+ * @param column
+ * @param text
*/
public void defineLiteral(int line, int column, String text) {
@@ -650,13 +663,13 @@
literalList.addElement(t);
}
-
+
/**
* Define a new keyword object
- *
- * @param line
- * @param column
- * @param text
+ *
+ * @param line
+ * @param column
+ * @param text
*/
public void defineKeyword(int line, int column, String text) {
@@ -674,19 +687,24 @@
keywordList.addElement(t);
}
+
/**
* Define a new method object
- *
- * @param theMethod
- * @param type
+ *
+ * @param theMethod
+ * @param type
*/
public void defineMethod(JavaToken theMethod, JavaToken type) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("defineMethod(JavaToken, JavaToken) - JavaToken theMethod=" + theMethod.getText());
+ }
+
// if there is no type, this is a constructor
String name;
String className = null;
- // System.out.println("defineMethod:"+theMethod.getText());
if (type == null) {
// name = "~constructor~";
@@ -722,8 +740,8 @@
/**
* Define a new package object
* This is an adapter version to get the name of the package from a token
- *
- * @param tok
+ *
+ * @param tok
*/
public void definePackage(JavaToken tok) {
definePackage(getUniqueName(tok));
@@ -731,9 +749,9 @@
/**
* Define a new package object
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
PackageDef definePackage(String name) {
@@ -748,9 +766,9 @@
/**
* create a variable definition
- *
- * @param theVariable
- * @param type
+ *
+ * @param theVariable
+ * @param type
*/
public void defineVar(JavaToken theVariable, JavaToken type) {
@@ -771,8 +789,8 @@
/**
* State that we are done processing the method header
- *
- * @param exceptions
+ *
+ * @param exceptions
*/
public void endMethodHead(JavaVector exceptions) {
@@ -788,36 +806,51 @@
/**
* look for the name in the import list for this class
- *
- * @param name
- * @param type
- * @return
+ *
+ * @param name
+ * @param type
+ * @return
*/
Definition findInImports(String name, Class type) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("findInImports(String, Class) - String name=" + name);
+ log.debug("findInImports(String, Class) - importedClasses=" + importedClasses);
+ log.debug("findInImports(String, Class) - demand=" + demand);
+ }
+
Definition def = null;
- // System.out.println("findInImports:name="+name);
- // System.out.println("findInImports:importedClasses="+importedClasses);
- // System.out.println("findInImports:demand="+demand);
// look at the stuff we imported
// (the name could be a class name)
if (importedClasses != null) {
def = (Definition) importedClasses.get(name);
}
- // System.out.println("findInImports:importedClasses.get returned "+def);
+ if (log.isDebugEnabled())
+ {
+ log.debug("findInImports(String, Class) - def=" + def);
+ }
+
// TBD: best place for this?
if (def instanceof DummyClass) {
String packageName = ((DummyClass) def).getPackage();
- // System.out.println("findInImports:DummyClass's packageName is "+packageName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("findInImports(String, Class) - DummyClass's packageName is "+packageName);
+ }
+
if (packageName != null) {
PackageDef pd = (PackageDef) packages.get(packageName);
def = pd.lookup(def.getName(), type);
- // System.out.println("findInImports:pd.lookup returned "+def);
+ if (log.isDebugEnabled())
+ {
+ log.debug("findInImports(String, Class) - pd.lookup returned "+def);
+ }
}
}
@@ -829,7 +862,10 @@
while ((def == null) && e.hasMoreElements()) {
PackageDef pd = (PackageDef) e.nextElement();
- // System.out.println("findInImports:searching in package "+pd.getName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("findInImports(String, Class) - searching in package "+pd.getName());
+ }
def = pd.lookup(name, type);
}
}
@@ -839,9 +875,9 @@
/**
* Lookup a package in the list of all parsed packages
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
Definition findPackage(String name) {
return (Definition) packages.get(name);
@@ -849,9 +885,9 @@
/**
* Retrieve or add a package to the list of packages
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
PackageDef lookupPackage(String name) {
@@ -868,8 +904,8 @@
/**
* Return the currently-active scope
- *
- * @return
+ *
+ * @return
*/
ScopedDef getCurrentScope() {
@@ -882,8 +918,8 @@
/**
* Define a new package object
- *
- * @return
+ *
+ * @return
*/
PackageDef getDefaultPackage() {
@@ -902,9 +938,9 @@
/**
* Create a new dummy class object
- *
- * @param tok
- * @return
+ *
+ * @param tok
+ * @return
*/
public DummyClass getDummyClass(JavaToken tok) {
@@ -917,8 +953,8 @@
/**
* Get the java.lang.Object object
- *
- * @return
+ *
+ * @return
*/
ClassDef getObject() {
@@ -936,26 +972,26 @@
/**
* Create a new occurrence object
- *
- * @param tok
- * @return
+ *
+ * @param tok
+ * @return
*/
Occurrence getOccurrence(JavaToken tok) {
if (tok == null) {
return new Occurrence(null, 0);
- } else {
- return new Occurrence(currentFile, tok.getLine(), tok.getColumn(),
+ }
+
+ return new Occurrence(currentFile, tok.getLine(), tok.getColumn(),
getCurrentPackageName(),
getCurrentClassName(),
getCurrentMethodName());
- }
}
/**
* return the current qualified scope for lookup.
- *
- * @return
+ *
+ * @return
*/
Definition getScope() {
return qualifiedScope;
@@ -963,9 +999,9 @@
/**
* Get a unique occurrence of a String that has the name we want
- *
- * @param tok
- * @return
+ *
+ * @param tok
+ * @return
*/
String getUniqueName(JavaToken tok) {
return getUniqueName(tok.getText());
@@ -973,9 +1009,9 @@
/**
* Get a unique occurrence of a String that has the specified name
- *
- * @param name
- * @return
+ *
+ * @param name
+ * @return
*/
String getUniqueName(String name) {
return names.getName(name);
@@ -985,10 +1021,10 @@
* Lookup a non-method in the symbol table
* This version of lookup is a convenience wrapper that just passes -1
* as the parameter count to the real lookup routine
- *
- * @param name
- * @param type
- * @return
+ *
+ * @param name
+ * @param type
+ * @return
*/
Definition lookup(String name, Class type) {
return lookup(name, -1, type);
@@ -996,20 +1032,24 @@
/**
* Lookup a name in the symbol table
- *
- * @param name
- * @param numParams
- * @param type
- * @return
+ *
+ * @param name
+ * @param numParams
+ * @param type
+ * @return
*/
Definition lookup(String name, int numParams, Class type) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - String name=" + name);
+ log.debug("lookup(String, int, Class) - int numParams=" + numParams);
+ }
+
Definition def = null;
StringTokenizer st = null;
String afterPackage = null;
- boolean debug = false; // name.endsWith("SymbolTable");
- // System.out.println("SymbolTable:lookup:"+name+","+numParams);
// If we have a dot ('.') in the name, we must first resolve the package,
// class or interface that starts the name, the progress through the
// name
@@ -1037,8 +1077,9 @@
// We'll walk through to find the longest package name that we
// know about, then start checking to see if the rest of the
// elements are validly scoped within that package
- if (debug) {
- System.out.println("SymbolTable.lookup " + name);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - String name=" + name);
}
boolean doneWithPackage = false;
@@ -1051,19 +1092,22 @@
testName = id;
// see if the first part of the name is an imported class
- if (debug) {
- System.out.println("calling findInImports " + testName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - calling findInImports " + testName);
}
def = findInImports(testName, type);
- if (debug) {
- System.out.println("findInImports returned " + def);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - findInImports returned " + def);
}
if (def != null) {
- if (debug) {
- System.out.println("Found in imports:"
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - Found in imports:"
+ def.getName());
}
@@ -1075,18 +1119,21 @@
}
// keep track of the longest name that is a package
- // System.out.println("Looking for package:"+testName);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - Looking for package:"+testName);
+ }
testIt = (PackageDef) packages.get(testName);
- if (debug) {
- System.out.println("doneWithPackage=" + doneWithPackage
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - doneWithPackage=" + doneWithPackage
+ " testIt=" + ((testIt == null)
? "null"
: testIt.getName()) + " afterPackage="
+ afterPackage);
}
- // if (debug) System.out.println("packages="+packages);
if (!doneWithPackage && (testIt != null)) {
def = testIt;
afterPackage = null;
@@ -1102,19 +1149,20 @@
else if (numParams == -1) {
def = findInImports(name, type);
- if (debug) {
- System.out.print("lookup:findInImports returned " + def);
-
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - findInImports returned " + def);
if ((def != null) && (def.getParentScope() != null)) {
- System.out.println(" parentScope" + def.getParentScope());
- } else {
- System.out.println(" ");
+ log.debug("lookup(String, int, Class) - parentScope" + def.getParentScope());
}
}
if (def != null) {
- // System.out.println("lookup Returning import:"+def.getQualifiedName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - lookup Returning import:"+def.getQualifiedName());
+ }
return def;
}
}
@@ -1125,29 +1173,28 @@
// a final part of the name. If so, we need to push the scope of the
// leftmost part of the identifier. If not, we just want to analyze
// the entire name as a unit.
- if (debug) {
- System.out.print("lookup:def=");
-
+ if (log.isDebugEnabled())
+ {
if (def == null) {
- System.out.println("null");
+ log.debug("lookup(String, int, Class) - def=null");
} else {
- System.out.println(def.getName());
+ log.debug("lookup(String, int, Class) - def="+def.getName());
}
- }
- if (debug) {
- System.out.println("lookup:afterpackage=" + afterPackage);
+ log.debug("lookup(String, int, Class) - afterpackage=" + afterPackage);
}
if ((def != null) && (afterPackage != null)) {
- if (debug) {
- System.out.println("Setting scope=" + def.getName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - Setting scope=" + def.getName());
}
setScope(def);
} else {
- if (debug) {
- System.out.println("afterPackage=" + name);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - afterPackage=" + name);
}
afterPackage = name;
@@ -1166,8 +1213,9 @@
// if a explicit scope qualification was specified, look only there
if (qualifiedScope != null) {
- if (debug) {
- System.out.println("Checking qualified scope:"
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - Checking qualified scope:"
+ qualifiedScope);
}
@@ -1178,8 +1226,9 @@
// Otherwise, first try a scoped lookup
else {
- if (debug) {
- System.out.println("Checking activeScopes for:" + id);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - Checking activeScopes for:" + id);
}
def = activeScopes.lookup(id, numParams, type);
@@ -1190,8 +1239,9 @@
}
if (def == null) {
- if (debug) {
- System.out.println(id + " Not found in activescopes");
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - " + id + " Not found in activescopes");
}
break;
@@ -1204,12 +1254,14 @@
}
if (def == null) {
- if (debug) {
- System.out.println("lookup returning null:" + name);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - lookup returning null:" + name);
}
} else {
- if (debug) {
- System.out.println("lookup returning:"
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookup(String, int, Class) - lookup returning:"
+ def.getQualifiedName());
}
}
@@ -1219,9 +1271,9 @@
/**
* Lookup a class based on a placeholder for that class
- *
- * @param d
- * @return
+ *
+ * @param d
+ * @return
*/
ClassDef lookupDummy(Definition d) {
@@ -1240,28 +1292,31 @@
}
}
- // System.out.println("SymbolTable.lookupDummy: className="+className);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookupDummy(Definition) - String className=" + className);
+ }
newD = lookup(className, ClassDef.class);
- // System.out.println("newD="+newD);
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookupDummy(Definition) - String newD=" + newD);
+ }
if ((newD != null) && !(newD instanceof ClassDef)) {
- new Exception("newD is a " + newD).printStackTrace();
-
- // System.out.println("d = "+d);
- // System.out.println("parentScope = "+d.getParentScope());
+ if (log.isDebugEnabled())
+ {
+ log.debug("lookupDummy(Definition) - newD is a " + newD);
+ log.debug("lookupDummy(Definition) - d="+d + "parentScope = "+d.getParentScope());
+ }
}
- // if (newD == null)
- // System.out.println("No definition found for "+className);
- // else
- // System.out.println("Found "+newD.getQualifiedName());
return (ClassDef) newD;
}
/**
* Set up the list of imported packages for use in symbol lookup
- *
- * @param imports
+ *
+ * @param imports
*/
void openImports(JavaHashtable imports) {
@@ -1287,18 +1342,27 @@
if (d instanceof PackageDef) {
- // System.out.println("Adding package "+d.getName()+" to imports");
+ if (log.isDebugEnabled())
+ {
+ log.debug("openImports(JavaHashtable) - Adding package "+d.getName()+" to imports");
+ }
addDemand((PackageDef) d);
} else {
if (d instanceof DummyClass) {
- // System.out.println("found DummyClass "+d.getName()+" package "+((DummyClass)d).getPackage()+" in import list");
+ if (log.isDebugEnabled())
+ {
+ log.debug("openImports(JavaHashtable) - found DummyClass " + d.getName() + " package "
+ + ( (DummyClass) d ).getPackage() + " in import list");
+ }
Definition newD = lookupDummy(d);
- // if (newD == null) System.out.println("lookup for "+d.getName()+" failed, not adding import list");
if (newD != null) {
- // System.out.println("Adding class "+newD.getName()+" to imports");
+ if (log.isDebugEnabled())
+ {
+ log.debug("openImports(JavaHashtable) - Adding class "+newD.getName()+" to imports");
+ }
d = newD;
}
}
@@ -1330,13 +1394,12 @@
/**
* Push a scope on the stack for symbol lookup
- *
- * @param scope
- * @return
+ *
+ * @param scope
+ * @return
*/
Definition pushScope(Definition scope) {
- // System.out.println("pushScope");
if (!(scope instanceof ScopedDef)) {
throw new RuntimeException("Not a ScopedDef");
}
@@ -1348,8 +1411,8 @@
/**
* Get current package scope *
- *
- * @return
+ *
+ * @return
*/
String getCurrentPackageName() {
@@ -1376,8 +1439,8 @@
/**
* Get current class scope *
- *
- * @return
+ *
+ * @return
*/
String getCurrentClassName() {
@@ -1404,8 +1467,8 @@
/**
* Get current method scope *
- *
- * @return
+ *
+ * @return
*/
String getCurrentMethodName() {
@@ -1432,8 +1495,8 @@
/**
* Add an unresolved reference to the current scope
- *
- * @param t
+ *
+ * @param t
*/
public void reference(JavaToken t) {
@@ -1442,14 +1505,12 @@
t.setClassName(getCurrentClassName());
t.setMethodName(getCurrentMethodName());
getCurrentScope().addUnresolved(t);
-
- // System.out.println("SymbolTable.reference: Adding unresolved reference:"+t);
}
/**
* Method generatePackageTags
- *
- * @return
+ *
+ * @return
*/
public Hashtable generatePackageTags() {
@@ -1522,8 +1583,8 @@
/**
* Method persistRefs
- *
- * @param outDirPath
+ *
+ * @param outDirPath
*/
public void persistRefs(String outDirPath) {
@@ -1539,8 +1600,8 @@
/**
* Mark the current file that is being parsed
- *
- * @param file
+ *
+ * @param file
*/
public void setFile(File file) {
currentFile = file;
@@ -1559,8 +1620,8 @@
* Set the qualified scope for the next name lookup. Names will only be
* searched for within that scope. This version of setScope looks up
* the definition to set based on its name as received from a token...
- *
- * @param t
+ *
+ * @param t
*/
void setScope(JavaToken t) {
@@ -1575,8 +1636,8 @@
/**
* Set the qualified scope for the next name lookup. Names will only be
* searched for within that scope
- *
- * @param d
+ *
+ * @param d
*/
void setScope(Definition d) {
@@ -1593,8 +1654,8 @@
* Set the qualified scope for the next name lookup. Names will only be
* searched for within that scope. This version of setScope looks up
* the definition to set based on its name...
- *
- * @param name
+ *
+ * @param name
*/
void setScope(String name) {
@@ -1606,9 +1667,7 @@
}
/**
- * Return a String representation for the entire symbol table
- *
- * @return
+ * @see java.lang.Object#toString()
*/
public String toString() {
@@ -1638,8 +1697,8 @@
/**
* Method startReadExternal
- *
- * @param name
+ *
+ * @param name
*/
static public void startReadExternal(String name) {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Taggable.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Taggable.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Taggable.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Taggable.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,13 +18,15 @@
/**
* This interface is used as a handle to all classes that can be tagged
+ *
+ * @version $Id: $
*/
interface Taggable {
/**
* Create tag information about an object
- *
- * @param tagList
+ *
+ * @param tagList
*/
void generateTags(HTMLTagContainer tagList);
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/TypedDef.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/TypedDef.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/TypedDef.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/TypedDef.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,13 +20,15 @@
* This interface represents definitions that have a "type" associated with
* them. It provides a getType method that can be used to retrieve the
* symbol for that type.
+ *
+ * @version $Id: $
*/
interface TypedDef {
/**
* returns the symbol representing the type associated with a definition
- *
- * @return
+ *
+ * @return
*/
Definition getType();
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/VariableDef.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/VariableDef.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/VariableDef.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/VariableDef.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;
@@ -27,10 +29,15 @@
* Definition of a variable in a source file.
* This can be member data in class,
* a local variable or a method parameter.
+ *
+ * @version $Id: $
*/
public class VariableDef extends Definition
implements TypedDef, Externalizable {
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( VariableDef.class );
+
// ==========================================================================
// == Class Variables
// ==========================================================================
@@ -50,11 +57,11 @@
/**
* Constructor to create a new variable symbol
- *
- * @param name
- * @param occ
- * @param type
- * @param parentScope
+ *
+ * @param name
+ * @param occ
+ * @param type
+ * @param parentScope
*/
VariableDef(String name, // the variable's name
Occurrence occ, // where it was defined
@@ -67,18 +74,14 @@
}
/**
- * get the type of the variable
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.TypedDef#getType()
*/
public Definition getType() {
return type;
}
/**
- * Method generateReferences
- *
- * @param output
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#generateReferences(java.io.FileWriter)
*/
public void generateReferences(FileWriter output) {
@@ -117,19 +120,15 @@
output.write("</p>");
} catch (IOException e) {
+ log.error( "IOException: " + e.getMessage(), e );
}
- ;
}
/**
- * Method generateTags
- *
- * @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) {
- String linkString;
- String linkFileName;
String nameString = "<a class=\"varDef\" name=" + getClassScopeName()
+ " href=" + getRefName() + "#"
+ getClassScopeName() + ">" + getName() + "</a>";
@@ -145,17 +144,18 @@
}
/**
- * 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) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("getOccurrenceTag(Occurrence) - Occurrence occ=" + occ);
+ }
+
String linkString;
String linkFileName;
- // System.out.println("Occurrence:"+o.getLine());
linkFileName = getRelativePath(occ) + getSourceName();
linkString = "<a class=\"varRef\" title=\"" + getType().getName()
+ "\" " + "href=" + linkFileName + "#"
@@ -167,16 +167,14 @@
}
/**
- * Resolve referenced symbols used by this variable
- *
- * @param symbolTable
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#resolveTypes(org.apache.forrest.forrestdoc.java.src.symtab.SymbolTable)
*/
void resolveTypes(SymbolTable symbolTable) {
if ((type != null) && (type instanceof DummyClass)) {
// resolve the type of the variable
- ClassDef newType = (ClassDef) symbolTable.lookupDummy(type);
+ ClassDef newType = symbolTable.lookupDummy(type);
if (newType != null) {
newType.addReference(type.getOccurrence());
@@ -189,9 +187,7 @@
}
/**
- * Method getClassScopeName
- *
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.symtab.Definition#getClassScopeName()
*/
String getClassScopeName() {
@@ -230,14 +226,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("persisting VariableDef "+getQualifiedName());
+ if (log.isDebugEnabled())
+ {
+ log.debug("writeExternal(ObjectOutput) - persisting VariableDef "+getQualifiedName());
+ }
+
out.writeObject(getName());
Definition parentScopeOut = getParentScope();
@@ -261,11 +258,7 @@
}
/**
- * Method readExternal
- *
- * @param in
- * @throws java.io.IOException
- * @throws ClassNotFoundException
+ * @see java.io.Externalizable#readExternal(java.io.ObjectInput)
*/
public void readExternal(ObjectInput in)
throws java.io.IOException, ClassNotFoundException {
@@ -282,9 +275,7 @@
}
/**
- * Visitor design pattern. Let the visitor visit this definition.
- *
- * @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);
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Visitor.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Visitor.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Visitor.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/symtab/Visitor.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,34 +18,36 @@
/**
* All visitors implement this public.
+ *
+ * @version $Id: $
*/
public interface Visitor {
/**
* Method visit
- *
- * @param def
+ *
+ * @param def
*/
public void visit(PackageDef def);
/**
* Method visit
- *
- * @param def
+ *
+ * @param def
*/
public void visit(ClassDef def);
/**
* Method visit
- *
- * @param def
+ *
+ * @param def
*/
public void visit(MethodDef def);
/**
* Method visit
- *
- * @param def
+ *
+ * @param def
*/
public void visit(VariableDef def);
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSCollections.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSCollections.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSCollections.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSCollections.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,16 +22,16 @@
/**
* Class JSCollections
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class JSCollections {
/**
* Method sortEnumeration
- *
- * @param unsortedItems
- * @return
+ *
+ * @param unsortedItems
+ * @return
*/
public static Vector sortEnumeration(Enumeration unsortedItems) {
@@ -77,16 +77,12 @@
/**
* Method sortVector
- *
- * @param unsortedItems
- * @return
+ *
+ * @param unsortedItems
+ * @return
*/
public static Object[] sortVector(Vector unsortedItems) {
- Object element;
- Vector sortedItems;
- JSComparable value;
-
if (unsortedItems == null) {
return (null);
}
@@ -105,22 +101,20 @@
}
}
-// Comparator.java
-// delegate object to hand to QuickSort for callback compare
-
/**
* Class QSComparator
- *
- * @version %I%, %G%
+ * delegate object to hand to QuickSort for callback compare
+ *
+ * @version $Id: $
*/
class QSComparator implements Comparator {
/**
* Method compare
- *
- * @param a
- * @param b
- * @return
+ *
+ * @param a
+ * @param b
+ * @return
*/
public int compare(Object a, Object b) {
return (((JSComparable) a).compareTo((JSComparable) b));
@@ -128,17 +122,17 @@
/**
* Method equals
- *
- * @param a
- * @param b
- * @return
+ *
+ * @param a
+ * @param b
+ * @return
*/
public boolean equals(Object a, Object b) {
if (((JSComparable) a).compareTo((JSComparable) b) == 0) {
return true;
- } else {
- return false;
}
+
+ return false;
}
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSComparable.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSComparable.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSComparable.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/JSComparable.java Mon Jul 16 15:17:40 2007
@@ -19,7 +19,7 @@
/**
* Interface JSComparable
*
- * @version %I%, %G%
+ * @version $Id: $
*/
public interface JSComparable {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/QuickSort.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/QuickSort.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/QuickSort.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/QuickSort.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.
@@ -26,12 +26,14 @@
* package, as a quick replacement to
* the previous one that was not
* ASL compatible.
+ *
+ * @version $Id: $
*/
public class QuickSort {
/**
* Sort array of Objects using the QuickSort algorithm.
- *
+ *
* @param s An Object[].
* @param lo The current lower bound.
* @param hi The current upper bound.
@@ -118,7 +120,7 @@
/**
* Sorts and array of objects.
- *
+ *
* @param data An Object[].
* @param cmp A Comparator to compare two elements.
*/
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SkipCRInputStream.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SkipCRInputStream.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SkipCRInputStream.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SkipCRInputStream.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 SkipCRInputStream
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class SkipCRInputStream extends BufferedInputStream {
/**
* Constructor SkipCRInputStream
- *
- * @param s
+ *
+ * @param s
*/
public SkipCRInputStream(InputStream s) {
super(s);
@@ -38,19 +38,16 @@
/**
* Constructor SkipCRInputStream
- *
- * @param s
- * @param size
+ *
+ * @param s
+ * @param size
*/
public SkipCRInputStream(InputStream s, int size) {
super(s, size);
}
/**
- * Method read
- *
- * @return
- * @throws IOException
+ * @see java.io.BufferedInputStream#read()
*/
public int read() throws IOException {
@@ -58,8 +55,8 @@
if (c == 13) {
return super.read();
- } else {
- return c;
}
+
+ return c;
}
}
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SortableString.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SortableString.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SortableString.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/util/SortableString.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,15 +18,15 @@
/**
* Class SortableString
- *
- * @version %I%, %G%
+ *
+ * @version $Id: $
*/
public class SortableString implements JSComparable {
/**
* Method getString
- *
- * @return
+ *
+ * @return
*/
public String getString() {
return _s;
@@ -34,18 +34,15 @@
/**
* Constructor SortableString
- *
- * @param s
+ *
+ * @param s
*/
public SortableString(String s) {
_s = s;
}
/**
- * Method compareTo
- *
- * @param o
- * @return
+ * @see org.apache.forrest.forrestdoc.java.src.util.JSComparable#compareTo(java.lang.Object)
*/
public int compareTo(Object o) {
return _s.compareTo(((SortableString) o).getString());
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/FileListener.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/FileListener.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/FileListener.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/FileListener.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.
@@ -19,12 +19,14 @@
/**
* Somebody that wants to know about each file that the
* lexer processes.
+ *
+ * @version $Id: $
*/
public interface FileListener {
/**
* Called each time a new file is processed.
- *
+ *
* @param path The absolute path of the file that's currently being processed.
*/
public void notify(String path);
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/JavaToken.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/JavaToken.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/JavaToken.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/java/src/xref/JavaToken.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.
@@ -23,6 +23,8 @@
* the parser. We've extended it to save information about the file from
* which the token was created, and the number of parameters (telling if the
* symbol looked like a method invocation or some other symbol reference.)
+ *
+ * @version $Id: $
*/
public class JavaToken extends antlr.CommonToken {
@@ -55,18 +57,14 @@
protected String methodName;
/**
- * Method getColumn
- *
- * @return
+ * @see antlr.CommonToken#getColumn()
*/
public int getColumn() {
return column;
}
/**
- * Method setColumn
- *
- * @param c
+ * @see antlr.CommonToken#setColumn(int)
*/
public void setColumn(int c) {
column = c;
@@ -74,8 +72,8 @@
/**
* Method getPackageName
- *
- * @return
+ *
+ * @return
*/
public String getPackageName() {
return packageName;
@@ -83,8 +81,8 @@
/**
* Method setPackageName
- *
- * @param name
+ *
+ * @param name
*/
public void setPackageName(String name) {
@@ -97,8 +95,8 @@
/**
* Method getClassName
- *
- * @return
+ *
+ * @return
*/
public String getClassName() {
return className;
@@ -106,8 +104,8 @@
/**
* Method setClassName
- *
- * @param name
+ *
+ * @param name
*/
public void setClassName(String name) {
@@ -120,8 +118,8 @@
/**
* Method getMethodName
- *
- * @return
+ *
+ * @return
*/
public String getMethodName() {
return methodName;
@@ -129,8 +127,8 @@
/**
* Method setMethodName
- *
- * @param name
+ *
+ * @param name
*/
public void setMethodName(String name) {
@@ -153,8 +151,8 @@
/**
* Constructor JavaToken
- *
- * @param t
+ *
+ * @param t
*/
public JavaToken(JavaToken t) {
@@ -176,8 +174,8 @@
/**
* get the File that contained the text scanned for this token
- *
- * @return
+ *
+ * @return
*/
public File getFile() {
return file;
@@ -186,8 +184,8 @@
/**
* get the number of parameters for this token (if it represents a
* method invocation
- *
- * @return
+ *
+ * @return
*/
public int getParamCount() {
return paramCount;
@@ -195,8 +193,8 @@
/**
* Sets the file property of this token
- *
- * @param file
+ *
+ * @param file
*/
public void setFile(File file) {
this.file = file;
@@ -204,17 +202,15 @@
/**
* Sets the parameter count property of this token
- *
- * @param count
+ *
+ * @param count
*/
public void setParamCount(int count) {
paramCount = count;
}
/**
- * Method toString
- *
- * @return
+ * @see antlr.CommonToken#toString()
*/
public String toString() {
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLDoc.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLDoc.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLDoc.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLDoc.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,20 +17,25 @@
package org.apache.forrest.forrestdoc.js.doc;
+import org.apache.log4j.Logger;
+
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
/**
- * Class that mounts a Document in HTML as document
+ * Class that mounts a Document in HTML as document
+ *
+ * @version $Id: $
*/
public class GenerateHTMLDoc {
- private static FileInputStream fis;
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( GenerateHTMLDoc.class );
+
private static FileOutputStream fos;
private static BufferedReader br;
private static String LINE_SEPARATOR = String.valueOf((char) 13) + String.valueOf((char) 10);
@@ -49,7 +54,7 @@
br = new BufferedReader(new FileReader(fis));
} catch (FileNotFoundException fnfe) {
- fnfe.printStackTrace();
+ log.error( "FileNotFoundException: " + fnfe.getMessage(), fnfe );
}
try {
@@ -148,51 +153,17 @@
fos.write("</html>".getBytes());
} catch (IOException ioe) {
- ioe.printStackTrace();
+ log.error( "IOException: " + ioe.getMessage(), ioe );
}
- System.out.println("Html generated with success!");
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Html generated with success!");
+ }
}
public static void main(String args[]) throws Exception{
GenerateHTMLDoc main1 = new GenerateHTMLDoc(new File(args[0]), args[1]);
-
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLIndex.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLIndex.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLIndex.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/GenerateHTMLIndex.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,8 @@
package org.apache.forrest.forrestdoc.js.doc;
+import org.apache.log4j.Logger;
+
import org.apache.tools.ant.BuildException;
import java.io.BufferedReader;
@@ -29,12 +31,17 @@
import java.util.Vector;
/**
- * Searches all javascript files and creates a index HTML
- * with links to documentation
+ * Searches all javascript files and creates a index HTML
+ * with links to documentation
+ *
+ * @version $Id: $
*/
public class GenerateHTMLIndex {
- private static File file, file2 = null;
+ /** Logger for this class */
+ private static final Logger log = Logger.getLogger( GenerateHTMLIndex.class );
+
+ private static File file = null;
private static FileInputStream fis;
private static FileOutputStream fos;
private static BufferedReader br;
@@ -59,13 +66,13 @@
}
file = new File(jSDir);
-
+
if (!file.isDirectory()) {
throw new BuildException("destDir has to be a directory");
}
-
+
collectFiles(file, v);
-
+
try {
fos = new FileOutputStream(destDir + "index.htm");
@@ -75,6 +82,7 @@
file.mkdir();
fos = new FileOutputStream(destDir + "index.htm");
} catch (FileNotFoundException e) {
+ log.error( "FileNotFoundException: " + e.getMessage(), e );
}
}
try {
@@ -103,9 +111,17 @@
file = (File) v.get(i);
docGenerator = new GenerateHTMLDoc(file, destDir);
}
- System.out.println("Number of .js files: " + v.size());
+
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "Number of .js files: " + v.size());
+ }
+
for (int i = 0; i < v.size(); i++) {
- System.out.println(file.getName());
+ if ( log.isInfoEnabled() )
+ {
+ log.info( "file: " + file.getName());
+ }
file = (File) v.get(i);
fos.write(("<TR>" + LINE_SEPARATOR).getBytes());
@@ -134,7 +150,7 @@
}
} catch (FileNotFoundException fnfe) {
- fnfe.printStackTrace();
+ log.error( "FileNotFoundException: " + fnfe.getMessage(), fnfe );
}
fos.write(("</TD>" + LINE_SEPARATOR).getBytes());
@@ -146,45 +162,24 @@
fos.write("</html>".getBytes());
} catch (IOException ioe) {
- ioe.printStackTrace();
+ log.error( "IOException: " + ioe.getMessage(), ioe );
}
}
-
+
private void collectFiles(File baseDir, Vector fileVector) {
File[] fileList = baseDir.listFiles();
for (int i = 0; i < fileList.length; i++) {
if (fileList[i].isDirectory()){
collectFiles(fileList[i], fileVector);
- }
+ }
else if (fileList[i].getName().indexOf(".js") != -1) {
v.addElement(fileList[i]);
}
}
- }
-
+ }
+
public static void main(String[] args) {
GenerateHTMLIndex index = new GenerateHTMLIndex(args[0], args[1]);
}
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Modified: forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/JSDocTask.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/JSDocTask.java?view=diff&rev=556752&r1=556751&r2=556752
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/JSDocTask.java (original)
+++ forrest/trunk/whiteboard/forrestdoc/src/java/org/apache/forrest/forrestdoc/js/doc/JSDocTask.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,7 +21,9 @@
import org.apache.tools.ant.Task;
/**
- * Ant task responsible for creating automatic documentation for .js files
+ * Ant task responsible for creating automatic documentation for .js files
+ *
+ * @version $Id: $
*/
public class JSDocTask extends Task {
@@ -38,7 +40,7 @@
/**
* Sets the destDir.
- *
+ *
* @param destDir The destDir to set
*/
public void setDestDir(String destDir) {
@@ -47,13 +49,10 @@
/**
* Sets the jSDir.
- *
+ *
* @param jSDir The jSDir to set
*/
public void setJSDir(String jSDir) {
this.jSDir = jSDir;
}
-
}
-
-
|