cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect RendererAspectContext.java RendererAspect.java
Date Sun, 15 Jun 2003 16:56:09 GMT
cziegeler    2003/06/15 09:56:09

  Modified:    src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl
                        WindowAspect.java RendererAspectChain.java
                        DefaultRendererContext.java
                        CompositeContentAspect.java XSLTAspect.java
                        TabContentAspect.java AbstractAspect.java
               src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect
                        RendererAspectContext.java RendererAspect.java
  Log:
  Prepared configurations for renderer aspects allows:
  - validation during configuration time
  - improved performance
  Making XSLT Processor configurable
  
  Revision  Changes    Path
  1.3       +25 -7     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java
  
  Index: WindowAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/WindowAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WindowAspect.java	22 May 2003 15:19:38 -0000	1.2
  +++ WindowAspect.java	15 Jun 2003 16:56:08 -0000	1.3
  @@ -53,6 +53,8 @@
   import java.util.Iterator;
   import java.util.Map;
   
  +import org.apache.avalon.framework.parameters.ParameterException;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.coplet.CopletInstanceData;
   import org.apache.cocoon.portal.layout.Layout;
  @@ -72,10 +74,6 @@
    */
   public final class WindowAspect extends AbstractAspect {
   
  -    protected String getTagName(RendererAspectContext context) {
  -        return context.getAspectParameters().getParameter("tag-name", "window");
  -    }
  -
       /* (non-Javadoc)
        * @see org.apache.cocoon.portal.layout.renderer.RendererAspect#toSAX(org.apache.cocoon.portal.layout.renderer.RendererAspectContext,
org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
        */
  @@ -84,7 +82,9 @@
                           PortalService service,
                           ContentHandler contenthandler)
       throws SAXException {
  +        final PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();
           final CopletInstanceData copletInstanceData = ((CopletLayout)layout).getCopletInstanceData();
  +
           AttributesImpl attributes = new AttributesImpl();
           Map parameter = layout.getParameters();
   		Map.Entry entry;
  @@ -92,14 +92,32 @@
   			entry = (Map.Entry) iter.next();
   			attributes.addCDATAAttribute((String)entry.getKey(), (String)entry.getValue());
   		}
  -        XMLUtils.startElement(contenthandler, this.getTagName(context), attributes);
  +        XMLUtils.startElement(contenthandler, config.tagName, attributes);
           int status = copletInstanceData.getStatus();
           XMLUtils.createElement(contenthandler, "title", copletInstanceData.getCopletData().getTitle());
           XMLUtils.createElement(contenthandler, "status", "" + status);
   
           context.invokeNext( layout, service, contenthandler );
   
  -        XMLUtils.endElement(contenthandler, this.getTagName(context));
  +        XMLUtils.endElement(contenthandler, config.tagName);
  +    }
  +
  +    protected class PreparedConfiguration {
  +        public String tagName;
  +        
  +        public void takeValues(PreparedConfiguration from) {
  +            this.tagName = from.tagName;
  +        }
  +    }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
  +     */
  +    public Object prepareConfiguration(Parameters configuration) 
  +    throws ParameterException {
  +        PreparedConfiguration pc = new PreparedConfiguration();
  +        pc.tagName = configuration.getParameter("tag-name", "window");
  +        return pc;
       }
   
   }
  
  
  
  1.3       +8 -4      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/RendererAspectChain.java
  
  Index: RendererAspectChain.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/RendererAspectChain.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RendererAspectChain.java	14 Jun 2003 17:55:43 -0000	1.2
  +++ RendererAspectChain.java	15 Jun 2003 16:56:09 -0000	1.3
  @@ -59,6 +59,7 @@
   import org.apache.avalon.framework.component.ComponentSelector;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
  +import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect;
   
  @@ -88,16 +89,19 @@
                       final String role = current.getAttribute("type");
                       try {
                           RendererAspect rAspect = (RendererAspect) selector.select(role);
  -                        Parameters aspectConfiguration = Parameters.fromConfiguration(current);
                           this.aspects.add(rAspect);               
  -                        this.configs.add(aspectConfiguration);
  +                        Parameters aspectConfiguration = Parameters.fromConfiguration(current);
  +                        Object compiledConf = rAspect.prepareConfiguration(aspectConfiguration);
  +                        this.configs.add(compiledConf);
                           
  -                        Iterator descriptionIterator = rAspect.getAspectDescriptions(aspectConfiguration);
  +                        Iterator descriptionIterator = rAspect.getAspectDescriptions(compiledConf);
                           if ( descriptionIterator != null ) {
                               while ( descriptionIterator.hasNext() ) {
                                   this.aspectDescriptions.add( descriptionIterator.next()
);
                               }
                           }
  +                    } catch (ParameterException pe) {
  +                        throw new ConfigurationException("Unable to configure renderer
aspect " + role, pe);
                       } catch (ComponentException se) {
                           throw new ConfigurationException("Unable to lookup aspect " + role,
se);
                       }
  
  
  
  1.2       +4 -5      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java
  
  Index: DefaultRendererContext.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/DefaultRendererContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultRendererContext.java	7 May 2003 06:22:22 -0000	1.1
  +++ DefaultRendererContext.java	15 Jun 2003 16:56:09 -0000	1.2
  @@ -54,7 +54,6 @@
   import java.util.Iterator;
   import java.util.Map;
   
  -import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.Layout;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect;
  @@ -75,7 +74,7 @@
       
       private Iterator iterator;
       private Iterator configIterator;
  -    private Parameters config;
  +    private Object config;
       private Map attributes;
       
       public DefaultRendererContext(RendererAspectChain chain) {
  @@ -92,7 +91,7 @@
                       		ContentHandler handler)
   	throws SAXException {
   		if (iterator.hasNext()) {
  -            this.config = (Parameters) this.configIterator.next();
  +            this.config = this.configIterator.next();
               final RendererAspect aspect = (RendererAspect) iterator.next();
               aspect.toSAX(this, layout, service, handler);
   		}
  @@ -102,7 +101,7 @@
   	/* (non-Javadoc)
   	 * @see org.apache.cocoon.portal.layout.renderer.RendererAspectContext#getConfiguration()
   	 */
  -	public Parameters getAspectParameters() {
  +	public Object getAspectConfiguration() {
   		return this.config;
   	}
   
  
  
  
  1.3       +25 -8     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/CompositeContentAspect.java
  
  Index: CompositeContentAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/CompositeContentAspect.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CompositeContentAspect.java	22 May 2003 15:19:38 -0000	1.2
  +++ CompositeContentAspect.java	15 Jun 2003 16:56:09 -0000	1.3
  @@ -53,6 +53,8 @@
   import java.util.Iterator;
   import java.util.Map;
   
  +import org.apache.avalon.framework.parameters.ParameterException;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.Item;
   import org.apache.cocoon.portal.layout.Layout;
  @@ -73,10 +75,6 @@
   
       protected static final String ITEM_STRING = "item";
   
  -    protected String getTagName(RendererAspectContext context) {
  -        return context.getAspectParameters().getParameter("tag-name", "composite");
  -    }
  -    
       /* (non-Javadoc)
        * @see org.apache.cocoon.portal.layout.renderer.RendererAspect#toSAX(org.apache.cocoon.portal.layout.renderer.RendererAspectContext,
org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
        */
  @@ -85,7 +83,8 @@
                           PortalService service,
                           ContentHandler handler)
       throws SAXException {
  -
  +        PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();
  +        
           AttributesImpl attributes = new AttributesImpl();
           Map parameter = layout.getParameters();
           Map.Entry entry;
  @@ -93,9 +92,9 @@
           	entry = (Map.Entry) iter.next();
               attributes.addCDATAAttribute((String)entry.getKey(), (String)entry.getValue());
           }
  -        XMLUtils.startElement(handler, this.getTagName(context), attributes);
  +        XMLUtils.startElement(handler, config.tagName, attributes);
           super.toSAX(context, layout, service, handler);
  -        XMLUtils.endElement(handler, this.getTagName(context));
  +        XMLUtils.endElement(handler, config.tagName);
   
       }
   
  @@ -125,5 +124,23 @@
           XMLUtils.endElement(handler, ITEM_STRING);
   
   	}
  +
  +    protected class PreparedConfiguration {
  +        public String tagName;
  +        
  +        public void takeValues(PreparedConfiguration from) {
  +            this.tagName = from.tagName;
  +        }
  +    }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
  +     */
  +    public Object prepareConfiguration(Parameters configuration) 
  +    throws ParameterException {
  +        PreparedConfiguration pc = new PreparedConfiguration();
  +        pc.tagName = configuration.getParameter("tag-name", "composite");
  +        return pc;
  +    }
   
   }
  
  
  
  1.5       +33 -6     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java
  
  Index: XSLTAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/XSLTAspect.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLTAspect.java	14 Jun 2003 17:55:43 -0000	1.4
  +++ XSLTAspect.java	15 Jun 2003 16:56:09 -0000	1.5
  @@ -57,6 +57,8 @@
   
   import org.apache.avalon.framework.component.Component;
   import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.parameters.ParameterException;
  +import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.components.variables.VariableResolver;
   import org.apache.cocoon.components.variables.VariableResolverFactory;
   import org.apache.cocoon.portal.PortalService;
  @@ -90,13 +92,15 @@
                           PortalService service,
                           ContentHandler handler)
       throws SAXException {
  +        PreparedConfiguration config = (PreparedConfiguration)context.getAspectConfiguration();
  +
           XSLTProcessor processor = null;
           Source stylesheet = null;
           SourceResolver resolver = null;
           try {
               resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
  -            stylesheet = resolver.resolveURI(this.getStylesheetURI(context, layout));
  -            processor = (XSLTProcessor) this.manager.lookup(XSLTProcessorImpl.ROLE);
  +            stylesheet = resolver.resolveURI(this.getStylesheetURI(config, layout));
  +            processor = (XSLTProcessor) this.manager.lookup(config.xsltRole);
               TransformerHandler transformer = processor.getTransformerHandler(stylesheet);
               SAXResult result = new SAXResult(new IncludeXMLConsumer((handler)));
               if (handler instanceof LexicalHandler) {
  @@ -122,10 +126,11 @@
           }
   	}
   
  -    protected String getStylesheetURI(RendererAspectContext context, Layout layout) {
  +    protected String getStylesheetURI(PreparedConfiguration config, Layout layout) {
  +
           // FIXME Get the stylesheet either from a layout attribute or another aspect
  -        String stylesheet =  context.getAspectParameters().getParameter("style", "NOTFOUND");
  -        // TODO make this more faster
  +        String stylesheet = config.stylesheet;
  +        // TODO make this faster
           VariableResolverFactory factory = null;
           try {
               factory = (VariableResolverFactory) this.manager.lookup(VariableResolverFactory.ROLE);
  @@ -143,4 +148,26 @@
           return stylesheet;
       }
   
  +    protected class PreparedConfiguration {
  +        public String stylesheet;
  +        public String xsltRole; 
  +
  +        public void takeValues(PreparedConfiguration from) {
  +            this.stylesheet = from.stylesheet;
  +            this.xsltRole = from.xsltRole;
  +        }
  +    }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
  +     */
  +    public Object prepareConfiguration(Parameters configuration) 
  +    throws ParameterException {
  +        PreparedConfiguration pc = new PreparedConfiguration();
  +        pc.stylesheet = configuration.getParameter("style");
  +        pc.xsltRole = configuration.getParameter("xslt-processor-role", XSLTProcessorImpl.ROLE);
  +        return pc;
  +    }
  +
   }
  +
  
  
  
  1.8       +37 -8     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java
  
  Index: TabContentAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/TabContentAspect.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TabContentAspect.java	14 Jun 2003 17:55:43 -0000	1.7
  +++ TabContentAspect.java	15 Jun 2003 16:56:09 -0000	1.8
  @@ -55,6 +55,7 @@
   import java.util.Map;
   
   import org.apache.avalon.framework.component.ComponentException;
  +import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.aspect.impl.DefaultAspectDescription;
  @@ -75,7 +76,8 @@
    * 
    * @version CVS $Id$
    */
  -public class TabContentAspect extends CompositeContentAspect {
  +public class TabContentAspect 
  +    extends CompositeContentAspect {
   
       /* (non-Javadoc)
        * @see org.apache.cocoon.portal.layout.renderer.RendererAspect#toSAX(org.apache.cocoon.portal.layout.renderer.RendererAspectContext,
org.apache.cocoon.portal.layout.Layout, org.apache.cocoon.portal.PortalService, org.xml.sax.ContentHandler)
  @@ -86,6 +88,8 @@
                           ContentHandler handler)
       throws SAXException {
           if (layout instanceof CompositeLayout) {
  +            TabPreparedConfiguration config = (TabPreparedConfiguration)context.getAspectConfiguration();
  +
               AttributesImpl attributes = new AttributesImpl();
               Map parameter = layout.getParameters();
   			Map.Entry entry;
  @@ -93,7 +97,7 @@
   				entry = (Map.Entry) iter.next();
   				attributes.addCDATAAttribute((String)entry.getKey(), (String)entry.getValue());
   			}
  -            XMLUtils.startElement(handler, this.getTagName(context), attributes);
  +            XMLUtils.startElement(handler, config.tagName, attributes);
   
               PortalService portalService = null;
               try {
  @@ -102,7 +106,7 @@
                   CompositeLayout tabLayout = (CompositeLayout) layout;
   
                   // selected tab
  -                Integer data = (Integer) layout.getAspectData(context.getAspectParameters().getParameter("aspect-name",
"tab"));
  +                Integer data = (Integer) layout.getAspectData(config.aspectName);
                   int selected = data.intValue();
                   
                   // loop over all tabs
  @@ -130,7 +134,7 @@
               } finally {
                   this.manager.release(portalService);
               }
  -            XMLUtils.endElement(handler, this.getTagName(context));
  +            XMLUtils.endElement(handler, config.tagName);
           } else {
               throw new SAXException("Wrong layout type, TabLayout expected: " + layout.getClass().getName());
           }
  @@ -142,14 +146,39 @@
        * Return the aspects required for this renderer
        * @return An iterator for the aspect descriptions or null.
        */
  -    public Iterator getAspectDescriptions(Parameters configuration) {
  +    public Iterator getAspectDescriptions(Object configuration) {
  +        TabPreparedConfiguration pc = (TabPreparedConfiguration)configuration;
  +        
           DefaultAspectDescription desc = new DefaultAspectDescription();
  -        desc.setName(configuration.getParameter("aspect-name", "tab"));
  +        desc.setName(pc.aspectName);
           desc.setClassName("java.lang.Integer");
  -        desc.setPersistence(configuration.getParameter("store", "session"));
  +        desc.setPersistence(pc.store);
           desc.setAutoCreate(true);
           
           return Collections.singletonList(desc).iterator();
  +    }
  +
  +    protected class TabPreparedConfiguration extends PreparedConfiguration {
  +        public String aspectName;
  +        public String store;
  +        
  +        public void takeValues(TabPreparedConfiguration from) {
  +            super.takeValues(from);
  +            this.aspectName = from.aspectName;
  +            this.store = from.store;
  +        }
  +    }
  +    
  +    /* (non-Javadoc)
  +     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
  +     */
  +    public Object prepareConfiguration(Parameters configuration) 
  +    throws ParameterException {
  +        TabPreparedConfiguration pc = new TabPreparedConfiguration();
  +        pc.takeValues((PreparedConfiguration)super.prepareConfiguration(configuration));
  +        pc.aspectName = configuration.getParameter("aspect-name", "tab");
  +        pc.store = configuration.getParameter("store");
  +        return pc;
       }
   
   }
  
  
  
  1.4       +11 -2     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractAspect.java
  
  Index: AbstractAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/impl/AbstractAspect.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractAspect.java	14 Jun 2003 17:55:43 -0000	1.3
  +++ AbstractAspect.java	15 Jun 2003 16:56:09 -0000	1.4
  @@ -56,6 +56,7 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.avalon.framework.thread.ThreadSafe;
   import org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect;
  @@ -84,8 +85,16 @@
        * Return the aspects required for this renderer
        * @return An iterator for the aspect descriptions or null.
        */
  -    public Iterator getAspectDescriptions(Parameters configuration) {
  +    public Iterator getAspectDescriptions(Object preparedConf) {
           return null;
  +    }
  +
  +    /* (non-Javadoc)
  +     * @see org.apache.cocoon.portal.layout.renderer.aspect.RendererAspect#prepareConfiguration(org.apache.avalon.framework.parameters.Parameters)
  +     */
  +    public Object prepareConfiguration(Parameters configuration) 
  +    throws ParameterException {
  +        return configuration;
       }
   
   }
  
  
  
  1.3       +3 -4      cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/RendererAspectContext.java
  
  Index: RendererAspectContext.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/RendererAspectContext.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RendererAspectContext.java	7 May 2003 20:24:03 -0000	1.2
  +++ RendererAspectContext.java	15 Jun 2003 16:56:09 -0000	1.3
  @@ -50,7 +50,6 @@
   */
   package org.apache.cocoon.portal.layout.renderer.aspect;
   
  -import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.Layout;
   import org.xml.sax.ContentHandler;
  @@ -75,9 +74,9 @@
       throws SAXException;
   
       /** 
  -     * Get the {@link Parameters} of the aspect.
  +     * Get the "compiled" configuration of the aspect.
        */
  -    Parameters getAspectParameters();
  +    Object getAspectConfiguration();
       
       /**
        * Set an attribute
  
  
  
  1.4       +18 -3     cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/RendererAspect.java
  
  Index: RendererAspect.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/portal/java/org/apache/cocoon/portal/layout/renderer/aspect/RendererAspect.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RendererAspect.java	14 Jun 2003 17:55:44 -0000	1.3
  +++ RendererAspect.java	15 Jun 2003 16:56:09 -0000	1.4
  @@ -53,6 +53,7 @@
   import java.util.Iterator;
   
   import org.apache.avalon.framework.component.Component;
  +import org.apache.avalon.framework.parameters.ParameterException;
   import org.apache.avalon.framework.parameters.Parameters;
   import org.apache.cocoon.portal.PortalService;
   import org.apache.cocoon.portal.layout.Layout;
  @@ -60,7 +61,8 @@
   import org.xml.sax.SAXException;
   
   /**
  - * A renderer aspect extends a renderer with a distinct functionality
  + * A renderer aspect extends a renderer with a distinct functionality.
  + * A renderer aspect has to be thread safe!
    * 
    * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
    * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  @@ -85,6 +87,19 @@
        * Return the aspects required for this renderer
        * @return An iterator for the aspect descriptions or null.
        */
  -    Iterator getAspectDescriptions(Parameters configuration);
  +    Iterator getAspectDescriptions(Object preparedConfiguration);
   
  +    /**
  +     * Compile the configuration.
  +     * A renderer aspect can "compile" the configuration in
  +     * order to increase performance.
  +     * If the renderer does not want to compile it should
  +     * simply return the configuration.
  +     * The "compiled" configuration is passed to the
  +     * {@link #getAspectDescriptions(Object)} method and
  +     * is available during streaming via the context object.
  +     * This method can also be used for validation the configuration.
  +     */
  +    Object prepareConfiguration(Parameters configuration)
  +    throws ParameterException;
   }
  
  
  

Mime
View raw message