cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/sitemap AbstractSitemap.java Handler.java Manager.java Sitemap.java
Date Thu, 12 Apr 2001 16:01:00 GMT
giacomo     01/04/12 09:00:59

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 Cocoon.java
               src/org/apache/cocoon/components/language/markup/sitemap/java
                        Tag: xml-cocoon2 sitemap.xsl
               src/org/apache/cocoon/sitemap Tag: xml-cocoon2
                        AbstractSitemap.java Handler.java Manager.java
                        Sitemap.java
  Log:
  Added a parallel calling path into the sitemap system to let it assemble a
  StreamPipeline (which contains a Eventpipeline).
  
  This was made to enable the collection of sub pipeline for content aggregation.
  
  The remaining question is how to make this calling path available to (selected)
  components because IMHO it doesn't make sense to open it to every component.
  
  This is meant as a entertainment quiz over the boring Estern time :)
  
  Happy Eastern to all
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.4.2.72  +14 -2     xml-cocoon/src/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.4.2.71
  retrieving revision 1.4.2.72
  diff -u -r1.4.2.71 -r1.4.2.72
  --- Cocoon.java	2001/04/12 12:30:32	1.4.2.71
  +++ Cocoon.java	2001/04/12 16:00:54	1.4.2.72
  @@ -28,6 +28,8 @@
   import org.apache.avalon.configuration.ConfigurationException;
   import org.apache.avalon.Initializable;
   import org.apache.cocoon.components.parser.Parser;
  +import org.apache.cocoon.components.pipeline.StreamPipeline;
  +import org.apache.cocoon.components.pipeline.EventPipeline;
   import org.apache.cocoon.components.store.FilesystemStore;
   import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
  @@ -50,7 +52,7 @@
    *
    * @author <a href="mailto:fumagalli@exoffice.com">Pierpaolo Fumagalli</a>
(Apache Software Foundation, Exoffice Technologies)
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.4.2.71 $ $Date: 2001/04/12 12:30:32 $
  + * @version CVS $Revision: 1.4.2.72 $ $Date: 2001/04/12 16:00:54 $
    */
   public class Cocoon extends AbstractLoggable implements Component, Initializable, Disposable,
Modifiable, Processor, Contextualizable {
       /** The application context */
  @@ -188,8 +190,8 @@
           // Create the sitemap
           Configuration sconf = conf.getChild("sitemap");
           this.sitemapManager = new Manager();
  -        this.sitemapManager.contextualize(this.context);
           this.sitemapManager.setLogger(getLogger());
  +        this.sitemapManager.contextualize(this.context);
           this.sitemapManager.compose(this.componentManager);
           this.sitemapManager.configure(conf);
           this.sitemapFileName = sconf.getAttribute("file");
  @@ -242,6 +244,16 @@
       throws Exception {
           if (disposed) throw new IllegalStateException("You cannot process a Disposed Cocoon
engine.");
           return this.sitemapManager.invoke(environment, "", this.sitemapFileName, true);
  +    }
  +
  +    /**
  +     * Process the given <code>Environment</code> to assemble 
  +     * a <code>StreamPipeline</code> and an <code>EventPipeline</code>.
  +     */
  +    public boolean process(Environment environment, StreamPipeline pipeline, EventPipeline
eventPipeline)
  +    throws Exception {
  +        if (disposed) throw new IllegalStateException("You cannot process a Disposed Cocoon
engine.");
  +        return this.sitemapManager.invoke(environment, "", this.sitemapFileName, true,
pipeline, eventPipeline);
       }
   
       /**
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.95  +37 -20    xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl
  
  Index: sitemap.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/markup/sitemap/java/Attic/sitemap.xsl,v
  retrieving revision 1.1.2.94
  retrieving revision 1.1.2.95
  diff -u -r1.1.2.94 -r1.1.2.95
  --- sitemap.xsl	2001/04/04 15:42:40	1.1.2.94
  +++ sitemap.xsl	2001/04/12 16:00:56	1.1.2.95
  @@ -95,7 +95,7 @@
        *
        * @author &lt;a href="mailto:giacomo@apache.org"&gt;Giacomo Pati&lt;/a&gt;
        * @author &lt;a href="mailto:bloritsch@apache.org"&gt;Berin Loritsch&lt;/a&gt;
  -     * @version CVS $Id: sitemap.xsl,v 1.1.2.94 2001/04/04 15:42:40 giacomo Exp $
  +     * @version CVS $Id: sitemap.xsl,v 1.1.2.95 2001/04/12 16:00:56 giacomo Exp $
        */
       public class <xsl:value-of select="@file-name"/> extends AbstractSitemap {
         static final String LOCATION = "<xsl:value-of select="translate(@file-path, '/',
'.')"/>.<xsl:value-of select="@file-name"/>";
  @@ -303,12 +303,12 @@
            * @exception Exception If an error occurs during request evaluation and production
            */
           private boolean resource_<xsl:value-of select="translate(@name, '- ', '__')"/>
(StreamPipeline pipeline,
  -            EventPipeline eventPipeline, List listOfMaps, Environment environment, String
cocoon_view)
  +            EventPipeline eventPipeline, List listOfMaps, Environment environment, String
cocoon_view, boolean internalRequest)
           throws Exception {
             Map map = null;
             Parameters param = null;
             <xsl:apply-templates select="./*"/>
  -          return false;
  +          return internalRequest;
           }
         </xsl:for-each>
   
  @@ -323,12 +323,12 @@
            * @exception Exception If an error occurs during request evaluation and production
            */
           private boolean view_<xsl:value-of select="translate(@name, '- ', '__')"/>
(StreamPipeline pipeline,
  -            EventPipeline eventPipeline, List listOfMaps, Environment environment)
  +            EventPipeline eventPipeline, List listOfMaps, Environment environment, boolean
internalRequest)
           throws Exception {
             Map map = null;
             Parameters param = null;
             <xsl:apply-templates select="./*"/>
  -          return false;
  +          return internalRequest;
           }
         </xsl:for-each>
   
  @@ -378,7 +378,7 @@
           pipeline.setEventPipeline(eventPipeline);
           boolean result = false;
           try {
  -           result = process (environment, pipeline, eventPipeline);
  +           result = process (environment, pipeline, eventPipeline, false);
           } catch (Exception e) {
             getLogger().error("processing of resource failed", e);
             throw e;
  @@ -392,8 +392,18 @@
         /**
          * Process to producing the output to the specified &lt;code&gt;OutputStream&lt;/code&gt;.
          */
  -      private final boolean process(Environment environment, StreamPipeline pipeline, EventPipeline
eventPipeline)
  +      public boolean process(Environment environment, StreamPipeline pipeline, EventPipeline
eventPipeline)
         throws Exception {
  +        getLogger().debug("processing internal sitemap request");
  +        return process (environment, pipeline, eventPipeline, true);
  +      }
  +
  +      /**
  +       * Process to producing the output to the specified &lt;code&gt;OutputStream&lt;/code&gt;.
  +       */
  +      private final boolean process(Environment environment, StreamPipeline pipeline, 
  +                                    EventPipeline eventPipeline, boolean internalRequest)
  +      throws Exception {
           /* the &lt;code&gt;List&lt;/code&gt; objects to hold the replacement
values
              delivered from matchers and selectors to replace occurences of
              XPath kind expressions in values of src attribute used with
  @@ -419,7 +429,7 @@
               <xsl:choose>
                 <xsl:when test="(./map:handle-errors)">
                   try {
  -                  return error_process_<xsl:value-of select="$pipeline-position"/>
(environment, objectModel, e);
  +                  return error_process_<xsl:value-of select="$pipeline-position"/>
(environment, objectModel, e, internalRequest);
                   } catch (Exception ex) {
                     getLogger().warn("Sitemap Error Process", ex);
                   }
  @@ -437,7 +447,7 @@
         <xsl:for-each select="/map:sitemap/map:pipelines/map:pipeline">
           <xsl:variable name="pipeline-position" select="position()"/>
           <xsl:if test="(./map:handle-errors)">
  -          private boolean error_process_<xsl:value-of select="$pipeline-position"/>
(Environment environment, Map objectModel, Exception e)
  +          private boolean error_process_<xsl:value-of select="$pipeline-position"/>
(Environment environment, Map objectModel, Exception e, boolean internalRequest)
             throws Exception {
               StreamPipeline pipeline = null;
               EventPipeline eventPipeline = null;
  @@ -825,8 +835,7 @@
         environment.setStatus(<xsl:value-of select="@status-code"/>);
       </xsl:if>
   
  -    <!-- the "if(true)" is needed to prevent "statement not reachable" error messages
during compile -->
  -    {
  +    if (!internalRequest) {
         boolean result = false;
   
         try {
  @@ -836,8 +845,11 @@
             throw pipelineException<xsl:value-of select="generate-id(.)"/>;
         }
   
  -      if(true) return result;
  +      return result;
       }
  +    <!-- the if(true) prevents "unreachable statement" errors during compile -->
  +    if(true) return true;
  +
     </xsl:template> <!-- match="map:serialize" -->
   
     <!-- generate the code to invoke a reader -->
  @@ -850,7 +862,7 @@
       </xsl:call-template>
   
       <!-- the "if(true)" is needed to prevent "statement not reachable" error messages
during compile -->
  -    {
  +    if (!internalRequest) {
         boolean result = false;
   
         try {
  @@ -860,8 +872,10 @@
             throw RpipelineException<xsl:value-of select="generate-id(.)"/>;
         }
   
  -      if(true) return result;
  +      return result;
       }
  +    <!-- the if(true) prevents "unreachable statement" errors during compile -->
  +    if(true)return true;
     </xsl:template> <!-- match="map:read" -->
   
     <!-- generate the code to invoke a sub sitemap  -->
  @@ -886,7 +900,10 @@
       </xsl:variable>
   
       <!-- generate the code to invoke the sitemapManager which handles delegation of
control to sub sitemaps -->
  -    if(true)return sitemapManager.invoke (environment, substitute(listOfMaps,"<xsl:value-of
select="@uri-prefix"/>"), substitute(listOfMaps,"<xsl:value-of select="@src"/>"),
<xsl:value-of select="$check-reload"/>);
  +    if (internalRequest)
  +      return sitemapManager.invoke (environment, substitute(listOfMaps,"<xsl:value-of
select="@uri-prefix"/>"), substitute(listOfMaps,"<xsl:value-of select="@src"/>"),
<xsl:value-of select="$check-reload"/>, pipeline, eventPipeline);
  +    else
  +      if(true)return sitemapManager.invoke (environment, substitute(listOfMaps,"<xsl:value-of
select="@uri-prefix"/>"), substitute(listOfMaps,"<xsl:value-of select="@src"/>"),
<xsl:value-of select="$check-reload"/>);
     </xsl:template> <!-- match="map:mount" -->
   
     <!-- generate the code to redirect a request -->
  @@ -895,7 +912,7 @@
   
         <!-- redirect to a internal resource definition -->
         <xsl:when test="@resource">
  -        if(true)return resource_<xsl:value-of select="translate(@resource, '- ', '__')"/>(pipeline,
eventPipeline, listOfMaps, environment, cocoon_view);
  +        if(true)return resource_<xsl:value-of select="translate(@resource, '- ', '__')"/>(pipeline,
eventPipeline, listOfMaps, environment, cocoon_view, internalRequest);
         </xsl:when>
   
         <!-- redirect to a external resource definition with optional session mode attribute.
Let the environment do the redirect -->
  @@ -927,7 +944,7 @@
     <xsl:template match="map:label">
       <xsl:apply-templates/>
       if ("<xsl:value-of select="@name"/>".equals(cocoon_view))
  -      return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment);
  +      return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment, internalRequest);
     </xsl:template> <!-- match="map:label" -->
   
     <!-- collect parameter definitions -->
  @@ -1054,7 +1071,7 @@
           <xsl:for-each select="/map:sitemap/map:views/map:view[@from-position='last']">
             if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
               getLogger().debug("View <xsl:value-of select="@name"/>");
  -            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment);
  +            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment, internalRequest);
             }
           </xsl:for-each>
           // performing link translation
  @@ -1151,14 +1168,14 @@
         <xsl:if test="$component-label">
           <xsl:for-each select="/map:sitemap/map:views/map:view[@from-label=$component-label]">
             if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  -            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment);
  +            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment, internalRequest);
             }
           </xsl:for-each>
         </xsl:if>
         <xsl:if test="$prefix='generator'">
           <xsl:for-each select="/map:sitemap/map:views/map:view[@from-position='first']">
             if ("<xsl:value-of select="@name"/>".equals(cocoon_view)) {
  -            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment);
  +            return view_<xsl:value-of select="translate(@name, '- ', '__')"/> (pipeline,
eventPipeline, listOfMaps, environment, internalRequest);
             }
           </xsl:for-each>
         </xsl:if>
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.31  +11 -2     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.30
  retrieving revision 1.1.2.31
  diff -u -r1.1.2.30 -r1.1.2.31
  --- AbstractSitemap.java	2001/04/11 12:41:28	1.1.2.30
  +++ AbstractSitemap.java	2001/04/12 16:00:57	1.1.2.31
  @@ -30,8 +30,10 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.Roles;
  -import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.components.classloader.RepositoryClassLoader;
  +import org.apache.cocoon.components.pipeline.StreamPipeline;
  +import org.apache.cocoon.components.pipeline.EventPipeline;
  +import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.util.ClassUtils;
   
  @@ -41,7 +43,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.30 $ $Date: 2001/04/11 12:41:28 $
  + * @version CVS $Revision: 1.1.2.31 $ $Date: 2001/04/12 16:00:57 $
    */
   public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap {
       private Context context;
  @@ -239,5 +241,12 @@
        * This method is supplied by the generated Sitemap.
        */
       public abstract boolean process (Environment environment)
  +    throws Exception;
  +
  +    /**
  +     * Constructs a resource for the <code>Environment</code> arguments.
  +     * This method is supplied by the generated Sitemap.
  +     */
  +    public abstract boolean process (Environment environment, StreamPipeline pipeline,
EventPipeline eventPipeline)
       throws Exception;
   }
  
  
  
  1.1.2.22  +22 -7     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Handler.java,v
  retrieving revision 1.1.2.21
  retrieving revision 1.1.2.22
  diff -u -r1.1.2.21 -r1.1.2.22
  --- Handler.java	2001/04/12 12:30:35	1.1.2.21
  +++ Handler.java	2001/04/12 16:00:57	1.1.2.22
  @@ -21,6 +21,8 @@
   import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.language.generator.ProgramGenerator;
   import org.apache.cocoon.components.language.generator.CompiledComponent;
  +import org.apache.cocoon.components.pipeline.StreamPipeline;
  +import org.apache.cocoon.components.pipeline.EventPipeline;
   import org.apache.cocoon.components.url.URLFactory;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.Roles;
  @@ -40,7 +42,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.21 $ $Date: 2001/04/12 12:30:35 $
  + * @version CVS $Revision: 1.1.2.22 $ $Date: 2001/04/12 16:00:57 $
    */
   public class Handler extends AbstractLoggable implements Runnable, Configurable, Composer,
Contextualizable, Processor {
       private Context context;
  @@ -145,14 +147,24 @@
   
       public boolean process (Environment environment)
       throws Exception {
  +        checkSanity();
  +        return sitemap.process(environment);
  +    }
  +
  +    public boolean process (Environment environment, StreamPipeline pipeline, EventPipeline
eventPipeline)
  +    throws Exception {
  +        checkSanity();
  +        return sitemap.process(environment, pipeline, eventPipeline);
  +    }
  +
  +    private void checkSanity () throws Exception {
           throwEventualException();
           if (sitemap == null) {
               getLogger().fatalError("Sitemap is not set for the Handler!!!!");
               throw new RuntimeException("The Sitemap is null, this should never be!");
           }
  -        return sitemap.process(environment);
       }
  -
  +    
       public void setBasePath (String basePath) {
           this.basePath = basePath;
       }
  @@ -160,16 +172,19 @@
       /** Generate the Sitemap class */
       public void run() {
           Sitemap smap;
  -        //InputSource inputSource = new InputSource (sourceFile.getPath());
  -        //String systemId = inputSource.getSystemId();
  -
  -        //File file = new File(systemId);
   
           String markupLanguage = "sitemap";
           String programmingLanguage = "java";
   
           ProgramGenerator programGenerator = null;
           try {
  +            /* FIXME: Workaround -- set the logger XSLTFactoryLoader used to generate source
  +             * within the sitemap generation phase.
  +             * Needed because we never have the opportunity to handle the lifecycle of
the
  +             * XSLTFactoryLoader, since it is created by the Xalan engine.
  +             */
  +            XSLTFactoryLoader.setLogger(getLogger());
  +            
               programGenerator = (ProgramGenerator) this.manager.lookup(Roles.PROGRAM_GENERATOR);
               smap = (Sitemap) programGenerator.load(this.sourceFile, markupLanguage, programmingLanguage,
environment);
   
  
  
  
  1.1.2.12  +82 -24    xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Manager.java,v
  retrieving revision 1.1.2.11
  retrieving revision 1.1.2.12
  diff -u -r1.1.2.11 -r1.1.2.12
  --- Manager.java	2001/03/12 05:55:24	1.1.2.11
  +++ Manager.java	2001/04/12 16:00:58	1.1.2.12
  @@ -24,6 +24,8 @@
   import org.apache.avalon.AbstractLoggable;
   
   import org.apache.cocoon.ProcessingException;
  +import org.apache.cocoon.components.pipeline.StreamPipeline;
  +import org.apache.cocoon.components.pipeline.EventPipeline;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.sitemap.Handler;
   import org.apache.cocoon.sitemap.XSLTFactoryLoader;
  @@ -36,7 +38,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.11 $ $Date: 2001/03/12 05:55:24 $
  + * @version CVS $Revision: 1.1.2.12 $ $Date: 2001/04/12 16:00:58 $
    */
   public class Manager extends AbstractLoggable implements Configurable, Composer, Contextualizable
{
   
  @@ -51,35 +53,100 @@
       /** The component manager */
       private ComponentManager manager;
   
  +    /** get a configuration
  +     * @param conf the configuration
  +     */    
       public void configure (Configuration conf) {
           this.conf = conf;
       }
   
  +    /** get a context
  +     * @param context the context object
  +     */    
       public void contextualize (Context context) {
           this.context = context;
       }
   
  +    /** get a component manager
  +     * @param manager the component manager
  +     */    
       public void compose (ComponentManager manager) {
           this.manager = manager;
       }
   
  +    /** invokes the sitemap handler to process a request
  +     * @param environment the environment
  +     * @param uri_prefix the prefix to the URI
  +     * @param source the source of the sitemap
  +     * @param check_reload should the sitemap be automagically reloaded
  +     * @throws Exception there may be several excpetions thrown
  +     * @return states if the requested resource was produced
  +     */    
       public boolean invoke (Environment environment, String uri_prefix,
                              String source, boolean check_reload)
       throws Exception {
  +        
           // make sure the uri_prefix ends with a slash
  -        String prefix;
  +        String prefix = this.getPrefix(uri_prefix);
  +
  +        // get a sitemap handler
  +        Handler sitemapHandler = getHandler(environment, source, check_reload);
  +
  +        // setup to invoke the processing
  +        setupProcessing(environment, sitemapHandler, uri_prefix, source);
  +        return sitemapHandler.process(environment);
  +    }
  +
  +    /** invokes the sitemap handler to process a request
  +     * @param environment the environment
  +     * @param uri_prefix the prefix to the URI
  +     * @param source the source of the sitemap
  +     * @param check_reload should the sitemap be automagically reloaded
  +     * @throws Exception there may be several excpetions thrown
  +     * @return states if the requested resource was produced
  +     */    
  +    public boolean invoke (Environment environment, String uri_prefix,
  +                           String source, boolean check_reload, 
  +                           StreamPipeline pipeline, EventPipeline eventPipeline)
  +    throws Exception {
  +        
  +        // make sure the uri_prefix ends with a slash
  +        String prefix = this.getPrefix(uri_prefix);
  +        
  +        // get a sitemap handler
  +        Handler sitemapHandler = getHandler(environment, source, check_reload);
  +
  +        // setup to invoke the processing
  +        setupProcessing(environment, sitemapHandler, uri_prefix, source);
  +        return sitemapHandler.process(environment, pipeline, eventPipeline);
  +    }
  +
  +    /** has the sitemap changed
  +     * @return whether the sitemap file has changed
  +     */    
  +    public boolean hasChanged() {
  +        Handler sitemapHandler = null;
  +        Iterator iter = sitemaps.values().iterator();
  +        while (iter.hasNext()) {
  +            sitemapHandler = (Handler) iter.next();
  +            if ((sitemapHandler != null) && (sitemapHandler.hasChanged())) {
  +                return true;
  +            }
  +        }
  +        return false;
  +    }
  +    
  +    /** make sure the uri_prefix ends with a slash */
  +    private String getPrefix (String uri_prefix) {
           if (uri_prefix.length() > 0)
  -            prefix = (uri_prefix.charAt(uri_prefix.length() - 1) == '/' ? uri_prefix :
uri_prefix + "/");
  +            return (uri_prefix.charAt(uri_prefix.length() - 1) == '/' ? uri_prefix : uri_prefix
+ "/");
           else
  -            prefix = uri_prefix;
  +            return uri_prefix;
  +    }
  +    
  +    private Handler getHandler(final Environment environment, final String source, final
boolean check_reload) 
  +            throws Exception {
           Handler sitemapHandler = (Handler) sitemaps.get(source);
  -
  -        /* FIXME: Workaround -- set the logger XSLTFactoryLoader used to generate source
  -         * within the sitemap generation phase.
  -         * Needed because we never have the opportunity to handle the lifecycle of the
  -         * XSLTFactoryLoader, since it is created by the Xalan engine.
  -         */
  -        XSLTFactoryLoader.setLogger(getLogger());
           
           if (sitemapHandler != null) {
               if (sitemapHandler.available()) {
  @@ -100,22 +167,13 @@
               sitemapHandler.regenerate(environment);
               sitemaps.put(source, sitemapHandler);
           }
  +        return sitemapHandler;
  +    }
   
  +    private void setupProcessing (Environment environment, Handler sitemapHandler, String
uri_prefix, String source) 
  +            throws Exception {
           environment.changeContext(uri_prefix, source);
           if (! sitemapHandler.available())
               throw new ProcessingException("The sitemap handler's sitemap is not available.");
  -        return sitemapHandler.process(environment);
  -    }
  -
  -    public boolean hasChanged() {
  -        Handler sitemapHandler = null;
  -        Iterator iter = sitemaps.values().iterator();
  -        while (iter.hasNext()) {
  -            sitemapHandler = (Handler) iter.next();
  -            if ((sitemapHandler != null) && (sitemapHandler.hasChanged())) {
  -                return true;
  -            }
  -        }
  -        return false;
       }
   }
  
  
  
  1.1.4.16  +11 -1     xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java
  
  Index: Sitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/sitemap/Attic/Sitemap.java,v
  retrieving revision 1.1.4.15
  retrieving revision 1.1.4.16
  diff -u -r1.1.4.15 -r1.1.4.16
  --- Sitemap.java	2001/03/12 04:39:08	1.1.4.15
  +++ Sitemap.java	2001/04/12 16:00:58	1.1.4.16
  @@ -12,13 +12,16 @@
   import org.apache.avalon.Contextualizable;
   
   import org.apache.cocoon.components.language.generator.CompiledComponent;
  +import org.apache.cocoon.components.pipeline.StreamPipeline;
  +import org.apache.cocoon.components.pipeline.EventPipeline;
  +import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.Processor;
   
   /**
    * Base interface for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
  - * @version CVS $Revision: 1.1.4.15 $ $Date: 2001/03/12 04:39:08 $
  + * @version CVS $Revision: 1.1.4.16 $ $Date: 2001/04/12 16:00:58 $
    */
   public interface Sitemap extends CompiledComponent, Configurable, Contextualizable, Processor
{
       int GENERATOR = 1;
  @@ -28,4 +31,11 @@
       int ACTION = READER << 1;
       int MATCHER = ACTION << 1;
       int SELECTOR = MATCHER << 1;
  +
  +    /**
  +     * Process the given <code>Environment</code> assebling 
  +     * a <code>StreamPipeline</code> and an <code>EventPipeline</code>
  +     */
  +    boolean process(Environment environment, StreamPipeline pipeline, EventPipeline eventPipeline)
  +    throws Exception;
   }
  
  
  

----------------------------------------------------------------------
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