cziegeler 02/05/29 05:50:21 Modified: . changes.xml src/java/org/apache/cocoon Cocoon.java Processor.java ProcessorWrapper.java src/java/org/apache/cocoon/components CocoonComponentManager.java SitemapConfigurable.java src/java/org/apache/cocoon/components/treeprocessor TreeProcessor.java src/java/org/apache/cocoon/components/treeprocessor/sitemap PipelinesNode.java PipelinesNodeBuilder.java src/java/org/apache/cocoon/webapps/authentication/components AuthenticationManager.java Log: Added custom component configuration Revision Changes Path 1.177 +4 -1 xml-cocoon2/changes.xml Index: changes.xml =================================================================== RCS file: /home/cvs/xml-cocoon2/changes.xml,v retrieving revision 1.176 retrieving revision 1.177 diff -u -r1.176 -r1.177 --- changes.xml 29 May 2002 12:02:14 -0000 1.176 +++ changes.xml 29 May 2002 12:50:20 -0000 1.177 @@ -4,7 +4,7 @@ <!-- History of Cocoon changes - $Id: changes.xml,v 1.176 2002/05/29 12:02:14 cziegeler Exp $ + $Id: changes.xml,v 1.177 2002/05/29 12:50:20 cziegeler Exp $ --> <changes title="History of Changes"> @@ -38,6 +38,9 @@ </devs> <release version="@version@" date="@date@"> + <action dev="CZ" type="add"> + Added custom component configuration to map:pipelines section. + </action> <action dev="CZ" type="add"> Added global parameters to map:pipelines section. </action> 1.29 +9 -1 xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java Index: Cocoon.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Cocoon.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- Cocoon.java 27 May 2002 14:02:29 -0000 1.28 +++ Cocoon.java 29 May 2002 12:50:20 -0000 1.29 @@ -96,7 +96,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> (Apache Software Foundation, Exoffice Technologies) * @author <a href="mailto:[EMAIL PROTECTED]">Stefano Mazzocchi</a> * @author <a href="mailto:[EMAIL PROTECTED]">Leo Sutic</a> - * @version CVS $Id: Cocoon.java,v 1.28 2002/05/27 14:02:29 cziegeler Exp $ + * @version CVS $Id: Cocoon.java,v 1.29 2002/05/29 12:50:20 cziegeler Exp $ */ public class Cocoon extends AbstractLoggable @@ -638,6 +638,14 @@ --activeRequestCount; } } + } + + /** + * Get the sitemap component configurations + * @since @next-version@ + */ + public Configuration getComponentConfigurations() { + return null; } /** 1.8 +8 -1 xml-cocoon2/src/java/org/apache/cocoon/Processor.java Index: Processor.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/Processor.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- Processor.java 27 May 2002 14:02:29 -0000 1.7 +++ Processor.java 29 May 2002 12:50:20 -0000 1.8 @@ -51,6 +51,7 @@ package org.apache.cocoon; import org.apache.avalon.framework.component.Component; +import org.apache.avalon.framework.configuration.Configuration; import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; @@ -59,7 +60,7 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Pierpaolo Fumagalli</a> * (Apache Software Foundation, Exoffice Technologies) * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: Processor.java,v 1.7 2002/05/27 14:02:29 cziegeler Exp $ + * @version CVS $Id: Processor.java,v 1.8 2002/05/29 12:50:20 cziegeler Exp $ */ public interface Processor extends Component { @@ -85,4 +86,10 @@ */ ProcessingPipeline processInternal(Environment environment) throws Exception; + + /** + * Get the sitemap component configurations + * @since @next-version@ + */ + Configuration getComponentConfigurations(); } 1.8 +10 -1 xml-cocoon2/src/java/org/apache/cocoon/ProcessorWrapper.java Index: ProcessorWrapper.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/ProcessorWrapper.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- ProcessorWrapper.java 27 May 2002 14:02:29 -0000 1.7 +++ ProcessorWrapper.java 29 May 2002 12:50:20 -0000 1.8 @@ -52,6 +52,7 @@ import org.apache.avalon.framework.activity.Disposable; import org.apache.avalon.framework.component.Component; +import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.components.pipeline.ProcessingPipeline; import org.apache.cocoon.environment.Environment; @@ -60,7 +61,7 @@ * This class is a wrapper around the real processor (the <code>Cocoon</code> class). * It is necessary to avoid infinite dispose loops * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: ProcessorWrapper.java,v 1.7 2002/05/27 14:02:29 cziegeler Exp $ + * @version CVS $Id: ProcessorWrapper.java,v 1.8 2002/05/29 12:50:20 cziegeler Exp $ */ public final class ProcessorWrapper implements Processor, Component, Disposable, ThreadSafe { @@ -91,6 +92,14 @@ public ProcessingPipeline processInternal(Environment environment) throws Exception { return this.processor.processInternal(environment); + } + + /** + * Get the sitemap component configurations + * @since @next-version@ + */ + public Configuration getComponentConfigurations() { + return this.processor.getComponentConfigurations(); } } 1.20 +23 -9 xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java Index: CocoonComponentManager.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/CocoonComponentManager.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- CocoonComponentManager.java 29 May 2002 09:12:04 -0000 1.19 +++ CocoonComponentManager.java 29 May 2002 12:50:20 -0000 1.20 @@ -63,7 +63,9 @@ import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.component.ComponentSelector; import org.apache.avalon.framework.component.Recomposable; +import org.apache.avalon.framework.configuration.Configuration; import org.apache.cocoon.ProcessingException; +import org.apache.cocoon.Processor; import org.apache.cocoon.environment.Environment; import java.net.MalformedURLException; import org.apache.excalibur.source.Source; @@ -79,7 +81,7 @@ * and by handling the lookup of the <code>SourceResolver</code> (in development) * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: CocoonComponentManager.java,v 1.19 2002/05/29 09:12:04 cziegeler Exp $ + * @version CVS $Id: CocoonComponentManager.java,v 1.20 2002/05/29 12:50:20 cziegeler Exp $ */ public final class CocoonComponentManager extends ExcaliburComponentManager @@ -123,7 +125,7 @@ */ public static void enterEnvironment(Environment env, Map objectModel, - Object processor) { + Processor processor) { if (environmentStack.get() == null) { environmentStack.set(new Stack()); } @@ -131,11 +133,11 @@ if ( !stack.empty() ) { final Object[] objects = (Object[])stack.peek(); if ( objects[1] == objectModel ) { - stack.push(new Object[] {env, objectModel, objects[2], TWO, processor}); + stack.push(new Object[] {env, objectModel, objects[2], TWO, processor, processor.getComponentConfigurations()}); return; } } - stack.push(new Object[] {env, objectModel, new HashMap(5), ONE, processor, new ArrayList(2)}); + stack.push(new Object[] {env, objectModel, new HashMap(5), ONE, processor, processor.getComponentConfigurations(), new ArrayList(2)}); } /** @@ -153,8 +155,8 @@ final Component component = (Component)o[0]; ((CocoonComponentManager)o[1]).releaseRLComponent( component ); } - if (objects.length > 5) { - final List automaticReleasedComponents = (List)objects[5]; + if (objects.length > 6) { + final List automaticReleasedComponents = (List)objects[6]; for(int i = 0; i < automaticReleasedComponents.size(); i++) { final Object[] o = (Object[])automaticReleasedComponents.get(i); final Component component = (Component)o[0]; @@ -225,6 +227,18 @@ } ((RequestLifecycleComponent) component).setup((org.apache.cocoon.environment.SourceResolver)objects[0], (Map)objects[1]); + if (component instanceof SitemapConfigurable) { + for(int i=0; i < stack.size(); i++) { + Object[] o = (Object[])stack.get(i); + Configuration cc = (Configuration)o[5]; + if ( null != cc ) { + cc = cc.getChild( role, false ); + if ( null != cc ) { + ((SitemapConfigurable) component).setSitemapConfiguration(cc); + } + } + } + } } catch (Exception local) { throw new ComponentException("Exception during setup of RequestLifecycleComponent with role '"+role+"'", local); } @@ -262,7 +276,7 @@ final Stack stack = (Stack)environmentStack.get(); if ( null != stack && !stack.empty()) { final Object[] objects = (Object[])stack.firstElement(); - final List automaticReleasedComponents = (List)objects[5]; + final List automaticReleasedComponents = (List)objects[6]; automaticReleasedComponents.add(new Object[] {component, selector, manager}); } else { throw new ProcessingException("Unable to add component for automatic release: no environment available."); @@ -278,7 +292,7 @@ final Stack stack = (Stack)environmentStack.get(); if ( null != stack && !stack.empty()) { final Object[] objects = (Object[])stack.firstElement(); - final List automaticReleasedComponents = (List)objects[5]; + final List automaticReleasedComponents = (List)objects[6]; automaticReleasedComponents.add(new Object[] {component, manager}); } else { throw new ProcessingException("Unable to add component for automatic release: no environment available."); @@ -293,7 +307,7 @@ final Stack stack = (Stack)environmentStack.get(); if ( null != stack && !stack.empty()) { final Object[] objects = (Object[])stack.firstElement(); - final List automaticReleasedComponents = (List)objects[5]; + final List automaticReleasedComponents = (List)objects[6]; int i = 0; boolean found = false; while (i < automaticReleasedComponents.size() && !found) { 1.2 +3 -2 xml-cocoon2/src/java/org/apache/cocoon/components/SitemapConfigurable.java Index: SitemapConfigurable.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/SitemapConfigurable.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SitemapConfigurable.java 29 May 2002 12:02:14 -0000 1.1 +++ SitemapConfigurable.java 29 May 2002 12:50:20 -0000 1.2 @@ -60,9 +60,10 @@ * * @since @next-version@ * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: SitemapConfigurable.java,v 1.1 2002/05/29 12:02:14 cziegeler Exp $ + * @version CVS $Id: SitemapConfigurable.java,v 1.2 2002/05/29 12:50:20 cziegeler Exp $ */ -public interface SitemapConfigurable { +public interface SitemapConfigurable + extends RequestLifecycleComponent { /** * Set the <code>Configuration</code>. 1.12 +29 -3 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java Index: TreeProcessor.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- TreeProcessor.java 27 May 2002 14:02:29 -0000 1.11 +++ TreeProcessor.java 29 May 2002 12:50:21 -0000 1.12 @@ -94,11 +94,19 @@ * Interpreted tree-traversal implementation of a pipeline assembly language. * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> - * @version CVS $Id: TreeProcessor.java,v 1.11 2002/05/27 14:02:29 cziegeler Exp $ + * @version CVS $Id: TreeProcessor.java,v 1.12 2002/05/29 12:50:21 cziegeler Exp $ */ -public class TreeProcessor extends AbstractLoggable implements ThreadSafe, Processor, - Composable, Configurable, LogKitManageable, RoleManageable, Contextualizable, Disposable { +public class TreeProcessor + extends AbstractLoggable + implements ThreadSafe, + Processor, + Composable, + Configurable, + LogKitManageable, + RoleManageable, + Contextualizable, + Disposable { private static final String XCONF_URL = "resource://org/apache/cocoon/components/treeprocessor/treeprocessor-builtins.xml"; @@ -148,6 +156,9 @@ /** Check for reload? */ protected boolean checkReload; + /** component configurations */ + protected Configuration componentConfigurations; + /** * Create a TreeProcessor. */ @@ -337,6 +348,21 @@ } finally { context.dispose(); } + } + + /** + * Set the sitemap component configurations + */ + public void setComponentConfigurations(Configuration componentConfigurations) { + this.componentConfigurations = componentConfigurations; + } + + /** + * Get the sitemap component configurations + * @since @next-version@ + */ + public Configuration getComponentConfigurations() { + return this.componentConfigurations; } protected synchronized void setupRootNode(Environment env) throws Exception { 1.7 +3 -6 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java Index: PipelinesNode.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNode.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- PipelinesNode.java 29 May 2002 12:02:15 -0000 1.6 +++ PipelinesNode.java 29 May 2002 12:50:21 -0000 1.7 @@ -73,7 +73,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: PipelinesNode.java,v 1.6 2002/05/29 12:02:15 cziegeler Exp $ + * @version CVS $Id: PipelinesNode.java,v 1.7 2002/05/29 12:50:21 cziegeler Exp $ */ public final class PipelinesNode extends SimpleParentProcessingNode @@ -85,20 +85,17 @@ private Processor processor; + /** Global sitemap parameters */ private Map globalParameters; /** * Constructor * @param processor The processor for this sitemap * @param parameters Optional global parameters for this sitemap (can be null) - * @param componentConfigurations Optional sitemap configurations for components */ public PipelinesNode(Processor processor, - Map parameters, - Configuration[] componentConfigurations) { + Map parameters) { this.processor = processor; - // FIXME - we have the parameters and the component configurations - // and now? this.globalParameters = parameters; } 1.4 +3 -5 xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNodeBuilder.java Index: PipelinesNodeBuilder.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelinesNodeBuilder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- PipelinesNodeBuilder.java 29 May 2002 12:02:15 -0000 1.3 +++ PipelinesNodeBuilder.java 29 May 2002 12:50:21 -0000 1.4 @@ -63,7 +63,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: PipelinesNodeBuilder.java,v 1.3 2002/05/29 12:02:15 cziegeler Exp $ + * @version CVS $Id: PipelinesNodeBuilder.java,v 1.4 2002/05/29 12:50:21 cziegeler Exp $ */ public class PipelinesNodeBuilder extends ContainerNodeBuilder implements ThreadSafe { @@ -71,7 +71,6 @@ public ProcessingNode buildNode(Configuration config) throws Exception { Map parameters = null; - Configuration[] componentConfigs = null; // check for global paramters Configuration child = config.getChild("global-parameters", false); @@ -92,11 +91,10 @@ child = config.getChild("component-configurations", false); if (child != null) { this.checkNamespace(child); - componentConfigs = child.getChildren(); + this.treeBuilder.getProcessor().setComponentConfigurations(child); } PipelinesNode node = new PipelinesNode(this.treeBuilder.getProcessor(), - parameters, - componentConfigs); + parameters); this.treeBuilder.setupNode(node, config); ProcessingNode[] children = buildChildNodes(config); 1.5 +11 -2 xml-cocoon2/src/java/org/apache/cocoon/webapps/authentication/components/AuthenticationManager.java Index: AuthenticationManager.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/webapps/authentication/components/AuthenticationManager.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- AuthenticationManager.java 29 Apr 2002 08:52:07 -0000 1.4 +++ AuthenticationManager.java 29 May 2002 12:50:21 -0000 1.5 @@ -61,6 +61,7 @@ import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.ProcessingException; +import org.apache.cocoon.components.SitemapConfigurable; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Redirector; import org.apache.cocoon.environment.Request; @@ -97,11 +98,11 @@ * This is the basis authentication component. * * @author <a href="mailto:[EMAIL PROTECTED]">Carsten Ziegeler</a> - * @version CVS $Id: AuthenticationManager.java,v 1.4 2002/04/29 08:52:07 cziegeler Exp $ + * @version CVS $Id: AuthenticationManager.java,v 1.5 2002/05/29 12:50:21 cziegeler Exp $ */ public final class AuthenticationManager extends AbstractSessionComponent -implements Configurable { +implements Configurable, SitemapConfigurable { /** The Avalon Role */ public static final String ROLE = AuthenticationManager.class.getName(); @@ -180,6 +181,14 @@ this.handler = null; this.handlerName = null; this.userHandlers = null; + } + + /** + * Set the <code>Configuration</code>. + */ + public void setSitemapConfiguration(Configuration config) + throws ConfigurationException { + System.out.println("Got config: " + config); } /**
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]