cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap ComponentsSelector.java
Date Mon, 27 May 2002 11:12:13 GMT
cziegeler    02/05/27 04:12:13

  Modified:    src/java/org/apache/cocoon/components/treeprocessor
                        InvokeContext.java
               src/java/org/apache/cocoon/components/treeprocessor/sitemap
                        ComponentsSelector.java
  Log:
  One step further...
  
  Revision  Changes    Path
  1.4       +13 -3     xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
  
  Index: InvokeContext.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InvokeContext.java	27 May 2002 10:52:08 -0000	1.3
  +++ InvokeContext.java	27 May 2002 11:12:13 -0000	1.4
  @@ -54,6 +54,7 @@
   import org.apache.avalon.framework.component.Recomposable;
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.avalon.framework.logger.Loggable;
   
  @@ -77,7 +78,7 @@
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Id: InvokeContext.java,v 1.3 2002/05/27 10:52:08 cziegeler Exp $
  + * @version CVS $Id: InvokeContext.java,v 1.4 2002/05/27 11:12:13 cziegeler Exp $
    */
   
   public class InvokeContext implements Recomposable, Disposable, Loggable {
  @@ -108,6 +109,9 @@
       /** The ProcessingPipeline used */
       protected ProcessingPipeline processingPipeline;
   
  +    /** The Selector for the processing pipeline */
  +    protected ComponentSelector pipelineSelector;
  +
       /**
        * Create an <code>InvokeContext</code> without existing pipelines. This
also means
        * the current request is external.
  @@ -191,7 +195,8 @@
       public ProcessingPipeline getProcessingPipeline()
       throws Exception {
           if (this.processingPipeline == null) {
  -            this.processingPipeline = (ProcessingPipeline)this.pipelinesManager.lookup(ProcessingPipeline.ROLE);
  +            this.pipelineSelector = (ComponentSelector)this.pipelinesManager.lookup(ProcessingPipeline.ROLE+"Selector");
  +            this.processingPipeline = (ProcessingPipeline)this.pipelineSelector.select(this.processingPipelineName);
               // FIXME - Setup pipeline
               this.processingPipeline.recompose( this.pipelinesManager );
           }
  @@ -284,7 +289,12 @@
   
               this.pipelinesManager.release(this.eventPipeline);
               this.pipelinesManager.release(this.streamPipeline);
  -            this.pipelinesManager.release(this.processingPipeline);
  +            if ( this.pipelineSelector != null) {
  +                this.pipelineSelector.release(this.processingPipeline);
  +                this.processingPipeline = null;
  +                this.pipelinesManager.release( this.pipelineSelector );
  +                this.pipelineSelector = null;
  +            }
               this.pipelinesManager = null;
           }
       }
  
  
  
  1.2       +34 -29    xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ComponentsSelector.java
  
  Index: ComponentsSelector.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/ComponentsSelector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComponentsSelector.java	5 Mar 2002 08:26:23 -0000	1.1
  +++ ComponentsSelector.java	27 May 2002 11:12:13 -0000	1.2
  @@ -58,6 +58,7 @@
   import org.apache.avalon.framework.configuration.DefaultConfiguration;
   
   import org.apache.cocoon.components.pipeline.OutputComponentSelector;
  +import org.apache.cocoon.components.pipeline.ProcessingPipeline;
   import org.apache.cocoon.components.ExtendedComponentSelector;
   
   import org.apache.cocoon.acting.Action;
  @@ -75,10 +76,11 @@
    * Component selector for sitemap components.
    *
    * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  - * @version CVS $Id: ComponentsSelector.java,v 1.1 2002/03/05 08:26:23 sylvain Exp $
  + * @version CVS $Id: ComponentsSelector.java,v 1.2 2002/05/27 11:12:13 cziegeler Exp $
    */
   
  -public class ComponentsSelector extends ExtendedComponentSelector implements OutputComponentSelector,
SitemapComponentSelector {
  +public class ComponentsSelector extends ExtendedComponentSelector
  +implements OutputComponentSelector, SitemapComponentSelector {
   
       public static final int UNKNOWN     = -1;
       public static final int GENERATOR   = 0;
  @@ -88,6 +90,7 @@
       public static final int MATCHER     = 4;
       public static final int SELECTOR    = 5;
       public static final int ACTION      = 6;
  +    public static final int PIPELINE    = 7;
   
       public static final String[] SELECTOR_ROLES = {
           Generator.ROLE   + "Selector",
  @@ -96,7 +99,8 @@
           Reader.ROLE      + "Selector",
           Matcher.ROLE     + "Selector",
           Selector.ROLE    + "Selector",
  -        Action.ROLE      + "Selector"
  +        Action.ROLE      + "Selector",
  +        ProcessingPipeline.ROLE + "Selector"
       };
   
       public static final String[] COMPONENT_NAMES = {
  @@ -106,7 +110,8 @@
           "reader",
           "matcher",
           "selector",
  -        "action"
  +        "action",
  +        "pipeline"
       };
   
       /** The role as an integer */
  @@ -170,7 +175,7 @@
           if (this.roleId == SERIALIZER || this.roleId == READER) {
               this.hintMimeTypes = new HashMap();
           }
  -        
  +
           this.hintLabels = new HashMap();
   
           super.configure(config);
  @@ -193,7 +198,7 @@
                   this.hintMimeTypes.put(hint, mimeType);
               }
           }
  -        
  +
           String label = config.getAttribute("label", null);
           if (label != null) {
               // Empty '' attribute will result in empty array,
  @@ -213,36 +218,36 @@
        */
       public void initialize() /*throws Exception*/ {
   
  -    // FIXME : need to catch exceptions since ECS doesn't propagate the throws clause of
Initializable
  -    try {
  +        // FIXME : need to catch exceptions since ECS doesn't propagate the throws clause
of Initializable
  +        try {
   
  -        Configuration emptyConfig = new DefaultConfiguration("", "");
  +            Configuration emptyConfig = new DefaultConfiguration("", "");
   
  -        // Ensure all system-defined hints exist.
  -        // NOTE : checking this here means they can be user-defined in the sitemap
  -        switch(this.roleId) {
  -            case GENERATOR :
  -                ensureExists("!notifying-generator!",
  -                    org.apache.cocoon.sitemap.NotifyingGenerator.class, emptyConfig);
  +            // Ensure all system-defined hints exist.
  +            // NOTE : checking this here means they can be user-defined in the sitemap
  +            switch(this.roleId) {
  +                case GENERATOR :
  +                    ensureExists("!notifying-generator!",
  +                        org.apache.cocoon.sitemap.NotifyingGenerator.class, emptyConfig);
   
  -                ensureExists("!content-aggregator!",
  -                    org.apache.cocoon.sitemap.ContentAggregator.class, emptyConfig);
  -            break;
  +                    ensureExists("!content-aggregator!",
  +                        org.apache.cocoon.sitemap.ContentAggregator.class, emptyConfig);
  +                break;
   
  -            case TRANSFORMER :
  -                ensureExists("!link-translator!",
  -                    org.apache.cocoon.sitemap.LinkTranslator.class, emptyConfig);
  -            break;
  -        }
  +                case TRANSFORMER :
  +                    ensureExists("!link-translator!",
  +                        org.apache.cocoon.sitemap.LinkTranslator.class, emptyConfig);
  +                break;
  +            }
   
  -        super.initialize();
  +            super.initialize();
   
  -        // Don't keep known hints (they're no more needed)
  -        this.knownHints = null;
  +            // Don't keep known hints (they're no more needed)
  +            this.knownHints = null;
   
  -    } catch(Exception e) {
  -        throw new CascadingRuntimeException("Cannot setup default components", e);
  -    }
  +        } catch(Exception e) {
  +            throw new CascadingRuntimeException("Cannot setup default components", e);
  +        }
   
       }
   
  
  
  

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