Author: cziegeler Date: Tue Oct 19 01:21:39 2004 New Revision: 55054 Modified: cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/JaasSecurityGenerator.java cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/webservices/AbstractComposableService.java cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ChainMetaModule.java cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/LocateResource.java cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/SelectMetaInputModule.java cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLMetaModule.java cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java cocoon/trunk/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java Log: Move from Composable to Serviceable
Modified: cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/JaasSecurityGenerator.java ============================================================================== --- cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/JaasSecurityGenerator.java (original) +++ cocoon/trunk/src/blocks/authentication-fw/java/org/apache/cocoon/webapps/authentication/generation/JaasSecurityGenerator.java Tue Oct 19 01:21:39 2004 @@ -23,12 +23,9 @@ import javax.security.auth.callback.*; import javax.security.auth.login.LoginContext; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.parameters.Parameters; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.SourceResolver; -import org.apache.cocoon.generation.AbstractGenerator; import org.apache.cocoon.generation.ServiceableGenerator; import org.apache.cocoon.webapps.session.ContextManager; import org.xml.sax.SAXException; Modified: cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java ============================================================================== --- cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java (original) +++ cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/SoapServerImpl.java Tue Oct 19 01:21:39 2004 @@ -29,10 +29,6 @@ import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Startable; -import org.apache.avalon.framework.component.Component; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; @@ -40,6 +36,9 @@ import org.apache.avalon.framework.context.ContextException; import org.apache.avalon.framework.context.Contextualizable; import org.apache.avalon.framework.logger.AbstractLogEnabled; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.axis.AxisEngine; import org.apache.axis.Constants; @@ -88,10 +87,10 @@ * @author <a href="mailto:">Steve Loughran</a> * @author <a href="mailto:[EMAIL PROTECTED]">Doug Davis</a> * - * @version CVS $Id: SoapServerImpl.java,v 1.4 2004/03/28 20:51:24 antonio Exp $ + * @version CVS $Id$ */ public class SoapServerImpl extends AbstractLogEnabled - implements SoapServer, Composable, Configurable, Contextualizable, Initializable, + implements SoapServer, Serviceable, Configurable, Contextualizable, Initializable, Startable, ThreadSafe { /** @@ -127,8 +126,8 @@ // context reference private Context m_context; - // component manager reference - private ComponentManager m_manager; + // serivce manager reference + private ServiceManager m_manager; /** * Contextualize this Reader. @@ -145,11 +144,11 @@ /** * Compose this server * - * @param manager a <code>ComponentManager</code> value + * @param manager a <code>ServiceManager</code> value * @exception ComponentException if an error occurs */ - public void compose(ComponentManager manager) - throws ComponentException + public void service(ServiceManager manager) + throws ServiceException { m_manager = manager; } @@ -377,7 +376,7 @@ finally { if (resolver != null) m_manager.release(resolver); - if (parser != null) m_manager.release((Component)parser); + if (parser != null) m_manager.release(parser); } } @@ -490,7 +489,7 @@ // Add Avalon specifics to MessageContext msgContext.setProperty(LOGGER, getLogger()); - msgContext.setProperty(AvalonProvider.COMPONENT_MANAGER, m_manager); + msgContext.setProperty(AvalonProvider.SERVICE_MANAGER, m_manager); // Save some HTTP specific info in the bag in case someone needs it msgContext.setProperty(Constants.MC_JWS_CLASSDIR, m_jwsClassDir); Modified: cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java ============================================================================== --- cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java (original) +++ cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/components/axis/providers/AvalonProvider.java Tue Oct 19 01:21:39 2004 @@ -17,8 +17,7 @@ // currently part of Cocoon until it's officially in Axis CVS (BZ#12903) package org.apache.cocoon.components.axis.providers; -import org.apache.avalon.framework.component.Component; -import org.apache.avalon.framework.component.ComponentManager; +import org.apache.avalon.framework.service.ServiceManager; import org.apache.axis.AxisFault; import org.apache.axis.MessageContext; @@ -84,15 +83,14 @@ * </p> * * @author <a href="mailto:[EMAIL PROTECTED]">Marcus Crafter</a> - * @version CVS $Id: AvalonProvider.java,v 1.5 2004/03/05 13:01:42 bdelacretaz Exp $ + * @version CVS $Id$ */ -public class AvalonProvider extends RPCProvider -{ +public class AvalonProvider extends RPCProvider { /** - * Constant used to retrieve the ComponentManager reference + * Constant used to retrieve the ServiceManager reference * from the MessageContext object. */ - public static final String COMPONENT_MANAGER = "component-manager"; + public static final String SERVICE_MANAGER = "service-manager"; /** * Constant which represents the name of the ROLE this @@ -115,11 +113,11 @@ ) throws Exception { - ComponentManager manager = - (ComponentManager) msgContext.getProperty(COMPONENT_MANAGER); + ServiceManager manager = + (ServiceManager) msgContext.getProperty(SERVICE_MANAGER); if (manager == null) - throw new AxisFault("Could not access Avalon ComponentManager"); + throw new AxisFault("Could not access Avalon ServiceManager"); return decorate(manager.lookup(role), manager); } @@ -129,13 +127,12 @@ * proxy (see below). * * @param object a <code>Component</code> instance - * @param manager a <code>ComponentManager</code> instance + * @param manager a <code>ServiceManager</code> instance * @return the <code>Proxy</code> wrapped <code>Component</code> instance * @exception Exception if an error occurs */ - private Object decorate(final Component object, final ComponentManager manager) - throws Exception - { + private Object decorate(final Object object, final ServiceManager manager) + throws Exception { // obtain a list of all interfaces this object implements Class[] interfaces = object.getClass().getInterfaces(); @@ -160,8 +157,7 @@ * Return the option in the configuration that contains the service class * name. In the Avalon case, it is the ROLE name to lookup. */ - protected String getServiceClassNameOptionName() - { + protected String getServiceClassNameOptionName() { return ROLE; } @@ -240,17 +236,17 @@ private final String SL_DESTROY = "destroy"; private final Class SL_CLASS = ServiceLifecycle.class; - // Component & ComponentManager references - private final Component m_object; - private final ComponentManager m_manager; + // Component & ServiceManager references + private final Object m_object; + private final ServiceManager m_manager; /** * Simple constructor, sets all internal references * * @param object a <code>Component</code> instance - * @param manager a <code>ComponentManager</code> instance + * @param manager a <code>ServiceManager</code> instance */ - public Handler(final Component object, final ComponentManager manager) + public Handler(final Object object, final ServiceManager manager) { m_object = object; m_manager = manager; Modified: cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/webservices/AbstractComposableService.java ============================================================================== --- cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/webservices/AbstractComposableService.java (original) +++ cocoon/trunk/src/blocks/axis/java/org/apache/cocoon/webservices/AbstractComposableService.java Tue Oct 19 01:21:39 2004 @@ -17,9 +17,8 @@ import javax.xml.rpc.ServiceException; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.Serviceable; import org.apache.cocoon.components.axis.providers.AvalonProvider; /** @@ -40,10 +39,10 @@ */ public abstract class AbstractComposableService extends AbstractLogEnabledService - implements Composable { + implements Serviceable { - // component manager reference - protected ComponentManager m_manager; + // service manager reference + protected ServiceManager m_manager; /** * ServiceLifecycle <code>init</code> method. Updates an internal @@ -58,20 +57,18 @@ super.init(context); try { - setComponentManager(); + setServiceManager(); - } catch (ComponentException e) { + } catch (org.apache.avalon.framework.service.ServiceException e) { throw new ServiceException("ComponentException generated", e); } } - /** - * Compose this service. - * - * @param manager a <code>ComponentManager</code> instance - * @exception ComponentException if an error occurs + /* (non-Javadoc) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(final ComponentManager manager) throws ComponentException { + public void service(final ServiceManager manager) + throws org.apache.avalon.framework.service.ServiceException { m_manager = manager; } @@ -80,10 +77,10 @@ * from the context. * @exception ComponentException if an error occurs */ - private void setComponentManager() throws ComponentException { - compose( - (ComponentManager) m_context.getProperty( - AvalonProvider.COMPONENT_MANAGER + private void setServiceManager() throws org.apache.avalon.framework.service.ServiceException { + service( + (ServiceManager) m_context.getProperty( + AvalonProvider.SERVICE_MANAGER ) ); } Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/AbstractMetaModule.java Tue Oct 19 01:21:39 2004 @@ -20,12 +20,12 @@ import java.util.Map; import org.apache.avalon.framework.activity.Disposable; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.ComponentSelector; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceSelector; +import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; /** @@ -36,26 +36,26 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Turner</a> - * @version CVS $Id: AbstractMetaModule.java,v 1.10 2004/05/26 01:31:06 joerg Exp $ + * @version CVS $Id$ */ public abstract class AbstractMetaModule extends AbstractInputModule - implements Composable, Disposable { + implements Serviceable, Disposable { - /** The component manager instance */ - protected ComponentManager manager; + /** The service manager instance */ + protected ServiceManager manager; /** The cached InputModule-Selector */ - protected ComponentSelector inputSelector = null; + protected ServiceSelector inputSelector; /** The cached default InputModule */ - protected InputModule input = null; + protected InputModule input; /** The default InputModule name / shorthand. Defaults to 'request-param' */ protected String defaultInput = "request-param"; // default to request parameters /** The default InputModule configuration */ - protected Configuration inputConf = null; // will become an empty configuration object - // during configure() so why bother here... + protected Configuration inputConf; // will become an empty configuration object + // during configure() so why bother here... /** Is this instance initialized? */ protected boolean initialized = false; @@ -71,16 +71,10 @@ private final static String[] OPNAME = new String[] {"GET_VALUE", "GET_VALUES", "GET_NAMES"}; - /** - * Set the current <code>ComponentManager</code> instance used by this - * <code>Composable</code>. - */ - public void compose(ComponentManager manager) throws ComponentException { - + public void service(ServiceManager manager) throws ServiceException { this.manager=manager; } - /** * Initialize the meta module with exactly one other input * module. Since "meta" modules require references to components @@ -98,7 +92,7 @@ try { // obtain input modules if (!this.initialized) { - this.inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + this.inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); if (this.inputSelector != null && this.inputSelector instanceof ThreadSafe) { if (this.defaultInput != null) { @@ -137,15 +131,15 @@ * Obtain a permanent reference to an InputModule. */ protected InputModule obtainModule(String type) { - ComponentSelector inputSelector = this.inputSelector; + ServiceSelector inputSelector = this.inputSelector; InputModule module = null; try { if (inputSelector == null) - inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); - if (inputSelector.hasComponent(type)){ + if (inputSelector.isSelectable(type)){ - if (type != null && inputSelector.hasComponent(type)) + if (type != null && inputSelector.isSelectable(type)) module = (InputModule) inputSelector.select(type); if (!(module instanceof ThreadSafe) ) { @@ -158,9 +152,9 @@ getLogger().warn("A problem occurred setting up '" + type +"': Selector is "+(inputSelector!=null?"not ":"") +"null, Component is " - +(inputSelector!=null && inputSelector.hasComponent(type)?"known":"unknown")); + +(inputSelector!=null && inputSelector.isSelectable(type)?"known":"unknown")); - } catch (ComponentException ce) { + } catch (ServiceException ce) { if (getLogger().isWarnEnabled()) getLogger().warn("Could not obtain selector for InputModules: "+ce.getMessage()); } finally { @@ -177,17 +171,17 @@ * release a permanent reference to an InputModule. */ protected void releaseModule(InputModule module) { - ComponentSelector inputSelector = this.inputSelector; + ServiceSelector inputSelector = this.inputSelector; if (module != null) { try { // FIXME: Is it OK to release a module when we have released the selector before? if (inputSelector == null) - inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); inputSelector.release(module); module = null; - } catch (ComponentException ce) { + } catch (ServiceException ce) { if (getLogger().isWarnEnabled()) getLogger().warn("Could not obtain selector for InputModules: "+ce.getMessage()); } finally { @@ -307,7 +301,7 @@ InputModule dynamicMod, String dynamicModName, Configuration dynamicModConf) throws ConfigurationException { - ComponentSelector cs = this.inputSelector; + ServiceSelector cs = this.inputSelector; Object value = null; String name = null; InputModule input = null; @@ -317,8 +311,8 @@ try { if (cs == null) { try { - cs = (ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); - } catch (ComponentException e) { + cs = (ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + } catch (ServiceException e) { throw new ConfigurationException("Could not find MetaModule's module selector", e); } } @@ -344,11 +338,11 @@ } if (input == null) { - if (cs.hasComponent(name)) { + if (cs.isSelectable(name)) { release = true; try { input = (InputModule) cs.select(name); - } catch (ComponentException e) { + } catch (ServiceException e) { throw new ConfigurationException( "MetaModule unable to create "+ (useDynamic ? "dynamically" : "statically")+ Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ChainMetaModule.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ChainMetaModule.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/ChainMetaModule.java Tue Oct 19 01:21:39 2004 @@ -17,7 +17,7 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; -import org.apache.avalon.framework.component.ComponentSelector; +import org.apache.avalon.framework.service.ServiceSelector; import org.apache.avalon.framework.thread.ThreadSafe; import java.util.Map; @@ -60,7 +60,7 @@ * (<code><empty-as-null/></code>).</p> * * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> - * @version CVS $Id: ChainMetaModule.java,v 1.4 2004/03/05 13:02:48 bdelacretaz Exp $ + * @version CVS $Id$ */ public class ChainMetaModule extends AbstractMetaModule implements ThreadSafe { @@ -100,7 +100,7 @@ try { // obtain input modules if (!this.initialized) { - this.inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + this.inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); if (this.inputSelector != null && this.inputSelector instanceof ThreadSafe) { for (int i=0; i<this.inputs.length; i++) { Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/LocateResource.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/LocateResource.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/LocateResource.java Tue Oct 19 01:21:39 2004 @@ -15,11 +15,11 @@ */ package org.apache.cocoon.components.modules.input; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.excalibur.source.Source; @@ -54,16 +54,16 @@ * getAttributeNames() will return an Iterator to an empty collection.</p> * * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> - * @version CVS $Id: LocateResource.java,v 1.3 2004/03/05 13:02:48 bdelacretaz Exp $ + * @version CVS $Id$ */ -public class LocateResource extends AbstractInputModule implements Composable, ThreadSafe { +public class LocateResource extends AbstractInputModule implements Serviceable, ThreadSafe { - protected static Collection col = null; + protected static Collection col; static { col = new TreeSet(); } - protected ComponentManager manager = null; + protected ServiceManager manager; /** * Calculate the minimal length of the URL, that is the position @@ -146,7 +146,7 @@ urlstring = shortenURI(urlstring, minLen); } } - } catch (ComponentException e1) { + } catch (ServiceException e1) { if (this.getLogger().isErrorEnabled()) this.getLogger().error("Exception obtaining source resolver ", e1); } finally { @@ -157,11 +157,10 @@ return (found ? urlstring : null); } - /** - * Set the current <code>ComponentManager</code> instance used by this - * <code>Composable</code>. + /* (non-Javadoc) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(ComponentManager manager) throws ComponentException { + public void service(ServiceManager manager) throws ServiceException { this.manager = manager; } Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/SelectMetaInputModule.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/SelectMetaInputModule.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/SelectMetaInputModule.java Tue Oct 19 01:21:39 2004 @@ -19,8 +19,6 @@ import java.util.Map; import java.util.TreeMap; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.thread.ThreadSafe; @@ -47,7 +45,7 @@ * </tbody></table> * * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> - * @version CVS $Id: SelectMetaInputModule.java,v 1.4 2004/06/16 14:57:54 vgritsenko Exp $ + * @version CVS $Id$ */ public class SelectMetaInputModule extends AbstractMetaModule implements ThreadSafe { @@ -208,13 +206,6 @@ this.getLogger().debug("Obtained value : "+result); } return result; - } - - /* (non-Javadoc) - * @see org.apache.avalon.framework.component.Composable#compose(ComponentManager) - */ - public void compose(ComponentManager manager) throws ComponentException { - super.compose(manager); } /* (non-Javadoc) Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLFileModule.java Tue Oct 19 01:21:39 2004 @@ -15,12 +15,12 @@ */ package org.apache.cocoon.components.modules.input; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.logger.Logger; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.components.source.SourceUtil; import org.apache.commons.collections.map.AbstractReferenceMap; @@ -83,9 +83,9 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Jeff Turner</a> * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> - * @version CVS $Id: XMLFileModule.java,v 1.22 2004/06/30 21:04:08 pier Exp $ + * @version CVS $Id$ */ -public class XMLFileModule extends AbstractJXPathModule implements Composable, ThreadSafe { +public class XMLFileModule extends AbstractJXPathModule implements Serviceable, ThreadSafe { /** Static (cocoon.xconf) configuration location, for error reporting */ String staticConfLocation; @@ -101,7 +101,7 @@ String src; SourceResolver resolver; - ComponentManager manager; + ServiceManager manager; // // need two caches for Object and Object[] @@ -150,7 +150,7 @@ * @return a <code>Document</code> value * @exception Exception if an error occurs */ - public synchronized Document getDocument(ComponentManager manager, SourceResolver resolver, Logger logger) + public synchronized Document getDocument(ServiceManager manager, SourceResolver resolver, Logger logger) throws Exception { Source src = null; Document dom = null; @@ -218,11 +218,10 @@ - /** - * Set the current <code>ComponentManager</code> instance used by this - * <code>Composable</code>. + /* (non-Javadoc) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(ComponentManager manager) throws ComponentException { + public void service(ServiceManager manager) throws ServiceException { this.manager = manager; this.resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE); } Modified: cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLMetaModule.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLMetaModule.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/components/modules/input/XMLMetaModule.java Tue Oct 19 01:21:39 2004 @@ -22,11 +22,10 @@ import java.util.TreeSet; import java.util.Vector; -import org.apache.avalon.framework.component.Component; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.environment.ObjectModelHelper; @@ -90,7 +89,7 @@ * <p>Produces Objects of type [EMAIL PROTECTED] org.apache.cocoon.xml.dom.DocumentWrapper DocumentWrapper}</p> * * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> - * @version CVS $Id: XMLMetaModule.java,v 1.4 2004/03/05 13:02:48 bdelacretaz Exp $ + * @version CVS $Id$ */ public class XMLMetaModule extends AbstractMetaModule implements ThreadSafe { @@ -320,10 +319,10 @@ } /* (non-Javadoc) - * @see org.apache.avalon.framework.component.Composable#compose(org.apache.avalon.framework.component.ComponentManager) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(ComponentManager manager) throws ComponentException { - super.compose(manager); + public void service(ServiceManager manager) throws ServiceException { + super.service(manager); this.xpathProcessor = (XPathProcessor)this.manager.lookup(XPathProcessor.ROLE); } @@ -332,7 +331,7 @@ */ public void dispose() { if ( this.manager != null ) { - this.manager.release((Component)this.xpathProcessor); + this.manager.release(this.xpathProcessor); this.xpathProcessor = null; } super.dispose(); Modified: cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingRegexpMatcher.java Tue Oct 19 01:21:39 2004 @@ -19,12 +19,12 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; -import org.apache.avalon.framework.component.ComponentSelector; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Disposable; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceSelector; +import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.components.modules.input.InputModule; @@ -46,14 +46,14 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> - * @version CVS $Id: CachingRegexpMatcher.java,v 1.3 2004/03/05 13:02:57 bdelacretaz Exp $ + * @version CVS $Id$ */ public class CachingRegexpMatcher extends AbstractRegexpMatcher - implements Configurable, Initializable, Composable, Disposable + implements Configurable, Initializable, Serviceable, Disposable { - /** The component manager instance */ - protected ComponentManager manager; + /** The service manager instance */ + protected ServiceManager manager; private String defaultParam; private String defaultInput = "request-param"; // default to request parameters @@ -63,20 +63,19 @@ String INPUT_MODULE_SELECTOR = INPUT_MODULE_ROLE+"Selector"; private boolean initialized = false; - private InputModule input = null; - private ComponentSelector inputSelector = null; + private InputModule input; + private ServiceSelector inputSelector; - /** - * Set the current <code>ComponentManager</code> instance used by this - * <code>Composable</code>. + /* (non-Javadoc) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(ComponentManager manager) throws ComponentException { - + public void service(ServiceManager manager) throws ServiceException { this.manager=manager; } - - + /* (non-Javadoc) + * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) + */ public void configure(Configuration config) throws ConfigurationException { this.defaultParam = config.getChild("parameter-name").getValue(null); @@ -84,16 +83,16 @@ this.defaultInput = this.inputConf.getAttribute("name",this.defaultInput); } - - + /* (non-Javadoc) + * @see org.apache.avalon.framework.activity.Initializable#initialize() + */ public void initialize() { - try { // obtain input module - this.inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + this.inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); if (this.defaultInput != null && this.inputSelector != null && - this.inputSelector.hasComponent(this.defaultInput) + this.inputSelector.isSelectable(this.defaultInput) ){ this.input = (InputModule) this.inputSelector.select(this.defaultInput); if (!(this.input instanceof ThreadSafe && this.inputSelector instanceof ThreadSafe) ) { @@ -108,7 +107,7 @@ getLogger().error("A problem occurred setting up '" + this.defaultInput + "': Selector is "+(this.inputSelector!=null?"not ":"") +"null, Component is " - +(this.inputSelector!=null&&this.inputSelector.hasComponent(this.defaultInput)?"known":"unknown")); + +(this.inputSelector!=null&&this.inputSelector.isSelectable(this.defaultInput)?"known":"unknown")); } } catch (Exception e) { if (getLogger().isWarnEnabled()) @@ -170,12 +169,12 @@ } else { // input was not thread safe // so acquire it again - ComponentSelector iputSelector = null; + ServiceSelector iputSelector = null; InputModule iput = null; try { // obtain input module - iputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); - if (inputName != null && iputSelector != null && iputSelector.hasComponent(inputName)){ + iputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + if (inputName != null && iputSelector != null && iputSelector.isSelectable(inputName)){ iput = (InputModule) iputSelector.select(inputName); } if (iput != null) { Modified: cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/matching/modular/CachingWildcardMatcher.java Tue Oct 19 01:21:39 2004 @@ -19,16 +19,15 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; -import org.apache.avalon.framework.component.ComponentSelector; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.activity.Initializable; import org.apache.avalon.framework.activity.Disposable; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceSelector; +import org.apache.avalon.framework.service.Serviceable; import org.apache.avalon.framework.thread.ThreadSafe; import org.apache.cocoon.components.modules.input.InputModule; - import org.apache.cocoon.matching.AbstractWildcardMatcher; import java.util.Map; @@ -46,14 +45,14 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> - * @version CVS $Id: CachingWildcardMatcher.java,v 1.3 2004/03/05 13:02:57 bdelacretaz Exp $ + * @version CVS $Id$ */ public class CachingWildcardMatcher extends AbstractWildcardMatcher - implements Configurable, Initializable, Composable, Disposable + implements Configurable, Initializable, Serviceable, Disposable { - /** The component manager instance */ - protected ComponentManager manager; + /** The service manager instance */ + protected ServiceManager manager; private String defaultParam; private String defaultInput = "request-param"; // default to request parameters @@ -63,37 +62,32 @@ String INPUT_MODULE_SELECTOR = INPUT_MODULE_ROLE+"Selector"; private boolean initialized = false; - private InputModule input = null; - private ComponentSelector inputSelector = null; - - /** - * Set the current <code>ComponentManager</code> instance used by this - * <code>Composable</code>. - */ - public void compose(ComponentManager manager) throws ComponentException { + private InputModule input; + private ServiceSelector inputSelector; - this.manager=manager; + public void service(ServiceManager manager) throws ServiceException { + this.manager = manager; } - - + /* (non-Javadoc) + * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration) + */ public void configure(Configuration config) throws ConfigurationException { - this.defaultParam = config.getChild("parameter-name").getValue(null); this.inputConf = config.getChild("input-module"); this.defaultInput = this.inputConf.getAttribute("name",this.defaultInput); } - - + /* (non-Javadoc) + * @see org.apache.avalon.framework.activity.Initializable#initialize() + */ public void initialize() { - try { // obtain input module - this.inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + this.inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); if (this.defaultInput != null && this.inputSelector != null && - this.inputSelector.hasComponent(this.defaultInput) + this.inputSelector.isSelectable(this.defaultInput) ){ this.input = (InputModule) this.inputSelector.select(this.defaultInput); if (!(this.input instanceof ThreadSafe && this.inputSelector instanceof ThreadSafe) ) { @@ -108,7 +102,7 @@ getLogger().error("A problem occurred setting up '" + this.defaultInput + "': Selector is "+(this.inputSelector!=null?"not ":"") +"null, Component is " - +(this.inputSelector!=null&&this.inputSelector.hasComponent(this.defaultInput)?"known":"unknown")); + +(this.inputSelector!=null&&this.inputSelector.isSelectable(this.defaultInput)?"known":"unknown")); } } catch (Exception e) { if (getLogger().isWarnEnabled()) @@ -118,8 +112,10 @@ + /* (non-Javadoc) + * @see org.apache.avalon.framework.activity.Disposable#dispose() + */ public void dispose() { - if (!this.initialized) if (getLogger().isErrorEnabled()) getLogger().error("Uninitialized Component! FAILING"); @@ -170,12 +166,12 @@ } else { // input was not thread safe // so acquire it again - ComponentSelector iputSelector = null; + ServiceSelector iputSelector = null; InputModule iput = null; try { // obtain input module - iputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); - if (inputName != null && iputSelector != null && iputSelector.hasComponent(inputName)){ + iputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + if (inputName != null && iputSelector != null && iputSelector.isSelectable(inputName)){ iput = (InputModule) iputSelector.select(inputName); } if (iput != null) { Modified: cocoon/trunk/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/matching/modular/WildcardMatcher.java Tue Oct 19 01:21:39 2004 @@ -19,13 +19,12 @@ import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.framework.parameters.Parameters; -import org.apache.avalon.framework.component.ComponentSelector; -import org.apache.avalon.framework.component.ComponentException; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.ServiceSelector; +import org.apache.avalon.framework.service.Serviceable; import org.apache.cocoon.components.modules.input.InputModule; - import org.apache.cocoon.matching.AbstractWildcardMatcher; import java.util.Map; @@ -43,14 +42,14 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Christian Haul</a> * @author <a href="mailto:[EMAIL PROTECTED]">Sylvain Wallez</a> * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> - * @version CVS $Id: WildcardMatcher.java,v 1.3 2004/03/05 13:02:57 bdelacretaz Exp $ + * @version CVS $Id$ */ public class WildcardMatcher extends AbstractWildcardMatcher - implements Configurable, Composable + implements Configurable, Serviceable { - /** The component manager instance */ - protected ComponentManager manager; + /** The service manager instance */ + protected ServiceManager manager; private String defaultParam; private String defaultInput = "request-param"; // default to request parameters @@ -59,11 +58,10 @@ String INPUT_MODULE_ROLE = InputModule.ROLE; String INPUT_MODULE_SELECTOR = INPUT_MODULE_ROLE+"Selector"; - /** - * Set the current <code>ComponentManager</code> instance used by this - * <code>Composable</code>. + /* (non-Javadoc) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(ComponentManager manager) throws ComponentException { + public void service(ServiceManager manager) throws ServiceException { this.manager=manager; } @@ -89,7 +87,7 @@ } InputModule input = null; - ComponentSelector inputSelector = null; + ServiceSelector inputSelector = null; Object result = null; // one could test whether the input module is ThreadSafe and @@ -101,8 +99,8 @@ try { // obtain input module - inputSelector=(ComponentSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); - if (inputName != null && inputSelector != null && inputSelector.hasComponent(inputName)){ + inputSelector=(ServiceSelector) this.manager.lookup(INPUT_MODULE_SELECTOR); + if (inputName != null && inputSelector != null && inputSelector.isSelectable(inputName)){ input = (InputModule) inputSelector.select(inputName); } if (input != null) { Modified: cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java ============================================================================== --- cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java (original) +++ cocoon/trunk/src/java/org/apache/cocoon/transformation/AbstractDOMTransformer.java Tue Oct 19 01:21:39 2004 @@ -16,11 +16,10 @@ package org.apache.cocoon.transformation; import org.apache.avalon.framework.activity.Disposable; -import org.apache.avalon.framework.component.ComponentManager; -import org.apache.avalon.framework.component.Composable; import org.apache.avalon.framework.parameters.Parameters; - -import org.apache.avalon.excalibur.pool.Recyclable; +import org.apache.avalon.framework.service.ServiceException; +import org.apache.avalon.framework.service.ServiceManager; +import org.apache.avalon.framework.service.Serviceable; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.environment.SourceResolver; @@ -45,10 +44,10 @@ * @author <a href="mailto:[EMAIL PROTECTED]">Ross Burton</a> * @author <a href="mailto:[EMAIL PROTECTED]">Bruce G. Robertson</a> * @author <a href="mailto:[EMAIL PROTECTED]">Vadim Gritsenko</a> - * @version CVS $Id: AbstractDOMTransformer.java,v 1.3 2004/04/28 16:35:21 joerg Exp $ + * @version CVS $Id$ */ public abstract class AbstractDOMTransformer extends AbstractTransformer - implements Transformer, DOMBuilder.Listener, Composable, Disposable, Recyclable { + implements DOMBuilder.Listener, Serviceable, Disposable { /** * The SAX entity resolver @@ -71,9 +70,9 @@ protected Parameters parameters; /** - * A <code>ComponentManager</code> which is available for use. + * A <code>ServiceManager</code> which is available for use. */ - protected ComponentManager manager; + protected ServiceManager manager; /** * The <code>DOMBuilder</code> used to build DOM tree out of @@ -87,10 +86,10 @@ this.builder = new DOMBuilder(this); } - /** - * Set the component manager. + /* (non-Javadoc) + * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager) */ - public void compose(ComponentManager manager) { + public void service(ServiceManager manager) throws ServiceException { this.manager = manager; } @@ -119,10 +118,11 @@ this.objectModel = null; this.parameters = null; this.builder.recycle(); + super.recycle(); } - /** - * dispose + /* (non-Javadoc) + * @see org.apache.avalon.framework.activity.Disposable#dispose() */ public void dispose() { this.builder = null;