cziegeler    2004/05/26 04:37:05

  Modified:    src/java/org/apache/cocoon/generation
                        DirectoryGenerator.java
                        ImageDirectoryGenerator.java
               src/documentation/xdocs/userdocs/generators
                        file-generator.xml imagedirectory-generator.xml
                        directory-generator.xml
               tools/targets docs-build.xml
               tools/src/anttasks SitemapTask.java
               src/java/org/apache/cocoon/xml SaxBuffer.java
  Log:
  Start using documentation task for sitemap components
  
  Revision  Changes    Path
  1.11      +13 -41    
cocoon-2.1/src/java/org/apache/cocoon/generation/DirectoryGenerator.java
  
  Index: DirectoryGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/generation/DirectoryGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- DirectoryGenerator.java   5 Mar 2004 13:02:55 -0000       1.10
  +++ DirectoryGenerator.java   26 May 2004 11:37:05 -0000      1.11
  @@ -43,47 +43,19 @@
   import java.util.Comparator;
   
   /**
  + * @cocoon.sitemap.component.documentation
    * Generates an XML directory listing.
  - * <p>
  - * The root node of the generated document will normally be a
  - * <code>directory</code> node, and a directory node can contain zero
  - * or more <code>file</code> or directory nodes. A file node has no
  - * children. Each node will contain the following attributes:
  - * <blockquote>
  - *   <dl>
  - *   <dt> name
  - *   <dd> the name of the file or directory
  - *   <dt> lastModified
  - *   <dd> the time the file was last modified, measured as the number of
  - *   milliseconds since the epoch (as in java.io.File.lastModified)
  - *   <dt> size
  - *   <dd> the file size, in bytes (as in java.io.File.length)
  - *   <dt> date (optional)
  - *   <dd> the time the file was last modified in human-readable form
  - *   </dl>
  - * </blockquote>
  - * <p>
  - * <b>Configuration options:</b>
  - * <dl>
  - * <dt> <i>depth</i> (optional)
  - * <dd> Sets how deep DirectoryGenerator should delve into the
  - * directory structure. If set to 1 (the default), only the starting
  - * directory's immediate contents will be returned.
  - * <dt> <i>sort</i> (optional)
  - * <dd> Sort order in which the nodes are returned. Possible values are
  - * name, size, time, directory. directory is the same as name,
  - * except that the directory entries are listed first. System order is 
default.
  - * <dt> <i>reverse</i> (optional)
  - * <dd>      Reverse the order of the sort
  - * <dt> <i>dateFormat</i> (optional)
  - * <dd> Sets the format for the date attribute of each node, as
  - * described in java.text.SimpleDateFormat. If unset, the default
  - * format for the current locale will be used.
  - * <dt> <i>refreshDelay</i> (optional)
  - * <dd> Sets the delay (in seconds) between checks on the filesystem for 
changed content.
  - * Defaults to 1 second.
  - * </dl>
  - *
  + * 
  + * @cocoon.sitemap.component.name   directory
  + * @cocoon.sitemap.component.label  content
  + * @cocoon.sitemap.component.logger sitemap.generator.directory
  + * @cocoon.sitemap.component.documentation.caching
  + *               Uses the last modification date of the directory and the 
contained files
  + * 
  + * @cocoon.sitemap.component.pooling.min   2
  + * @cocoon.sitemap.component.pooling.max  16
  + * @cocoon.sitemap.component.pooling.grow  2
  + *  
    * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a>
    *         (Apache Software Foundation)
    * @author <a href="mailto:[EMAIL PROTECTED]">Conny Krappatsch</a>
  
  
  
  1.3       +16 -3     
cocoon-2.1/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java
  
  Index: ImageDirectoryGenerator.java
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/java/org/apache/cocoon/generation/ImageDirectoryGenerator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ImageDirectoryGenerator.java      5 Mar 2004 13:02:55 -0000       1.2
  +++ ImageDirectoryGenerator.java      26 May 2004 11:37:05 -0000      1.3
  @@ -26,8 +26,21 @@
   import org.xml.sax.SAXException;
   
   /**
  - * An extension of DirectoryGenerators that adds extra attributes for image
  - * files.
  + * @cocoon.sitemap.component.documentation
  + * Generates an XML directory listing. This is an extension of 
  + * the <link href="directory-generator.html">Directory Generator</link> that 
  + * adds extra attributes for image files.
  + * 
  + * @cocoon.sitemap.component.name   imagedirectory
  + * @cocoon.sitemap.component.label  content
  + * @cocoon.sitemap.component.logger sitemap.generator.imagedirectory
  + * @cocoon.sitemap.component.documentation.caching
  + *               Uses the last modification date of the directory and the 
contained files
  + * 
  + * @cocoon.sitemap.component.pooling.min   2
  + * @cocoon.sitemap.component.pooling.max  16
  + * @cocoon.sitemap.component.pooling.grow  2
  + *
    *
    * @author <a href="mailto:[EMAIL PROTECTED]">Donald A. Ball Jr.</a>
    * @author <a href="mailto:[EMAIL PROTECTED]">Torsten Curdt</a>
  
  
  
  1.7       +1 -5      
cocoon-2.1/src/documentation/xdocs/userdocs/generators/file-generator.xml
  
  Index: file-generator.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/generators/file-generator.xml,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- file-generator.xml        8 May 2004 08:57:57 -0000       1.6
  +++ file-generator.xml        26 May 2004 11:37:05 -0000      1.7
  @@ -17,6 +17,7 @@
   <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" 
"document-v10.dtd">
   
   <document>
  +    <!-- This document will be enhanced by information taken from the 
javadoc -->
        <header>
                <title>File Generator</title>
                <version>0.9</version>
  @@ -31,11 +32,6 @@
                        <p>The file generator reads an xml document from the 
local file system or from any url.
                       While url generator may appear to be a more suitable 
name, it's known as the file generator for historical reasons.</p>
                      <p>The file generator is the default generator.</p>
  -                     <ul>
  -                             <li>Name : file</li>
  -                             <li>Class: 
org.apache.cocoon.generation.FileGenerator</li>
  -                             <li>Cacheable: yes - uses the last modification 
date of the xml document for validation.</li>
  -                     </ul>
                        <p>The location of the source xml document is specified 
in
                        the pipeline by the src attribute.</p>
   <source>
  
  
  
  1.8       +1 -7      
cocoon-2.1/src/documentation/xdocs/userdocs/generators/imagedirectory-generator.xml
  
  Index: imagedirectory-generator.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/generators/imagedirectory-generator.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- imagedirectory-generator.xml      8 May 2004 08:57:57 -0000       1.7
  +++ imagedirectory-generator.xml      26 May 2004 11:37:05 -0000      1.8
  @@ -17,6 +17,7 @@
   <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" 
"document-v10.dtd">
   
   <document>
  +    <!-- This document will be enhanced by information taken from the 
javadoc -->
     <header>
       <title>Image Directory Generator</title>
       <version>1.0</version>
  @@ -28,13 +29,6 @@
     </header>
     <body>
       <s1 title="Image Directory Generator">
  -      <p>Generates an XML directory listing. This is an extension of the
  -             <link href="directory-generator.html">Directory 
Generator</link>.</p>
  -      <ul>
  -        <li>Name: imagedirectory</li>
  -        <li>Class: org.apache.cocoon.generation.ImageDirectoryGenerator</li>
  -        <li>Cacheable: yes</li>
  -      </ul>
         <p>The Image Directory provides all the functionality of the
                <link href="directory-generator.html">Directory 
Generator</link>. Additionally it
           ensures that the files are images and adds their dimensions 
(<code>width</code>
  
  
  
  1.8       +3 -8      
cocoon-2.1/src/documentation/xdocs/userdocs/generators/directory-generator.xml
  
  Index: directory-generator.xml
  ===================================================================
  RCS file: 
/home/cvs/cocoon-2.1/src/documentation/xdocs/userdocs/generators/directory-generator.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- directory-generator.xml   6 Mar 2004 02:25:35 -0000       1.7
  +++ directory-generator.xml   26 May 2004 11:37:05 -0000      1.8
  @@ -17,6 +17,7 @@
   <!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V1.0//EN" 
"document-v10.dtd">
   
   <document>
  +  <!-- This document will be enhanced by information taken from the javadoc 
-->
     <header>
       <title>Directory Generator</title>
       <version>1.0</version>
  @@ -31,12 +32,6 @@
     </header>
     <body>
       <s1 title="Directory Generator">
  -      <p>Generates an XML directory listing.</p>
  -      <ul>
  -        <li>Name: directory</li>
  -        <li>Class: org.apache.cocoon.generation.DirectoryGenerator</li>
  -        <li>Cacheable: yes</li>
  -      </ul>
         <p>The root node of the generated document will normally be a 
<code>directory</code> node. A
             directory node can contain zero or more <code>file</code> or 
<code>directory</code> nodes.
             A file node has no children. All generated elements have the 
namespace
  @@ -47,7 +42,7 @@
           <li><code>name</code>: the name of the file or directory.</li>
           <li><code>lastModified</code>: the time the file was last modified, 
measured as the number
               of milliseconds since the epoch (as in 
<code>java.io.File.lastModified</code>).</li>
  -        <li><code>date</code>: the time the file was last modified in 
human-readable form.</li>
  +        <li><code>date</code> (optional): the time the file was last 
modified in human-readable form.</li>
           <li><code>size</code>: the file size (or 0 for directories).</li>
         </ul>
         <p>Additionally the node for the requested directory has the 
attributes:</p>
  @@ -72,7 +67,7 @@
             generate command (as seen in the example above for the parameter 
<code>depth</code>):
         </p>
         <ul>
  -        <li>depth: Sets how deep Directory Generator should delve into the 
directory structure. If
  +        <li>depth: Sets how deep the generator should delve into the 
directory structure. If
               set to 1 (the default), only the starting directory's immediate 
contents will be
               returned.</li>
           <li>dateFormat: Sets the format for the date attribute of each node 
as described in
  
  
  
  1.13      +2 -2      cocoon-2.1/tools/targets/docs-build.xml
  
  Index: docs-build.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/targets/docs-build.xml,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- docs-build.xml    25 May 2004 12:53:43 -0000      1.12
  +++ docs-build.xml    26 May 2004 11:37:05 -0000      1.13
  @@ -49,9 +49,9 @@
       <copy file="status.xml"
         tofile="${build.context}/xdocs/status.xml" filtering="on"/>
   
  -     <!-- generate sitemap components docs 
  +     <!-- generate sitemap components docs -->
       <sitemap-components docDir="${build.context}/xdocs/userdocs" 
source="${java}"/>
  -    -->
  +    <!-- -->
       
       <!-- Forrest needs its own file at src/documentation/sitemap.xmap, so we
       overwrite it with the old Cocoon-specific sitemap here -->
  
  
  
  1.15      +34 -13    cocoon-2.1/tools/src/anttasks/SitemapTask.java
  
  Index: SitemapTask.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/SitemapTask.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- SitemapTask.java  8 May 2004 02:54:45 -0000       1.14
  +++ SitemapTask.java  26 May 2004 11:37:05 -0000      1.15
  @@ -90,11 +90,14 @@
       /** The directory containing the sources*/
       private String directory;
       
  +    /** The name of the block */
       private String blockName;
       
  -    private boolean deprecated = false;
  +    /** Is this block deprecated? */
  +    protected boolean deprecated = false;
       
  -    private boolean stable = true;
  +    /** Is this block stable? */
  +    protected boolean stable = true;
       
       /**
        * Set the directory containg the source files.
  @@ -317,18 +320,35 @@
               final String htmlName = docFile.getName().substring(0, 
docFile.getName().length()-3) + "html";
               Node oldEntry = XPathAPI.selectSingleNode(sectionNode, "[EMAIL 
PROTECTED]'"+htmlName+"']");
               Node newEntry = indexDoc.createElement("menu-item");
  -            ((Element)newEntry).setAttribute("href", htmlName);
  -            ((Element)newEntry).setAttribute("label", component.getName() + 
" " + component.getType());
  +            ((Element)newEntry).setAttribute("href", htmlName);            
  +            ((Element)newEntry).setAttribute("label", 
capitalize(component.getName()) + " " + capitalize(component.getType()));
               if ( oldEntry != null ) {
                   oldEntry.getParentNode().replaceChild(newEntry, oldEntry);
               } else {
                   sectionNode.appendChild(newEntry);
               }
  +            // FIXME we should sort the entries!
               DocumentCache.writeDocument(indexFile, indexDoc, this);
           }
           
       }
   
  +    /**
  +     * Helper method to capitalize a string.
  +     * This is taken from commons-lang, but we don't want the dependency 
  +     * right now!
  +     */
  +    public static String capitalize(String str) {
  +        int strLen;
  +        if (str == null || (strLen = str.length()) == 0) {
  +            return str;
  +        }
  +        return new StringBuffer(strLen)
  +            .append(Character.toTitleCase(str.charAt(0)))
  +            .append(str.substring(1))
  +            .toString();
  +    }
  +
       final class SitemapComponent {
           
           final protected JavaClass javaClass;
  @@ -366,7 +386,7 @@
               StringBuffer buffer = new StringBuffer();
               
               // first check: deprecated?
  -            if ( deprecated || this.getTagValue("deprecated", null) != null 
) {
  +            if ( SitemapTask.this.deprecated || 
this.getTagValue("deprecated", null) != null ) {
                   indent(parent, 3);
                   buffer.append("The ")
                   .append(this.type)
  @@ -379,7 +399,7 @@
                   buffer = new StringBuffer();
               }
               // unstable block?
  -            if ( !stable ) {
  +            if ( !SitemapTask.this.stable ) {
                   indent(parent, 3);
                   buffer.append("The ")
                   .append(this.type)
  @@ -485,7 +505,7 @@
                        descriptionDoc.getDocumentElement().getChildNodes());
               
               // check: deprecated?
  -            if ( deprecated || this.getTagValue("deprecated", null) != null 
) {
  +            if ( SitemapTask.this.deprecated || 
this.getTagValue("deprecated", null) != null ) {
                   Node node = XPathAPI.selectSingleNode(body, "[EMAIL 
PROTECTED]'Description']");
                   // node is never null - this is ensured by the test above
                   Element e = node.getOwnerDocument().createElement("note");
  @@ -497,7 +517,7 @@
                   }
               }
               // check: stable?
  -            if ( !stable ) {
  +            if ( !SitemapTask.this.stable ) {
                   Node node = XPathAPI.selectSingleNode(body, "[EMAIL 
PROTECTED]'Description']");
                   // node is never null - this is ensured by the test above
                   Element e = node.getOwnerDocument().createElement("note");
  @@ -512,8 +532,8 @@
               this.addRow(tableNode, "Name", this.name);
   
               // Info - Block
  -            if ( blockName != null ) {
  -                this.addRow(tableNode, "Block", blockName);
  +            if ( SitemapTask.this.blockName != null ) {
  +                this.addRow(tableNode, "Block", SitemapTask.this.blockName);
               }
               
               // Info - Cacheable
  @@ -597,7 +617,7 @@
           }
           
           private String getTagValue(String tagName, String defaultValue) {
  -            final DocletTag tag = javaClass.getTagByName( tagName );
  +            final DocletTag tag = this.javaClass.getTagByName( tagName );
               if ( tag != null ) {
                   return tag.getValue();
               }
  @@ -670,7 +690,8 @@
                   throw new BuildException(e);
               }
           }
  -    }
  +    
  +}
       
       // Class Constants
       private static final String LOG_ENABLED = 
"org.apache.avalon.framework.logger.LogEnabled";
  
  
  
  1.14      +2 -2      cocoon-2.1/src/java/org/apache/cocoon/xml/SaxBuffer.java
  
  Index: SaxBuffer.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/xml/SaxBuffer.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SaxBuffer.java    6 May 2004 10:09:03 -0000       1.13
  +++ SaxBuffer.java    26 May 2004 11:37:05 -0000      1.14
  @@ -51,7 +51,7 @@
   public class SaxBuffer implements XMLConsumer, XMLizable, Recyclable, 
Serializable {
   
       /**
  -     * Stores list of [EMAIL PROTECTED] SaxBit} objects.
  +     * Stores list of [EMAIL PROTECTED] #SaxBit} objects.
        */
       protected List saxbits = new ArrayList();
   
  
  
  

Reply via email to