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/26 16:21:27 UTC
cvs commit: jakarta-turbine-maven/xdocs musings.xml
jvanzyl 02/02/26 07:21:27
Modified: src/java/org/apache/maven/jxr/pacman PackageManager.java
xdocs musings.xml
Removed: src/java/org/apache/maven/jxr/util FileUtils.java
Log:
Slowly refactoring out the jxr util and pacman packages in favour of
commons/ant utilities and the use of the java parser.
Revision Changes Path
1.3 +57 -32 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PackageManager.java 24 Feb 2002 01:32:39 -0000 1.2
+++ PackageManager.java 26 Feb 2002 15:21:27 -0000 1.3
@@ -1,5 +1,6 @@
+package org.apache.maven.jxr.pacman;
+
/*
- *
* Copyright (c) 1998 The Java Apache Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,11 +49,12 @@
* License version 1.0
*
*/
-package org.apache.maven.jxr.pacman;
-import org.apache.maven.jxr.util.*;
import java.util.*;
import java.io.*;
+
+import org.apache.maven.jxr.util.*;
+import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.Project;
@@ -65,16 +67,24 @@
private Hashtable directories = new Hashtable();
- /** All the packages that have been parsed */
+ /**
+ * All the packages that have been parsed
+ */
private Hashtable packages = new Hashtable();
- /** The default Java package. */
+ /**
+ * The default Java package.
+ */
private PackageType defaultPackage = new PackageType();
- /** Controling ant task; */
+ /**
+ * Controling ant task;
+ */
private Task task = null;
- /** The SingletonInstance of this PackageManager. */
+ /**
+ * The SingletonInstance of this PackageManager.
+ */
public static PackageManager instance = new PackageManager();
/**
@@ -93,13 +103,17 @@
return (PackageType) this.packages.get(name);
}
- /** Add a package to the PackageManager */
+ /**
+ * Add a package to the PackageManager
+ */
public void addPackageType(PackageType packageType)
{
this.packages.put(packageType.getName(), packageType);
}
- /** Get all of the packages in the PackageManager */
+ /**
+ * Get all of the packages in the PackageManager
+ */
public PackageType[] getPackageTypes()
{
@@ -121,34 +135,33 @@
return found;
}
- /** Parse out all the directories on which this depends. */
+ /**
+ * Parse out all the directories on which this depends.
+ */
private void parse(String directory)
{
-
- String[] extensions = {"java"};
-
- //go through each directory.
-
- //get the java source files for this dir.
-
- String[] files = FileUtils.getFilesFromExtension(directory, extensions);
+ // Go through each directory and get the java source
+ // files for this dir.
+ DirectoryScanner directoryScanner = new DirectoryScanner();
+ File baseDir = new File(directory);
+ directoryScanner.setBasedir(baseDir);
+ String[] includes = { "**/*.java" };
+ directoryScanner.setIncludes(includes);
+ directoryScanner.scan();
+ String[] files = directoryScanner.getIncludedFiles();
for (int j = 0; j < files.length; ++j)
{
-
log("parsing... " + files[j]);
//now parse out this file to get the packages/classname/etc
-
try
{
+ String fileName = new File(baseDir,files[j]).getAbsolutePath();
+ JavaFile jfi = FileManager.getInstance().getFile(fileName);
- JavaFile jfi = FileManager.getInstance().getFile(files[j]);
-
- /*
- now that we have this parsed out blend its information
- with the current package structure
- */
+ // now that we have this parsed out blend its information
+ // with the current package structure
PackageType jp = this.getPackageType(jfi.getPackageType().getName());
if (jp == null)
@@ -176,7 +189,9 @@
}
- /** Description of the Method */
+ /**
+ * Description of the Method
+ */
public void process(String directory)
{
if (this.directories.get(directory) == null)
@@ -186,7 +201,9 @@
}
}
- /** Description of the Method */
+ /**
+ * Description of the Method
+ */
public void process(String[] directories)
{
@@ -197,19 +214,25 @@
}
- /** Gets the instance attribute of the PackageManager class */
+ /**
+ * Gets the instance attribute of the PackageManager class
+ */
public static PackageManager getInstance()
{
return instance;
}
- /** Sets the task attribute of the PackageManager object */
+ /**
+ * Sets the task attribute of the PackageManager object
+ */
public void setTask(Task task)
{
this.task = task;
}
- /** Simple logging facility */
+ /**
+ * Simple logging facility
+ */
public final static void log(String message)
{
@@ -225,7 +248,9 @@
}
- /** Dump the package information to STDOUT. FOR DEBUG ONLY */
+ /**
+ * Dump the package information to STDOUT. FOR DEBUG ONLY
+ */
public void dump()
{
1.2 +2 -1 jakarta-turbine-maven/xdocs/musings.xml
Index: musings.xml
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/xdocs/musings.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- musings.xml 24 Feb 2002 20:00:17 -0000 1.1
+++ musings.xml 26 Feb 2002 15:21:27 -0000 1.2
@@ -107,7 +107,8 @@
make the tools easily integrated into cvs
</li>
<li>
- lxr finding all the source files that use a particular file
+ lxr finding all the source files that use a particular file,
+ and finding unreferenced files in a code base.
</li>
</ul>
</section>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>