cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.2/src/java/org/apache/cocoon/components/pipeline AbstractProcessingPipeline.java
Date Sun, 28 Dec 2003 22:11:19 GMT
unico       2003/12/28 14:11:19

  Modified:    src/java/org/apache/cocoon/components/cprocessor/sitemap
                        SerializeNode.java GenerateNode.java
                        TransformNode.java
               src/java/org/apache/cocoon/components/pipeline
                        AbstractProcessingPipeline.java
  Log:
  fix setSitemapComponent() methods
  
  Revision  Changes    Path
  1.2       +13 -2     cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/SerializeNode.java
  
  Index: SerializeNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/SerializeNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SerializeNode.java	28 Dec 2003 21:03:17 -0000	1.1
  +++ SerializeNode.java	28 Dec 2003 22:11:19 -0000	1.2
  @@ -62,6 +62,7 @@
   import org.apache.cocoon.components.cprocessor.variables.VariableResolver;
   import org.apache.cocoon.components.cprocessor.variables.VariableResolverFactory;
   import org.apache.cocoon.environment.Environment;
  +import org.apache.cocoon.serialization.Serializer;
   import org.apache.cocoon.sitemap.PatternException;
   
   /**
  @@ -80,6 +81,7 @@
   
       private VariableResolver m_mimeType;
       private int m_statusCode;
  +    private String m_serializerRole;
   
       public SerializeNode() {
       }
  @@ -96,6 +98,15 @@
           m_statusCode = config.getAttributeAsInteger("status-code",-1);
       }
       
  +    public void initialize() throws Exception {
  +        super.initialize();
  +        m_serializerRole = Serializer.ROLE;
  +        String hint = getComponentId();
  +        if (hint != null) {
  +            m_serializerRole += "/" + hint;
  +        }
  +    }
  +    
       public final boolean invoke(Environment env, InvokeContext context) throws Exception
{
   
           //inform the pipeline that we have a branch point
  @@ -136,7 +147,7 @@
           }
           
           pipeline.setSerializer(
  -            getComponentId(),
  +            m_serializerRole,
               null,
               VariableResolver.buildParameters(m_parameters, context, objectModel),
               super.m_pipelineHints == null
  
  
  
  1.2       +13 -2     cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/GenerateNode.java
  
  Index: GenerateNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/GenerateNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GenerateNode.java	28 Dec 2003 21:03:17 -0000	1.1
  +++ GenerateNode.java	28 Dec 2003 22:11:19 -0000	1.2
  @@ -63,6 +63,7 @@
   import org.apache.cocoon.components.cprocessor.variables.VariableResolver;
   import org.apache.cocoon.components.cprocessor.variables.VariableResolverFactory;
   import org.apache.cocoon.environment.Environment;
  +import org.apache.cocoon.generation.Generator;
   import org.apache.cocoon.sitemap.PatternException;
   
   /**
  @@ -80,6 +81,7 @@
   implements ProcessingNode {
   
       private VariableResolver m_src;
  +    private String m_generatorRole;
   
       public GenerateNode() {
       }
  @@ -96,12 +98,21 @@
           super.m_labels.add(ViewNode.FIRST_POS_LABEL);
       }
       
  +    public void initialize() throws Exception {
  +        super.initialize();
  +        m_generatorRole = Generator.ROLE;
  +        String hint = getComponentId();
  +        if (hint != null) {
  +            m_generatorRole += "/" + hint;
  +        }
  +    }
  +    
       public final boolean invoke(Environment env, InvokeContext context) throws Exception
{
           
           Map objectModel = env.getObjectModel();
           
           context.getProcessingPipeline().setGenerator(
  -            getComponentId(),
  +            m_generatorRole,
               m_src.resolve(context, objectModel),
               VariableResolver.buildParameters(super.m_parameters, context, objectModel),
               super.m_pipelineHints == null
  
  
  
  1.2       +14 -3     cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/TransformNode.java
  
  Index: TransformNode.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/cprocessor/sitemap/TransformNode.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransformNode.java	28 Dec 2003 21:03:17 -0000	1.1
  +++ TransformNode.java	28 Dec 2003 22:11:19 -0000	1.2
  @@ -61,6 +61,7 @@
   import org.apache.cocoon.components.cprocessor.variables.VariableResolverFactory;
   import org.apache.cocoon.environment.Environment;
   import org.apache.cocoon.sitemap.PatternException;
  +import org.apache.cocoon.transformation.Transformer;
   
   /**
    *
  @@ -76,6 +77,7 @@
   public class TransformNode extends PipelineEventComponentProcessingNode {
   
       private VariableResolver m_src;
  +    private String m_transformerRole;
   
       public TransformNode() {
       }
  @@ -91,12 +93,21 @@
           }
       }
       
  +    public void initialize() throws Exception {
  +        super.initialize();
  +        m_transformerRole = Transformer.ROLE;
  +        String hint = getComponentId();
  +        if (hint != null) {
  +            m_transformerRole += "/" + hint;
  +        }
  +    }
  +    
       public final boolean invoke(Environment env, InvokeContext context) throws Exception
{
   
           Map objectModel = env.getObjectModel();
  -
  +        
           context.getProcessingPipeline().addTransformer(
  -            getComponentId(),
  +            m_transformerRole,
               m_src.resolve(context, objectModel),
               VariableResolver.buildParameters(super.m_parameters, context, objectModel),
               super.m_pipelineHints == null
  
  
  
  1.21      +4 -18     cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
  
  Index: AbstractProcessingPipeline.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- AbstractProcessingPipeline.java	28 Dec 2003 21:18:29 -0000	1.20
  +++ AbstractProcessingPipeline.java	28 Dec 2003 22:11:19 -0000	1.21
  @@ -105,7 +105,6 @@
       protected ArrayList transformers = new ArrayList();
       protected ArrayList transformerParams = new ArrayList();
       protected ArrayList transformerSources = new ArrayList();
  -    protected ArrayList transformerSelectors = new ArrayList();
   
       // Serializer stuff
       protected Serializer serializer;
  @@ -273,15 +272,8 @@
           if (this.generator == null) {
               throw new ProcessingException ("You must set a generator first before you can
use a transformer.");
           }
  -        ServiceSelector selector = null;
           try {
  -            selector = (ServiceSelector) this.newManager.lookup(Transformer.ROLE + "Selector");
  -        } catch (ServiceException ce) {
  -            throw new ProcessingException("Lookup of transformer selector failed.", ce);
  -        }
  -        try {
  -            this.transformers.add(selector.select(role));
  -            this.transformerSelectors.add(selector);
  +            this.transformers.add(newManager.lookup(role));
           } catch (ServiceException ce) {
               throw new ProcessingException("Lookup of transformer for role '"+role+"' failed.",
ce);
           }
  @@ -313,7 +305,6 @@
           this.serializerSource = source;
           this.serializerParam = param;
           this.serializerMimeType = mimeType;
  -//        this.sitemapSerializerMimeType = serializerSelector.getMimeTypeForHint(role);
           this.lastConsumer = this.serializer;
       }
   
  @@ -338,7 +329,6 @@
           this.readerSource = source;
           this.readerParam = param;
           this.readerMimeType = mimeType;
  -        // this.sitemapReaderMimeType = readerSelector.getMimeTypeForHint(role);
       }
   
       /**
  @@ -645,14 +635,10 @@
           }
   
           // Release transformers
  -        int size = this.transformerSelectors.size();
  +        int size = this.transformers.size();
           for (int i = 0; i < size; i++) {
  -            final ServiceSelector selector =
  -                (ServiceSelector)this.transformerSelectors.get(i);
  -            selector.release( this.transformers.get(i) );
  -            this.newManager.release( selector );
  +            newManager.release( this.transformers.get(i) );
           }
  -        this.transformerSelectors.clear();
           this.transformers.clear();
           this.transformerParams.clear();
           this.transformerSources.clear();
  
  
  

Mime
View raw message