You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ks...@apache.org on 2002/02/24 19:37:07 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/jxr CodeTransform.java DirectoryIndexer.java JXR.java JxrTask.java
kschrader 02/02/24 10:37:07
Modified: src/java/org/apache/maven/jxr CodeTransform.java
DirectoryIndexer.java JXR.java JxrTask.java
Log:
Formatting, imports and JavaDocs
Revision Changes Path
1.5 +149 -275 jakarta-turbine-maven/src/java/org/apache/maven/jxr/CodeTransform.java
Index: CodeTransform.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jxr/CodeTransform.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CodeTransform.java 24 Feb 2002 05:23:48 -0000 1.4
+++ CodeTransform.java 24 Feb 2002 18:37:07 -0000 1.5
@@ -30,12 +30,15 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import org.apache.maven.jxr.util.*;
import org.apache.maven.jxr.pacman.*;
+import org.apache.maven.jxr.util.MetaData;
+import org.apache.maven.jxr.util.SimpleWordTokenizer;
+import org.apache.maven.jxr.util.StringEntry;
+import org.apache.maven.jxr.util.Util;
import java.io.*;
-import java.util.*;
-import java.text.*;
+import java.util.Hashtable;
+import java.util.Vector;
/**
* Syntax highlights java by turning it into html. A codeviewer object is
@@ -63,8 +66,7 @@
* importFilter
* </pre>
*/
-public class CodeTransform implements Serializable
-{
+public class CodeTransform implements Serializable {
/** Description of the Field */
public final static boolean LINE_NUMBERS = true;
@@ -134,8 +136,7 @@
/** Constructor for the CodeTransform object */
- public CodeTransform()
- {
+ public CodeTransform() {
loadHash();
}
@@ -144,17 +145,14 @@
* Now different method of seeing if at end of input stream, closes inputs
* stream at end.
*/
- public final String syntaxHighlight(String line)
- {
+ public final String syntaxHighlight(String line) {
return htmlFilter(line);
}
/** Filter html tags into more benign text. */
- private final String htmlFilter(String line)
- {
+ private final String htmlFilter(String line) {
StringBuffer buf = new StringBuffer();
- if (line == null || line.equals(""))
- {
+ if (line == null || line.equals("")) {
return "";
}
line = replace(line, "<", "<");
@@ -170,10 +168,8 @@
* Filter out multiLine comments. State is kept with a private boolean
* variable.
*/
- private final String multiLineCommentFilter(String line)
- {
- if (line == null || line.equals(""))
- {
+ private final String multiLineCommentFilter(String line) {
+ if (line == null || line.equals("")) {
return "";
}
StringBuffer buf = new StringBuffer();
@@ -181,14 +177,12 @@
//First, check for the end of a java comment.
if (inJavadocComment &&
- (index = line.indexOf("*/")) > -1 && !isInsideString(line, index))
- {
+ (index = line.indexOf("*/")) > -1 && !isInsideString(line, index)) {
inJavadocComment = false;
buf.append(JAVADOC_COMMENT_START);
buf.append(line.substring(0, index));
buf.append("*/").append(JAVADOC_COMMENT_END);
- if (line.length() > index + 2)
- {
+ if (line.length() > index + 2) {
buf.append(inlineCommentFilter(line.substring(index + 2)));
}
@@ -196,14 +190,12 @@
}
//Second, check for the end of a multi-line comment.
- if (inMultiLineComment && (index = line.indexOf("*/")) > -1 && !isInsideString(line, index))
- {
+ if (inMultiLineComment && (index = line.indexOf("*/")) > -1 && !isInsideString(line, index)) {
inMultiLineComment = false;
buf.append(COMMENT_START);
buf.append(line.substring(0, index));
buf.append("*/").append(COMMENT_END);
- if (line.length() > index + 2)
- {
+ if (line.length() > index + 2) {
buf.append(inlineCommentFilter(line.substring(index + 2)));
}
return uriFilter(buf.toString());
@@ -211,17 +203,13 @@
//If there was no end detected and we're currently in a multi-line
//comment, we don't want to do anymore work, so return line.
- else if (inMultiLineComment)
- {
+ else if (inMultiLineComment) {
StringBuffer buffer = new StringBuffer(line);
buffer.insert(0, COMMENT_START);
buffer.append(COMMENT_END);
return uriFilter(buffer.toString());
- }
-
- else if (inJavadocComment)
- {
+ } else if (inJavadocComment) {
StringBuffer buffer = new StringBuffer(line);
buffer.insert(0, JAVADOC_COMMENT_START);
@@ -231,8 +219,7 @@
//We're not currently in a Javadoc comment, so check to see if the start
//of a multi-line Javadoc comment is in this line.
- else if ((index = line.indexOf("/**")) > -1 && !isInsideString(line, index))
- {
+ else if ((index = line.indexOf("/**")) > -1 && !isInsideString(line, index)) {
inJavadocComment = true;
//Return result of other filters + everything after the start
//of the multiline comment. We need to pass the through the
@@ -247,8 +234,7 @@
//We're not currently in a comment, so check to see if the start
//of a multi-line comment is in this line.
- else if ((index = line.indexOf("/*")) > -1 && !isInsideString(line, index))
- {
+ else if ((index = line.indexOf("/*")) > -1 && !isInsideString(line, index)) {
inMultiLineComment = true;
//Return result of other filters + everything after the start
//of the multiline comment. We need to pass the through the
@@ -263,8 +249,7 @@
//Otherwise, no useful multi-line comment information was found so
//pass the line down to the next filter for processesing.
- else
- {
+ else {
return inlineCommentFilter(line);
}
}
@@ -277,39 +262,31 @@
* isInsideString(line, index) where index points to some point in the line
* that we need to check... started doing this function below.
*/
- private final String inlineCommentFilter(String line)
- {
- if (line == null || line.equals(""))
- {
+ private final String inlineCommentFilter(String line) {
+ if (line == null || line.equals("")) {
return "";
}
StringBuffer buf = new StringBuffer();
int index;
- if ((index = line.indexOf("//")) > -1 && !isInsideString(line, index))
- {
+ if ((index = line.indexOf("//")) > -1 && !isInsideString(line, index)) {
buf.append(stringFilter(line.substring(0, index)));
buf.append(COMMENT_START);
buf.append(line.substring(index));
buf.append(COMMENT_END);
- }
- else
- {
+ } else {
buf.append(stringFilter(line));
}
return buf.toString();
}
/** Filters strings from a line of text and formats them properly. */
- private final String stringFilter(String line)
- {
+ private final String stringFilter(String line) {
- if (line == null || line.equals(""))
- {
+ if (line == null || line.equals("")) {
return "";
}
StringBuffer buf = new StringBuffer();
- if (line.indexOf("\"") <= -1)
- {
+ if (line.indexOf("\"") <= -1) {
return keywordFilter(line);
}
int start = 0;
@@ -317,19 +294,16 @@
int endStringIndex = -1;
int tempIndex;
//Keep moving through String characters until we want to stop...
- while ((tempIndex = line.indexOf("\"")) > -1)
- {
+ while ((tempIndex = line.indexOf("\"")) > -1) {
//We found the beginning of a string
- if (startStringIndex == -1)
- {
+ if (startStringIndex == -1) {
startStringIndex = 0;
buf.append(stringFilter(line.substring(start, tempIndex)));
buf.append(STRING_START).append("\"");
line = line.substring(tempIndex + 1);
}
//Must be at the end
- else
- {
+ else {
startStringIndex = -1;
endStringIndex = tempIndex;
buf.append(line.substring(0, endStringIndex + 1));
@@ -346,10 +320,8 @@
/**
* Filters keywords from a line of text and formats them properly.
*/
- private final String keywordFilter(String line)
- {
- if (line == null || line.equals(""))
- {
+ private final String keywordFilter(String line) {
+ if (line == null || line.equals("")) {
return "";
}
StringBuffer buf = new StringBuffer();
@@ -359,30 +331,24 @@
int startAt = 0;
char ch;
StringBuffer temp = new StringBuffer();
- while (i < line.length())
- {
+ while (i < line.length()) {
temp.setLength(0);
ch = line.charAt(i);
startAt = i;
while (i < line.length() && ((ch >= 65 && ch <= 90)
- || (ch >= 97 && ch <= 122)))
- {
+ || (ch >= 97 && ch <= 122))) {
temp.append(ch);
i++;
- if (i < line.length())
- {
+ if (i < line.length()) {
ch = line.charAt(i);
}
}
String tempString = temp.toString();
- if (reservedWords.containsKey(tempString) && !usedReservedWords.containsKey(tempString))
- {
+ if (reservedWords.containsKey(tempString) && !usedReservedWords.containsKey(tempString)) {
usedReservedWords.put(tempString, tempString);
line = replace(line, tempString, (RESERVED_WORD_START + tempString + RESERVED_WORD_END));
i += (RESERVED_WORD_START.length() + RESERVED_WORD_END.length());
- }
- else
- {
+ } else {
i++;
}
}
@@ -393,11 +359,9 @@
/**
* Replace... I made it use a stringBuffer... hope it still works :)
*/
- private final String replace(String line, String oldString, String newString)
- {
+ private final String replace(String line, String oldString, String newString) {
int i = 0;
- while ((i = line.indexOf(oldString, i)) >= 0)
- {
+ while ((i = line.indexOf(oldString, i)) >= 0) {
line = (new StringBuffer().append(line.substring(0, i)).append(newString).append(line.substring(i + oldString.length()))).toString();
i += newString.length();
}
@@ -408,10 +372,8 @@
* Checks to see if some position in a line is between String start and
* ending characters. Not yet used in code or fully working :)
*/
- private final boolean isInsideString(String line, int position)
- {
- if (line.indexOf("\"") < 0)
- {
+ private final boolean isInsideString(String line, int position) {
+ if (line.indexOf("\"") < 0) {
return false;
}
int index;
@@ -419,29 +381,23 @@
String right = line.substring(position);
int leftCount = 0;
int rightCount = 0;
- while ((index = left.indexOf("\"")) > -1)
- {
+ while ((index = left.indexOf("\"")) > -1) {
leftCount++;
left = left.substring(index + 1);
}
- while ((index = right.indexOf("\"")) > -1)
- {
+ while ((index = right.indexOf("\"")) > -1) {
rightCount++;
right = right.substring(index + 1);
}
- if (rightCount % 2 != 0 && leftCount % 2 != 0)
- {
+ if (rightCount % 2 != 0 && leftCount % 2 != 0) {
return true;
- }
- else
- {
+ } else {
return false;
}
}
/** Description of the Method */
- private final void loadHash()
- {
+ private final void loadHash() {
reservedWords.put("abstract", "abstract");
reservedWords.put("do", "do");
reservedWords.put("inner", "inner");
@@ -499,38 +455,34 @@
/** Description of the Method */
final void writeObject(ObjectOutputStream oos)
- throws IOException
- {
+ throws IOException {
oos.defaultWriteObject();
}
/** Description of the Method */
final void readObject(ObjectInputStream ois)
- throws ClassNotFoundException, IOException
- {
+ throws ClassNotFoundException, IOException {
ois.defaultReadObject();
}
/** Gets the header attribute of the CodeTransform object */
- public final String getHeader()
- {
+ public final String getHeader() {
//FIX ME: migrate this to use ECS
return "<html>\n" +
- "<body bgcolor=\"white\">\n" +
- "<pre>\n" + this.getFileOverview();
+ "<body bgcolor=\"white\">\n" +
+ "<pre>\n" + this.getFileOverview();
}
/** Gets the footer attribute of the CodeTransform object */
- public final String getFooter()
- {
+ public final String getFooter() {
//FIX ME: migrate this to use ECS
return "</pre>\n" +
- "<hr>" +
- "<center>" + JXR.NOTICE + "</center>" +
- "</body>\n" +
- "</html>\n";
+ "<hr>" +
+ "<center>" + JXR.NOTICE + "</center>" +
+ "</body>\n" +
+ "</html>\n";
}
@@ -539,8 +491,7 @@
String destfile,
String revision,
MetaData metadata)
- throws IOException
- {
+ throws IOException {
this.setCurrentFilename(sourcefile);
@@ -561,14 +512,12 @@
out.println(getHeader());
int linenumber = 1;
- while ((line = in.readLine()) != null)
- {
- if (LINE_NUMBERS)
- {
+ while ((line = in.readLine()) != null) {
+ if (LINE_NUMBERS) {
out.print("<a name=\"" + linenumber + "\" " +
- "href=\"#" + linenumber + "\">" +
- linenumber +
- "</a>" + getLineWidth(linenumber));
+ "href=\"#" + linenumber + "\">" +
+ linenumber +
+ "</a>" + getLineWidth(linenumber));
}
out.println(this.syntaxHighlight(line));
@@ -582,37 +531,30 @@
}
/** Get an overview header for this file. */
- private final String getFileOverview()
- {
+ private final String getFileOverview() {
StringBuffer overview = new StringBuffer();
overview.append("<table bgcolor=\"#FFFFCC\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\">");
//get the URI to get Javadoc info.
StringBuffer javadocURI = new StringBuffer()
- .append(getPackageRoot())
- .append("../apidocs");
+ .append(getPackageRoot())
+ .append("../apidocs");
- try
- {
+ try {
JavaFile jf = FileManager.getInstance().getFile(this.getCurrentFilename());
javadocURI.append("/");
javadocURI.append(Util.replace(jf.getPackageType().getName(), ".", "/"));
javadocURI.append("/");
- if (jf.getClassType() != null)
- {
+ if (jf.getClassType() != null) {
javadocURI.append(jf.getClassType().getName());
- }
- else
- {
+ } else {
System.out.println(this.getCurrentFilename());
}
javadocURI.append(".html");
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
}
@@ -625,8 +567,7 @@
}
/** Gets the overviewEntry attribute of the CodeTransform object */
- private final String getOverviewEntry(String name, String value)
- {
+ private final String getOverviewEntry(String name, String value) {
StringBuffer buff = new StringBuffer();
@@ -652,8 +593,7 @@
}
/** Gets the overviewEntry attribute of the CodeTransform object */
- private final String getOverviewEntry(String name, String value, String right)
- {
+ private final String getOverviewEntry(String name, String value, String right) {
StringBuffer buff = new StringBuffer();
@@ -692,18 +632,12 @@
* Handles line width which may need to change depending on which line
* number you are on.
*/
- private final String getLineWidth(int linenumber)
- {
- if (linenumber < 10)
- {
+ private final String getLineWidth(int linenumber) {
+ if (linenumber < 10) {
return " ";
- }
- else if (linenumber < 100)
- {
+ } else if (linenumber < 100) {
return " ";
- }
- else
- {
+ } else {
return " ";
}
}
@@ -712,24 +646,19 @@
* Handles finding classes based on the current filename and then makes
* HREFs for you to link to them with.
*/
- private final String jxrFilter(String line)
- {
+ private final String jxrFilter(String line) {
JavaFile jf = null;
- try
- {
+ try {
//if the current file isn't set then just return
- if (this.getCurrentFilename() == null)
- {
+ if (this.getCurrentFilename() == null) {
return line;
}
jf = FileManager.getInstance().getFile(this.getCurrentFilename());
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
return line;
}
@@ -738,8 +667,7 @@
//get the imported packages
ImportType[] imports = jf.getImportTypes();
- for (int j = 0; j < imports.length; ++j)
- {
+ for (int j = 0; j < imports.length; ++j) {
v.addElement(imports[j].getPackage());
}
@@ -752,27 +680,24 @@
StringEntry[] words = SimpleWordTokenizer.tokenize(line);
//go through each word and then match them to the correct class if necessary.
- for (int i = 0; i < words.length; ++i)
- {
+ for (int i = 0; i < words.length; ++i) {
//each word
StringEntry word = words[i];
- for (int j = 0; j < packages.length; ++j)
- {
+ for (int j = 0; j < packages.length; ++j) {
//get the package from teh PackageManager because this will hold
//the version with the classes also.
PackageType currentImport = PackageManager.getInstance()
- .getPackageType(packages[j]);
+ .getPackageType(packages[j]);
//the package here might in fact be null because it wasn't parsed out
//this might be something that is either not included or os part
//of another package and wasn't parsed out.
- if (currentImport == null)
- {
+ if (currentImport == null) {
continue;
}
@@ -783,8 +708,7 @@
String wordName = word.toString();
- if (wordName.indexOf(".") != -1)
- {
+ if (wordName.indexOf(".") != -1) {
//if there is a "." in the string then we have to assume
//it is a package.
@@ -807,13 +731,11 @@
PackageType pt = PackageManager.getInstance().getPackageType(fqpn_package);
- if (pt != null)
- {
+ if (pt != null) {
ClassType ct = pt.getClassType(fqpn_class);
- if (ct != null)
- {
+ if (ct != null) {
//OK. the user specified a full package to be imported
//that is in the package manager so it is time to
//link to it.
@@ -826,8 +748,7 @@
}
if (fqpn_package.equals(currentImport.getName()) &&
- currentImport.getClassType(fqpn_class) != null)
- {
+ currentImport.getClassType(fqpn_class) != null) {
//then the package we are currently in is the one specified in the string
//and the import class is correct.
@@ -837,9 +758,7 @@
}
- }
- else if (currentImport.getClassType(wordName) != null)
- {
+ } else if (currentImport.getClassType(wordName) != null) {
//System.out.println( "FIX ME: found imported class: "+ wordName );
line = xrLine(line, packages[j], currentImport.getClassType(wordName));
@@ -854,14 +773,12 @@
}
/** Get the current filename */
- public final String getCurrentFilename()
- {
+ public final String getCurrentFilename() {
return this.currentFilename;
}
/** Set the current filename */
- public final void setCurrentFilename(String filename)
- {
+ public final void setCurrentFilename(String filename) {
this.currentFilename = filename;
}
@@ -869,8 +786,7 @@
* Given the current package, get an HREF to the package and class given
*/
private final String getHREF(String dest,
- ClassType jc)
- {
+ ClassType jc) {
StringBuffer href = new StringBuffer();
@@ -885,8 +801,7 @@
href.append(dest);
//now append the classname.html file
- if (jc != null)
- {
+ if (jc != null) {
href.append("/");
href.append(jc.getName());
href.append(".html");
@@ -896,8 +811,7 @@
}
/** Based on the destination package, get the HREF. */
- private final String getHREF(String dest)
- {
+ private final String getHREF(String dest) {
return getHREF(dest, null);
}
@@ -909,11 +823,9 @@
*
* EX: org.apache.maven == 3 </p>
*/
- private final int getPackageCount(String packageName)
- {
+ private final int getPackageCount(String packageName) {
- if (packageName == null)
- {
+ if (packageName == null) {
return 0;
}
@@ -921,13 +833,11 @@
int index = 0;
- while (true)
- {
+ while (true) {
index = packageName.indexOf(".", index);
- if (index == -1)
- {
+ if (index == -1) {
break;
}
++index;
@@ -944,8 +854,7 @@
* Parse out the current link and look for package/import statements and
* then create HREFs for them
*/
- private final String importFilter(String line)
- {
+ private final String importFilter(String line) {
int start = -1;
@@ -960,14 +869,12 @@
//
if (line.indexOf("import") != -1 ||
- isPackage)
- {
+ isPackage) {
start = line.trim().indexOf(" ");
}
- if (start != -1)
- {
+ if (start != -1) {
//filter out this packagename...
@@ -976,14 +883,11 @@
//specify the classname of this import if any.
String classname = null;
- if (pkg.indexOf(".*") != -1)
- {
+ if (pkg.indexOf(".*") != -1) {
pkg = Util.replace(pkg, ".*", "");
- }
- else if (isPackage == false)
- {
+ } else if (isPackage == false) {
//this is an explicit Class import
@@ -993,8 +897,7 @@
int end = pkg.lastIndexOf(".");
- if (end == -1)
- {
+ if (end == -1) {
end = pkg.length() - 1;
}
@@ -1007,32 +910,30 @@
//if this package is within the PackageManager then you can create an HREF for it.
if (PackageManager.getInstance().getPackageType(pkg.toString()) != null ||
- isPackage)
- {
+ isPackage) {
//Create an HREF for explicit classname imports
- if (classname != null)
- {
+ if (classname != null) {
line = Util.replace(line, classname, "<a href=\"" +
- this.getHREF(pkg.toString()) +
- "/" +
- classname +
- ".html" +
- "\">" +
- classname +
- "</a>");
+ this.getHREF(pkg.toString()) +
+ "/" +
+ classname +
+ ".html" +
+ "\">" +
+ classname +
+ "</a>");
}
//now replace the given package with a href
line = Util.replace(line, pkg.toString(), "<a href=\"" +
- this.getHREF(pkg.toString()) +
- "/" +
- DirectoryIndexer.INDEX +
- "\">" +
- pkg.toString() +
- "</a>");
+ this.getHREF(pkg.toString()) +
+ "/" +
+ DirectoryIndexer.INDEX +
+ "\">" +
+ pkg.toString() +
+ "</a>");
}
}
@@ -1045,19 +946,15 @@
* From the current file, determine the package root based on the current
* path.
*/
- public final String getPackageRoot()
- {
+ public final String getPackageRoot() {
StringBuffer buff = new StringBuffer();
JavaFile jf = null;
- try
- {
+ try {
jf = FileManager.getInstance().getFile(this.getCurrentFilename());
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
return null;
}
@@ -1066,8 +963,7 @@
int count = this.getPackageCount(current);
- for (int i = 0; i < count; ++i)
- {
+ for (int i = 0; i < count; ++i) {
buff.append("../");
}
@@ -1077,31 +973,26 @@
/**
* Given a line of text, search for URIs and make href's out of them
*/
- public final String uriFilter(String line)
- {
+ public final String uriFilter(String line) {
- for (int i = 0; i < VALID_URI_SCHEMES.length; ++i)
- {
+ for (int i = 0; i < VALID_URI_SCHEMES.length; ++i) {
String scheme = VALID_URI_SCHEMES[i];
int index = line.indexOf(scheme);
- if (index != -1)
- {
+ if (index != -1) {
int start = index;
int end = -1;
- for (int j = start; j < line.length(); ++j)
- {
+ for (int j = start; j < line.length(); ++j) {
char current = line.charAt(j);
if (Character.isLetterOrDigit(current) == false &&
- isInvalidURICharacter(current))
- {
+ isInvalidURICharacter(current)) {
end = j;
break;
}
@@ -1113,16 +1004,15 @@
//now you should have the full URI so you can replace this
//in the current buffer
- if (end != -1)
- {
+ if (end != -1) {
String uri = line.substring(start, end);
line = Util.replace(line, uri, "<a href=\"" +
- uri +
- "\" target=\"alexandria_uri\">" +
- uri +
- "</a>");
+ uri +
+ "\" target=\"alexandria_uri\">" +
+ uri +
+ "</a>");
}
@@ -1132,12 +1022,9 @@
//if we are in a multiline comment we should not call JXR here.
if (inMultiLineComment == false &&
- inJavadocComment == false)
- {
+ inJavadocComment == false) {
return jxrFilter(line);
- }
- else
- {
+ } else {
return line;
}
@@ -1148,14 +1035,11 @@
* if the given char is not one of the following in VALID_URI_CHARS then
* return true
*/
- private final boolean isInvalidURICharacter(char c)
- {
+ private final boolean isInvalidURICharacter(char c) {
- for (int i = 0; i < VALID_URI_CHARS.length; ++i)
- {
+ for (int i = 0; i < VALID_URI_CHARS.length; ++i) {
- if (VALID_URI_CHARS[i] == c)
- {
+ if (VALID_URI_CHARS[i] == c) {
return false;
}
@@ -1165,26 +1049,22 @@
}
/** The current revision of the CVS module */
- public final String getRevision()
- {
+ public final String getRevision() {
return this.revision;
}
/** The current source file being read */
- public final String getSourcefile()
- {
+ public final String getSourcefile() {
return this.sourcefile;
}
/** The current dest file being written */
- public final String getDestfile()
- {
+ public final String getDestfile() {
return this.destfile;
}
/** The current source directory being read from. */
- public final String getSourceDirectory()
- {
+ public final String getSourceDirectory() {
return this.sourcedir;
}
@@ -1194,16 +1074,14 @@
*/
public final String xrLine(String line,
String packageName,
- ClassType classType)
- {
+ ClassType classType) {
StringBuffer buff = new StringBuffer(line);
String link = null;
String find = null;
- if (classType != null)
- {
+ if (classType != null) {
String href = this.getHREF(packageName, classType);
@@ -1213,9 +1091,7 @@
//build out what the link would be.
link = "<a href=\"" + href + "\">" + find + "</a>";
- }
- else
- {
+ } else {
String href = this.getHREF(packageName);
@@ -1238,8 +1114,7 @@
StringEntry[] tokens = SimpleWordTokenizer.tokenize(buff.toString(), find);
- for (int l = 0; l < tokens.length; ++l)
- {
+ for (int l = 0; l < tokens.length; ++l) {
int start = tokens[l].getIndex();
int end = tokens[l].getIndex() + find.length();
@@ -1253,8 +1128,7 @@
/** Highlight the package in this line. */
public final String xrLine(String line,
- String packageName)
- {
+ String packageName) {
String href = this.getHREF(packageName);
1.4 +107 -147 jakarta-turbine-maven/src/java/org/apache/maven/jxr/DirectoryIndexer.java
Index: DirectoryIndexer.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jxr/DirectoryIndexer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DirectoryIndexer.java 24 Feb 2002 01:32:38 -0000 1.3
+++ DirectoryIndexer.java 24 Feb 2002 18:37:07 -0000 1.4
@@ -1,6 +1,10 @@
-/*
+package org.apache.maven.jxr;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
*
- * Copyright (c) 1998 The Java Apache Project. All rights reserved.
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -14,57 +18,64 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. Every modification must be notified to the Java Apache Project
- * and redistribution of the modified code without prior notification
- * is not permitted in any form.
- *
- * 4. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Java Apache Project
- * (http://java.apache.org/)."
- *
- * 5. The names "Alexandria", "Apache Alexandria" and "Apache Alexandria
- * Project" must not be used to endorse or promote products
- * derived from this software without prior written permission.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Java Apache Project
- * (http://java.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * License version 1.0
- *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
*/
-package org.apache.maven.jxr;
-import org.apache.maven.jxr.util.*;
+import org.apache.maven.jxr.util.Util;
-//java stuff
-import java.io.*;
-import java.util.*;
-import java.text.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.util.Collections;
+import java.util.Date;
+import java.util.StringTokenizer;
+import java.util.Vector;
/**
* Handles building a directory index of files and directories.
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.3 2002/02/24 01:32:38 jvanzyl Exp $
+ * @version $Id: DirectoryIndexer.java,v 1.4 2002/02/24 18:37:07 kschrader Exp $
*/
-public class DirectoryIndexer
-{
+public class DirectoryIndexer {
/** Description of the Field */
public final static int MODE_FULL = 1;
@@ -97,9 +108,6 @@
/**
* @see DirectoryIndexer
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
* @param directory
* @param image_folder
* @param image_file
@@ -108,8 +116,7 @@
public DirectoryIndexer(String directory,
String image_folder,
String image_file)
- throws IOException
- {
+ throws IOException {
this(directory, image_folder, image_file, MODE_JAVA);
@@ -118,9 +125,6 @@
/**
* Create a given DirectoryIndexer with the given dir, images, etc
*
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
* @param directory
* @param image_folder
* @param image_file
@@ -131,8 +135,7 @@
String image_folder,
String image_file,
int mode)
- throws IOException
- {
+ throws IOException {
this(null, directory, image_folder, image_file, mode);
@@ -153,8 +156,7 @@
String image_folder,
String image_file,
int mode)
- throws IOException
- {
+ throws IOException {
this.root = root;
@@ -169,22 +171,18 @@
}
/**
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
+ * Process the directory
*/
private final void process()
- throws IOException
- {
+ throws IOException {
- if (!directory.isDirectory())
- {
+ if (!directory.isDirectory()) {
throw new IOException("Not a directory");
}
String index = directory.getAbsolutePath() +
- System.getProperty("file.separator") +
- INDEX;
+ System.getProperty("file.separator") +
+ INDEX;
//System.out.println("\tWriting index file -> " + index);
@@ -197,8 +195,7 @@
//if the mode is MODE_JAVA then provide a package header for this dir.
if (this.getMode() == MODE_JAVA &&
- this.getRoot() != null)
- {
+ this.getRoot() != null) {
String dir = this.getDirectory();
@@ -208,29 +205,23 @@
int end = dir.length();
if (start != -1 &&
- end != -1 &&
- start < end)
- {
+ end != -1 &&
+ start < end) {
String pkg = dir.substring(start, end);
out.print("<br><p><b>Package: ");
StringTokenizer toke = new StringTokenizer(pkg, System.getProperty("file.separator"));
- while (toke.hasMoreElements())
- {
+ while (toke.hasMoreElements()) {
String subpkg = (String) toke.nextElement();
- if (toke.hasMoreTokens())
- {
+ if (toke.hasMoreTokens()) {
out.print("<a href=\"");
- for (int i = 0; i < toke.countTokens(); i++)
- {
+ for (int i = 0; i < toke.countTokens(); i++) {
out.print("../");
}
out.print(INDEX + "\">" + subpkg + "</a>.");
- }
- else
- {
+ } else {
out.print(subpkg);
}
}
@@ -255,24 +246,22 @@
items = this.getDirs();
- for (int i = 0; i < items.length; ++i)
- {
+ for (int i = 0; i < items.length; ++i) {
String directory = items[i];
out.println(getItem(new File(directory)));
new DirectoryIndexer(this.getRoot(),
- directory,
- image_folder,
- image_file,
- this.getMode());
+ directory,
+ image_folder,
+ image_file,
+ this.getMode());
}
items = this.getFiles();
- for (int i = 0; i < items.length; ++i)
- {
+ for (int i = 0; i < items.length; ++i) {
out.println(getItem(new File(items[i])));
}
@@ -291,19 +280,14 @@
/**
* Make an href for a file
*
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
*/
- private final String getItem(File item)
- {
+ private final String getItem(File item) {
String image = IMAGE_FILE;
String href = item.getName();
String name = item.getName();
- if (item.isDirectory())
- {
+ if (item.isDirectory()) {
href = item.getName() + "/" + INDEX;
@@ -311,14 +295,12 @@
}
//potentially rip off.html links on names
- if (item.isFile())
- {
+ if (item.isFile()) {
int start = 0;
int end = item.getName().indexOf(".html");
- if (end != -1)
- {
+ if (end != -1) {
name = item.getName().substring(start, end);
}
@@ -327,34 +309,29 @@
//"<td width=\"" + IMAGE_WIDTH + "\"><img src=\"" + image + "\" border=\"0\"></td>" +
return "<tr valign=\"middle\">" +
- "<td valign=\"middle\" NOWRAP><img src=\"" + image + "\" valign=\"middle\" border=\"0\"> <a href=\"" + href + "\">" + name + "</a></td>" +
- "<td valign=\"middle\" NOWRAP>" + item.length() + " (in bytes) </td>" +
- "<td valign=\"middle\" NOWRAP>" + DateFormat.getDateInstance().format(new Date(item.lastModified())) + "</td>" +
- "</tr>";
+ "<td valign=\"middle\" NOWRAP><img src=\"" + image + "\" valign=\"middle\" border=\"0\"> <a href=\"" + href + "\">" + name + "</a></td>" +
+ "<td valign=\"middle\" NOWRAP>" + item.length() + " (in bytes) </td>" +
+ "<td valign=\"middle\" NOWRAP>" + DateFormat.getDateInstance().format(new Date(item.lastModified())) + "</td>" +
+ "</tr>";
}
/**
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
+ * Get the directories
*/
private final String[] getDirs()
- throws IOException
- {
+ throws IOException {
Vector v = new Vector();
String[] list = directory.list();
- for (int i = 0; i < list.length; ++i)
- {
+ for (int i = 0; i < list.length; ++i) {
String item = directory.getAbsolutePath() +
- System.getProperty("file.separator") +
- list[i];
+ System.getProperty("file.separator") +
+ list[i];
- if (new File(item).isDirectory())
- {
+ if (new File(item).isDirectory()) {
v.addElement(item);
}
@@ -367,27 +344,22 @@
}
/**
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
+ * Get the files
*/
private final String[] getFiles()
- throws IOException
- {
+ throws IOException {
Vector v = new Vector();
String[] list = directory.list();
- for (int i = 0; i < list.length; ++i)
- {
+ for (int i = 0; i < list.length; ++i) {
String item = directory.getAbsolutePath() +
- System.getProperty("file.separator") +
- list[i];
+ System.getProperty("file.separator") +
+ list[i];
//don't process the index file
- if (list[i].equals(INDEX))
- {
+ if (list[i].equals(INDEX)) {
continue;
}
@@ -395,19 +367,16 @@
//if the mode is JAVA only return .html files else return all
if (this.getMode() == MODE_JAVA &&
- JXR.isHtmlFile(item) &&
- new File(item).isFile())
- {
+ JXR.isHtmlFile(item) &&
+ new File(item).isFile()) {
v.addElement(item);
- }
- else if (this.getMode() == MODE_DEFAULT &&
- filename.equals(INDEX) == false &&
- filename.equals(new File(IMAGE_DIRECTORY).getName()) == false &&
- filename.equals(new File(IMAGE_FILE).getName()) == false &&
- new File(item).isFile())
- {
+ } else if (this.getMode() == MODE_DEFAULT &&
+ filename.equals(INDEX) == false &&
+ filename.equals(new File(IMAGE_DIRECTORY).getName()) == false &&
+ filename.equals(new File(IMAGE_FILE).getName()) == false &&
+ new File(item).isFile()) {
v.addElement(item);
@@ -424,14 +393,9 @@
/**
* Copy one file to another file
- *
- * @author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>
- * @version $Id: DirectoryIndexer.java,v 1.2 2002/02/23 20:41:21 jvanzyl Exp
- * $
*/
public void copy(String source, String dest)
- throws IOException
- {
+ throws IOException {
InputStream is = new FileInputStream(source);
OutputStream os = new FileOutputStream(dest);
@@ -440,8 +404,7 @@
byte bytes[] = new byte[200];
int readCount = 0;
- while ((readCount = is.read(bytes)) > 0)
- {
+ while ((readCount = is.read(bytes)) > 0) {
os.write(bytes, 0, readCount);
}
@@ -456,20 +419,17 @@
* @see MODE_DEFAULT
* @see MODE_JAVA
*/
- public int getMode()
- {
+ public int getMode() {
return mode;
}
/** Get the root dir for directory indexing. */
- public String getRoot()
- {
+ public String getRoot() {
return this.root;
}
/** Get the directory */
- public String getDirectory()
- {
+ public String getDirectory() {
return this.directory.getAbsolutePath();
}
}
1.6 +87 -105 jakarta-turbine-maven/src/java/org/apache/maven/jxr/JXR.java
Index: JXR.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jxr/JXR.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- JXR.java 24 Feb 2002 17:14:07 -0000 1.5
+++ JXR.java 24 Feb 2002 18:37:07 -0000 1.6
@@ -1,8 +1,10 @@
package org.apache.maven.jxr;
-/*
+/* ====================================================================
+ * The Apache Software License, Version 1.1
*
- * Copyright (c) 1998 The Java Apache Project. All rights reserved.
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -16,59 +18,59 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. Every modification must be notified to the Java Apache Project
- * and redistribution of the modified code without prior notification
- * is not permitted in any form.
- *
- * 4. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Java Apache Project
- * (http://java.apache.org/)."
- *
- * 5. The names "Alexandria", "Apache Alexandria" and "Apache Alexandria
- * Project" must not be used to endorse or promote products
- * derived from this software without prior written permission.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Java Apache Project
- * (http://java.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * License version 1.0
- *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
*/
-import org.apache.maven.jxr.util.*;
-
-import org.apache.tools.ant.*;
+import org.apache.maven.jxr.util.MetaData;
+import org.apache.tools.ant.DirectoryScanner;
-import java.io.*;
+import java.io.File;
+import java.io.IOException;
/**
- * Main entry point into Alexandria used to kick off the XReference code
+ * Main entry point into Maven used to kick off the XReference code
* building.
*
* @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * @version $Id: JXR.java,v 1.6 2002/02/24 18:37:07 kschrader Exp $
*/
-public class JXR
-{
+public class JXR {
/** Description of the Field */
public final static String NOTICE =
- "This page automatically generated by Maven";
+ "This page automatically generated by Maven";
/** Path to all source.files */
private String source = "";
@@ -88,10 +90,10 @@
private String revision;
/**
+ * The constructor for the JXR class.
+ *
* @param revision The CVS revision of this file.
* @param source The directory that files are being read from (src/java)
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
* @param source
* @param dest
* @param metadata
@@ -99,8 +101,7 @@
public JXR(String source,
String dest,
MetaData metadata,
- String revision)
- {
+ String revision) {
this.source = source;
this.dest = dest;
this.metadata = metadata;
@@ -113,11 +114,8 @@
/**
* Now that we have instantiated everythign. Process this JXR task.
*
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
*/
- private void process()
- {
+ private void process() {
DirectoryScanner ds = new DirectoryScanner();
@@ -125,12 +123,10 @@
File dir = new File(this.getSource());
- if (!dir.exists())
- {
- if (dir.mkdirs() == false)
- {
+ if (!dir.exists()) {
+ if (dir.mkdirs() == false) {
throw new IllegalStateException(
- "Your source directory does not exist and could not be created:" +
+ "Your source directory does not exist and could not be created:" +
this.getSource());
}
}
@@ -142,25 +138,19 @@
String[] files = ds.getIncludedFiles();
- for (int i = 0; i < files.length; ++i)
- {
+ for (int i = 0; i < files.length; ++i) {
- if (!updated(files[i]))
- {
+ if (!updated(files[i])) {
String source = this.getSource() + System.getProperty("file.separator") + files[i];
- try
- {
+ try {
- if (isJavaFile(source))
- {
+ if (isJavaFile(source)) {
transform(source, getDestination(source));
}
- }
- catch (IOException e)
- {
+ } catch (IOException e) {
e.printStackTrace();
}
@@ -171,20 +161,22 @@
}
/**
- * @author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * Check to see if the file is a Java source file
+ *
+ * @param filename The name of the file to check
+ * @return <code>true</true> if the file is a Java file
*/
- public static boolean isJavaFile(String filename)
- {
+ public static boolean isJavaFile(String filename) {
return filename.indexOf(".java") != -1;
}
/**
- * @author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * Check to see if the file is a HTML file
+ *
+ * @param filename The name of the file to check
+ * @return <code>true</true> if the file is a HTML file
*/
- public static boolean isHtmlFile(String filename)
- {
+ public static boolean isHtmlFile(String filename) {
return filename.indexOf(".html") != -1;
}
@@ -192,11 +184,10 @@
* Given a filename get the destination on the filesystem of where to store
* the to be generated HTML file. Pay attention to the package name.
*
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * @param filename The name of the file to find
+ * @return A String with the store destination.
*/
- private String getDestination(String filename)
- {
+ private String getDestination(String filename) {
String dest = new String(filename);
@@ -207,8 +198,7 @@
int start = 0;
int end = dest.indexOf(".java");
- if (end != -1)
- {
+ if (end != -1) {
//remove the .java from the filename
dest = dest.substring(start, end);
}
@@ -227,13 +217,12 @@
* Given a source file transform it into HTML and write it to the
* destination (dest) file.
*
+ * @param source The jave source file
+ * @param dest The directory to put the HTML into
* @throws IOException Thrown if the transform can't happen for some reason.
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
*/
private void transform(String source, String dest)
- throws IOException
- {
+ throws IOException {
log(source + " -> " + dest);
@@ -242,22 +231,18 @@
}
/**
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * Log to system.out
*/
- private void log(String message)
- {
+ private void log(String message) {
System.out.println("\t" + message);
}
/**
* Get an array of files that you should act on.
*
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * @return String[] An array of files to act on.
*/
- private String[] getFiles()
- {
+ private String[] getFiles() {
return new String[0];
}
@@ -273,29 +258,26 @@
* </ul>
*
*
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
*/
- private boolean updated(String file)
- {
+ private boolean updated(String file) {
return false;
}
/**
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * Get the path to the source files
+ *
+ * @return The path to the source files
*/
- public String getSource()
- {
+ public String getSource() {
return this.source;
}
/**
- * @author <a href="mailto:burton@apache.org">Kevin A. Burton</a>
- * @version $Id: JXR.java,v 1.5 2002/02/24 17:14:07 kschrader Exp $
+ * Get the path to the destination files
+ *
+ * @return The path to the destination files
*/
- public String getDest()
- {
+ public String getDest() {
return this.dest;
}
1.4 +50 -55 jakarta-turbine-maven/src/java/org/apache/maven/jxr/JxrTask.java
Index: JxrTask.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jxr/JxrTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- JxrTask.java 24 Feb 2002 03:01:40 -0000 1.3
+++ JxrTask.java 24 Feb 2002 18:37:07 -0000 1.4
@@ -1,7 +1,10 @@
package org.apache.maven.jxr;
-/*
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
*
- * Copyright (c) 1998 The Java Apache Project. All rights reserved.
+ * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -15,45 +18,46 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. Every modification must be notified to the Java Apache Project
- * and redistribution of the modified code without prior notification
- * is not permitted in any form.
- *
- * 4. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the Java Apache Project
- * (http://java.apache.org/)."
- *
- * 5. The names "Alexandria", "Apache Alexandria" and "Apache Alexandria
- * Project" must not be used to endorse or promote products
- * derived from this software without prior written permission.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the Java Apache Project
- * (http://java.apache.org/)."
- *
- * THIS SOFTWARE IS PROVIDED BY THE JAVA APACHE PROJECT "AS IS" AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE JAVA APACHE PROJECT OR
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * License version 1.0
- *
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
*/
-import org.apache.maven.jxr.pacman.*;
-import org.apache.maven.jxr.util.*;
+
+import org.apache.maven.jxr.pacman.PackageManager;
+import org.apache.maven.jxr.util.MetaData;
import org.apache.maven.project.Project;
import org.apache.maven.project.Repository;
-
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
@@ -62,8 +66,7 @@
* will create an html-based version of Java source code
*/
-public class JxrTask extends Task
-{
+public class JxrTask extends Task {
/** the starting directory housing the .java files */
private String startDir;
@@ -79,10 +82,8 @@
/** Description of the Method */
public void execute()
- throws BuildException
- {
- try
- {
+ throws BuildException {
+ try {
PackageManager pkgmgr = PackageManager.getInstance();
pkgmgr.setTask(this);
pkgmgr.process(startDir);
@@ -96,35 +97,29 @@
new JXR(startDir, destDir, meta, "HEAD");
new DirectoryIndexer(destDir, destDir, imageFolder,
- imageFile, DirectoryIndexer.MODE_JAVA);
- }
- catch (Exception ex)
- {
+ imageFile, DirectoryIndexer.MODE_JAVA);
+ } catch (Exception ex) {
throw new BuildException(ex);
}
}
/** Sets the imageFile attribute of the JxrTask object */
- public void setImageFile(String imageFile)
- {
+ public void setImageFile(String imageFile) {
this.imageFile = imageFile;
}
/** Sets the imageFolder attribute of the JxrTask object */
- public void setImageFolder(String imageFolder)
- {
+ public void setImageFolder(String imageFolder) {
this.imageFolder = imageFolder;
}
/** Sets the startDir attribute of the JxrTask object */
- public void setStartDir(String startDir)
- {
+ public void setStartDir(String startDir) {
this.startDir = startDir;
}
/** Sets the destDir attribute of the JxrTask object */
- public void setDestDir(String destDir)
- {
+ public void setDestDir(String destDir) {
this.destDir = destDir;
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>