cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nicola...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon Main.java
Date Sun, 21 Jul 2002 13:08:07 GMT
nicolaken    2002/07/21 06:08:07

  Modified:    .        build.xml changes.xml
               src/java/org/apache/cocoon Main.java
  Log:
    <action dev="NKB" type="update">
      Made docs target use logging to file via the logkit.xconf and added informative System.out
messages for the
      commandline cocoon (Main.java).
    </action>
  
  Revision  Changes    Path
  1.251     +12 -2     xml-cocoon2/build.xml
  
  Index: build.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/build.xml,v
  retrieving revision 1.250
  retrieving revision 1.251
  diff -u -r1.250 -r1.251
  --- build.xml	17 Jul 2002 07:27:08 -0000	1.250
  +++ build.xml	21 Jul 2002 13:08:06 -0000	1.251
  @@ -250,7 +250,7 @@
       <property name="build.docs"     value="${build.dir}/docs"/>
       <property name="build.xdocs"    value="${build.dir}/xdocs"/>
       <property name="build.docs.printer" value="${build.dir}/printer-docs"/>
  -    <property name="build.docs.loglevel" value="INFO"/>
  +    <property name="build.docs.loglevel" value="ERROR"/>
       <property name="build.war"      value="${build.dir}/webapp"/>
       <property name="build.javadocs" value="${build.dir}/javadocs"/>
       <property name="build.context" value="${build.dir}/documentation"/>
  @@ -1065,6 +1065,9 @@
       <copy todir="${build.context}/WEB-INF/classes" filtering="on">
         <fileset dir="${webapp.dir}/WEB-INF/classes"/>
       </copy>
  +    <copy todir="${build.context}" filtering="on" file="${webapp.dir}/WEB-INF/logkit.xconf">
  +
  +    </copy>    
     </target>
   
   
  @@ -1102,7 +1105,7 @@
         <arg value="-c."/>
         <arg value="-d../docs"/>
         <arg value="-w../work"/>
  -      <arg value="-l../work/cocoon.log"/>
  +      <arg value="-k../documentation/logkit.xconf"/>
         <arg value="-u${build.docs.loglevel}"/>
         <arg value="index.html"/>
         <classpath>
  @@ -1116,6 +1119,13 @@
       </java>
     </target>
   
  +  <!-- =================================================================== -->
  +  <!-- Set a variable if the generated docs are already up-to-date.        -->
  +  <!-- =================================================================== -->
  +  <target name="docs_clean" depends="init">
  +    <delete dir="${build.context}/../docs"/>
  +  </target>
  +  
     <!-- =================================================================== -->
     <!-- Copies the webapp directories                                       -->
     <!-- =================================================================== -->
  
  
  
  1.217     +5 -1      xml-cocoon2/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/changes.xml,v
  retrieving revision 1.216
  retrieving revision 1.217
  diff -u -r1.216 -r1.217
  --- changes.xml	19 Jul 2002 06:50:27 -0000	1.216
  +++ changes.xml	21 Jul 2002 13:08:07 -0000	1.217
  @@ -39,6 +39,10 @@
    </devs>
   
    <release version="@version@" date="@date@">
  +  <action dev="NKB" type="update">
  +    Made docs target use logging to file via the logkit.xconf and added informative System.out
messages for the
  +    commandline cocoon (Main.java).
  +  </action> 
     <action dev="CZ" type="update" due-to="Leo Sutic" due-to-email="leo.sutic@inspireinfrastructure.com">
       Allow parent component manager to be LogEnabled.
     </action> 
  
  
  
  1.21      +46 -6     xml-cocoon2/src/java/org/apache/cocoon/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Main.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- Main.java	4 Jun 2002 11:42:48 -0000	1.20
  +++ Main.java	21 Jul 2002 13:08:07 -0000	1.21
  @@ -94,6 +94,7 @@
    * Command line entry point.
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  + * @author <a href="mailto:nicolaken@apache.org">Nicola Ken Barozzi</a> 
    * @version CVS $Id$
    */
   public class Main {
  @@ -235,6 +236,8 @@
           String accept = DEFAULT_ACCEPT;
           boolean followLinks = true;
   
  +        System.out.print("\nsetup...");
  +        
           List clOptions = parser.getArguments();
           int size = clOptions.size();
   
  @@ -312,7 +315,9 @@
           final Priority priority = Priority.getPriorityForName(logLevel);
           Hierarchy.getDefaultHierarchy().setDefaultPriority(priority);
           log = Hierarchy.getDefaultHierarchy().getLoggerFor("");
  -
  +        
  +        System.out.print(".");
  +        
           if (destDir.equals("")) {
               String error = "Careful, you must specify a destination dir when using the
-d/--destDir argument";
               log.fatalError(error);
  @@ -341,6 +346,8 @@
               System.exit(1);
           }
   
  +        System.out.print(".");
  +        
           try {
               File dest = null;
               if (!precompileOnly) {
  @@ -358,6 +365,8 @@
                        conf = new File(context, configFile);
               }
   
  +        System.out.print(".");
  +        
               DefaultContext appContext = new DefaultContext();
               appContext.put(Constants.CONTEXT_CLASS_LOADER, Main.class.getClassLoader());
               CommandlineContext clContext = new CommandlineContext(contextDir);
  @@ -384,6 +393,9 @@
                   logKitManager = new DefaultLogKitManager(Hierarchy.getDefaultHierarchy());
                   logKitManager.setLogger(log);
               }
  +            
  +        System.out.print(".");
  +                    
               appContext.put(Constants.CONTEXT_CLASSPATH, getClassPath(contextDir));
               appContext.put(Constants.CONTEXT_WORK_DIR, work);
               appContext.put(Constants.CONTEXT_UPLOAD_DIR, contextDir + "upload-dir");
  @@ -391,19 +403,30 @@
               appContext.put(Constants.CONTEXT_CACHE_DIR, cacheDir);
               appContext.put(Constants.CONTEXT_CONFIG_URL, conf.toURL());
               Cocoon c = new Cocoon();
  +           
  +        System.out.print(".");
  +                    
               c.setLogger(log);
               c.contextualize(appContext);
               c.setLogKitManager(logKitManager);
               c.initialize();
               Main main = new Main(c, context, dest, brokenLinkFile);
  +            
  +        System.out.print(".");
  +                    
               main.userAgent = userAgent;
               main.accept = accept;
               main.followLinks = followLinks;
  +
  +        System.out.print(".done.\n");
  +                    
               main.warmup();
               if (main.process(targets, precompileOnly) == 0) {
                   main.recursivelyPrecompile(context, context);
               }
  +        System.out.print("\ndisposing...");
               c.dispose();
  +        System.out.print(".done.\n");
               log.info("Done");
           } catch (Exception e) {
               log.fatalError("Exception caught ", e);
  @@ -549,7 +572,8 @@
        */
       public void warmup() throws Exception {
           log.info("Warming up...");
  -        log.info(" [Cocoon might need to compile the sitemaps, this might take a while]");
  +        System.out.println("Warming up...");    
  +        //log.info(" [Cocoon might need to compile the sitemaps, this might take a while]");
           //cocoon.process(new LinkSamplingEnvironment("/", context, attributes, null));
           cocoon.generateSitemap(new LinkSamplingEnvironment("/", context, attributes, null,
this.log));
       }
  @@ -564,6 +588,7 @@
       public int process(Collection uris, boolean precompileOnly) throws Exception {
           int nCount = 0;
           log.info("...ready, let's go:");
  +        System.out.println("...ready, let's go:");
   
           ArrayList links = new java.util.ArrayList();
           Iterator i = uris.iterator();
  @@ -595,6 +620,7 @@
                   }
               } catch (ResourceNotFoundException rnfe) {
                   log.warn("  [broken link]--> " + url);
  +                System.out.println("  [broken link]--> " + url);                
                   if (null != this.brokenLinkWriter) {
                       this.brokenLinkWriter.println(url);
                   }
  @@ -684,8 +710,11 @@
        * @exception Exception if an error occurs
        */
       public Collection processURI(String uri) throws Exception {
  +    
           log.info("Processing URI: " + uri);
  -
  +        System.out.println("URI: " + uri);
  +        System.out.print("  getting links: .");
  +                
           // Get parameters, deparameterized URI and path from URI
           final TreeMap parameters = new TreeMap();
           final String deparameterizedURI = NetUtils.deparameterize(uri, parameters);
  @@ -743,11 +772,13 @@
                   try {
                       translatedAbsoluteLink = this.translateURI(absoluteLink);
                       log.info("  Link translated: " + absoluteLink);
  +                    System.out.println(".");                    
                       allTranslatedLinks.put(absoluteLink, translatedAbsoluteLink);
                       absoluteLinks.add(absoluteLink);
                   } catch (ResourceNotFoundException rnfe) {
                       log.warn("  [broken link]--> " + absoluteLink);
  -
  +                    System.out.println("  [broken link]--> " + absoluteLink);
  +                    
                       if (null != this.brokenLinkWriter) {
                           this.brokenLinkWriter.println(absoluteLink);
                       }
  @@ -758,7 +789,9 @@
               final String translatedRelativeLink = NetUtils.relativize(path, translatedAbsoluteLink);
               translatedLinks.put(link, translatedRelativeLink);
           }
  -
  +        
  +        System.out.println("\n  processing");     
  +        
           try {
               // Process URI
               File file = IOUtils.createFile(destDir, NetUtils.decodePath(filename));
  @@ -768,15 +801,19 @@
   
               if (type == null) {
                   log.warn("  [broken link]--> " + filename);
  +                System.out.println("  [broken link]--> " + filename);
  +                               
                   if (null != this.brokenLinkWriter) {
                       this.brokenLinkWriter.println(filename);
                   }
                   resourceUnavailable(file);
               } else {
                   log.info("  [" + type + "]--> " + filename);
  +                System.out.println("  [" + type + "]--> " + filename);    
               }
           } catch (ResourceNotFoundException rnfe) {
               this.log.warn("Could not process URI: " + deparameterizedURI);
  +            System.out.println("Could not process URI: " + deparameterizedURI);       
     
           }
   
           return absoluteLinks;
  @@ -792,6 +829,7 @@
       public String translateURI(String uri) throws Exception {
           if (null == uri || "".equals(uri)) {
               log.warn("translate empty uri");
  +            System.out.println("translate empty uri");
               return "";
           }
           HashMap parameters = new HashMap();
  @@ -987,4 +1025,6 @@
           return buildClassPath.toString();
        }
   }
  +
  +
   
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message