You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2004/09/07 00:49:12 UTC

cvs commit: jakarta-tapestry/junit/src/org/apache/tapestry/junit MockEngine.java MockRequestCycle.java

hlship      2004/09/06 15:49:12

  Modified:    framework/src/java/org/apache/tapestry/services/impl
                        PropertySourceContribution.java
                        ImplStrings.properties ImplMessages.java
                        PropertySourceImpl.java InfrastructureImpl.java
                        ObjectPoolImpl.java
               framework/src/java/org/apache/tapestry/resolver
                        AbstractSpecificationResolver.java
               framework/src/java/org/apache/tapestry/request
                        RequestContext.java
               framework/src/java/org/apache/tapestry/services
                        Infrastructure.java
               framework/src/descriptor/META-INF tapestry.parse.xml
                        hivemodule.xml tapestry.request.xml
               framework/src/java/org/apache/tapestry/pageload
                        PageSource.java
               framework/src/java/org/apache/tapestry/binding
                        ListenerBinding.java
               .        .classpath
               framework/src/java/org/apache/tapestry/engine
                        AbstractEngine.java
               framework/src/java/org/apache/tapestry IEngine.java
               framework/src/java/org/apache/tapestry/bean Default.java
               junit/src/org/apache/tapestry/junit MockEngine.java
                        MockRequestCycle.java
  Added:       framework/src/java/org/apache/tapestry/services/impl
                        InfrastructureObjectProvider.java
  Removed:     framework/src/java/org/apache/tapestry/util
                        IRenderDescription.java JanitorThread.java
                        ICleanable.java
               junit/src/org/apache/tapestry/junit/utils TestPool.java
               framework/src/java/org/apache/tapestry/engine
                        BSFManagerPoolableAdaptor.java
  Log:
  Replace the old-as-the-hills Pool class with the new ObjectPool service interface.
  Remove outdated code.
  Add the InfrastructureObjectProvider.
  
  Revision  Changes    Path
  1.2       +3 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/PropertySourceContribution.java
  
  Index: PropertySourceContribution.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/PropertySourceContribution.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertySourceContribution.java	3 Sep 2004 17:45:49 -0000	1.1
  +++ PropertySourceContribution.java	6 Sep 2004 22:49:11 -0000	1.2
  @@ -24,7 +24,7 @@
    * @author Howard Lewis Ship
    * @since 3.1
    */
  -public class PropertySourceContribution extends BaseLocatable implements IPropertySource
  +public class PropertySourceContribution extends BaseLocatable
   {
       private String _name;
       private String _before;
  @@ -66,9 +66,9 @@
           _source = source;
       }
   
  -    public String getPropertyValue(String propertyName)
  +    public IPropertySource getSource()
       {
  -        return _source.getPropertyValue(propertyName);
  +        return _source;
       }
   
   }
  
  
  
  1.2       +2 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties
  
  Index: ImplStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ImplStrings.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ImplStrings.properties	3 Sep 2004 17:45:49 -0000	1.1
  +++ ImplStrings.properties	6 Sep 2004 22:49:11 -0000	1.2
  @@ -22,3 +22,5 @@
   unable-to-read-template=Could not read template {0}.
   
   unable-to-parse-specification=Could not parse specification {0}.
  +
  +unable-to-read-infrastructure-property=Unable to read property ''{0}'' of {1}: {2}
  
  
  
  1.2       +17 -4     jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java
  
  Index: ImplMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ImplMessages.java	3 Sep 2004 17:45:49 -0000	1.1
  +++ ImplMessages.java	6 Sep 2004 22:49:11 -0000	1.2
  @@ -20,6 +20,7 @@
   
   import org.apache.hivemind.Resource;
   import org.apache.hivemind.impl.MessageFormatter;
  +import org.apache.tapestry.services.Infrastructure;
   
   /**
    * 
  @@ -61,14 +62,26 @@
       {
           return _formatter.format("unable-to-read-template", template);
       }
  -    
  +
       public static String unableToParseTemplate(Resource resource)
       {
  -    	return _formatter.format("unable-to-parse-template", resource);
  +        return _formatter.format("unable-to-parse-template", resource);
       }
  -    
  +
       public static String unableToParseSpecification(Resource resource)
       {
  -    	return _formatter.format("unable-to-parse-specification", resource);
  +        return _formatter.format("unable-to-parse-specification", resource);
  +    }
  +
  +    public static String unableToReadInfrastructureProperty(
  +        String propertyName,
  +        Infrastructure service,
  +        Throwable cause)
  +    {
  +        return _formatter.format(
  +            "unable-to-read-infrastructure-property",
  +            propertyName,
  +            service,
  +            cause);
       }
   }
  
  
  
  1.2       +13 -14    jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/PropertySourceImpl.java
  
  Index: PropertySourceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/PropertySourceImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertySourceImpl.java	3 Sep 2004 17:45:49 -0000	1.1
  +++ PropertySourceImpl.java	6 Sep 2004 22:49:11 -0000	1.2
  @@ -21,6 +21,7 @@
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.order.Orderer;
   import org.apache.tapestry.engine.IPropertySource;
  +import org.apache.tapestry.util.DelegatingPropertySource;
   
   /**
    * Orders a list of {@link org.apache.tapestry.services.impl.PropertySourceContribution}s
  @@ -32,7 +33,7 @@
   public class PropertySourceImpl implements IPropertySource
   {
       private List _contributions;
  -    private List _orderedSources;
  +    private IPropertySource _delegate;
       private ErrorHandler _errorHandler;
       private Log _log;
   
  @@ -49,26 +50,24 @@
               orderer.add(c, c.getName(), c.getAfter(), c.getBefore());
           }
   
  -        _orderedSources = orderer.getOrderedObjects();
  -    }
  +        List ordered = orderer.getOrderedObjects();
   
  -    public String getPropertyValue(String propertyName)
  -    {
  -        Iterator i = _orderedSources.iterator();
  +        DelegatingPropertySource delegate = new DelegatingPropertySource();
   
  +        i = ordered.iterator();
           while (i.hasNext())
           {
  -            IPropertySource source = (IPropertySource) i.next();
  -
  -            String result = source.getPropertyValue(propertyName);
  +            PropertySourceContribution c = (PropertySourceContribution) i.next();
   
  -            if (result != null)
  -                return result;
  +            delegate.addSource(c.getSource());
           }
   
  -		// Not found, return null.
  -		
  -        return null;
  +        _delegate = delegate;
  +    }
  +
  +    public String getPropertyValue(String propertyName)
  +    {
  +        return _delegate.getPropertyValue(propertyName);
       }
   
       public void setContributions(List list)
  
  
  
  1.2       +12 -0     jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureImpl.java
  
  Index: InfrastructureImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InfrastructureImpl.java	3 Sep 2004 17:45:49 -0000	1.1
  +++ InfrastructureImpl.java	6 Sep 2004 22:49:11 -0000	1.2
  @@ -18,6 +18,7 @@
   import org.apache.tapestry.engine.ISpecificationSource;
   import org.apache.tapestry.services.ComponentMessagesSource;
   import org.apache.tapestry.services.Infrastructure;
  +import org.apache.tapestry.services.ObjectPool;
   import org.apache.tapestry.services.ResetEventCoordinator;
   import org.apache.tapestry.services.TemplateSource;
   
  @@ -34,6 +35,7 @@
       private ComponentMessagesSource _componentMessagesSource;
       private TemplateSource _templateSource;
       private ISpecificationSource _specificationSource;
  +    private ObjectPool _objectPool;
   
       public void setApplicationPropertySource(IPropertySource source)
       {
  @@ -83,6 +85,16 @@
       public void setSpecificationSource(ISpecificationSource source)
       {
           _specificationSource = source;
  +    }
  +
  +    public ObjectPool getObjectPool()
  +    {
  +        return _objectPool;
  +    }
  +
  +    public void setObjectPool(ObjectPool pool)
  +    {
  +        _objectPool = pool;
       }
   
   }
  
  
  
  1.2       +7 -1      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ObjectPoolImpl.java
  
  Index: ObjectPoolImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/ObjectPoolImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ObjectPoolImpl.java	3 Sep 2004 17:45:49 -0000	1.1
  +++ ObjectPoolImpl.java	6 Sep 2004 22:49:11 -0000	1.2
  @@ -19,6 +19,7 @@
   import java.util.List;
   import java.util.Map;
   
  +import org.apache.tapestry.event.ResetEventListener;
   import org.apache.tapestry.services.ObjectPool;
   
   /**
  @@ -32,7 +33,7 @@
    * @author Howard Lewis Ship
    * @since 3.1
    */
  -public class ObjectPoolImpl implements ObjectPool
  +public class ObjectPoolImpl implements ObjectPool, ResetEventListener
   {
       /**
        * Pool of Lists (of pooled objects), keyed on arbitrary key.
  @@ -60,6 +61,11 @@
           }
   
           pooled.add(value);
  +    }
  +
  +    public synchronized void resetDidOccur()
  +    {
  +        _pool.clear();
       }
   
   }
  
  
  
  1.1                  jakarta-tapestry/framework/src/java/org/apache/tapestry/services/impl/InfrastructureObjectProvider.java
  
  Index: InfrastructureObjectProvider.java
  ===================================================================
  //  Copyright 2004 The Apache Software Foundation
  //
  // Licensed under the Apache License, Version 2.0 (the "License");
  // you may not use this file except in compliance with the License.
  // You may obtain a copy of the License at
  //
  //     http://www.apache.org/licenses/LICENSE-2.0
  //
  // Unless required by applicable law or agreed to in writing, software
  // distributed under the License is distributed on an "AS IS" BASIS,
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  // See the License for the specific language governing permissions and
  // limitations under the License.
  
  package org.apache.tapestry.services.impl;
  import org.apache.commons.logging.Log;
  import org.apache.hivemind.ErrorHandler;
  import org.apache.hivemind.Location;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.service.ObjectProvider;
  import org.apache.hivemind.util.PropertyUtils;
  import org.apache.tapestry.services.Infrastructure;
  
  /**
   * An ObjectProvider that streamlines access to the 
   * central {@link org.apache.tapestry.services.Infrastructure} object.  The locator
   * for this provider is the name of a property of the Infrastructure. 
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  
  public class InfrastructureObjectProvider implements ObjectProvider
  {
      private Log _log;
      private ErrorHandler _errorHandler;
      private Infrastructure _infrastructure;
  
      public Object provideObject(
          Module contributingModule,
          Class propertyType,
          String locator,
          Location location)
      {
          try
          {
              return PropertyUtils.read(_infrastructure, locator);
          }
          catch (Throwable ex)
          {
              _errorHandler.error(
                  _log,
                  ImplMessages.unableToReadInfrastructureProperty(locator, _infrastructure, ex),
                  location,
                  ex);
  
              return null;
          }
      }
  
      public void setErrorHandler(ErrorHandler handler)
      {
          _errorHandler = handler;
      }
  
      public void setInfrastructure(Infrastructure infrastructure)
      {
          _infrastructure = infrastructure;
      }
  
      public void setLog(Log log)
      {
          _log = log;
      }
  
  }
  
  
  
  1.2       +2 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java
  
  Index: AbstractSpecificationResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/resolver/AbstractSpecificationResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractSpecificationResolver.java	3 Sep 2004 17:46:19 -0000	1.1
  +++ AbstractSpecificationResolver.java	6 Sep 2004 22:49:11 -0000	1.2
  @@ -22,7 +22,6 @@
   import org.apache.tapestry.engine.ISpecificationSource;
   import org.apache.tapestry.spec.IApplicationSpecification;
   import org.apache.tapestry.spec.IComponentSpecification;
  -import org.apache.tapestry.util.pool.IPoolable;
   
   /**
    *  Base class for resolving a {@link org.apache.tapestry.spec.IComponentSpecification}
  @@ -32,9 +31,9 @@
    *  @author Howard Lewis Ship
    *  @since 3.0
    *
  - **/
  + */
   
  -public class AbstractSpecificationResolver implements IPoolable
  +public class AbstractSpecificationResolver
   {
       private ISpecificationSource _specificationSource;
   
  
  
  
  1.2       +0 -21     jakarta-tapestry/framework/src/java/org/apache/tapestry/request/RequestContext.java
  
  Index: RequestContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/request/RequestContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RequestContext.java	3 Sep 2004 17:46:19 -0000	1.1
  +++ RequestContext.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -42,7 +42,6 @@
   import org.apache.tapestry.multipart.DefaultMultipartDecoder;
   import org.apache.tapestry.multipart.IMultipartDecoder;
   import org.apache.tapestry.spec.IApplicationSpecification;
  -import org.apache.tapestry.util.IRenderDescription;
   
   /**
    *  This class encapsulates all the relevant data for one request cycle of an
  @@ -607,26 +606,6 @@
       {
           if (value == null)
               return;
  -
  -        if (value instanceof IRenderDescription)
  -        {
  -            IRenderDescription renderValue = (IRenderDescription) value;
  -
  -            writer.begin("tr");
  -            writer.attribute("class", getRowClass());
  -
  -            writer.begin("th");
  -            writer.print(name);
  -            writer.end();
  -
  -            writer.begin("td");
  -
  -            renderValue.renderDescription(writer);
  -
  -            writer.end("tr");
  -            writer.println();
  -            return;
  -        }
   
           pair(writer, name, value.toString());
       }
  
  
  
  1.2       +5 -0      jakarta-tapestry/framework/src/java/org/apache/tapestry/services/Infrastructure.java
  
  Index: Infrastructure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/services/Infrastructure.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Infrastructure.java	3 Sep 2004 17:45:58 -0000	1.1
  +++ Infrastructure.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -58,4 +58,9 @@
        */
       
       public ISpecificationSource getSpecificationSource();
  +
  +	/**
  +	 * Returns a generic, shared ObjectPool instance.
  +	 */
  +    public ObjectPool getObjectPool();
   }
  
  
  
  1.2       +1 -1      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.parse.xml
  
  Index: tapestry.parse.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.parse.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tapestry.parse.xml	3 Sep 2004 17:46:17 -0000	1.1
  +++ tapestry.parse.xml	6 Sep 2004 22:49:12 -0000	1.2
  @@ -71,7 +71,7 @@
         <construct class="org.apache.tapestry.services.impl.TemplateSourceImpl">
           <set-service property="parser" service-id="TemplateParser"/>
           <set-object property="applicationPropertySource" 
  -                       value="service-property:tapestry.Infrastructure:applicationPropertySource"/>
  +                       value="infrastructure:applicationPropertySource"/>
           <set-service property="delegate" service-id="TemplateSourceDelegate"/>
           <set-service property="request" service-id="tapestry.globals.HttpServletRequest"/>
           <set-object property="context" value="service-property:tapestry.globals.ApplicationGlobals:context"/>
  
  
  
  1.2       +35 -1     jakarta-tapestry/framework/src/descriptor/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/hivemodule.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- hivemodule.xml	3 Sep 2004 17:46:17 -0000	1.1
  +++ hivemodule.xml	6 Sep 2004 22:49:12 -0000	1.2
  @@ -48,6 +48,7 @@
           <set-service property="resetEventCoordinator" service-id="ResetEventCoordinator"/>
           <set-service property="templateSource" service-id="tapestry.parse.TemplateSource"/>
           <set-service property="specificationSource" service-id="tapestry.parse.SpecificationSource"/>
  +        <set-service property="objectPool" service-id="GlobalObjectPool"/>
         </construct>
       </invoke-factory>
       
  @@ -88,6 +89,20 @@
       <create-instance class="org.apache.tapestry.services.impl.ResetEventCoordinatorImpl"/>
     </service-point>
     
  +  <service-point id="GlobalObjectPool" interface="org.apache.tapestry.services.ObjectPool">
  +    
  +    A general purpose object pool used throughout the application. Care should be
  +    taken to ensure that keys are sufficiently unique.  This service will likely
  +    be removed soon; replaced with a number of more individual object pools
  +    (as necessary).
  +     
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.ObjectPoolImpl">
  +        <event-listener service-id="ResetEventCoordinator"/>
  +      </construct>
  +    </invoke-factory> 
  +  </service-point> 
  +  
     
     <service-point id="ComponentMessagesSource" interface="org.apache.tapestry.services.ComponentMessagesSource">
       
  @@ -96,10 +111,29 @@
       <invoke-factory>
         <construct class="org.apache.tapestry.services.impl.ComponentMessagesSourceImpl">
           <event-listener service-id="ResetEventCoordinator"/>
  -        <set-object property="applicationPropertySource" value="service-property:Infrastructure:applicationPropertySource"/>
  +        <set-object property="applicationPropertySource" value="infrastructure:applicationPropertySource"/>
  +      </construct>
  +    </invoke-factory>
  +    
  +  </service-point>
  +  
  +  <service-point id="InfrastructureObjectProvider" interface="org.apache.hivemind.service.ObjectProvider">
  +    
  +    ObjectProvider mapped to prefix "infrastructure:", the locator is the name of a property of the
  +    Infratructure service.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.InfrastructureObjectProvider">
  +        <set-service property="infrastructure" service-id="Infrastructure"/>
         </construct>
       </invoke-factory>
       
     </service-point>
  +  
  +  <contribution configuration-id="hivemind.ObjectProviders">
  +    <provider prefix="infrastructure" service-id="InfrastructureObjectProvider"/>
  +  </contribution>
  +  
  +  
     
   </module>
  
  
  
  1.2       +8 -1      jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml
  
  Index: tapestry.request.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/descriptor/META-INF/tapestry.request.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- tapestry.request.xml	3 Sep 2004 17:46:17 -0000	1.1
  +++ tapestry.request.xml	6 Sep 2004 22:49:12 -0000	1.2
  @@ -22,7 +22,14 @@
     a collection of loosely bound services.
     
     <service-point id="EnginePool" interface="org.apache.tapestry.services.ObjectPool">
  -    <create-instance class="org.apache.tapestry.services.impl.ObjectPoolImpl"/>
  +    
  +    Contains engine instances, keyed on locale, ready for use in the current request.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.ObjectPoolImpl">
  +        <event-listener service-id="tapestry.ResetEventCoordinator"/>
  +      </construct>
  +    </invoke-factory> 
     </service-point>  
     
     <service-point id="LocaleExtractor" interface="org.apache.tapestry.services.LocaleExtractor">
  
  
  
  1.2       +8 -8      jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageSource.java
  
  Index: PageSource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/pageload/PageSource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PageSource.java	3 Sep 2004 17:46:11 -0000	1.1
  +++ PageSource.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -23,8 +23,8 @@
   import org.apache.tapestry.engine.IMonitor;
   import org.apache.tapestry.engine.IPageSource;
   import org.apache.tapestry.resolver.PageSpecificationResolver;
  +import org.apache.tapestry.services.ObjectPool;
   import org.apache.tapestry.util.MultiKey;
  -import org.apache.tapestry.util.pool.Pool;
   
   /**
    *  A source for pages for a particular application.  Each application
  @@ -73,7 +73,7 @@
        *
        **/
   
  -    private Pool _pool;
  +    private ObjectPool _pool;
   
       public PageSource(IEngine engine)
       {
  @@ -129,7 +129,7 @@
       {
           IEngine engine = cycle.getEngine();
           Object key = buildKey(engine, pageName);
  -        IPage result = (IPage) _pool.retrieve(key);
  +        IPage result = (IPage) _pool.get(key);
   
           if (result == null)
           {
  @@ -186,7 +186,7 @@
   
       protected PageLoader getPageLoader(IRequestCycle cycle)
       {
  -        PageLoader result = (PageLoader) _pool.retrieve(PAGE_LOADER_POOL_KEY);
  +        PageLoader result = (PageLoader) _pool.get(PAGE_LOADER_POOL_KEY);
   
           if (result == null)
               result = new PageLoader(cycle);
  @@ -218,7 +218,7 @@
       protected PageSpecificationResolver getPageSpecificationResolver(IRequestCycle cycle)
       {
           PageSpecificationResolver result =
  -            (PageSpecificationResolver) _pool.retrieve(PAGE_SPECIFICATION_RESOLVER_KEY);
  +            (PageSpecificationResolver) _pool.get(PAGE_SPECIFICATION_RESOLVER_KEY);
   
           if (result == null)
               result = new PageSpecificationResolver(cycle);
  @@ -258,12 +258,12 @@
       /**
        *  Invoked (during testing primarily) to release the entire pool
        *  of pages, and the caches of bindings and assets.
  -     *
  -     **/
  +     *  TODO: Probably remove this!
  +     */
   
       public synchronized void reset()
       {
  -        _pool.clear();
  +        // _pool.clear();
       }
   
       public String toString()
  
  
  
  1.2       +7 -3      jakarta-tapestry/framework/src/java/org/apache/tapestry/binding/ListenerBinding.java
  
  Index: ListenerBinding.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/binding/ListenerBinding.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ListenerBinding.java	3 Sep 2004 17:46:16 -0000	1.1
  +++ ListenerBinding.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -27,7 +27,7 @@
   import org.apache.tapestry.IPage;
   import org.apache.tapestry.IRequestCycle;
   import org.apache.tapestry.Tapestry;
  -import org.apache.tapestry.util.pool.Pool;
  +import org.apache.tapestry.services.ObjectPool;
   
   /**
    *  A very specialized binding that can be used as an {@link org.apache.tapestry.IActionListener},
  @@ -184,12 +184,16 @@
           }
       }
   
  +	/**
  +	 * TODO: remove the use of the pool; the BSFManager should be injected in, and be
  +	 * a pooled HiveMind service.
  +	 */
       private BSFManager obtainBSFManager(IRequestCycle cycle)
       {
           IEngine engine = cycle.getEngine();
  -        Pool pool = engine.getPool();
  +        ObjectPool pool = engine.getPool();
   
  -        BSFManager result = (BSFManager) pool.retrieve(BSF_POOL_KEY);
  +        BSFManager result = (BSFManager) pool.get(BSF_POOL_KEY);
   
           if (result == null)
           {
  
  
  
  1.53      +1 -0      jakarta-tapestry/.classpath
  
  Index: .classpath
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/.classpath,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- .classpath	4 Sep 2004 12:34:58 -0000	1.52
  +++ .classpath	6 Sep 2004 22:49:12 -0000	1.53
  @@ -23,5 +23,6 @@
       <classpathentry kind="lib"
           path="ext-package/lib/hivemind-1.0-rc-2-snapshot.jar" sourcepath="C:/workspace/jakarta-hivemind/framework/src/java"/>
       <classpathentry kind="lib" path="ext-package/lib/hivemind-lib-1.0-rc-2-snapshot.jar"/>
  +    <classpathentry kind="lib" path="framework/src/descriptor"/>
       <classpathentry kind="output" path="bin"/>
   </classpath>
  
  
  
  1.2       +7 -54     jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/AbstractEngine.java
  
  Index: AbstractEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/engine/AbstractEngine.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractEngine.java	3 Sep 2004 17:45:54 -0000	1.1
  +++ AbstractEngine.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -38,7 +38,6 @@
   import javax.servlet.http.HttpSessionBindingEvent;
   import javax.servlet.http.HttpSessionBindingListener;
   
  -import org.apache.bsf.BSFManager;
   import org.apache.commons.lang.builder.ToStringBuilder;
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -61,13 +60,15 @@
   import org.apache.tapestry.pageload.PageSource;
   import org.apache.tapestry.request.RequestContext;
   import org.apache.tapestry.request.ResponseOutputStream;
  -import org.apache.tapestry.services.*;
  +import org.apache.tapestry.services.ComponentMessagesSource;
   import org.apache.tapestry.services.Infrastructure;
  -import org.apache.tapestry.services.impl.*;
  +import org.apache.tapestry.services.ObjectPool;
  +import org.apache.tapestry.services.TemplateSource;
  +import org.apache.tapestry.services.impl.ComponentMessagesSourceImpl;
  +import org.apache.tapestry.services.impl.TemplateSourceImpl;
   import org.apache.tapestry.spec.IApplicationSpecification;
   import org.apache.tapestry.util.exception.ExceptionAnalyzer;
   import org.apache.tapestry.util.io.DataSqueezer;
  -import org.apache.tapestry.util.pool.Pool;
   
   /**
    *  Basis for building real Tapestry applications.  Immediate subclasses
  @@ -324,18 +325,6 @@
       protected static final String SERVICE_MAP_NAME = "org.apache.tapestry.ServiceMap";
   
       /**
  -     *  A shared instance of {@link Pool}.
  -     *
  -     *  @since 3.0
  -     *  @see #createPool(RequestContext)
  -     *
  -     **/
  -
  -    private transient Pool _pool;
  -
  -    protected static final String POOL_NAME = "org.apache.tapestry.Pool";
  -
  -    /**
        *  Name of a shared instance of {@link org.apache.tapestry.engine.IComponentClassEnhancer}
        *  stored in the {@link ServletContext}.
        *
  @@ -1066,7 +1055,6 @@
       {
       	_infrastructure.getResetEventCoordinator().fireResetEvent();
       	
  -        _pool.clear();
           _pageSource.reset();
           _scriptSource.reset();
           _enhancer.reset();
  @@ -1197,20 +1185,6 @@
               }
           }
   
  -        if (_pool == null)
  -        {
  -            String name = POOL_NAME + ":" + servletName;
  -
  -            _pool = (Pool) servletContext.getAttribute(name);
  -
  -            if (_pool == null)
  -            {
  -                _pool = createPool(context);
  -
  -                servletContext.setAttribute(name, _pool);
  -            }
  -        }
  -
           if (_pageSource == null)
           {
               String name = PAGE_SOURCE_NAME + ":" + servletName;
  @@ -1964,32 +1938,11 @@
           }
       }
   
  -    /**
  -     *  Returns an new instance of {@link Pool}, with the standard
  -     *  set of adaptors, plus {@link BSFManagerPoolableAdaptor} for
  -     *  {@link BSFManager}.
  -     *
  -     *  <p>Subclasses may override this
  -     *  method to configure the Pool differently.
  -     *
  -     *  @since 3.0
  -     *
  -     **/
  -
  -    protected Pool createPool(RequestContext context)
  -    {
  -        Pool result = new Pool();
  -
  -        result.registerAdaptor(BSFManager.class, new BSFManagerPoolableAdaptor());
  -
  -        return result;
  -    }
  -
       /** @since 3.0 **/
   
  -    public Pool getPool()
  +    public ObjectPool getPool()
       {
  -        return _pool;
  +        return _infrastructure.getObjectPool();
       }
   
       /**
  
  
  
  1.2       +2 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/IEngine.java
  
  Index: IEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/IEngine.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IEngine.java	3 Sep 2004 17:45:53 -0000	1.1
  +++ IEngine.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -29,10 +29,10 @@
   import org.apache.tapestry.engine.ISpecificationSource;
   import org.apache.tapestry.request.RequestContext;
   import org.apache.tapestry.services.ComponentMessagesSource;
  +import org.apache.tapestry.services.ObjectPool;
   import org.apache.tapestry.services.TemplateSource;
   import org.apache.tapestry.spec.IApplicationSpecification;
   import org.apache.tapestry.util.io.DataSqueezer;
  -import org.apache.tapestry.util.pool.Pool;
   
   /**
    * Defines the core, session-persistant object used to run a Tapestry
  @@ -355,7 +355,7 @@
        * 
        **/
       
  -    public Pool getPool();
  +    public ObjectPool getPool();
       
       /**
        *  Returns an object that can create enhanced versions of component classes.
  
  
  
  1.2       +1 -2      jakarta-tapestry/framework/src/java/org/apache/tapestry/bean/Default.java
  
  Index: Default.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/java/org/apache/tapestry/bean/Default.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Default.java	3 Sep 2004 17:45:59 -0000	1.1
  +++ Default.java	6 Sep 2004 22:49:12 -0000	1.2
  @@ -15,7 +15,6 @@
   package org.apache.tapestry.bean;
   
   import org.apache.tapestry.IBinding;
  -import org.apache.tapestry.util.pool.IPoolable;
   
   /**
    *  A helper bean to assist with providing defaults for unspecified
  @@ -29,7 +28,7 @@
    * 
    **/
   
  -public class Default implements IPoolable
  +public class Default
   {
       private IBinding binding;
       private Object defaultValue;
  
  
  
  1.12      +4 -4      jakarta-tapestry/junit/src/org/apache/tapestry/junit/MockEngine.java
  
  Index: MockEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/MockEngine.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- MockEngine.java	1 Sep 2004 20:21:53 -0000	1.11
  +++ MockEngine.java	6 Sep 2004 22:49:12 -0000	1.12
  @@ -32,16 +32,16 @@
   import org.apache.tapestry.engine.ISpecificationSource;
   import org.apache.tapestry.request.RequestContext;
   import org.apache.tapestry.services.ComponentMessagesSource;
  +import org.apache.tapestry.services.ObjectPool;
   import org.apache.tapestry.services.TemplateSource;
  +import org.apache.tapestry.services.impl.ObjectPoolImpl;
   import org.apache.tapestry.spec.IApplicationSpecification;
   import org.apache.tapestry.util.io.DataSqueezer;
  -import org.apache.tapestry.util.pool.Pool;
   
   /**
    *  An implementation of {@link IEngine} used for unit testing.
    *
    *  @author Howard Lewis Ship
  - *  @version $Id$
    *  @since 2.0.4
    *
    **/
  @@ -51,7 +51,7 @@
       private ClassResolver _resolver;
       private ComponentMessagesSource componentStringsSource;
   
  -    private Pool _pool = new Pool();
  +    private ObjectPool _pool = new ObjectPoolImpl();
       private String _servletPath;
       private IApplicationSpecification applicationSpecification;
   
  @@ -180,7 +180,7 @@
           return null;
       }
   
  -    public Pool getPool()
  +    public ObjectPool getPool()
       {
           return _pool;
       }
  
  
  
  1.8       +0 -1      jakarta-tapestry/junit/src/org/apache/tapestry/junit/MockRequestCycle.java
  
  Index: MockRequestCycle.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/MockRequestCycle.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MockRequestCycle.java	19 Feb 2004 17:37:56 -0000	1.7
  +++ MockRequestCycle.java	6 Sep 2004 22:49:12 -0000	1.8
  @@ -33,7 +33,6 @@
    * 
    *
    *  @author Howard Lewis Ship
  - *  @version $Id$
    *  @since 3.0
    **/
   public class MockRequestCycle implements IRequestCycle
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org