tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard M. Lewis Ship" <hls...@comcast.net>
Subject RE: [PATCH] Javadoc, Logging strings and some
Date Sun, 02 May 2004 13:26:37 GMT
I appreciate the effort you area putting into this, but I'm not really seeing the added utility of
all those static strings. For the most part, each of those strings is used just once (there's only a
handful of truly general messages). This ends up making Tapestry.java a chokepoint if there are
multiple developers.

However, I did come up with an alternate idea.

The problem with Tapestry.format() and friends is:
- You have to know the message key
- You have to know how all the arguments are used
- You may have to convert or format some of the objects aguments
- You may have to create an Object[] array if you have more than three arguments

Now, what if there was a TapestryMessages class, and it had a static method for each message.  It
could take typed parameters and, in turn, invoke Tapestry.format().

Better yet, what if each package inside Tapestry had its own Mesasges classes, such that there isn't
a chokepoint.

This would make the Tapestry code that much more readable, i.e.

throw new ApplicationRuntimeException(
	ParserMessage.unexpectedDTD(publicId), getLocation());

instead of:

throw new ApplicationRuntimeException(
	Tapestry.format("Parser.unexpectedDTD", publicId),
      getLocation());

--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Tapestry: Java Web Components 
Creator, HiveMind
http://howardlewisship.com


> -----Original Message-----
> From: HansD [mailto:cobra@pobox.com] 
> Sent: Sunday, May 02, 2004 4:45 AM
> To: tapestry-dev@jakarta.apache.org
> Subject: [PATCH] Javadoc, Logging strings and some
> 
> 
> Howard,
> 
> Since you've been updating the 3.1 code to the main trunk,
> here's a new patch
> 
> Please let me know what I can do to improve the quality of 
> the submitted patches.
> 
> Hans
> 
> 
> Index: .classpath
> ===================================================================
> RCS file: /home/cvspublic/jakarta-tapestry/.classpath,v
> retrieving revision 1.42
> diff -u -r1.42 .classpath
> --- .classpath	30 Apr 2004 15:15:17 -0000	1.42
> +++ .classpath	2 May 2004 07:38:44 -0000
> @@ -1,31 +1,31 @@
>  <?xml version="1.0" encoding="UTF-8"?>
>  <classpath>
> -    <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
> -    <classpathentry kind="lib" path="config"/>
> -    <classpathentry kind="src" path="framework/src"/>
> -    <classpathentry kind="src" path="junit/src"/>
> -    <classpathentry kind="src" path="contrib/src"/>
> -    <classpathentry kind="src" path="examples/Workbench/src"/>
> -    <classpathentry kind="src" path="examples/wap/src"/>
> -    <classpathentry kind="src" path="examples/VlibBeans/src"/>
> -    <classpathentry kind="src" path="examples/Vlib/src"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/jakarta-oro-2.0.6.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-logging-1.0.2.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-lang-1.0.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/bsf-2.3.0.jar"/>
> -    <classpathentry kind="lib" path="ext-dist/jdom-b8.jar"/>
> -    <classpathentry kind="lib" path="ext-dist/junit.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-beanutils-1.6.1.jar"/>
> -    <classpathentry kind="lib" 
> path="examples/Workbench/lib/jCharts-0.6.0.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-collections-2.1.jar"/>
> -    <classpathentry kind="lib" 
> path="lib/ext/commons-fileupload-1.0.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/javassist-2.5.1.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-digester-1.5.jar"/>
> -    <classpathentry kind="lib" path="lib/ext/commons-codec-1.2.jar"/>
> -    <classpathentry kind="lib" path="lib/ext/ognl-2.6.3.jar"/>
> -    <classpathentry kind="lib" path="lib/j2ee/geronimo-ejb.jar"/>
> -    <classpathentry kind="lib" path="lib/j2ee/jsp-api.jar"/>
> -    <classpathentry exported="true" kind="lib" 
> path="lib/j2ee/servlet-api.jar"/>
> -    <classpathentry kind="src" path="/jakarta-hivemind"/>
> -    <classpathentry kind="output" path="bin"/>
> +	<classpathentry sourcepath="JRE_SRC" kind="var" path="JRE_LIB"/>
> +	<classpathentry kind="lib" path="config"/>
> +	<classpathentry kind="src" path="framework/src"/>
> +	<classpathentry kind="src" path="junit/src"/>
> +	<classpathentry kind="src" path="contrib/src"/>
> +	<classpathentry kind="src" path="examples/Workbench/src"/>
> +	<classpathentry kind="src" path="examples/wap/src"/>
> +	<classpathentry kind="src" path="examples/VlibBeans/src"/>
> +	<classpathentry kind="src" path="examples/Vlib/src"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/jakarta-oro-2.0.6.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-logging-1.0.2.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-lang-1.0.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/bsf-2.3.0.jar"/>
> +	<classpathentry kind="lib" path="ext-dist/jdom-b8.jar"/>
> +	<classpathentry kind="lib" path="ext-dist/junit.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-beanutils-1.6.1.jar"/>
> +	<classpathentry kind="lib" 
> path="examples/Workbench/lib/jCharts-0.6.0.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-collections-2.1.jar"/>
> +	<classpathentry kind="lib" 
> path="lib/ext/commons-fileupload-1.0.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/javassist-2.5.1.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/ext/commons-digester-1.5.jar"/>
> +	<classpathentry kind="lib" 
> path="lib/ext/commons-codec-1.2.jar"/>
> +	<classpathentry kind="lib" path="lib/ext/ognl-2.6.3.jar"/>
> +	<classpathentry kind="lib" path="lib/j2ee/geronimo-ejb.jar"/>
> +	<classpathentry kind="lib" path="lib/j2ee/jsp-api.jar"/>
> +	<classpathentry exported="true" kind="lib" 
> path="lib/j2ee/servlet-api.jar"/>
> +	<classpathentry kind="lib" 
> path="lib/ext/hivemind-1.0-alpha-5.jar"/>
> +	<classpathentry kind="output" path="bin"/>
>  </classpath>
> Index: .project
> ===================================================================
> RCS file: /home/cvspublic/jakarta-tapestry/.project,v
> retrieving revision 1.3
> diff -u -r1.3 .project
> --- .project	30 Apr 2004 15:15:17 -0000	1.3
> +++ .project	2 May 2004 07:38:44 -0000
> @@ -3,7 +3,6 @@
>  	<name>jakarta-tapestry</name>
>  	<comment></comment>
>  	<projects>
> -		<project>jakarta-hivemind</project>
>  	</projects>
>  	<buildSpec>
>  		<buildCommand>
> Index: framework/src/org/apache/tapestry/ApplicationServlet.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/ApplicationServlet.java,v
> retrieving revision 1.9
> diff -u -r1.9 ApplicationServlet.java
> --- framework/src/org/apache/tapestry/ApplicationServlet.java	
> 30 Apr 2004 15:16:27 -0000	1.9
> +++ framework/src/org/apache/tapestry/ApplicationServlet.java	
> 2 May 2004 07:39:02 -0000
> @@ -85,13 +85,48 @@
>   *  @version $Id: ApplicationServlet.java,v 1.9 2004/04/30 
> 15:16:27 hlship Exp $
>   *  @author Howard Lewis Ship
>   * 
> + *  @see #init(ServletConfig)
> + *  @see #doService(HttpServletRequest, HttpServletResponse)
> + * 
>   **/
>  
>  public class ApplicationServlet extends HttpServlet
>  {
> +	private static final String MSG_USING_POOLED_ENGINE = 
> +		"ApplicationServlet.using-pooled-engine";
> +	private static final String MSG_CREATED_ENGINE = 
> +		"ApplicationServlet.created-engine";
> +	private static final String MSG_CREATING_ENGINE = 
> +		"ApplicationServlet.creating-engine";
> +	private static final String ENGINE_CLASS_PARAM = 
> +		"org.apache.tapestry.engine-class";
> +	private static final String MSG_SESSION_NO_ENGINE = 
> +		"ApplicationServlet.session-no-engine";
> +	private static final String MSG_ENGINE_FOM_SESSION = 
> +		"ApplicationServlet.engine-fom-session";
> +	private static final String MSG_ENGINE_TO_POOL = 
> +		"ApplicationServlet.engine-to-pool";
> +	private static final String 
> MSG_ENGINE_STATEFUL_WITHOUT_SESSION = 
> +		"ApplicationServlet.engine-stateful-without-session";
> +	private static final String MSG_SESSION_INVALIDATED = 
> +		"ApplicationServlet.session-invalidated";
> +	private static final String MSG_STORING_ENGINE_IN_SESSION = 
> +		"ApplicationServlet.storing-engine-in-session";
> +	private static final String MSG_COULD_NOT_LOCATE_ENGINE = 
> +		"ApplicationServlet.could-not-locate-engine";
> +	
> +	/**
> +	 * Common logger for this class
> +	 */
> +	
>      private static final Log LOG = 
> LogFactory.getLog(ApplicationServlet.class);
>  
> -    /** @since 2.3 **/
> +    /**
> +     * Optional parameter to specify the location of the 
> Application specification
> +     * To be decladerd in <pre>web.xml</pre>
> +     * 
> +     * @since 2.3 
> +     */
>  
>      private static final String APP_SPEC_PATH_PARAM =
>          "org.apache.tapestry.application-specification";
> @@ -135,7 +170,7 @@
>       * 
>       **/
>  
> -    private String _engineClassName;
> +    private String _engineClassNameCache;
>  
>      /**
>       *  Used to search for configuration properties.
> @@ -148,9 +183,11 @@
>      private IPropertySource _propertySource;
>  
>      /**
> -     *  Invokes {@link #doService(HttpServletRequest, 
> HttpServletResponse)}.
> +     * Invokes {@link #doService(HttpServletRequest, 
> HttpServletResponse)}.
> +     * 
> +     * @see HttpServlet#doGet(HttpServletRequest, 
> HttpServletResponse)
>       *
> -     *  @since 1.0.6
> +     * @since 1.0.6
>       *
>       **/
>  
> @@ -159,21 +196,25 @@
>      {
>          doService(request, response);
>      }
> +	
> +	/**
> +	 * @since 2.3
> +     *
> +	 **/
> +	 
> +	private ClassResolver _resolver;
>  
>      /**
> -     *  @since 2.3
> +     * Handles the {@link #doGet(HttpServletRequest, 
> HttpServletResponse) GET} and 
> +     * {@link #doPost(HttpServletRequest, 
> HttpServletResponse) POST} requests. 
>       * 
> -     **/
> -
> -    private ClassResolver _resolver;
> -
> -    /**
> -     * Handles the GET and POST requests. Performs the following:
> +     * Performs the following:
>       * <ul>
>       * <li>Construct a {@link RequestContext}
>       * <li>Invoke {@link #getEngine(RequestContext)} to get 
> or create the {@link IEngine}
>       * <li>Invoke {@link IEngine#service(RequestContext)} on 
> the application
>       * </ul>
> +     * 
>       **/
>  
>      protected void doService(HttpServletRequest request, 
> HttpServletResponse response)
> @@ -193,8 +234,7 @@
>              IEngine engine = getEngine(context);
>  
>              if (engine == null)
> -                throw new ServletException(
> -                    
> Tapestry.getMessage("ApplicationServlet.could-not-locate-engine"));
> +                throw new 
> ServletException(Tapestry.getMessage(MSG_COULD_NOT_LOCATE_ENGINE));
>  
>              boolean dirty = engine.service(context);
>  
> @@ -220,7 +260,7 @@
>                      if (forceStore || dirty)
>                      {
>                          if (LOG.isDebugEnabled())
> -                            LOG.debug("Storing " + engine + 
> " into session as " + _attributeName);
> +                            
> LOG.debug(Tapestry.format(MSG_STORING_ENGINE_IN_SESSION, 
> engine, _attributeName));
>  
>                          session.setAttribute(_attributeName, engine);
>                      }
> @@ -232,7 +272,7 @@
>                      // to be reclaimed by the garbage collector.
>  
>                      if (LOG.isDebugEnabled())
> -                        LOG.debug("Session invalidated.");
> +                        
> LOG.debug(Tapestry.getMessage(MSG_SESSION_INVALIDATED));
>                  }
>  
>                  // The engine is stateful and stored in a 
> session.  Even if it started
> @@ -243,10 +283,7 @@
>  
>              if (engine.isStateful())
>              {
> -                LOG.error(
> -                    Tapestry.format(
> -                        
> "ApplicationServlet.engine-stateful-without-session",
> -                        engine));
> +                
> LOG.error(Tapestry.format(MSG_ENGINE_STATEFUL_WITHOUT_SESSION,
>  engine));
>                  return;
>              }
>  
> @@ -256,7 +293,7 @@
>              // client in the same locale).
>  
>              if (LOG.isDebugEnabled())
> -                LOG.debug("Returning " + engine + " to pool.");
> +                
> LOG.debug(Tapestry.format(MSG_ENGINE_TO_POOL, engine));
>  
>              _enginePool.store(engine.getLocale(), engine);
>  
> @@ -296,6 +333,8 @@
>       * 
>       *  @since 2.3
>       * 
> +     *  @return A {@link RequestContext} object for this 
> request cylce
> +     * 
>       **/
>  
>      protected RequestContext createRequestContext(
> @@ -317,8 +356,9 @@
>      }
>  
>      /**
> -     *  Invokes {@link #doService(HttpServletRequest, 
> HttpServletResponse)}.
> +     * Invokes {@link #doService(HttpServletRequest, 
> HttpServletResponse)}.
>       *
> +     * @see HttpServlet#doGet(HttpServletRequest, 
> HttpServletResponse)
>       *
>       **/
>  
> @@ -347,6 +387,8 @@
>       *  <li>From the pool of available engines
>       *  <li>Freshly created
>       *  </ul>
> +     * 
> +     *  Invoked from {@link #doService(HttpServletRequest, 
> HttpServletResponse)}.
>       *
>       **/
>  
> @@ -363,13 +405,13 @@
>              if (engine != null)
>              {
>                  if (LOG.isDebugEnabled())
> -                    LOG.debug("Retrieved " + engine + " from 
> session " + session.getId() + ".");
> +                    
> LOG.debug(Tapestry.format(MSG_ENGINE_FOM_SESSION, engine, 
> session.getId()));
>  
>                  return engine;
>              }
>  
>              if (LOG.isDebugEnabled())
> -                LOG.debug("Session exists, but doesn't 
> contain an engine.");
> +                
> LOG.debug(Tapestry.getMessage(MSG_SESSION_NO_ENGINE));
>          }
>  
>          Locale locale = getLocaleFromRequest(context);
> @@ -384,7 +426,7 @@
>          else
>          {
>              if (LOG.isDebugEnabled())
> -                LOG.debug("Using pooled engine " + engine + 
> " (from locale " + locale + ").");
> +                
> LOG.debug(Tapestry.format(MSG_USING_POOLED_ENGINE, engine, locale));
>          }
>  
>          return engine;
> @@ -396,8 +438,12 @@
>       *  from the request itself.  This may return null
>       *  if no locale is determined.
>       *
> +     *  @param context The {@link RequestContext} object for 
> the current request cycle
> +     *  @return The {@link Locale} for this request, or null 
> if not found
> +     * 
>       **/
>  
> +    // TODO: ServletException is not thrown in underlying 
> methods, remove it?
>      protected Locale getLocaleFromRequest(RequestContext 
> context) throws ServletException
>      {
>          Cookie cookie = context.getCookie(LOCALE_COOKIE_NAME);
> @@ -415,7 +461,7 @@
>       * 
>       *  @see #getApplicationSpecification()
>       *  @see #constructApplicationSpecification()
> -     *  @see #createResourceResolver()
> +     *  @see #createClassResolver()
>       *
>       **/
>  
> @@ -435,14 +481,15 @@
>       *  for the servlet (which will utlimately be shared and 
> used through the
>       *  application).
>       * 
> -     *  <p>This implementation constructs a {@link 
> DefaultResourceResolver}, subclasses
> +     *  <p>This implementation constructs a {@link 
> DefaultClassResolver}, subclasses
>       *  may provide a different implementation.
>       * 
> -     *  @see #getResourceResolver()
> +     *  @see #getClassResolver()
>       *  @since 2.3
>       * 
>       **/
>  
> +    // TODO: ServletException is not thrown in underlying 
> methods, remove it?
>      protected ClassResolver createClassResolver() throws 
> ServletException
>      {
>          return new DefaultClassResolver();
> @@ -453,7 +500,7 @@
>       *  the {@link ApplicationSpecification} for this servlet.
>       *  Invokes {@link #getApplicationSpecificationPath()}, opens
>       *  the resource as a stream, then invokes
> -     *  {@link #parseApplicationSpecification(IResourceLocation)}.
> +     *  {@link #parseApplicationSpecification(Resource)}.
>       * 
>       *  <p>
>       *  This method exists to be overriden in
> @@ -636,6 +683,7 @@
>       * 
>       **/
>  
> +    // TODO: ServletException is not thrown in underlying 
> methods, remove it?
>      protected String getApplicationSpecificationPath() 
> throws ServletException
>      {
>          return getInitParameter(APP_SPEC_PATH_PARAM);
> @@ -643,16 +691,16 @@
>  
>      /**
>       *  Invoked by {@link #getEngine(RequestContext)} to create
> -     *  the {@link IEngine} instance specific to the
> -     *  application, if not already in the
> -     *  {@link HttpSession}.
> +     *  the {@link IEngine} instance specific to the application.
>       *
> -     *  <p>The {@link IEngine} instance returned is stored into the
> -     *  {@link HttpSession}.
> +     *  <p>The {@link IEngine} instance returned can be 
> stored into the
> +     *  {@link HttpSession} by {@link 
> #doService(HttpServletRequest, HttpServletResponse)}.
>       *
>       *  @see #getEngineClassName()    
>       *
>       **/
> +    
> +    // TODO: param context is not used, will it ever be? 
>  
>      protected IEngine createEngine(RequestContext context) 
> throws ServletException
>      {
> @@ -661,14 +709,14 @@
>              String className = getEngineClassName();
>  
>              if (LOG.isDebugEnabled())
> -                LOG.debug("Creating engine from class " + className);
> +                
> LOG.debug(Tapestry.format(MSG_CREATING_ENGINE, className));
>  
>              Class engineClass = 
> getClassResolver().findClass(className);
>  
>              IEngine result = (IEngine) engineClass.newInstance();
>  
>              if (LOG.isDebugEnabled())
> -                LOG.debug("Created engine " + result);
> +                
> LOG.debug(Tapestry.format(MSG_CREATED_ENGINE, result));
>  
>              return result;
>          }
> @@ -695,18 +743,18 @@
>  
>      protected String getEngineClassName()
>      {
> -        if (_engineClassName != null)
> -            return _engineClassName;
> +        if (_engineClassNameCache != null)
> +            return _engineClassNameCache;
>  
> -        _engineClassName = _specification.getEngineClassName();
> +        _engineClassNameCache = _specification.getEngineClassName();
>  
> -        if (_engineClassName == null)
> -            _engineClassName = 
> searchConfiguration("org.apache.tapestry.engine-class");
> +        if (_engineClassNameCache == null)
> +            _engineClassNameCache = 
> searchConfiguration(ENGINE_CLASS_PARAM);
>  
> -        if (_engineClassName == null)
> -            _engineClassName = BaseEngine.class.getName();
> +        if (_engineClassNameCache == null)
> +            _engineClassNameCache = BaseEngine.class.getName();
>  
> -        return _engineClassName;
> +        return _engineClassNameCache;
>      }
>  
>      /**
> Index: framework/src/org/apache/tapestry/IEngine.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/IEngine.java,v
> retrieving revision 1.11
> diff -u -r1.11 IEngine.java
> --- framework/src/org/apache/tapestry/IEngine.java	30 Apr 
> 2004 15:16:27 -0000	1.11
> +++ framework/src/org/apache/tapestry/IEngine.java	2 May 
> 2004 07:39:03 -0000
> @@ -210,12 +210,15 @@
>      public ITemplateSource getTemplateSource();
>  
>      /**
> -     *  Method invoked from the {@link 
> org.apache.tapestry.ApplicationServlet} 
> -     *  to perform processing of the
> -     *  request.  In release 3.0, this has become more of a 
> dirty flag, indicating
> -     *  if any state stored by the engine instance itself 
> has changed.
> +     * Method invoked from 
> +     * {@link 
> org.apache.tapestry.ApplicationServlet#doService(HttpServletRe
> quest, HttpServletResponse)} 
> +     * to perform processing of the request.  In release 
> 3.0, this has become 
> +     * more of a dirty flag, indicating if any state stored 
> by the engine instance 
> +     * itself has changed.
>       *
> -     *  @return true if the state of the engine was, or 
> could have been, changed during
> +     * @param context
> +     * 			The context of the current request 
> +     * @return true if the state of the engine was, or could 
> have been, changed during
>       *  processing.
>       *
>       **/
> Index: framework/src/org/apache/tapestry/TapestryStrings.properties
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/TapestryStrings.properties,v
> retrieving revision 1.41
> diff -u -r1.41 TapestryStrings.properties
> --- 
> framework/src/org/apache/tapestry/TapestryStrings.properties	
> 30 Mar 2004 18:45:25 -0000	1.41
> +++ 
> framework/src/org/apache/tapestry/TapestryStrings.properties	
> 2 May 2004 07:39:04 -0000
> @@ -60,7 +60,15 @@
>  ApplicationServlet.could-not-parse-spec=Unable to parse 
> application specification {0}.
>  ApplicationServlet.get-app-path-not-overriden=Application 
> servlet {0} does not provide an implementation of method 
> getApplicationServletPath().
>  ApplicationServlet.no-application-specification=Running 
> application without an application specification.
> -ApplicationServlet.engine-stateful-without-session=Engine 
> {0} is stateful even though there is no HttpSession.  
> Discarding the engine. 
> +ApplicationServlet.engine-stateful-without-session=Engine 
> {0} is stateful even though there is no HttpSession. 
> Discarding the engine. 
> +ApplicationServlet.storing-engine-in-session=Storing {0} 
> into session as {1}.
> +ApplicationServlet.session-invalidated=Session invalidated.
> +ApplicationServlet.engine-to-pool=Returning {0} to pool.
> +ApplicationServlet.engine-fom-session=Retrieved {0} from session.
> +ApplicationServlet.session-no-engine=Session exists, but 
> doesn't contain an engine.
> +ApplicationServlet.creating-engine=Creating engine from class {0}
> +ApplicationServlet.created-engine=Created engine {0}
> +ApplicationServlet.using-pooled-engine=Using pooled engine 
> {0} (from locale {1}).
>  
>  BaseComponent.multiple-component-references=Template for 
> component {0} contains multiple references to embedded component {1}.
>  BaseComponent.unbalanced-close-tags=More closing tags the 
> open tags in template.
> @@ -150,6 +158,8 @@
>  AbstractEngine.exception-during-cleanup=Exception during 
> post-request cleanup.
>  AbstractEngine.exception-during-cache-clear=Exception while 
> clearing caches after request.
>  AbstractEngine.validate-cycle=A validate cycle during page 
> activation was detected: {0}.
> +AbstractEngine.service-start=Begin service {0}.
> +AbstractEngine.creating-service-map=Creating service map.
>  
>  ActionService.context-parameters=Service action requires 
> either three or four service contect parameters.
>  ActionService.action-component-wrong-type=Component {0} does 
> not implement the IAction interface.
> @@ -416,9 +426,6 @@
>  MultiKey.first-element-may-not-be-null=First element of keys 
> may not be null.
>  MultiKey.no-keys=No keys for this MultiKey.
>  
> -Pool.unable-to-instantiate-instance=Unable to instantiate 
> new instance of class {0}.
> -
> -
>  # org.apache.tapestry.util.io
>  
>  DataSqueezer.short-prefix=The adaptor prefix must contain at 
> least one character.
> @@ -432,6 +439,10 @@
>  SerializableAdaptor.unable-to-interpret-char=Cannot 
> interpret ''{0}'' as a modified Base64 character.
>  
>  ComponentAddressAdaptor.no-separator=Invalid 
> ComponentAddress encoding -- separator not present
> +
> +# org.apache.tapestry.util.pool
> +Pool.unable-to-instantiate-instance=Unable to instantiate 
> new instance of class {0}.
> +Pool.retrieved-from-pool=Retrieved {0} from {1}
>  
>  # org.apache.tapestry.util.prop
>  
> Index: framework/src/org/apache/tapestry/engine/AbstractEngine.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/engine/AbstractEngine.java,v
> retrieving revision 1.31
> diff -u -r1.31 AbstractEngine.java
> --- 
> framework/src/org/apache/tapestry/engine/AbstractEngine.java	
> 30 Apr 2004 15:16:30 -0000	1.31
> +++ 
> framework/src/org/apache/tapestry/engine/AbstractEngine.java	
> 2 May 2004 07:39:06 -0000
> @@ -127,7 +127,25 @@
>  public abstract class AbstractEngine
>      implements IEngine, IEngineServiceView, Externalizable, 
> HttpSessionBindingListener
>  {
> -    private static final Log LOG = 
> LogFactory.getLog(AbstractEngine.class);
> +    private static final String MSG_ILLEGAL_ENCODING = 
> +    	"illegal-encoding";
> +	private static final String MSG_UNABLE_TO_INSTANTIATE_SERVICE = 
> +    	"AbstractEngine.unable-to-instantiate-service";
> +	private static final String MSG_SERVICE_NAME_MISMATCH = 
> +		"AbstractEngine.service-name-mismatch";
> +	private static final String MSG_CREATING_SERVICE_MAP = 
> +		"AbstractEngine.creating-service-map";
> +	private static final String MSG_UNKNOWN_SERVICE = 
> +		"AbstractEngine.unknown-service";
> +	private static final String MSG_UNABLE_TO_BEGIN_REQUEST = 
> +		"AbstractEngine.unable-to-begin-request";
> +	private static final String MSG_SERVICE_START = 
> +		"AbstractEngine.service-start";
> +	
> +	/**
> +	 * Common logger for this class
> +	 */
> +	private static final Log LOG = 
> LogFactory.getLog(AbstractEngine.class);
>  
>      /**
>       *  @since 2.0.4
> @@ -138,7 +156,15 @@
>  
>      private transient String _contextPath;
>      private transient String _servletPath;
> +    
> +    /**
> +     * Address of the client, used by {@link 
> #reportException(String, Throwable)} 
> +     */
>      private transient String _clientAddress;
> +    
> +    /**
> +     * ID of the session, used by {@link 
> #reportException(String, Throwable)} 
> +     */
>      private transient String _sessionId;
>      private transient boolean _stateful;
>      private transient ListenerMap _listeners;
> @@ -173,13 +199,14 @@
>       *
>       **/
>  
> -    public static final String GLOBAL_NAME = 
> "org.apache.tapestry.global";
> +    public static final String GLOBAL_ATTRIBUTE = 
> "org.apache.tapestry.global";
>  
>      /**
>       *  The name of the application property that will be used to
>       *  determine the encoding to use when generating the output
>       *
>       *  @since 3.0
> +     * 
>       **/
>  
>      public static final String OUTPUT_ENCODING_PROPERTY_NAME =
> @@ -258,7 +285,7 @@
>       *
>       **/
>  
> -    protected static final String SCRIPT_SOURCE_NAME = 
> "org.apache.tapestry.ScriptSource";
> +    protected static final String SCRIPT_SOURCE_ATTRIBUTE = 
> "org.apache.tapestry.ScriptSource";
>  
>      /**
>       *  The name of the context attribute for the {@link 
> IComponentMessagesSource}
> @@ -268,7 +295,7 @@
>       *
>       **/
>  
> -    protected static final String STRINGS_SOURCE_NAME = 
> "org.apache.tapestry.StringsSource";
> +    protected static final String STRINGS_SOURCE_ATTRIBUTE = 
> "org.apache.tapestry.StringsSource";
>  
>      private transient IComponentMessagesSource _stringsSource;
>  
> @@ -286,7 +313,7 @@
>       *
>       **/
>  
> -    protected static final String TEMPLATE_SOURCE_NAME = 
> "org.apache.tapestry.TemplateSource";
> +    protected static final String TEMPLATE_SOURCE_ATTRIBUTE 
> = "org.apache.tapestry.TemplateSource";
>  
>      /**
>       *  Servlet context attribute name for the default 
> {@link ISpecificationSource}
> @@ -294,7 +321,7 @@
>       *
>       **/
>  
> -    protected static final String SPECIFICATION_SOURCE_NAME =
> +    protected static final String SPECIFICATION_SOURCE_ATTRIBUTE =
>          "org.apache.tapestry.SpecificationSource";
>  
>      /**
> @@ -303,7 +330,7 @@
>       *
>       **/
>  
> -    protected static final String PAGE_SOURCE_NAME = 
> "org.apache.tapestry.PageSource";
> +    protected static final String PAGE_SOURCE_ATTRIBUTE = 
> "org.apache.tapestry.PageSource";
>  
>      /**
>       *  Servlet context attribute name for a shared instance
> @@ -315,7 +342,7 @@
>       *
>       **/
>  
> -    protected static final String DATA_SQUEEZER_NAME = 
> "org.apache.tapestry.DataSqueezer";
> +    protected static final String DATA_SQUEEZER_ATTRIBUTE = 
> "org.apache.tapestry.DataSqueezer";
>  
>      /**
>       *  The source for pages, which acts as a pool, but is capable of
> @@ -359,7 +386,7 @@
>       *
>       **/
>  
> -    protected static final String PROPERTY_SOURCE_NAME = 
> "org.apache.tapestry.PropertySource";
> +    protected static final String PROPERTY_SOURCE_ATTRIBUTE 
> = "org.apache.tapestry.PropertySource";
>  
>      /**
>       *  A shared instance of {@link IPropertySource}
> @@ -380,7 +407,7 @@
>  
>      private transient Map _serviceMap;
>  
> -    protected static final String SERVICE_MAP_NAME = 
> "org.apache.tapestry.ServiceMap";
> +    protected static final String SERVICE_MAP_ATTRIBUTE = 
> "org.apache.tapestry.ServiceMap";
>  
>      /**
>       *  A shared instance of {@link Pool}.
> @@ -392,7 +419,7 @@
>  
>      private transient Pool _pool;
>  
> -    protected static final String POOL_NAME = 
> "org.apache.tapestry.Pool";
> +    protected static final String POOL_ATTRIBUTE = 
> "org.apache.tapestry.Pool";
>  
>      /**
>       *  Name of a shared instance of {@link 
> org.apache.tapestry.engine.IComponentClassEnhancer}
> @@ -402,7 +429,7 @@
>       *
>       **/
>  
> -    protected static final String ENHANCER_NAME = 
> "org.apache.tapestry.ComponentClassEnhancer";
> +    protected static final String ENHANCER_ATTRIBUTE = 
> "org.apache.tapestry.ComponentClassEnhancer";
>  
>      /**
>       *  A shared instance of {@link 
> org.apache.tapestry.engine.IComponentClassEnhancer}.
> @@ -581,8 +608,9 @@
>      }
>  
>      /**
> -     *  Returns a service with the given name.  Services are 
> created by the
> -     *  first call to {@link #setupForRequest(RequestContext)}.
> +     * Returns a {@link IEngineService} object with the given name.  
> +     * Services are created by the first call to 
> +     * {@link #setupForRequest(RequestContext)}.
>       **/
>  
>      public IEngineService getService(String name)
> @@ -590,8 +618,7 @@
>          IEngineService result = (IEngineService) 
> _serviceMap.get(name);
>  
>          if (result == null)
> -            throw new ApplicationRuntimeException(
> -                
> Tapestry.format("AbstractEngine.unknown-service", name));
> +            throw new 
> ApplicationRuntimeException(Tapestry.format(MSG_UNKNOWN_SERVIC
> E, name));
>  
>          return result;
>      }
> @@ -793,8 +820,15 @@
>      }
>  
>      /**
> -     *  Delegate method for the servlet.  Services the request.
> +     * Delegate method for the servlet. Services the request.
> +     * 
> +     * @see ApplicationServlet#doService(HttpServletRequest, 
> HttpServletResponse)
> +     * @see IEngine#service(RequestContext)
>       *
> +     * @param context
> +     * 			The current request cycle
> +     * @returns true if dirty
> +     * 
>       **/
>  
>      public boolean service(RequestContext context) throws 
> ServletException, IOException
> @@ -805,7 +839,7 @@
>          IMonitor monitor = null;
>  
>          if (LOG.isDebugEnabled())
> -            LOG.debug("Begin service " + context.getRequestURI());
> +            LOG.debug(Tapestry.format(MSG_SERVICE_START, 
> context.getRequestURI()));
>  
>          if (_specification == null)
>              _specification = servlet.getApplicationSpecification();
> @@ -822,15 +856,12 @@
>          try
>          {
>              setupForRequest(context);
> -
>              monitor = getMonitor(context);
> -
>              output = new ResponseOutputStream(context.getResponse());
>          }
>          catch (Exception ex)
>          {
> -            
> reportException(Tapestry.getMessage("AbstractEngine.unable-to-
> begin-request"), ex);
> -
> +            
> reportException(Tapestry.getMessage(MSG_UNABLE_TO_BEGIN_REQUEST), ex);
>              throw new ServletException(ex.getMessage(), ex);
>          }
>  
> @@ -858,7 +889,6 @@
>                  {
>                      service = getService(Tapestry.HOME_SERVICE);
>                      cycle = createRequestCycle(context, 
> service, monitor);
> -
>                      throw ex;
>                  }
>  
> @@ -1189,11 +1219,10 @@
>  
>      protected void setupForRequest(RequestContext context)
>      {
> -        HttpServlet servlet = context.getServlet();
> -        ServletContext servletContext = servlet.getServletContext();
>          HttpServletRequest request = context.getRequest();
>          HttpSession session = context.getSession();
>  
> +        // needed for reportException
>          if (session != null)
>              _sessionId = context.getSession().getId();
>          else
> @@ -1204,6 +1233,8 @@
>          // should occur ... but only if there's an actual 
> error message
>          // to display.
>  
> +        // needed for reportException
> +        
>          if (_clientAddress == null)
>              _clientAddress = request.getRemoteAddr();
>  
> @@ -1231,192 +1262,184 @@
>              // (but won't be null).
>  
>              _contextPath = request.getContextPath();
> -
>              _servletPath = _contextPath + path;
>          }
>  
> -        String servletName = context.getServlet().getServletName();
> +        setupFromAttributes(context);
>  
> -        if (_propertySource == null)
> +        String encoding = request.getCharacterEncoding();
> +        if (encoding == null)
>          {
> -            String name = PROPERTY_SOURCE_NAME + ":" + servletName;
> +            encoding = getOutputEncoding();
> +            try
> +            {
> +                request.setCharacterEncoding(encoding);
> +            }
> +            catch (UnsupportedEncodingException e)
> +            {
> +                throw new 
> IllegalArgumentException(Tapestry.format(MSG_ILLEGAL_ENCODING,
>  encoding));
> +            }
> +            catch (NoSuchMethodError e)
> +            {
> +                // Servlet API 2.2 compatibility
> +                // Behave okay if the setCharacterEncoding() 
> method is unavailable
> +            }
> +            catch (AbstractMethodError e)
> +            {
> +                // Servlet API 2.2 compatibility
> +                // Behave okay if the setCharacterEncoding() 
> method is unavailable
> +            }
> +        }
> +    }
> +
> +    /**
> +     * Delegated from {@link 
> #setupForRequest(RequestContext) for setting up
> +     * variables that are either previously stored in the 
> {@link servletContext}
> +     * or need a new instance.
> +     * 
> +	 * @param context the current {@link RequestContext} object.
> +	 * 
> +	 */
> +	private void setupFromAttributes(RequestContext context)
> +	{
> +		HttpServlet servlet = context.getServlet();
> +		ServletContext servletContext = 
> servlet.getServletContext();
> +		String servletName = 
> context.getServlet().getServletName();
>  
> +        if (_propertySource == null)
> +        {
> +            String name = PROPERTY_SOURCE_ATTRIBUTE + ":" + 
> servletName;
>              _propertySource = (IPropertySource) 
> servletContext.getAttribute(name);
>  
>              if (_propertySource == null)
>              {
>                  _propertySource = createPropertySource(context);
> -
>                  servletContext.setAttribute(name, _propertySource);
>              }
>          }
>  
>          if (_enhancer == null)
>          {
> -            String name = ENHANCER_NAME + ":" + servletName;
> -
> +            String name = ENHANCER_ATTRIBUTE + ":" + servletName;
>              _enhancer = (IComponentClassEnhancer) 
> servletContext.getAttribute(name);
>  
>              if (_enhancer == null)
>              {
>                  _enhancer = createComponentClassEnhancer(context);
> -
>                  servletContext.setAttribute(name, _enhancer);
>              }
>          }
>  
>          if (_pool == null)
>          {
> -            String name = POOL_NAME + ":" + servletName;
> -
> +            String name = POOL_ATTRIBUTE + ":" + servletName;
>              _pool = (Pool) servletContext.getAttribute(name);
>  
>              if (_pool == null)
>              {
>                  _pool = createPool(context);
> -
>                  servletContext.setAttribute(name, _pool);
>              }
>          }
>  
>          if (_templateSource == null)
>          {
> -            String name = TEMPLATE_SOURCE_NAME + ":" + servletName;
> -
> +            String name = TEMPLATE_SOURCE_ATTRIBUTE + ":" + 
> servletName;
>              _templateSource = (ITemplateSource) 
> servletContext.getAttribute(name);
>  
>              if (_templateSource == null)
>              {
>                  _templateSource = createTemplateSource(context);
> -
>                  servletContext.setAttribute(name, _templateSource);
>              }
>          }
>  
>          if (_specificationSource == null)
>          {
> -            String name = SPECIFICATION_SOURCE_NAME + ":" + 
> servletName;
> -
> +            String name = SPECIFICATION_SOURCE_ATTRIBUTE + 
> ":" + servletName;
>              _specificationSource = (ISpecificationSource) 
> servletContext.getAttribute(name);
>  
>              if (_specificationSource == null)
>              {
>                  _specificationSource = 
> createSpecificationSource(context);
> -
>                  servletContext.setAttribute(name, 
> _specificationSource);
>              }
>          }
>  
>          if (_pageSource == null)
>          {
> -            String name = PAGE_SOURCE_NAME + ":" + servletName;
> -
> +            String name = PAGE_SOURCE_ATTRIBUTE + ":" + servletName;
>              _pageSource = (IPageSource) 
> servletContext.getAttribute(name);
>  
>              if (_pageSource == null)
>              {
>                  _pageSource = createPageSource(context);
> -
>                  servletContext.setAttribute(name, _pageSource);
>              }
>          }
>  
>          if (_scriptSource == null)
>          {
> -            String name = SCRIPT_SOURCE_NAME + ":" + servletName;
> -
> +            String name = SCRIPT_SOURCE_ATTRIBUTE + ":" + 
> servletName;
>              _scriptSource = (IScriptSource) 
> servletContext.getAttribute(name);
>  
>              if (_scriptSource == null)
>              {
>                  _scriptSource = createScriptSource(context);
> -
>                  servletContext.setAttribute(name, _scriptSource);
>              }
>          }
>  
>          if (_serviceMap == null)
>          {
> -            String name = SERVICE_MAP_NAME + ":" + servletName;
> -
> +            String name = SERVICE_MAP_ATTRIBUTE + ":" + servletName;
>              _serviceMap = (Map) servletContext.getAttribute(name);
>  
>              if (_serviceMap == null)
>              {
>                  _serviceMap = createServiceMap();
> -
>                  servletContext.setAttribute(name, _serviceMap);
>              }
>          }
>  
>          if (_stringsSource == null)
>          {
> -            String name = STRINGS_SOURCE_NAME + ":" + servletName;
> -
> +            String name = STRINGS_SOURCE_ATTRIBUTE + ":" + 
> servletName;
>              _stringsSource = (IComponentMessagesSource) 
> servletContext.getAttribute(name);
>  
>              if (_stringsSource == null)
>              {
>                  _stringsSource = 
> createComponentStringsSource(context);
> -
>                  servletContext.setAttribute(name, _stringsSource);
>              }
>          }
>  
>          if (_dataSqueezer == null)
>          {
> -            String name = DATA_SQUEEZER_NAME + ":" + servletName;
> -
> +            String name = DATA_SQUEEZER_ATTRIBUTE + ":" + 
> servletName;
>              _dataSqueezer = (DataSqueezer) 
> servletContext.getAttribute(name);
>  
>              if (_dataSqueezer == null)
>              {
>                  _dataSqueezer = createDataSqueezer();
> -
>                  servletContext.setAttribute(name, _dataSqueezer);
>              }
>          }
>  
>          if (_global == null)
>          {
> -            String name = GLOBAL_NAME + ":" + servletName;
> -
> +            String name = GLOBAL_ATTRIBUTE + ":" + servletName;
>              _global = servletContext.getAttribute(name);
>  
>              if (_global == null)
>              {
>                  _global = createGlobal(context);
> -
>                  servletContext.setAttribute(name, _global);
>              }
>          }
> +	}
>  
> -        String encoding = request.getCharacterEncoding();
> -        if (encoding == null)
> -        {
> -            encoding = getOutputEncoding();
> -            try
> -            {
> -                request.setCharacterEncoding(encoding);
> -            }
> -            catch (UnsupportedEncodingException e)
> -            {
> -                throw new 
> IllegalArgumentException(Tapestry.format("illegal-encoding", 
> encoding));
> -            }
> -            catch (NoSuchMethodError e)
> -            {
> -                // Servlet API 2.2 compatibility
> -                // Behave okay if the setCharacterEncoding() 
> method is unavailable
> -            }
> -            catch (AbstractMethodError e)
> -            {
> -                // Servlet API 2.2 compatibility
> -                // Behave okay if the setCharacterEncoding() 
> method is unavailable
> -            }
> -        }
> -    }
> -
> -    /**
> +	/**
>       *
>       *  Invoked from {@link 
> #setupForRequest(RequestContext)} to provide
>       *  a new instance of {@link IComponentMessagesSource}.
> @@ -1824,7 +1847,8 @@
>      }
>  
>      /**
> -     *  Creates a Map of all the services available to the 
> application.
> +     *  Creates a Map of all the services available to the 
> application. Invoked from
> +     *  {@link #setupForRequest(RequestContext)}.
>       *
>       *  <p>Note: the Map returned is not synchronized, on 
> the theory that returned
>       *  map is not further modified and therefore threadsafe.
> @@ -1834,7 +1858,7 @@
>      private Map createServiceMap()
>      {
>          if (LOG.isDebugEnabled())
> -            LOG.debug("Creating service map.");
> +            LOG.debug(Tapestry.getMessage(MSG_CREATING_SERVICE_MAP));
>  
>          ISpecificationSource source = getSpecificationSource();
>  
> @@ -1854,11 +1878,9 @@
>          ClassResolver resolver = getClassResolver();
>  
>          Iterator i = result.entrySet().iterator();
> -
>          while (i.hasNext())
>          {
>              Map.Entry entry = (Map.Entry) i.next();
> -
>              String name = (String) entry.getKey();
>              String className = (String) entry.getValue();
>  
> @@ -1874,11 +1896,7 @@
>  
>                  if (!service.getName().equals(name))
>                      throw new ApplicationRuntimeException(
> -                        Tapestry.format(
> -                            "AbstractEngine.service-name-mismatch",
> -                            name,
> -                            className,
> -                            serviceName));
> +                        
> Tapestry.format(MSG_SERVICE_NAME_MISMATCH, name, className, 
> serviceName));
>  
>                  // Replace the class name with an instance
>                  // of the named class.
> @@ -1888,10 +1906,7 @@
>              catch (InstantiationException ex)
>              {
>                  String message =
> -                    Tapestry.format(
> -                        
> "AbstractEngine.unable-to-instantiate-service",
> -                        name,
> -                        className);
> +                    
> Tapestry.format(MSG_UNABLE_TO_INSTANTIATE_SERVICE, name, className);
>  
>                  LOG.error(message, ex);
>  
> @@ -1900,10 +1915,7 @@
>              catch (IllegalAccessException ex)
>              {
>                  String message =
> -                    Tapestry.format(
> -                        
> "AbstractEngine.unable-to-instantiate-service",
> -                        name,
> -                        className);
> +                    
> Tapestry.format(MSG_UNABLE_TO_INSTANTIATE_SERVICE, name, className);
>  
>                  LOG.error(message, ex);
>  
> @@ -1997,7 +2009,8 @@
>       *
>       *  <p>This implementation simply extracts the value for
>       *  query parameter {@link Tapestry#SERVICE_QUERY_PARAMETER_NAME}
> -     *  and extracts the service name from that.
> +     *  and extracts the service name from that. If the 
> parameter is not
> +     *  provided, {@link Tapestry#HOME_SERVICE} is returned.
>       *
>       *  <p>
>       *  For supporting the JSP tags, this method first
> @@ -2276,7 +2289,6 @@
>      }
>  
>      /**
> -     *
>       *  The encoding to be used if none has been defined 
> using the output encoding property.
>       *  Override this method to change the default.
>       *
> Index: 
> framework/src/org/apache/tapestry/engine/DefaultSpecificationS
> ource.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/engine/DefaultSpecificationSource.java,v
> retrieving revision 1.14
> diff -u -r1.14 DefaultSpecificationSource.java
> --- 
> framework/src/org/apache/tapestry/engine/DefaultSpecificationS
> ource.java	30 Apr 2004 15:16:30 -0000	1.14
> +++ 
> framework/src/org/apache/tapestry/engine/DefaultSpecificationS
> ource.java	2 May 2004 07:39:06 -0000
> @@ -39,9 +39,9 @@
>  import org.apache.tapestry.util.xml.DocumentParseException;
>  
>  /**
> - *  Default implementation of {@link ISpecificationSource} that
> - *  expects to use the normal class loader to locate component
> - *  specifications from within the classpath.
> + * Default implementation of {@link ISpecificationSource} that
> + * expects to use the normal class loader to locate component
> + * specifications from within the classpath.
>   *
>   * <p>Caches specifications in memory forever, or until 
> {@link #reset()} is invoked.
>   *
> @@ -55,7 +55,11 @@
>  
>  public class DefaultSpecificationSource implements 
> ISpecificationSource, IRenderDescription
>  {
> -    private static final Log LOG = 
> LogFactory.getLog(DefaultSpecificationSource.class);
> +	/**
> +	 * Common logger for this class
> +	 */
> +	
> +	private static final Log LOG = 
> LogFactory.getLog(DefaultSpecificationSource.class);
>  
>      /**
>       *  Key used to get and store {@link 
> SpecificationParser} instances
> @@ -260,7 +264,7 @@
>      /**
>       *  Gets a component specification.
>       * 
> -     *  @param resourcePath the complete resource path to 
> the specification.
> +     *  @param resourceLocation the complete resource path 
> to the specification.
>       *  @throws ApplicationRuntimeException if the 
> specification cannot be obtained.
>       * 
>       **/
> @@ -273,7 +277,6 @@
>          if (result == null)
>          {
>              result = parseSpecification(resourceLocation, false);
> -
>              _componentCache.put(resourceLocation, result);
>          }
>  
> Index: 
> framework/src/org/apache/tapestry/engine/ISpecificationSource.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/engine/ISpecificationSource.java,v
> retrieving revision 1.7
> diff -u -r1.7 ISpecificationSource.java
> --- 
> framework/src/org/apache/tapestry/engine/ISpecificationSour
> ce.java	30 Apr 2004 15:16:30 -0000	1.7
> +++ 
> framework/src/org/apache/tapestry/engine/ISpecificationSour
> ce.java	2 May 2004 07:39:07 -0000
> @@ -37,7 +37,7 @@
>       *  @param specificationLocation the location where the 
> specification
>       *  may be read from.
>       * 
> -     *  @throws 
> org.apache.tapestry.ApplicationRuntimeException if the 
> specification doesn't
> +     *  @throws 
> org.apache.hivemind.ApplicationRuntimeException if the 
> specification doesn't
>       *  exist, is unreadable or invalid.
>       * 
>       *  @since 2.2
> @@ -52,7 +52,7 @@
>       *  @param specificationLocation the location where the 
> specification
>       *  may be read from.
>       * 
> -     *  @throws 
> org.apache.tapestry.ApplicationRuntimeException if the 
> specification doesn't
> +     *  @throws 
> org.apache.hivemind.ApplicationRuntimeException if the 
> specification doesn't
>       *  exist, is unreadable or invalid.
>       * 
>       *  @since 2.2
> @@ -74,7 +74,7 @@
>       * 
>       *  @param specificationLocation the resource path of 
> the specification
>       *  to return
> -     *  @throws 
> org.apache.tapestry.ApplicationRuntimeException if the specification
> +     *  @throws 
> org.apache.hivemind.ApplicationRuntimeException if the specification
>       *  cannot be read
>       * 
>       *  @since 2.2
> Index: framework/src/org/apache/tapestry/request/RequestContext.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/request/RequestContext.java,v
> retrieving revision 1.11
> diff -u -r1.11 RequestContext.java
> --- 
> framework/src/org/apache/tapestry/request/RequestContext.java	
> 19 Feb 2004 17:38:03 -0000	1.11
> +++ 
> framework/src/org/apache/tapestry/request/RequestContext.java	
> 2 May 2004 07:39:13 -0000
> @@ -91,31 +91,55 @@
>  
>  public class RequestContext implements IRender
>  {
> -    /** @since 2.2 **/
> -
> -    private static class DefaultRequestDecoder implements 
> IRequestDecoder
> -    {
> -        public DecodedRequest 
> decodeRequest(HttpServletRequest request)
> -        {
> -            DecodedRequest result = new DecodedRequest();
> -
> -            result.setRequestURI(request.getRequestURI());
> -            result.setScheme(request.getScheme());
> -            result.setServerName(request.getServerName());
> -            result.setServerPort(request.getServerPort());
> -
> -            return result;
> -        }
> -    }
> -
> +    /**
> +     * Common logger for this class
> +     * 
> +     */
> +    
>      private static final Log LOG = 
> LogFactory.getLog(RequestContext.class);
>  
> -    private HttpSession _session;
> +    /**
> +     * The {@link HttpSession} object for this request cycle. 
> +     * 
> +     */
> +    
> +    private HttpSession _sessionCache;
> +    
> +    /**
> +     * The {@link HttpServletRequest} object for this request cycle
> +     *  
> +     */
> +    
>      private HttpServletRequest _request;
> +    
> +    /**
> +     * The {@link HttpServletResponse} object for this request cycle
> +     * 
> +     */
> +    
>      private HttpServletResponse _response;
> +    
> +    /**
> +     * The {@link ApplicationServlet} object for this request cycle
> +     * 
> +     */
> +    
>      private ApplicationServlet _servlet;
> +    
> +    /**
> +     * The {@link DecodedRequest} object for this request cycle
> +     * 
> +     */
> +    
>      private DecodedRequest _decodedRequest;
> +    
> +    /**
> +     * The {@link IMultipartDecoder} object for this request cycle
> +     * 
> +     */
> +    
>      private IMultipartDecoder _decoder;
> +    
>      private boolean _decoded;
>  
>      /**
> @@ -123,7 +147,7 @@
>       *
>       **/
>  
> -    private Map _cookieMap;
> +    private Map _cookieCache;
>  
>      /**
>       *  Used during {@link #write(IMarkupWriter)}.
> @@ -134,6 +158,10 @@
>  
>      /**
>       * Creates a <code>RequestContext</code> from its components.
> +     * 
> +     * @param servlet The {@link ApplicationServlet} for 
> this request cycle
> +     * @param request The {@link HttpServletRequest} for 
> this request cycle
> +     * @param response The {@link HttpServletResponse} for 
> this request cycle
>       *
>       **/
>  
> @@ -218,10 +246,10 @@
>  
>          _response.addCookie(cookie);
>  
> -        if (_cookieMap == null)
> +        if (_cookieCache == null)
>              readCookieMap();
>  
> -        _cookieMap.put(cookie.getName(), cookie);
> +        _cookieCache.put(cookie.getName(), cookie);
>      }
>  
>      private void datePair(IMarkupWriter writer, String name, 
> long value)
> @@ -400,10 +428,10 @@
>  
>      public Cookie getCookie(String name)
>      {
> -        if (_cookieMap == null)
> +        if (_cookieCache == null)
>              readCookieMap();
>  
> -        return (Cookie) _cookieMap.get(name);
> +        return (Cookie) _cookieCache.get(name);
>      }
>  
>      /**
> @@ -550,10 +578,10 @@
>  
>      public HttpSession getSession()
>      {
> -        if (_session == null)
> -            _session = _request.getSession(false);
> +        if (_sessionCache == null)
> +            _sessionCache = _request.getSession(false);
>  
> -        return _session;
> +        return _sessionCache;
>      }
>  
>      /**
> @@ -564,15 +592,15 @@
>  
>      public HttpSession createSession()
>      {
> -        if (_session == null)
> +        if (_sessionCache == null)
>          {
>              if (LOG.isDebugEnabled())
>                  LOG.debug("Creating HttpSession");
>  
> -            _session = _request.getSession(true);
> +            _sessionCache = _request.getSession(true);
>          }
>  
> -        return _session;
> +        return _sessionCache;
>      }
>  
>      private void header(IMarkupWriter writer, String 
> valueName, String dataName)
> @@ -660,13 +688,13 @@
>  
>      private void readCookieMap()
>      {
> -        _cookieMap = new HashMap();
> +        _cookieCache = new HashMap();
>  
>          Cookie[] cookies = _request.getCookies();
>  
>          if (cookies != null)
>              for (int i = 0; i < cookies.length; i++)
> -                _cookieMap.put(cookies[i].getName(), cookies[i]);
> +                _cookieCache.put(cookies[i].getName(), cookies[i]);
>      }
>  
>      /**
> Index: 
> framework/src/org/apache/tapestry/util/DelegatingPropertySource.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/util/DelegatingPropertySource.java,v
> retrieving revision 1.4
> diff -u -r1.4 DelegatingPropertySource.java
> --- 
> framework/src/org/apache/tapestry/util/DelegatingPropertySour
> ce.java	19 Feb 2004 17:37:47 -0000	1.4
> +++ 
> framework/src/org/apache/tapestry/util/DelegatingPropertySour
> ce.java	2 May 2004 07:39:14 -0000
> @@ -34,19 +34,35 @@
>  {
>      private List _sources = new ArrayList();
>      
> +    /**
> +     * Empty constructor
> +     *
> +     */
> +    
>      public DelegatingPropertySource()
>      {
>      }
>      
> +    /**
> +     * Default constructor, which adds a first 
> +     * {@link IPropertySource} object.
> +     *  
> +     * @param delegate the first {@link IPropertySource} 
> object to add
> +     * to the list of delegate property sources.
> +     */
> +    
>      public DelegatingPropertySource(IPropertySource delegate)
>      {
>          addSource(delegate);
>      }
>      
>      /**
> -     *  Adds another source to the list of delegate property sources.
> -     *  This is typically only done during initialization
> -     *  of this DelegatingPropertySource.
> +     * Adds another source to the list of delegate property sources.
> +     * This is typically only done during initialization
> +     * of this DelegatingPropertySource.
> +     * 
> +     * @param source the {@link IPropertySource} object to add to
> +     * the list of delegate property sources.
>       * 
>       **/
>      
> @@ -56,8 +72,12 @@
>      }
>      
>      /**
> -     *  Re-invokes the method on each delegate property source, 
> -     *  in order, return the first non-null value found.
> +     * Re-invokes the method on each delegate property source, 
> +     * in order, return the first non-null value found.
> +     * 
> +     * @param propertyName the name of the property to search for in 
> +     * the list of delegate property sources
> +     * @return the first non-null value found, or null if not found
>       * 
>       **/
>      
> Index: 
> framework/src/org/apache/tapestry/util/PropertyHolderPropertyS
> ource.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/util/PropertyHolderPropertySource.java,v
> retrieving revision 1.4
> diff -u -r1.4 PropertyHolderPropertySource.java
> --- 
> framework/src/org/apache/tapestry/util/PropertyHolderPropertyS
> ource.java	19 Feb 2004 17:37:47 -0000	1.4
> +++ 
> framework/src/org/apache/tapestry/util/PropertyHolderPropertyS
> ource.java	2 May 2004 07:39:14 -0000
> @@ -28,13 +28,37 @@
>  
>  public class PropertyHolderPropertySource implements IPropertySource
>  {
> +	/**
> +	 * The stored properties
> +	 *  
> +	 */
> +	
>      private IPropertyHolder _holder;
>      
> +    /**
> +     * Simple constructor
> +     * 
> +     * @param holder a {@link IPropertyHolder} object that 
> holds the properties
> +     * to be stored
> +     * 
> +     */
> +    
>      public PropertyHolderPropertySource(IPropertyHolder holder)
>      {
>          _holder = holder;
>      }
>  
> +    /**
> +     * Returns the value for a given property, or null if the
> +     * source does not provide a value for the named property.
> +     * 
> +     * @see IPropertySource#getPropertyValue(String)
> +     * 
> +     * @param propertyName the name of the property to lookup in
> +     * the property source
> +     * @return the value for the given proerty, or null if not found
> +     *  
> +     */
>      public String getPropertyValue(String propertyName)
>      {
>          return _holder.getProperty(propertyName);
> Index: 
> framework/src/org/apache/tapestry/util/ServletContextPropertyS
> ource.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/util/ServletContextPropertySource.java,v
> retrieving revision 1.4
> diff -u -r1.4 ServletContextPropertySource.java
> --- 
> framework/src/org/apache/tapestry/util/ServletContextPropertyS
> ource.java	19 Feb 2004 17:37:47 -0000	1.4
> +++ 
> framework/src/org/apache/tapestry/util/ServletContextPropertyS
> ource.java	2 May 2004 07:39:14 -0000
> @@ -40,7 +40,10 @@
>      }
>  
>      /**
> -     *  Invokes {@link 
> ServletContext#getInitParameter(java.lang.String)}.
> +     * Invokes {@link 
> ServletContext#getInitParameter(java.lang.String)}.
> +     * 
> +     * @param propertyName the name of the property to be found
> +     * @return the value of the gieven property, or null if not found
>       *
>       **/
>  
> Index: 
> framework/src/org/apache/tapestry/util/ServletPropertySource.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/util/ServletPropertySource.java,v
> retrieving revision 1.4
> diff -u -r1.4 ServletPropertySource.java
> --- 
> framework/src/org/apache/tapestry/util/ServletPropertySour
> ce.java	19 Feb 2004 17:37:47 -0000	1.4
> +++ 
> framework/src/org/apache/tapestry/util/ServletPropertySour
> ce.java	2 May 2004 07:39:14 -0000
> @@ -32,15 +32,29 @@
>  
>  public class ServletPropertySource implements IPropertySource
>  {
> +	/**
> +	 * The {@link ServletConfig} object to be stored 
> +	 * 
> +	 */
> +	
>      private ServletConfig _config;
>      
> +    /**
> +     * Simple constructor
> +     * 
> +     * @param config a {@link ServletConfig} object to be stored
> +     * 
> +     */
>      public ServletPropertySource(ServletConfig config)
>      {
>          _config = config;
>      }   
>      
>      /**
> -     *  Invokes {@link 
> ServletConfig#getInitParameter(java.lang.String)}.
> +     * Invokes {@link 
> ServletConfig#getInitParameter(java.lang.String)}.
> +     * 
> +     * @param propertyName The name of the property to be found
> +     * @return the value of the given property, or null if not found
>       * 
>       **/
>      
> Index: framework/src/org/apache/tapestry/util/pool/Pool.java
> ===================================================================
> RCS file: 
> /home/cvspublic/jakarta-tapestry/framework/src/org/apache/tape
> stry/util/pool/Pool.java,v
> retrieving revision 1.9
> diff -u -r1.9 Pool.java
> --- framework/src/org/apache/tapestry/util/pool/Pool.java	
> 30 Apr 2004 15:16:31 -0000	1.9
> +++ framework/src/org/apache/tapestry/util/pool/Pool.java	
> 2 May 2004 07:39:15 -0000
> @@ -48,7 +48,7 @@
>   *  <p>Pool implements {@link ICleanable}, with a goal of
>   *  only keeping pooled objects that have been needed within
>   *  a recent time frame.  A generational system is used, where each
> - *  pooled object is assigned a generation count.  {@link 
> #executeCleanup}
> + *  pooled object is assigned a generation count.  {@link 
> #executeCleanup()}
>   *  discards objects whose generation count is too old (outside of a
>   *  {@link #getWindow() window}).
>   * 
> @@ -75,7 +75,14 @@
>  
>  public class Pool implements ICleanable, IRenderDescription
>  {
> -    private static final Log LOG = LogFactory.getLog(Pool.class);
> +    private static final String MSG_RETRIEVED_FROM_POOL = 
> +    	"Pool.retrieved-from-pool";
> +    
> +	/**
> +     * Common logger for this class
> +     */
> +	
> +	private static final Log LOG = LogFactory.getLog(Pool.class);
>  
>      private AdaptorRegistry _adaptors = new AdaptorRegistry();
>  
> @@ -104,15 +111,18 @@
>      private int _pooledCount;
>  
>      /**
> -     *  A map of PoolLists, keyed on an arbitrary object.
> +     * A map of PoolLists, keyed on an arbitrary object. 
> Creation is deferred.
> +     * 
> +     * @see #retrieve(Object)
>       *
>       **/
>  
>      private Map _map;
>  
>      /**
> -     *  Creates a new Pool using the default map size.  
> Creation of the map is deferred.
> +     * Creates a new Pool using the default map size.  
> Creation of the map is deferred.
>       *
> +     * @see #Pool(boolean)
>       *
>       **/
>  
> @@ -204,12 +214,16 @@
>       *  such object exists.  Getting an object from a Pool 
> removes it from the Pool,
>       *  but it can later be re-added with {@link 
> #store(Object,Object)}.
>       *
> +     *  @param key
> +     * 			The key of the pooled object to 
> be retrieved
> +     *  @return The pooled object, or null if not found
>       **/
>  
>      public synchronized Object retrieve(Object key)
>      {
>          Object result = null;
>  
> +        // Deferred creation
>          if (_map == null)
>              _map = new HashMap();
>  
> @@ -222,7 +236,7 @@
>              _pooledCount--;
>  
>          if (LOG.isDebugEnabled())
> -            LOG.debug("Retrieved " + result + " from " + key);
> +            
> LOG.debug(Tapestry.format(MSG_RETRIEVED_FROM_POOL, result, key));
>  
>          return result;
>      }
> Index: 
> framework/src/org/apache/tapestry/request/DefaultRequestDecoder.java
> ===================================================================
> RCS file: 
> framework/src/org/apache/tapestry/request/DefaultRequestDecoder.java
> diff -N 
> framework/src/org/apache/tapestry/request/DefaultRequestDecoder.java
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ 
> framework/src/org/apache/tapestry/request/DefaultRequestDecod
> er.java	1 Jan 1970 00:00:00 -0000
> @@ -0,0 +1,37 @@
> +//  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.request;
> +
> +import javax.servlet.http.HttpServletRequest;
> +
> +/**
> + * @since 2.2
> + *  
> + */
> +
> +class DefaultRequestDecoder implements IRequestDecoder
> +{
> +    public DecodedRequest decodeRequest(HttpServletRequest request)
> +    {
> +        DecodedRequest result = new DecodedRequest();
> +
> +        result.setRequestURI(request.getRequestURI());
> +        result.setScheme(request.getScheme());
> +        result.setServerName(request.getServerName());
> +        result.setServerPort(request.getServerPort());
> +
> +        return result;
> +    }
> +}
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org
> 


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


Mime
View raw message