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/08/29 23:38:23 UTC

cvs commit: jakarta-tapestry/framework/src/org/apache/tapestry/services Infrastructure.java

hlship      2004/08/29 14:38:23

  Modified:    framework/src/org/apache/tapestry/services/impl
                        InvokeEngineTerminator.java PropertySourceImpl.java
                        ImplStrings.properties ImplMessages.java
               framework/src/org/apache/tapestry/engine AbstractEngine.java
                        DefaultPropertySource.java
               junit/src/org/apache/tapestry/services/impl
                        TestBasicInfrastructure.java
                        TestPropertySource.java
               framework/conf/META-INF hivemodule.xml
               framework/src/org/apache/tapestry/pageload PageLoader.java
  Added:       framework/src/org/apache/tapestry Constants.java
               framework/src/org/apache/tapestry/services/impl
                        PropertyObjectProvider.java
                        ExtensionLookupFactory.java
                        ExtensionLookupParameter.java
                        InfrastructureImpl.java
                        ApplicationSpecificationPropertySource.java
               junit/src/org/apache/tapestry/services/impl
                        TestExtensionLookupFactory.java
               framework/src/org/apache/tapestry/services
                        Infrastructure.java
  Removed:     framework/src/org/apache/tapestry/services/impl
                        GlobalPropertyObjectProvider.java
  Log:
  Replace IEngine.getPropertySource() with the tapestry.ApplicationPropertySource service.
  
  Revision  Changes    Path
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/Constants.java
  
  Index: Constants.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;
  
  /**
   * Constant values used inside Tapestry. 
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public final class Constants
  {
  	/**
  	 * Key used to store and locate an {@link org.apache.tapestry.services.Infrastructure}
  	 * service instance as a request attribute.
  	 */
  	public static final String INFRASTRUCTURE_KEY = "org.apache.tapestry.Infrastructure";
  }
  
  
  
  1.2       +11 -1     jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/InvokeEngineTerminator.java
  
  Index: InvokeEngineTerminator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/InvokeEngineTerminator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- InvokeEngineTerminator.java	27 Aug 2004 13:42:47 -0000	1.1
  +++ InvokeEngineTerminator.java	29 Aug 2004 21:38:22 -0000	1.2
  @@ -20,9 +20,11 @@
   import javax.servlet.http.HttpServletRequest;
   import javax.servlet.http.HttpServletResponse;
   
  +import org.apache.tapestry.Constants;
   import org.apache.tapestry.IEngine;
   import org.apache.tapestry.request.RequestContext;
   import org.apache.tapestry.services.EngineManager;
  +import org.apache.tapestry.services.Infrastructure;
   import org.apache.tapestry.services.RequestServicer;
   import org.apache.tapestry.spec.IApplicationSpecification;
   
  @@ -36,15 +38,18 @@
    */
   public class InvokeEngineTerminator implements RequestServicer
   {
  -	private HttpServlet _servlet;
  +    private HttpServlet _servlet;
       private EngineManager _engineManager;
       private IApplicationSpecification _specification;
  +    private Infrastructure _infrastructure;
   
       public void service(HttpServletRequest request, HttpServletResponse response)
           throws IOException, ServletException
       {
           IEngine engine = _engineManager.getEngineInstance();
   
  +        request.setAttribute(Constants.INFRASTRUCTURE_KEY, _infrastructure);
  +
           RequestContext context = new RequestContext(_servlet, request, response, _specification);
   
           try
  @@ -73,6 +78,11 @@
       public void setSpecification(IApplicationSpecification specification)
       {
           _specification = specification;
  +    }
  +
  +    public void setInfrastructure(Infrastructure infrastructure)
  +    {
  +        _infrastructure = infrastructure;
       }
   
   }
  
  
  
  1.2       +3 -2      jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/PropertySourceImpl.java
  
  Index: PropertySourceImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/PropertySourceImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PropertySourceImpl.java	27 Aug 2004 13:42:47 -0000	1.1
  +++ PropertySourceImpl.java	29 Aug 2004 21:38:22 -0000	1.2
  @@ -18,7 +18,6 @@
   import java.util.List;
   
   import org.apache.commons.logging.Log;
  -import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.order.Orderer;
   import org.apache.tapestry.engine.IPropertySource;
  @@ -67,7 +66,9 @@
                   return result;
           }
   
  -        throw new ApplicationRuntimeException(ImplMessages.noSuchGlobalProperty(propertyName));
  +		// Not found, return null.
  +		
  +        return null;
       }
   
       public void setContributions(List list)
  
  
  
  1.4       +0 -1      jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplStrings.properties
  
  Index: ImplStrings.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplStrings.properties,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ImplStrings.properties	27 Aug 2004 13:42:47 -0000	1.3
  +++ ImplStrings.properties	29 Aug 2004 21:38:22 -0000	1.4
  @@ -15,6 +15,5 @@
   initializer-contribution=application initializer
   no-application-specification=Could not find an application specification for application servlet {0}.
   error-instantiating-engine=Unable to instantiate engine as instance of class {0}: {1}
  -no-such-global-property=Global property ''{0}'' does not exist.
   
   
  
  
  
  1.5       +0 -5      jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplMessages.java
  
  Index: ImplMessages.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ImplMessages.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ImplMessages.java	27 Aug 2004 13:42:47 -0000	1.4
  +++ ImplMessages.java	29 Aug 2004 21:38:22 -0000	1.5
  @@ -43,9 +43,4 @@
       {
           return _formatter.format("error-instantiating-engine", engineClass.getName(), cause);
       }
  -
  -    public static String noSuchGlobalProperty(String propertyName)
  -    {
  -        return _formatter.format("no-such-global-property", propertyName);
  -    }
   }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/PropertyObjectProvider.java
  
  Index: PropertyObjectProvider.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.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.Location;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.service.ObjectProvider;
  import org.apache.tapestry.engine.IPropertySource;
  
  /**
   * An implementation of {@link org.apache.hivemind.service.ObjectProvider}
   * that gets the actual value from the
   * <code>tapestry.GlobalPropertySource</code> service.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class PropertyObjectProvider implements ObjectProvider
  {
      private IPropertySource _source;
  
      /**
       * Gets the value; the locator is the key passed to
       * {@link IPropertySource#getPropertyValue(String)}.
       */
      public Object provideObject(
          Module contributingModule,
          Class propertyType,
          String locator,
          Location location)
      {
          try
          {
              return _source.getPropertyValue(locator);
          }
          catch (Exception ex)
          {
              throw new ApplicationRuntimeException(ex.getMessage(), location, ex);
          }
      }
  
      public void setSource(IPropertySource source)
      {
          _source = source;
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ExtensionLookupFactory.java
  
  Index: ExtensionLookupFactory.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 java.util.List;
  
  import org.apache.commons.logging.Log;
  import org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.ServiceImplementationFactory;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.lib.DefaultImplementationBuilder;
  import org.apache.tapestry.spec.IApplicationSpecification;
  
  /**
   * An implementation of {@link org.apache.hivemind.ServiceImplementationFactory}
   * that looks for a service implementation provided as an
   * {@link org.apache.tapestry.spec.ILibrarySpecification#getExtension(String) application
   * extension}. If no such extension exists, then a
   * {@link org.apache.hivemind.lib.DefaultImplementationBuilder default implementation}
   * is constructed and returned instead. This allows compatibility with Tapestry 3.0 and
   * earlier application extensions (though those will be phased out in the future).
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class ExtensionLookupFactory implements ServiceImplementationFactory
  {
      private IApplicationSpecification _specification;
      private DefaultImplementationBuilder _defaultBuilder;
  
      public Object createCoreServiceImplementation(
          String serviceId,
          Class serviceInterface,
          Log serviceLog,
          Module invokingModule,
          List parameters)
      {
          ExtensionLookupParameter p = (ExtensionLookupParameter) parameters.get(0);
  
          String extensionName = p.getExtensionName();
  
          try
          {
              if (_specification.checkExtension(extensionName))
                  return _specification.getExtension(extensionName, serviceInterface);
  
              return _defaultBuilder.buildDefaultImplementation(serviceInterface, invokingModule);
          }
          catch (Exception ex)
          {
              throw new ApplicationRuntimeException(ex.getMessage(), p.getLocation(), ex);
          }
      }
  
      public void setDefaultBuilder(DefaultImplementationBuilder builder)
      {
          _defaultBuilder = builder;
      }
  
      public void setSpecification(IApplicationSpecification specification)
      {
          _specification = specification;
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ExtensionLookupParameter.java
  
  Index: ExtensionLookupParameter.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.hivemind.impl.BaseLocatable;
  
  /**
   * Parameters to the {@link org.apache.tapestry.services.impl.ExtensionLookupFactory}
   * service implementation factory.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class ExtensionLookupParameter extends BaseLocatable
  {
  	private String _extensionName;
  	
      public String getExtensionName()
      {
          return _extensionName;
      }
  
      public void setExtensionName(String string)
      {
          _extensionName = string;
      }
  
  }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/InfrastructureImpl.java
  
  Index: InfrastructureImpl.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.tapestry.engine.IPropertySource;
  import org.apache.tapestry.services.Infrastructure;
  
  /**
   * Allows access to selected HiveMind services.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class InfrastructureImpl implements Infrastructure
  {
      private IPropertySource _applicationPropertySource;
  
      public void setApplicationPropertySource(IPropertySource source)
      {
          _applicationPropertySource = source;
      }
  
      public IPropertySource getApplicationPropertySource()
      {
          return _applicationPropertySource;
      }
  }
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/impl/ApplicationSpecificationPropertySource.java
  
  Index: ApplicationSpecificationPropertySource.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.tapestry.engine.IPropertySource;
  import org.apache.tapestry.spec.IApplicationSpecification;
  
  /**
   * Obtains meta-data properties from the
   * {@link org.apache.tapestry.spec.IApplicationSpecification}.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class ApplicationSpecificationPropertySource implements IPropertySource
  {
      private IApplicationSpecification _specification;
  
      /**
       * Invokes {@link org.apache.tapestry.util.IPropertyHolder#getProperty(String)}
       * on the specification.
       */
      public String getPropertyValue(String propertyName)
      {
          return _specification.getProperty(propertyName);
      }
  
      public void setSpecification(IApplicationSpecification specification)
      {
          _specification = specification;
      }
  
  }
  
  
  
  1.35      +25 -55    jakarta-tapestry/framework/src/org/apache/tapestry/engine/AbstractEngine.java
  
  Index: AbstractEngine.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/AbstractEngine.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- AbstractEngine.java	27 Aug 2004 13:42:48 -0000	1.34
  +++ AbstractEngine.java	29 Aug 2004 21:38:23 -0000	1.35
  @@ -45,6 +45,7 @@
   import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.ClassResolver;
   import org.apache.tapestry.ApplicationServlet;
  +import org.apache.tapestry.Constants;
   import org.apache.tapestry.IEngine;
   import org.apache.tapestry.IMarkupWriter;
   import org.apache.tapestry.INamespace;
  @@ -60,6 +61,7 @@
   import org.apache.tapestry.pageload.PageSource;
   import org.apache.tapestry.request.RequestContext;
   import org.apache.tapestry.request.ResponseOutputStream;
  +import org.apache.tapestry.services.Infrastructure;
   import org.apache.tapestry.spec.IApplicationSpecification;
   import org.apache.tapestry.util.exception.ExceptionAnalyzer;
   import org.apache.tapestry.util.io.DataSqueezer;
  @@ -69,14 +71,19 @@
    *  Basis for building real Tapestry applications.  Immediate subclasses
    *  provide different strategies for managing page state and other resources
    *  between request cycles.
  + * 
  + * <p>
  + *  Note: much of this description is <em>in transition</em> as part
  + *  of Tapestry 3.1. All ad-hoc singletons and such are being replaced with
  + *  HiveMind services. 
    *
  - *  Uses a shared instance of
  + *  <p>Uses a shared instance of
    *  {@link ITemplateSource}, {@link ISpecificationSource},
    *  {@link IScriptSource} and {@link IComponentMessagesSource}
    *  stored as attributes of the  {@link ServletContext}
    *  (they will be shared by all sessions).
    *
  - *  <p>An application is designed to be very lightweight.
  + *  <p>An engine is designed to be very lightweight.
    *  Particularily, it should <b>never</b> hold references to any
    *  {@link IPage} or {@link org.apache.tapestry.IComponent} objects.  The entire system is
    *  based upon being able to quickly rebuild the state of any page(s).
  @@ -128,6 +135,13 @@
   
       private static final long serialVersionUID = 6884834397673817117L;
   
  +    /**
  +     * The link to the world of HiveMind services.
  +     * 
  +     * @since 3.1
  +     */
  +    private transient Infrastructure _infrastructure;
  +
       private transient String _contextPath;
       private transient String _servletPath;
       private transient String _clientAddress;
  @@ -344,16 +358,6 @@
       private transient ClassResolver _resolver;
   
       /**
  -     *  Constant used to store a {@link org.apache.tapestry.util.IPropertyHolder}
  -     *  in the servlet context.
  -     *
  -     *  @since 2.3
  -     *
  -     **/
  -
  -    protected static final String PROPERTY_SOURCE_NAME = "org.apache.tapestry.PropertySource";
  -
  -    /**
        *  A shared instance of {@link IPropertySource}
        *
        *  @since 3.0
  @@ -790,10 +794,10 @@
   
       public boolean service(RequestContext context) throws ServletException, IOException
       {
  -    	// TODO: Switch this around sound that we don't downcast ... in fact,
  -    	// all of the stuff we get from the servlet will be coming out of the
  -    	// registry soon enough.
  -    	
  +        // TODO: Switch this around sound that we don't downcast ... in fact,
  +        // all of the stuff we get from the servlet will be coming out of the
  +        // registry soon enough.
  +
           ApplicationServlet servlet = (ApplicationServlet) context.getServlet();
           IRequestCycle cycle = null;
           ResponseOutputStream output = null;
  @@ -805,6 +809,9 @@
           if (_specification == null)
               _specification = context.getApplicationSpecification();
   
  +        if (_infrastructure == null)
  +            _infrastructure = (Infrastructure) context.getAttribute(Constants.INFRASTRUCTURE_KEY);
  +
           // The servlet invokes setLocale() before invoking service().  We want
           // to ignore that setLocale() ... that is, not force a cookie to be
           // written.
  @@ -1233,18 +1240,7 @@
           String servletName = context.getServlet().getServletName();
   
           if (_propertySource == null)
  -        {
  -            String name = PROPERTY_SOURCE_NAME + ":" + servletName;
  -
  -            _propertySource = (IPropertySource) servletContext.getAttribute(name);
  -
  -            if (_propertySource == null)
  -            {
  -                _propertySource = createPropertySource(context);
  -
  -                servletContext.setAttribute(name, _propertySource);
  -            }
  -        }
  +            _propertySource = _infrastructure.getApplicationPropertySource();
   
           if (_enhancer == null)
           {
  @@ -2053,32 +2049,6 @@
       }
   
       /**
  -     *  Creates a shared property source that will be stored into
  -     *  the servlet context.
  -     *  Subclasses may override this method to build thier
  -     *  own search path.
  -     *
  -     *  <p>If the application specification contains an extension
  -     *  named "org.apache.tapestry.property-source" it is inserted
  -     *  in the search path just before
  -     *  the property source for JVM System Properties.  This is a simple
  -     *  hook at allow application-specific methods of obtaining
  -     *  configuration values (typically, from a database or from JMX,
  -     *  in some way).  Alternately, subclasses may
  -     *  override this method to provide whatever search path
  -     *  is appropriate.
  -     *
  -     *
  -     *  @since 2.3
  -     *
  -     **/
  -
  -    protected IPropertySource createPropertySource(RequestContext context)
  -    {
  -        return new DefaultPropertySource(context);
  -    }
  -
  -    /**
        *  Creates the shared Global object.  This implementation looks for an configuration
        *  property, <code>org.apache.tapestry.global-class</code>, and instantiates that class
        *  using a no-arguments
  @@ -2093,7 +2063,7 @@
       {
           String className = _propertySource.getPropertyValue("org.apache.tapestry.global-class");
   
  -        if (className == null)
  +        if (Tapestry.isBlank(className))
               return Collections.synchronizedMap(new HashMap());
   
           Class globalClass = _resolver.findClass(className);
  
  
  
  1.5       +3 -1      jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultPropertySource.java
  
  Index: DefaultPropertySource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultPropertySource.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultPropertySource.java	27 Aug 2004 13:42:48 -0000	1.4
  +++ DefaultPropertySource.java	29 Aug 2004 21:38:23 -0000	1.5
  @@ -48,7 +48,9 @@
    *  in some way).  
    *  
    *  @author mb
  - *  @since 3.1
  + *  @since 3.0
  + *  @deprecated To be removed in 3.2, replaced with the <code>tapestry.ApplicationPropertySource</code>
  + *  service
    */
   public class DefaultPropertySource implements IPropertySource
   {
  
  
  
  1.6       +2 -2      jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestBasicInfrastructure.java
  
  Index: TestBasicInfrastructure.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestBasicInfrastructure.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- TestBasicInfrastructure.java	27 Aug 2004 13:42:49 -0000	1.5
  +++ TestBasicInfrastructure.java	29 Aug 2004 21:38:23 -0000	1.6
  @@ -193,7 +193,7 @@
   
           replayControls();
   
  -        GlobalPropertyObjectProvider p = new GlobalPropertyObjectProvider();
  +        PropertyObjectProvider p = new PropertyObjectProvider();
           p.setSource(source);
   
           assertEquals("bar", p.provideObject(null, null, "foo", null));
  @@ -215,7 +215,7 @@
   
           replayControls();
   
  -        GlobalPropertyObjectProvider p = new GlobalPropertyObjectProvider();
  +        PropertyObjectProvider p = new PropertyObjectProvider();
           p.setSource(source);
   
           try
  
  
  
  1.2       +1 -9      jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestPropertySource.java
  
  Index: TestPropertySource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestPropertySource.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestPropertySource.java	27 Aug 2004 13:42:49 -0000	1.1
  +++ TestPropertySource.java	29 Aug 2004 21:38:23 -0000	1.2
  @@ -17,7 +17,6 @@
   import java.util.Collections;
   
   import org.apache.commons.logging.Log;
  -import org.apache.hivemind.ApplicationRuntimeException;
   import org.apache.hivemind.ErrorHandler;
   import org.apache.hivemind.test.HiveMindTestCase;
   import org.apache.tapestry.engine.IPropertySource;
  @@ -78,14 +77,7 @@
   
           ps.initializeService();
   
  -        try
  -        {
  -            ps.getPropertyValue("foo");
  -        }
  -        catch (ApplicationRuntimeException ex)
  -        {
  -            assertEquals(ImplMessages.noSuchGlobalProperty("foo"), ex.getMessage());
  -        }
  +        assertNull(ps.getPropertyValue("foo"));
   
           verifyControls();
       }
  
  
  
  1.1                  jakarta-tapestry/junit/src/org/apache/tapestry/services/impl/TestExtensionLookupFactory.java
  
  Index: TestExtensionLookupFactory.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 java.util.Collections;
  import java.util.List;
  
  import org.apache.hivemind.ApplicationRuntimeException;
  import org.apache.hivemind.Location;
  import org.apache.hivemind.internal.Module;
  import org.apache.hivemind.lib.DefaultImplementationBuilder;
  import org.apache.hivemind.test.HiveMindTestCase;
  import org.apache.tapestry.spec.IApplicationSpecification;
  import org.easymock.MockControl;
  
  /**
   * Tests {@link org.apache.tapestry.services.impl.ExtensionLookupFactory}.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public class TestExtensionLookupFactory extends HiveMindTestCase
  {
      private List createParameters(String extensionName)
      {
          ExtensionLookupParameter p = new ExtensionLookupParameter();
  
          p.setExtensionName(extensionName);
  
          return Collections.singletonList(p);
      }
  
      public void testInSpecification()
      {
          MockControl specControl = newControl(IApplicationSpecification.class);
          IApplicationSpecification spec = (IApplicationSpecification) specControl.getMock();
  
          Runnable r = (Runnable) newMock(Runnable.class);
  
          // Training
  
          spec.checkExtension("foo.bar");
          specControl.setReturnValue(true);
  
          spec.getExtension("foo.bar", Runnable.class);
          specControl.setReturnValue(r);
  
          replayControls();
  
          ExtensionLookupFactory f = new ExtensionLookupFactory();
          f.setSpecification(spec);
  
          Object actual =
              f.createCoreServiceImplementation(
                  "biz.bap.Boom",
                  Runnable.class,
                  null,
                  null,
                  createParameters("foo.bar"));
  
          assertSame(r, actual);
  
          verifyControls();
      }
  
      public void testDefault()
      {
          MockControl specControl = newControl(IApplicationSpecification.class);
          IApplicationSpecification spec = (IApplicationSpecification) specControl.getMock();
  
          MockControl dibControl = newControl(DefaultImplementationBuilder.class);
          DefaultImplementationBuilder dib = (DefaultImplementationBuilder) dibControl.getMock();
  
          Module module = (Module) newMock(Module.class);
  
          Runnable r = (Runnable) newMock(Runnable.class);
  
          // Training
  
          spec.checkExtension("foo.bar");
          specControl.setReturnValue(false);
  
          dib.buildDefaultImplementation(Runnable.class, module);
          dibControl.setReturnValue(r);
  
          replayControls();
  
          ExtensionLookupFactory f = new ExtensionLookupFactory();
          f.setSpecification(spec);
          f.setDefaultBuilder(dib);
  
          Object actual =
              f.createCoreServiceImplementation(
                  "biz.bap.Boom",
                  Runnable.class,
                  null,
                  module,
                  createParameters("foo.bar"));
  
          assertSame(r, actual);
  
          verifyControls();
      }
  
      public void testFailure()
      {
          Location l = fabricateLocation(264);
          ExtensionLookupParameter p = new ExtensionLookupParameter();
  
          p.setLocation(l);
          p.setExtensionName("gnip.gnop");
  
          List parameters = Collections.singletonList(p);
  
          ExtensionLookupFactory f = new ExtensionLookupFactory();
  
          try
          {
              f.createCoreServiceImplementation(null, null, null, null, parameters);
  
              unreachable();
          }
          catch (ApplicationRuntimeException ex)
          {
              assertSame(l, ex.getLocation());
          }
      }
  }
  
  
  
  1.6       +133 -10   jakarta-tapestry/framework/conf/META-INF/hivemodule.xml
  
  Index: hivemodule.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/conf/META-INF/hivemodule.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- hivemodule.xml	27 Aug 2004 13:42:49 -0000	1.5
  +++ hivemodule.xml	29 Aug 2004 21:38:23 -0000	1.6
  @@ -17,7 +17,8 @@
   
   <module id="tapestry" version="3.1.0">
   
  -  The master module for the Apache Tapestry web application framework.
  +  The master module for the Apache Tapestry web application framework.  This is growing rapidly 
  +  and will likely split into a number of sub modules.
     
     <service-point id="MasterInitializer" interface="org.apache.tapestry.services.ApplicationInitializer">
       
  @@ -190,6 +191,11 @@
     
     <contribution configuration-id="hivemind.FactoryDefaults">
       <default symbol="org.apache.tapestry.engine-class" value="org.apache.tapestry.engine.BaseEngine"/>
  +    <default symbol="org.apache.tapestry.default-script-language" value="jython"/>
  +    <default symbol="org.apache.tapestry.visit-class" value="java.util.HashMap"/>
  +    <default symbol="org.apache.tapestry.output-encoding" value="UTF-8"/>
  +    <default symbol="org.apache.tapestry.enhance.disable-abstract-method-validation" value="false"/>
  +    <default symbol="org.apache.tapestry.default-page-class" value="org.apache.tapestry.html.BasePage"/>
     </contribution>
     
     <service-point id="RequestServicerPipeline" interface="org.apache.tapestry.services.RequestServicer">
  @@ -212,6 +218,7 @@
           <set-service property="engineManager" service-id="EngineManager"/>
           <set-object property="specification" value="service-property:ApplicationGlobals:specification"/>
           <set-object property="servlet" value="service-property:ApplicationGlobals:servlet"/>
  +        <set-service property="infrastructure" service-id="Infrastructure"/>
         </construct>
       </invoke-factory>
       
  @@ -229,14 +236,11 @@
     </contribution>
     
     
  -  
  -  <configuration-point id="GlobalPropertySources">
  +  <schema id="PropertySources">
       
  -    Specifies a sequence of property sources used to resolve global application configuration data, which may
  -    be in web.xml (servlet init parameters or servlet
  -    context init parameters), or provided as HiveMind substitution symbol.
  +      Used to build a list of IPropertySource instances in a specific
  +      consultation order.
       
  -    <schema>
         <element name="source">
           
           <attribute name="name" required="true">
  @@ -260,12 +264,20 @@
           </conversion>
           
         </element>
  -    </schema>
  +
  +  </schema>
  +  
  +  <configuration-point id="GlobalPropertySources" schema-id="PropertySources">
  +    
  +    Specifies a sequence of property sources used to resolve global application configuration data, which may
  +    be in web.xml (servlet init parameters or servlet
  +    context init parameters), or provided as HiveMind substitution symbol.
  +    
     </configuration-point>
     
     <service-point id="GlobalPropertySource" interface="org.apache.tapestry.engine.IPropertySource">
       
  -    Service point of obtaining configuration data resolved using GlobalPropertySourcePipeline
  +    Service point for obtaining configuration data resolved using GlobalPropertySources
       configuration point.
       
       <invoke-factory>
  @@ -321,20 +333,131 @@
       <source name="symbols" object="service:SymbolSourcesPropertySource" after="context"/>
     </contribution>
     
  +  
  +  <configuration-point id="ApplicationPropertySources" schema-id="PropertySources">
  +    
  +    Property sources used by the application, which includes a search of the
  +    application specification, a delegate of the application specification, the servlet and
  +    servlet context, and JVM System Properties.
  +    
  +  </configuration-point>
  +  
  +  <service-point id="ApplicationPropertySource" interface="org.apache.tapestry.engine.IPropertySource">
  +    
  +    Service point for obtaining configuration data resolved using ApplicationPropertySources
  +    configuration point.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.PropertySourceImpl">
  +        <set-configuration property="contributions" configuration-id="ApplicationPropertySources"/>
  +      </construct>
  +    </invoke-factory>
  +        
  +  </service-point>
  +  
  +  <contribution configuration-id="ApplicationPropertySources">
  +    <source name="app-spec" object="service:ApplicationSpecificationPropertySource"/>
  +    <source name="servlet" object="service:ServletPropertySource" after="app-spec"/>
  +    <source name="context" object="service:ServletContextPropertySource" after="servlet"/>
  +    <source name="delegate" object="service:DelegatePropertySource" after="context"/>
  +    <source name="symbols" object="service:SymbolSourcesPropertySource" after="context"/>
  +  </contribution>
  +  
  +  <service-point id="ApplicationSpecificationPropertySource" interface="org.apache.tapestry.engine.IPropertySource">
  +    
  +    Obtains property values from application specification meta-data.
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.ApplicationSpecificationPropertySource">
  +        <set-service property="specification" service-id="ApplicationSpecification"/>
  +      </construct>
  +    </invoke-factory>
  +    
  +  </service-point>
  +  
  +  <service-point id="DelegatePropertySource" interface="org.apache.tapestry.engine.IPropertySource">
  +    
  +    Property source provided as an application extension: org.apache.tapestry.property-source.
  +    
  +    <invoke-factory service-id="ExtensionLookupFactory">
  +      <lookup extension-name="org.apache.tapestry.property-source"/>
  +    </invoke-factory>
  +    
  +  </service-point>
  +  
     <service-point id="GlobalPropertyObjectProvider" interface="org.apache.hivemind.service.ObjectProvider">
       
       An object provider based on obtaining global properties from the GlobalPropertySource
       service.
       
       <invoke-factory>
  -      <construct class="org.apache.tapestry.services.impl.GlobalPropertyObjectProvider">
  +      <construct class="org.apache.tapestry.services.impl.PropertyObjectProvider">
           <set-service property="source" service-id="GlobalPropertySource"/>
         </construct>
       </invoke-factory>
       
     </service-point>
     
  +  <service-point id="ApplicationPropertyObjectProvider" interface="org.apache.hivemind.service.ObjectProvider">
  +    
  +    An object provider based on obtained properties from the ApplicationPropertySource service.
  +
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.PropertyObjectProvider">
  +        <set-service property="source" service-id="ApplicationPropertySource"/>
  +      </construct>
  +    </invoke-factory>    
  +    
  +  </service-point>
  +  
     <contribution configuration-id="hivemind.ObjectProviders">
       <provider prefix="global-property" service-id="GlobalPropertyObjectProvider"/>
  +    <provider prefix="app-property" service-id="ApplicationPropertyObjectProvider"/>
  +  </contribution>
  +  
  +  <service-point id="Infrastructure" interface="org.apache.tapestry.services.Infrastructure">
  +    
  +    A kind of "clearing house" of other services. The Infrastructure is provided to the
  +    IEngine instance via the InvokeEngineTerminator service (using an HttpServletRequest
  +    attribute).  The engine can then get the other services it depends upon.  Ultimately,
  +    Infrastructure may be removed and the entire IEngine interface may go away!
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.InfrastructureImpl">
  +        <set-service property="applicationPropertySource" service-id="ApplicationPropertySource"/>
  +      </construct>
  +    </invoke-factory>
  +    
  +  </service-point>
  +  
  +  <service-point id="ExtensionLookupFactory" interface="org.apache.hivemind.ServiceImplementationFactory">
  +    
  +    A service factory that, in fact, attempts to obtain service implementations
  +    as application extensions.  Failing that, a default implementation is
  +    constructed.
  +    
  +    <parameters-schema>
  +      
  +      <element name="lookup">
  +        
  +        <attribute name="extension-name" required="true"/>
  +        
  +        <conversion class="org.apache.tapestry.services.impl.ExtensionLookupParameter"/>
  +        
  +      </element>
  +      
  +    </parameters-schema>
  +    
  +    <invoke-factory>
  +      <construct class="org.apache.tapestry.services.impl.ExtensionLookupFactory">
  +        <set-service property="specification" service-id="ApplicationSpecification"/>
  +        <set-service property="defaultBuilder" service-id="hivemind.lib.DefaultImplementationBuilder"/>
  +      </construct>
  +    </invoke-factory>
  +  </service-point>
  +  
  +  <contribution configuration-id="hivemind.SymbolSources">
  +    <source name="SystemProperties" before="hivemind.ApplicationDefaults" 
  +      class="org.apache.hivemind.impl.SystemPropertiesSymbolSource"/>
     </contribution>
   </module>
  
  
  
  1.28      +0 -4      jakarta-tapestry/framework/src/org/apache/tapestry/pageload/PageLoader.java
  
  Index: PageLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/pageload/PageLoader.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- PageLoader.java	4 Jul 2004 21:00:09 -0000	1.27
  +++ PageLoader.java	29 Aug 2004 21:38:23 -0000	1.28
  @@ -50,7 +50,6 @@
   import org.apache.tapestry.engine.ISpecificationSource;
   import org.apache.tapestry.engine.ITemplateSource;
   import org.apache.tapestry.event.PageDetachListener;
  -import org.apache.tapestry.html.BasePage;
   import org.apache.tapestry.request.RequestContext;
   import org.apache.tapestry.resolver.ComponentSpecificationResolver;
   import org.apache.tapestry.resource.ContextResource;
  @@ -677,9 +676,6 @@
               className =
                   _engine.getPropertySource().getPropertyValue(
                       "org.apache.tapestry.default-page-class");
  -
  -            if (className == null)
  -                className = BasePage.class.getName();
   
               if (LOG.isDebugEnabled())
                   LOG.debug("Defaulting to class " + className);
  
  
  
  1.1                  jakarta-tapestry/framework/src/org/apache/tapestry/services/Infrastructure.java
  
  Index: Infrastructure.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;
  
  import org.apache.tapestry.engine.IPropertySource;
  
  /**
   * Tapestry infrastructure ... key services required by the
   * {@link org.apache.tapestry.IEngine} instance.
   *
   * @author Howard Lewis Ship
   * @since 3.1
   */
  public interface Infrastructure
  {
  	/**
  	 * Returns an {@link IPropertySource} configured to search
  	 * the application specification, etc.  See 
  	 * <code>tapestry.ApplicationPropertySource</code>.
  	 */
  	public IPropertySource getApplicationPropertySource();
  
  }
  
  
  

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