You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by jv...@apache.org on 2002/02/28 23:29:01 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/jxr/pacman PackageManager.java
jvanzyl 02/02/28 14:29:01
Modified: src/java/org/apache/maven/jxr CodeTransform.java JXR.java
src/java/org/apache/maven/jxr/pacman PackageManager.java
Removed: src/java/org/apache/maven/jxr JxrTask.java
Log:
Move the executor bean to the top-level package. Most of this code can
go go once the java parser is hooked in. A small visitor could easily
be made to replace the few elements of a java source file that the
code transformer actually uses to cross reference.
Revision Changes Path
1.7 +7 -2 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.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- CodeTransform.java 26 Feb 2002 14:45:54 -0000 1.6
+++ CodeTransform.java 28 Feb 2002 22:29:01 -0000 1.7
@@ -36,10 +36,15 @@
import org.apache.commons.util.StringUtils;
-import org.apache.maven.jxr.pacman.*;
+import org.apache.maven.jxr.pacman.ClassType;
+import org.apache.maven.jxr.pacman.PackageManager;
+import org.apache.maven.jxr.pacman.JavaFile;
+import org.apache.maven.jxr.pacman.ImportType;
+import org.apache.maven.jxr.pacman.FileManager;
+import org.apache.maven.jxr.pacman.PackageType;
+
import org.apache.maven.jxr.util.SimpleWordTokenizer;
import org.apache.maven.jxr.util.StringEntry;
-
/**
* Syntax highlights java by turning it into html. A codeviewer object is
1.8 +66 -40 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JXR.java 26 Feb 2002 14:45:54 -0000 1.7
+++ JXR.java 28 Feb 2002 22:29:01 -0000 1.8
@@ -60,21 +60,27 @@
import org.apache.tools.ant.DirectoryScanner;
/**
- * Main entry point into Maven used to kick off the XReference code
- * building.
+ * 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.7 2002/02/26 14:45:54 jvanzyl Exp $
+ * @version $Id: JXR.java,v 1.8 2002/02/28 22:29:01 jvanzyl Exp $
*/
-public class JXR {
- /** Description of the Field */
+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 */
+ /**
+ * Path to all source.files
+ */
private String source = "";
- /** Path to destination */
+ /**
+ * Path to destination
+ */
private String dest = "";
/**
@@ -83,7 +89,9 @@
*/
private CodeTransform transformer = new CodeTransform();
- /** The revision of the module currently being processed. */
+ /**
+ * The revision of the module currently being processed.
+ */
private String revision;
/**
@@ -96,7 +104,8 @@
*/
public JXR(String source,
String dest,
- String revision) {
+ String revision)
+ {
this.source = source;
this.dest = dest;
this.revision = revision;
@@ -107,9 +116,9 @@
/**
* Now that we have instantiated everythign. Process this JXR task.
- *
*/
- private void process() {
+ private void process()
+ {
DirectoryScanner ds = new DirectoryScanner();
@@ -117,11 +126,13 @@
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:" +
- this.getSource());
+ "Your source directory does not exist and could not be created:" +
+ this.getSource());
}
}
@@ -132,35 +143,40 @@
String[] files = ds.getIncludedFiles();
- for (int i = 0; i < files.length; ++i) {
-
- if (!updated(files[i])) {
+ for (int i = 0; i < files.length; ++i)
+ {
+ if (!updated(files[i]))
+ {
+ String source = this.getSource() +
+ System.getProperty("file.separator") + 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();
}
-
}
-
}
-
}
/**
* 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
+ * @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;
}
@@ -168,9 +184,12 @@
* 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
+ * @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;
}
@@ -181,7 +200,8 @@
* @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);
@@ -192,7 +212,8 @@
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);
}
@@ -216,7 +237,8 @@
* @throws IOException Thrown if the transform can't happen for some reason.
*/
private void transform(String source, String dest)
- throws IOException {
+ throws IOException
+ {
log(source + " -> " + dest);
@@ -227,7 +249,8 @@
/**
* Log to system.out
*/
- private void log(String message) {
+ private void log(String message)
+ {
System.out.println("\t" + message);
}
@@ -236,7 +259,8 @@
*
* @return String[] An array of files to act on.
*/
- private String[] getFiles() {
+ private String[] getFiles()
+ {
return new String[0];
}
@@ -251,9 +275,9 @@
*
* </ul>
*
- *
*/
- private boolean updated(String file) {
+ private boolean updated(String file)
+ {
return false;
}
@@ -262,7 +286,8 @@
*
* @return The path to the source files
*/
- public String getSource() {
+ public String getSource()
+ {
return this.source;
}
@@ -271,7 +296,8 @@
*
* @return The path to the destination files
*/
- public String getDest() {
+ public String getDest()
+ {
return this.dest;
}
1.4 +1 -28 jakarta-turbine-maven/src/java/org/apache/maven/jxr/pacman/PackageManager.java
Index: PackageManager.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jxr/pacman/PackageManager.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PackageManager.java 26 Feb 2002 15:21:27 -0000 1.3
+++ PackageManager.java 28 Feb 2002 22:29:01 -0000 1.4
@@ -55,8 +55,6 @@
import org.apache.maven.jxr.util.*;
import org.apache.tools.ant.DirectoryScanner;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.Project;
/**
* Given a list of directories, parse them out and store them as rendered
@@ -78,11 +76,6 @@
private PackageType defaultPackage = new PackageType();
/**
- * Controling ant task;
- */
- private Task task = null;
-
- /**
* The SingletonInstance of this PackageManager.
*/
public static PackageManager instance = new PackageManager();
@@ -223,35 +216,16 @@
}
/**
- * Sets the task attribute of the PackageManager object
- */
- public void setTask(Task task)
- {
- this.task = task;
- }
-
- /**
* Simple logging facility
*/
public final static void log(String message)
{
-
- if (instance.task == null)
- {
- System.out.println(" PackageManager -> " + message);
- }
- else
- {
- instance.task.log(message, Project.MSG_VERBOSE);
- }
-
+ System.out.println(" PackageManager -> " + message);
}
-
/**
* Dump the package information to STDOUT. FOR DEBUG ONLY
*/
-
public void dump()
{
@@ -279,7 +253,6 @@
}
}
-
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>