jakarta-watchdog-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rlu...@apache.org
Subject cvs commit: jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml FileLister.java GetWorkspaceInXML.java
Date Fri, 21 Jun 2002 15:30:51 GMT
rlubke      2002/06/21 08:30:51

  Modified:    src/tools/org/apache/watchdog/jspxml FileLister.java
                        GetWorkspaceInXML.java
  Log:
  Patch for Bugzilla 9577.
  Submitted by Gidado-Yisa Immanuel (avm3 @ cdc.gov)
  
  1. Only files that have been converted are displayed
     (speeds up build time on my local system)
  2. Show number of files processed (and ignored)
  3. Created a new constructor in FilesLister that takes
     in an "ignore" extension so that the filtering function
     could filter out files with extensions of the form:
     ignore + "." + extension
  
  Revision  Changes    Path
  1.2       +22 -5     jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml/FileLister.java
  
  Index: FileLister.java
  ===================================================================
  RCS file: /home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml/FileLister.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FileLister.java	2 Feb 2002 03:21:25 -0000	1.1
  +++ FileLister.java	21 Jun 2002 15:30:51 -0000	1.2
  @@ -63,10 +63,16 @@
   import java.io.*;
   import java.util.*;
   
  +/**
  +   When determining if a file should be listed, if
  +   <code>ignore!=null</code>, then do not include files that end with
  +   <code>ingore + "." + extension.
  +*/
   public class FileLister {
       protected Vector file_list ;
       protected File start_dir ;
       protected String extension ;
  +	protected String ignore ;
   
       public FileLister() {
           file_list = new Vector();
  @@ -80,6 +86,13 @@
           this.extension = extension ;
       }
   
  +    public FileLister(String absolute_path, String extension, String ignore) {
  +        file_list = new Vector();
  +        start_dir = new File(absolute_path);
  +        this.extension = extension ;
  +		this.ignore = ignore;
  +    }
  +
       public Object[] listFiles() {
           addFiles(start_dir);
           return file_list.toArray();
  @@ -101,8 +114,12 @@
   
               String file_extension = file_name.substring(dot_index + 1, file_name.length());
   
  -            if (file_extension.equals(extension))
  -                file_list.add(start_dir.getAbsolutePath());
  +            if (file_extension.equals(extension)) {
  +				if (ignore==null ||
  +					! file_name.endsWith(ignore + "." + extension))
  +
  +					file_list.add(start_dir.getAbsolutePath());
  +			}
               return ;
           }
           //we are here means we have a directory
  
  
  
  1.2       +25 -12    jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml/GetWorkspaceInXML.java
  
  Index: GetWorkspaceInXML.java
  ===================================================================
  RCS file: /home/cvs/jakarta-watchdog-4.0/src/tools/org/apache/watchdog/jspxml/GetWorkspaceInXML.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GetWorkspaceInXML.java	2 Feb 2002 03:21:25 -0000	1.1
  +++ GetWorkspaceInXML.java	21 Jun 2002 15:30:51 -0000	1.2
  @@ -89,19 +89,19 @@
           }
   
           String extension = "jsp" ; //files with extension .jsp
  +		String jsp_root_file = new File(jsp_root_dir).toString();
  +		int jsp_root_length = jsp_root_file==null ? 0 : jsp_root_file.length();
   
  -        FileLister lister = new FileLister(jsp_root_dir , extension) ;
  +        FileLister lister = new FileLister(jsp_root_dir , extension, "XML") ;
           Object[] files = lister.listFiles();
  -        System.out.println("" + files.length + " files to process in " +
  -                           jsp_root_dir);
  +        System.out.println(files.length + " files to process in " + 
  +						   jsp_root_dir);                           
   
  +		int already_converted = 0;
           for (int i = 0; i < files.length;i++) {
               jsp_file = (String)files[i];
               int index = jsp_file.lastIndexOf(".jsp");
   
  -            if (index != -1)
  -                if (jsp_file.endsWith("XML.jsp"))
  -                    continue;
               xml_file = jsp_file.substring(0, index) + "XML" + ".jsp";
   
               //it should convert only if the jsp file is newer than the XML file
  @@ -109,15 +109,25 @@
               File file_jsp = new File(jsp_file) ;
               File file_xml = new File(xml_file);
   
  -            System.out.println("processing " + jsp_file);
               if (file_xml.exists()) {  
                   //there was already a conversion
  -                if (file_xml.lastModified() > file_jsp.lastModified())
  +                if (file_xml.lastModified() > file_jsp.lastModified()) {
  +					already_converted++;
                       continue;
  +				}
               }
   
               //if we are here means we need to convert the jsp file to xml
  -            System.out.println("*** converting to " + xml_file);
  +			String xml_file_name = xml_file.toString();
  +			int path_index = xml_file_name.indexOf(jsp_root_file);
  +			if (path_index > 0) {
  +				String relative_path =
  +					xml_file_name.substring(path_index + jsp_root_length + 1);
  +				System.out.println("  " + relative_path);
  +			}
  +			else
  +				System.out.println("  " + xml_file);
  +
               jsp2XML jsp_converter = new jsp2XML(jsp_file);
               String xml = jsp_converter.ConvertJsp2XML();
   
  @@ -130,6 +140,9 @@
               }
   
           }  //end for
  +		if (already_converted > 0)
  +			System.out.println(already_converted +
  +							   " files previously converted");
   
           //we generated the workspace in XML...now we need to create the
           //jsp-gtest-xml file that has targets for running the tests against
  
  
  

--
To unsubscribe, e-mail:   <mailto:watchdog-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:watchdog-dev-help@jakarta.apache.org>


Mime
View raw message