vmassol     2003/01/28 06:12:34

  Modified:    documentation/docs/dtds sitemap-v10.dtd
               documentation/src/java/org/apache/cactus/documentation
                        CheckSitemapTask.java
  Log:
  Added support for resources that should not be checked for existence.
  
  Revision  Changes    Path
  1.5       +1 -0      jakarta-cactus/documentation/docs/dtds/sitemap-v10.dtd
  
  Index: sitemap-v10.dtd
  ===================================================================
  RCS file: /home/cvs/jakarta-cactus/documentation/docs/dtds/sitemap-v10.dtd,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap-v10.dtd   22 Jan 2003 18:21:13 -0000      1.4
  +++ sitemap-v10.dtd   28 Jan 2003 14:12:34 -0000      1.5
  @@ -26,6 +26,7 @@
       id ID #REQUIRED
       source CDATA #IMPLIED
       name CDATA #IMPLIED
  +    check CDATA #IMPLIED
   >
   
   <!ELEMENT external (#PCDATA)>
  
  
  
  1.3       +33 -9     
jakarta-cactus/documentation/src/java/org/apache/cactus/documentation/CheckSitemapTask.java
  
  Index: CheckSitemapTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-cactus/documentation/src/java/org/apache/cactus/documentation/CheckSitemapTask.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CheckSitemapTask.java     22 Jan 2003 18:02:03 -0000      1.2
  +++ CheckSitemapTask.java     28 Jan 2003 14:12:34 -0000      1.3
  @@ -76,7 +76,8 @@
    * Checks the sitemap for invalid resource links (currently only local).
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Christopher Lenz</a>
  - *
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Vincent Massol</a>
  + * 
    * @version $Id$
    */
   public class CheckSitemapTask extends Task
  @@ -233,17 +234,40 @@
        */
       private boolean checkSitemapResource(Element theElement)
       {
  -        String id = theElement.getAttribute("id");
  -        String source = theElement.getAttribute("source");
  -        if ((source == null) || (source.length() == 0))
  +        if (isResourceToBeChecked(theElement))
           {
  -            log("Skipping remote resource [" + id + "]", Project.MSG_VERBOSE);
  +            String id = theElement.getAttribute("id");
  +            String source = theElement.getAttribute("source");
  +                         
  +    
  +            if ((source == null) || (source.length() == 0))
  +            {
  +                log("Skipping remote resource [" + id + "]", 
  +                    Project.MSG_VERBOSE);
  +            }
  +            else
  +            {
  +                checkLocalSitemapResource(id, source);
  +            }
           }
  -        else
  +        return true;
  +    }
  +
  +    /**
  +     * @param theElement the resource for which to verify if it is to be checked
  +     * for existence
  +     * @return true if the resource must be checked or false otherwise
  +     */
  +    private boolean isResourceToBeChecked(Element theElement)
  +    {
  +        // Checks are enabled by default 
  +        boolean isToBeChecked = true;
  +        if (theElement.getAttribute("check") != null)
           {
  -            checkLocalSitemapResource(id, source);
  +            isToBeChecked = 
  +                (new Boolean(theElement.getAttribute("check"))).booleanValue();
           }
  -        return true;
  +        return isToBeChecked;            
       }
       
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to