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.2/src/java/org/apache/cocoon Cocoon.java
Date Sun, 19 Oct 2003 17:43:18 GMT
cziegeler    2003/10/19 10:43:18

  Modified:    src/java/org/apache/cocoon/components/flow
                        CompilingInterpreter.java
               src/java/org/apache/cocoon/components/treeprocessor
                        TreeProcessor.java
               src/java/org/apache/cocoon Cocoon.java
  Log:
  Cleaning up code, moving more components to Serviceable
  
  Revision  Changes    Path
  1.2       +5 -5      cocoon-2.2/src/java/org/apache/cocoon/components/flow/CompilingInterpreter.java
  
  Index: CompilingInterpreter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/flow/CompilingInterpreter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CompilingInterpreter.java	15 Oct 2003 17:04:50 -0000	1.1
  +++ CompilingInterpreter.java	19 Oct 2003 17:43:17 -0000	1.2
  @@ -49,8 +49,8 @@
   import java.util.Iterator;
   import java.util.Map;
   
  -import org.apache.avalon.framework.component.ComponentException;
  -import org.apache.avalon.framework.component.ComponentManager;
  +import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.avalon.framework.service.ServiceManager;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceResolver;
   import org.mozilla.javascript.Context;
  @@ -79,8 +79,8 @@
       /**
        * Composable
        */
  -    public void compose(ComponentManager manager) throws ComponentException {
  -        super.compose(manager);
  +    public void service(ServiceManager manager) throws ServiceException {
  +        super.service(manager);
           this.sourceresolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
       }
   
  
  
  
  1.18      +31 -12    cocoon-2.2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
  
  Index: TreeProcessor.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TreeProcessor.java	19 Oct 2003 16:12:54 -0000	1.17
  +++ TreeProcessor.java	19 Oct 2003 17:43:17 -0000	1.18
  @@ -59,20 +59,23 @@
   import org.apache.avalon.excalibur.component.RoleManageable;
   import org.apache.avalon.excalibur.component.RoleManager;
   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.Composable;
   import org.apache.avalon.framework.component.Recomposable;
   import org.apache.avalon.framework.configuration.Configurable;
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.configuration.SAXConfigurationHandler;
  +import org.apache.avalon.framework.container.ContainerUtil;
   import org.apache.avalon.framework.context.Context;
   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.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.Constants;
   import org.apache.cocoon.Processor;
   import org.apache.cocoon.components.ChainedConfiguration;
   import org.apache.cocoon.components.CocoonComponentManager;
  @@ -82,6 +85,7 @@
   import org.apache.cocoon.components.source.SourceUtil;
   import org.apache.cocoon.components.source.impl.DelayedRefreshSourceWrapper;
   import org.apache.cocoon.environment.Environment;
  +import org.apache.cocoon.environment.EnvironmentHelper;
   import org.apache.cocoon.environment.wrapper.EnvironmentWrapper;
   import org.apache.cocoon.environment.wrapper.MutableEnvironmentFacade;
   import org.apache.excalibur.source.Source;
  @@ -98,7 +102,7 @@
       extends AbstractLogEnabled
       implements ThreadSafe,
                  Processor,
  -               Composable,
  +               Serviceable,
                  Configurable,
                  RoleManageable,
                  Contextualizable,
  @@ -116,7 +120,7 @@
       protected Context context;
   
       /** The component manager */
  -    protected ComponentManager manager;
  +    protected ServiceManager manager;
   
       /** The role manager */
       protected RoleManager roleManager;
  @@ -163,6 +167,9 @@
       /** The source resolver */
       protected SourceResolver resolver;
       
  +    /** The environment helper */
  +    protected EnvironmentHelper environmentHelper;
  +
       /**
        * Create a TreeProcessor.
        */
  @@ -177,7 +184,7 @@
       /**
        * Create a child processor for a given language
        */
  -    protected TreeProcessor(TreeProcessor parent, ComponentManager manager, String language)
{
  +    protected TreeProcessor(TreeProcessor parent, ServiceManager manager, String language)
{
           this.parent = parent;
           this.language = (language == null) ? parent.language : language;
   
  @@ -203,7 +210,7 @@
        * @return a new child processor.
        */
       public TreeProcessor createChildProcessor(
  -        ComponentManager manager,
  +        ServiceManager manager,
           String language,
           Source source)
         throws Exception {
  @@ -219,9 +226,17 @@
           this.context = context;
       }
   
  -    public void compose(ComponentManager manager) throws ComponentException {
  +    public void service(ServiceManager manager) throws ServiceException {
           this.manager = manager;
           this.resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
  +        try {
  +            this.environmentHelper = new EnvironmentHelper(
  +                         (String) this.context.get(Constants.CONTEXT_ROOT_URL));
  +            ContainerUtil.enableLogging(this.environmentHelper, this.getLogger());
  +            ContainerUtil.service(this.environmentHelper, this.manager);
  +        } catch (ContextException e) {
  +            throw new ServiceException("Unable to get context root url from context.",
e);
  +        }
       }
   
       public void setRoleManager(RoleManager rm) {
  @@ -528,8 +543,13 @@
           this.rootNode = root;
       }
   
  +    /* (non-Javadoc)
  +     * @see org.apache.avalon.framework.activity.Disposable#dispose()
  +     */
       public void dispose() {
  -        disposeTree();
  +        this.disposeTree();
  +        ContainerUtil.dispose(this.environmentHelper);
  +        this.environmentHelper = null;
           if (this.parent == null) {
               // root processor : dispose the builder selector
               this.builderSelector.dispose();
  @@ -566,7 +586,7 @@
       private static final class ForwardEnvironmentWrapper extends EnvironmentWrapper {
   
           public ForwardEnvironmentWrapper(Environment env,
  -            ComponentManager manager, String uri, Logger logger) throws MalformedURLException
{
  +            ServiceManager manager, String uri, Logger logger) throws MalformedURLException
{
               super(env, manager, uri, logger);
           }
   
  @@ -591,8 +611,7 @@
        * @see org.apache.cocoon.Processor#getSourceResolver()
        */
       public org.apache.cocoon.environment.SourceResolver getSourceResolver() {
  -        // TODO (CZ) Add real resolver here
  -        return (org.apache.cocoon.environment.SourceResolver)this.resolver;
  +        return this.environmentHelper;
       }
   
   }
  
  
  
  1.24      +2 -1      cocoon-2.2/src/java/org/apache/cocoon/Cocoon.java
  
  Index: Cocoon.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.2/src/java/org/apache/cocoon/Cocoon.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- Cocoon.java	19 Oct 2003 17:27:32 -0000	1.23
  +++ Cocoon.java	19 Oct 2003 17:43:17 -0000	1.24
  @@ -251,6 +251,7 @@
        */
       public void dispose() {
           ContainerUtil.dispose(this.environmentHelper);
  +        this.environmentHelper = null;
           this.context = null;
           this.disposed = true;
       }
  
  
  

Mime
View raw message