You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@locus.apache.org on 2000/08/21 19:35:41 UTC

cvs commit: xml-cocoon/src/org/apache/cocoon/sitemap/patterns PatternException.java PatternMatcher.java PatternTranslator.java

stefano     00/08/21 10:35:40

  Modified:    src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        AbstractSitemap.java SitemapHandler.java
                        SitemapManager.java
  Added:       src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        PatternException.java
  Removed:     src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        ErrorGenerator.java
               src/org/apache/cocoon/sitemap/patterns Tag: xml-cocoon2
                        PatternException.java PatternMatcher.java
                        PatternTranslator.java
  Log:
  lots of fixes and cleanups
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.5   +2 -3      xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/AbstractSitemap.java,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- AbstractSitemap.java	2000/08/04 21:12:11	1.1.2.4
  +++ AbstractSitemap.java	2000/08/21 17:35:30	1.1.2.5
  @@ -20,7 +20,6 @@
   import org.apache.cocoon.ProcessingException; 
   import org.apache.cocoon.Processor; 
   import org.apache.cocoon.environment.Environment; 
  -import org.apache.cocoon.sitemap.patterns.PatternException;
   
   import org.xml.sax.SAXException; 
   
  @@ -28,7 +27,7 @@
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/08/04 21:12:11 $
  + * @version CVS $Revision: 1.1.2.5 $ $Date: 2000/08/21 17:35:30 $
    */
   public abstract class AbstractSitemap
            implements Sitemap {      
  @@ -73,7 +72,7 @@
        *//*
       public boolean hasContentChanged(HttpServletRequest resuest) {
           return true;
  -    }*/
  +    }
   
        /** 
         * Loads a class specified in a sitemap component definition and
  
  
  
  1.1.2.9   +8 -22     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapHandler.java
  
  Index: SitemapHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapHandler.java,v
  retrieving revision 1.1.2.8
  retrieving revision 1.1.2.9
  diff -u -r1.1.2.8 -r1.1.2.9
  --- SitemapHandler.java	2000/08/17 17:07:36	1.1.2.8
  +++ SitemapHandler.java	2000/08/21 17:35:31	1.1.2.9
  @@ -31,7 +31,7 @@
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/08/17 17:07:36 $
  + * @version CVS $Revision: 1.1.2.9 $ $Date: 2000/08/21 17:35:31 $
    */
   public class SitemapHandler implements Runnable, Configurable, Composer, Processor {
   
  @@ -86,23 +86,6 @@
           }
       }
   
  -    protected void throwEventualException () 
  -    throws ProcessingException, SAXException, IOException, InterruptedException {
  -        if (exception == null) return; // No exception was caught
  -        
  -        if (exception instanceof ProcessingException) {
  -            throw (ProcessingException) exception;
  -        } else if (exception instanceof SAXException) {
  -            throw (SAXException) exception;
  -        } else if (exception instanceof IOException) {
  -            throw (IOException) exception;
  -        } else if (exception instanceof InterruptedException) {
  -            throw (InterruptedException) exception;
  -        } else {
  -            throw new ProcessingException ("Unknown Exception raised: " + exception.toString());
  -        }
  -    }
  - 
       protected boolean available () {
           return (sitemap != null);
       }
  @@ -122,7 +105,7 @@
       }
   
       protected synchronized void regenerateAsynchronously (Environment environment)
  -    throws ProcessingException, SAXException, IOException, InterruptedException { 
  +    throws Exception { 
           if (!this.isRegenerationRunning) {
               isRegenerationRunning = true;
               regeneration = new Thread (this);
  @@ -132,16 +115,15 @@
       }
   
       protected synchronized void regenerate (Environment environment) 
  -    throws ProcessingException, SAXException, IOException, InterruptedException { 
  +    throws Exception { 
           regenerateAsynchronously(environment);
           regeneration.join();
  -        throwEventualException();
       }
   
       public boolean process (Environment environment) 
       throws Exception {
           throwEventualException();
  -        return sitemap.process (environment);
  +        return sitemap.process(environment);
       }
   
       public void setBasePath (String basePath) {
  @@ -172,5 +154,9 @@
               this.environment = null;
               this.isRegenerationRunning = false;
           }
  +    }
  +    
  +    public void throwEventualException() throws Exception {
  +        if (this.exception != null) throw this.exception;
       }
   } 
  
  
  
  1.1.2.8   +8 -11     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapManager.java
  
  Index: SitemapManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/SitemapManager.java,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- SitemapManager.java	2000/08/17 17:07:36	1.1.2.7
  +++ SitemapManager.java	2000/08/21 17:35:31	1.1.2.8
  @@ -32,7 +32,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/08/17 17:07:36 $
  + * @version CVS $Revision: 1.1.2.8 $ $Date: 2000/08/21 17:35:31 $
    */
   public class SitemapManager implements Configurable, Composer {
   
  @@ -59,31 +59,28 @@
       public boolean invoke (Environment environment, String uri_prefix, 
                              String source, boolean check_reload) 
       throws Exception {
  -        SitemapHandler sitemapHandler = (SitemapHandler) sitemaps.get (source);
  +        SitemapHandler sitemapHandler = (SitemapHandler) sitemaps.get(source);
  +        
           if (sitemapHandler != null) {
  -            sitemapHandler.throwEventualException();
               if (sitemapHandler.available()) {
                   if (check_reload 
                    && sitemapHandler.hasChanged()
                    && !sitemapHandler.isRegenerating()) {
                       sitemapHandler.regenerateAsynchronously(environment);
                   }
  -                environment.changeContext (uri_prefix, source);
  -                return sitemapHandler.process (environment);
               } else {
                   sitemapHandler.regenerate(environment);
               }
  -            environment.changeContext (uri_prefix, source);
  -            return sitemapHandler.process (environment);
           } else {
               sitemapHandler = new SitemapHandler(source, check_reload);
  -            if (sitemapHandler instanceof Composer) sitemapHandler.setComponentManager (this.manager);
  -            if (sitemapHandler instanceof Configurable) sitemapHandler.setConfiguration (this.conf); 
  +            if (sitemapHandler instanceof Composer) sitemapHandler.setComponentManager(this.manager);
  +            if (sitemapHandler instanceof Configurable) sitemapHandler.setConfiguration(this.conf); 
               sitemaps.put(source, sitemapHandler);
               sitemapHandler.regenerate(environment); 
  -            environment.changeContext (uri_prefix, source);
  -            return sitemapHandler.process (environment);
           }
  +        
  +        environment.changeContext(uri_prefix, source);
  +        return sitemapHandler.process(environment);
       }
   
       public boolean hasChanged () {
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +27 -0     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/PatternException.java