User: pathoss
Date: 02/05/13 02:06:01
Modified: core/src/xdoclet Tag: MODULE_REFACTORING_BRANCH
GenerationManager.java
Log:
Done some cleanup.
Revision Changes Path
No revision
No revision
1.11.2.7 +30 -50 xdoclet/core/src/xdoclet/GenerationManager.java
Index: GenerationManager.java
===================================================================
RCS file: /cvsroot/xdoclet/xdoclet/core/src/xdoclet/GenerationManager.java,v
retrieving revision 1.11.2.6
retrieving revision 1.11.2.7
diff -u -w -r1.11.2.6 -r1.11.2.7
--- GenerationManager.java 12 May 2002 11:58:00 -0000 1.11.2.6
+++ GenerationManager.java 13 May 2002 09:06:01 -0000 1.11.2.7
@@ -7,15 +7,9 @@
import java.io.File;
import java.net.URL;
import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import org.apache.commons.logging.Log;
-
import xjavadoc.XClass;
import xdoclet.loader.ModuleFinder;
@@ -26,12 +20,11 @@
import xdoclet.util.LogUtil;
/**
- * Verify if the generation is needed for Java files and Xml files based
- * templates.
+ * Verify if the generation is needed for Java files and Xml files based templates.
*
* @author Vincent Harcq ([EMAIL PROTECTED])
* @created March 30, 2002
- * @version $Revision: 1.11.2.6 $
+ * @version $Revision: 1.11.2.7 $
*/
public class GenerationManager implements java.io.Serializable
{
@@ -39,13 +32,11 @@
private final static File xjavadocJar = ModuleFinder.getJar("xjavadoc.jar");
- private final static String TEMPLATE_FILES_DB = "xdoclet-template-db-" +
DocletTask.XDOCLET_VERSION + ".properties";
-
private static transient Map parserDb = null;
private boolean guessGenerationNeeded = true;
- private transient TemplateSubTask subTask;
+ private transient TemplateSubTask subTask = null;
/**
* Describe what the GenerationManager constructor does
@@ -84,9 +75,8 @@
}
/**
- * Return (and construct) the template database. It is a map between a
- * <code>String</code> representing the template file and an array of
- * <String> representing the merge files that are part of the generation.
+ * Return (and construct) the template database. It is a map between a
<code>String</code> representing the template
+ * file and an array of <String> representing the merge files that are part of
the generation.
*
* @return the <code>Map</code>
*/
@@ -109,8 +99,7 @@
}
/**
- * Test if a Java source mmust be generated or not depending of timestamp of
- * elements involved.
+ * Test if a Java source mmust be generated or not depending of timestamp of
elements involved.
*
* @param clazz the Class from wich we generate
* @param file the File that will be generated
@@ -153,10 +142,9 @@
}
/**
- * Verify if the generation of a file to generate is needed because either
- * the Template used to generate the file have a later timestamp, or because
- * ALL the Java sources imported in this task have a sooner timestamp. This
- * is used to test if xml files generation is needed.
+ * Verify if the generation of a file to generate is needed because either the
Template used to generate the file
+ * have a later timestamp, or because ALL the Java sources imported in this
task have a sooner timestamp. This is
+ * used to test if xml files generation is needed.
*
* @param file The file to check
* @return true if the generation is needed
@@ -215,7 +203,7 @@
}
/**
- * Sets the GuessGenerationNeeded attribute of the GenerationManager object
+ * Sets the GuessGenerationNeeded attribute of the GenerationManager object.
*
* @param guessGenerationNeeded The new GuessGenerationNeeded value
*/
@@ -313,9 +301,8 @@
}
/**
- * Verify if the generation of a file is needed because either the template
- * file has a sooner timestamp, or because one of the merge files have a
- * sooner timestamp
+ * Verify if the generation of a file is needed because either the template
file has a sooner timestamp, or because
+ * one of the merge files have a sooner timestamp
*
* @param file The file to generate
* @param templateURL the Template file to use
@@ -370,49 +357,42 @@
}
}
- if (log.isDebugEnabled()) {
log.debug("Number of Merge files involved = " + files.length);
- }
+
for (int i = 0; i < files.length; i++) {
- String merge_file_pattern = files[i];
- List merge_files = new ArrayList();
+ String mergeFilePattern = files[i];
+ List mergeFiles = new ArrayList();
- if (merge_file_pattern.indexOf("{0}") != -1) {
+ if (mergeFilePattern.indexOf("{0}") != -1) {
XClass[] classes = ClassTagsHandler.getAllClasses();
for (int j = 0; j < classes.length; j++) {
XClass aClass = classes[j];
- String ejb_name = MessageFormat.format(merge_file_pattern, new
Object[]{AbstractProgramElementTagsHandler.getClassNameFor(aClass)});
- String merge_file_name =
PackageTagsHandler.packageNameAsPathFor(aClass.containingPackage()) + File.separator +
ejb_name;
+ String ejbName = MessageFormat.format(mergeFilePattern, new
Object[]{AbstractProgramElementTagsHandler.getClassNameFor(aClass)});
+ String mergeFileName =
PackageTagsHandler.packageNameAsPathFor(aClass.containingPackage()) + File.separator +
ejbName;
if (subTask.getMergeDir() != null)
- merge_files.add(new File(subTask.getMergeDir(),
merge_file_name));
+ mergeFiles.add(new File(subTask.getMergeDir(),
mergeFileName));
}
}
else {
if (subTask.getMergeDir() != null)
- merge_files.add(new File(subTask.getMergeDir(),
merge_file_pattern));
+ mergeFiles.add(new File(subTask.getMergeDir(),
mergeFilePattern));
}
- for (Iterator iterator = merge_files.iterator(); iterator.hasNext(); ) {
- File merge_file = (File) iterator.next();
+ for (Iterator iterator = mergeFiles.iterator(); iterator.hasNext(); ) {
+ File mergeFile = (File) iterator.next();
- if (log.isDebugEnabled()) {
- log.debug("Generation check for '" + file.getName() + "'
because of " + merge_file.getName());
- }
- if (merge_file.exists()) {
- if (file.lastModified() < merge_file.lastModified()) {
- if (log.isDebugEnabled()) {
- log.debug("Generation needed for '" + file.getName() +
"' because of timestamp of " + merge_file.getName());
- }
+ log.debug("Generation check for '" + file.getName() + "' because of
" + mergeFile.getName());
+
+ if (mergeFile.exists()) {
+ if (file.lastModified() < mergeFile.lastModified()) {
+ log.debug("Generation needed for '" + file.getName() + "'
because of timestamp of " + mergeFile.getName());
return true;
}
- if (log.isDebugEnabled()) {
- log.debug("Reject file '" + file.getName() + "' because of
timestamp of " + merge_file.getName());
- }
+ log.debug("Reject file '" + file.getName() + "' because of
timestamp of " + mergeFile.getName());
}
}
}
return false;
}
-
}
_______________________________________________________________
Have big pipes? SourceForge.net is looking for download mirrors. We supply
the hardware. You get the recognition. Email Us: [EMAIL PROTECTED]
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel