You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by jk...@apache.org on 2006/03/11 21:55:35 UTC
svn commit: r385164 [22/32] - in /jakarta/tapestry/trunk: ./ .settings/
annotations/src/java/org/apache/tapestry/annotations/
annotations/src/test/org/apache/tapestry/annotations/ config/
contrib/src/documentation/content/xdocs/tapestry-contrib/Compone...
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentMessagesSourceImpl.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -48,21 +48,20 @@
public class ComponentMessagesSourceImpl implements ComponentMessagesSource, ResetEventListener
{
+ private Properties _emptyProperties = new Properties();
+
+ private static final String SUFFIX = ".properties";
+
/**
- * The name of the component/application/etc property that will be used to
- * determine the encoding to use when loading the messages.
+ * The name of the component/application/etc property that will be used to determine the
+ * encoding to use when loading the messages
*/
public static final String MESSAGES_ENCODING_PROPERTY_NAME = "org.apache.tapestry.messages-encoding";
- private static final String SUFFIX = ".properties";
-
- private Properties _emptyProperties = new Properties();
-
/**
- * Map of Maps. The outer map is keyed on component specification location
- * (a{@link Resource}. This inner map is keyed on locale and the value is
- * a {@link Properties}.
+ * Map of Maps. The outer map is keyed on component specification location (a{@link Resource}.
+ * This inner map is keyed on locale and the value is a {@link Properties}.
*/
private Map _componentCache = new HashMap();
@@ -70,9 +69,8 @@
private ComponentPropertySource _componentPropertySource;
/**
- * Returns an instance of {@link Properties}containing the properly
- * localized messages for the component, in the {@link Locale}identified by
- * the component's containing page.
+ * Returns an instance of {@link Properties}containing the properly localized messages for the
+ * component, in the {@link Locale}identified by the component's containing page.
*/
protected synchronized Properties getLocalizedProperties(IComponent component)
@@ -84,14 +82,18 @@
Map propertiesMap = findPropertiesMapForResource(specificationLocation);
- Properties result = (Properties)propertiesMap.get(locale);
+ Properties result = (Properties) propertiesMap.get(locale);
if (result == null)
{
// Not found, create it now.
- result = assembleComponentProperties(component, specificationLocation, propertiesMap, locale);
+ result = assembleComponentProperties(
+ component,
+ specificationLocation,
+ propertiesMap,
+ locale);
propertiesMap.put(locale, result);
}
@@ -101,7 +103,7 @@
private Map findPropertiesMapForResource(Resource resource)
{
- Map result = (Map)_componentCache.get(resource);
+ Map result = (Map) _componentCache.get(resource);
if (result == null)
{
@@ -120,7 +122,7 @@
Map propertiesMap = findPropertiesMapForResource(namespaceLocation);
- Properties result = (Properties)propertiesMap.get(locale);
+ Properties result = (Properties) propertiesMap.get(locale);
if (result == null)
{
@@ -132,42 +134,43 @@
return result;
}
- private Properties assembleComponentProperties(IComponent component, Resource baseResourceLocation,
- Map propertiesMap, Locale locale)
+ private Properties assembleComponentProperties(IComponent component,
+ Resource baseResourceLocation, Map propertiesMap, Locale locale)
{
List localizations = findLocalizationsForResource(baseResourceLocation, locale);
Properties parent = null;
Properties assembledProperties = null;
-
+
Iterator i = localizations.iterator();
- while(i.hasNext())
+ while (i.hasNext())
{
- ResourceLocalization rl = (ResourceLocalization)i.next();
+ ResourceLocalization rl = (ResourceLocalization) i.next();
Locale l = rl.getLocale();
- // Retrieve namespace properties for current locale (and parent
- // locales)
- Properties namespaceProperties = getNamespaceProperties(component, l);
-
- // Use the namespace properties as default for assembled properties
+ // Retrieve namespace properties for current locale (and parent locales)
+ Properties namespaceProperties = getNamespaceProperties(component, l);
+
+ // Use the namespace properties as default for assembled properties
assembledProperties = new Properties(namespaceProperties);
-
+
// Read localized properties for component
Properties properties = readComponentProperties(component, l, rl.getResource(), null);
// Override parent properties with current locale
- if (parent != null)
- {
- if (properties != null) parent.putAll(properties);
+ if (parent != null) {
+ if (properties != null)
+ parent.putAll(properties);
}
- else parent = properties;
-
+ else
+ parent = properties;
+
// Add to assembled properties
- if (parent != null) assembledProperties.putAll(parent);
-
+ if (parent != null)
+ assembledProperties.putAll(parent);
+
// Save result in cache
propertiesMap.put(l, assembledProperties);
}
@@ -175,9 +178,12 @@
return assembledProperties;
}
- private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap, Locale locale)
+ private Properties assembleNamespaceProperties(INamespace namespace, Map propertiesMap,
+ Locale locale)
{
- List localizations = findLocalizationsForResource(namespace.getSpecificationLocation(), locale);
+ List localizations = findLocalizationsForResource(
+ namespace.getSpecificationLocation(),
+ locale);
// Build them back up in reverse order.
@@ -185,13 +191,13 @@
Iterator i = localizations.iterator();
- while(i.hasNext())
+ while (i.hasNext())
{
- ResourceLocalization rl = (ResourceLocalization)i.next();
+ ResourceLocalization rl = (ResourceLocalization) i.next();
Locale l = rl.getLocale();
- Properties properties = (Properties)propertiesMap.get(l);
+ Properties properties = (Properties) propertiesMap.get(l);
if (properties == null)
{
@@ -209,9 +215,9 @@
/**
* Finds the localizations of the provided resource. Returns a List of
- * {@link ResourceLocalization}(each pairing a locale with a localized
- * resource). The list is ordered from most general (i.e., "foo.properties")
- * to most specific (i.e., "foo_en_US_yokel.properties").
+ * {@link ResourceLocalization}(each pairing a locale with a localized resource). The list is
+ * ordered from most general (i.e., "foo.properties") to most specific (i.e.,
+ * "foo_en_US_yokel.properties").
*/
private List findLocalizationsForResource(Resource resource, Locale locale)
@@ -222,7 +228,7 @@
LocalizedNameGenerator g = new LocalizedNameGenerator(baseName, locale, SUFFIX);
- while(g.more())
+ while (g.more())
{
String localizedName = g.next();
Locale l = g.getCurrentLocale();
@@ -244,16 +250,16 @@
return fileName.substring(0, dotx);
}
- private Properties readComponentProperties(IComponent component, Locale locale, Resource propertiesResource,
- Properties parent)
+ private Properties readComponentProperties(IComponent component, Locale locale,
+ Resource propertiesResource, Properties parent)
{
String encoding = getComponentMessagesEncoding(component, locale);
return readPropertiesResource(propertiesResource.getResourceURL(), encoding, parent);
}
- private Properties readNamespaceProperties(INamespace namespace, Locale locale, Resource propertiesResource,
- Properties parent)
+ private Properties readNamespaceProperties(INamespace namespace, Locale locale,
+ Resource propertiesResource, Properties parent)
{
String encoding = getNamespaceMessagesEncoding(namespace, locale);
@@ -262,7 +268,8 @@
private Properties readPropertiesResource(URL resourceURL, String encoding, Properties parent)
{
- if (resourceURL == null) return parent;
+ if (resourceURL == null)
+ return parent;
Properties result = new Properties(parent);
@@ -276,13 +283,16 @@
if (encoding == null)
wrapper.load(input);
- else wrapper.load(input, encoding);
+ else
+ wrapper.load(input, encoding);
input.close();
}
catch (IOException ex)
{
- throw new ApplicationRuntimeException(ImplMessages.unableToLoadProperties(resourceURL, ex), ex);
+ throw new ApplicationRuntimeException(ImplMessages.unableToLoadProperties(
+ resourceURL,
+ ex), ex);
}
finally
{
@@ -294,14 +304,15 @@
private void close(InputStream is)
{
- if (is != null) try
- {
- is.close();
- }
- catch (IOException ex)
- {
- // Ignore.
- }
+ if (is != null)
+ try
+ {
+ is.close();
+ }
+ catch (IOException ex)
+ {
+ // Ignore.
+ }
}
/**
@@ -315,16 +326,21 @@
public Messages getMessages(IComponent component)
{
- return new ComponentMessages(component.getPage().getLocale(), getLocalizedProperties(component));
+ return new ComponentMessages(component.getPage().getLocale(),
+ getLocalizedProperties(component));
}
private String getComponentMessagesEncoding(IComponent component, Locale locale)
{
- String encoding = _componentPropertySource.getLocalizedComponentProperty(component, locale,
+ String encoding = _componentPropertySource.getLocalizedComponentProperty(
+ component,
+ locale,
MESSAGES_ENCODING_PROPERTY_NAME);
if (encoding == null)
- encoding = _componentPropertySource.getLocalizedComponentProperty(component, locale,
+ encoding = _componentPropertySource.getLocalizedComponentProperty(
+ component,
+ locale,
TemplateSourceImpl.TEMPLATE_ENCODING_PROPERTY_NAME);
return encoding;
@@ -332,7 +348,9 @@
private String getNamespaceMessagesEncoding(INamespace namespace, Locale locale)
{
- return _componentPropertySource.getLocalizedNamespaceProperty(namespace, locale,
+ return _componentPropertySource.getLocalizedNamespaceProperty(
+ namespace,
+ locale,
MESSAGES_ENCODING_PROPERTY_NAME);
}
@@ -340,4 +358,4 @@
{
_componentPropertySource = componentPropertySource;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentPropertySourceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentPropertySourceImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentPropertySourceImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ComponentPropertySourceImpl.java Sat Mar 11 12:54:27 2006
@@ -183,4 +183,4 @@
{
_globalProperties = globalProperties;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineFactoryImpl.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -25,17 +25,15 @@
import org.apache.tapestry.spec.IApplicationSpecification;
/**
- * Standard implementation of {@link org.apache.tapestry.services.EngineFactory}
- * service. This should do for most purposes, since a major focus of Tapestry
- * 4.0 is to no longer require subclassing of
- * {@link org.apache.tapestry.engine.BaseEngine}.
+ * Standard implementation of {@link org.apache.tapestry.services.EngineFactory} service. This
+ * should do for most purposes, since a major focus of Tapestry 4.0 is to no longer require
+ * subclassing of {@link org.apache.tapestry.engine.BaseEngine}.
*
* @author Howard Lewis Ship
* @since 4.0
*/
public class EngineFactoryImpl implements EngineFactory
{
-
private IApplicationSpecification _applicationSpecification;
private String _defaultEngineClassName;
@@ -46,10 +44,8 @@
private ErrorLog _errorLog;
- /** Defines an object that can construct an IEngine instance. */
interface EngineConstructor
{
-
IEngine construct();
}
@@ -57,10 +53,8 @@
// instantiate a BaseEngine instance, without using reflection
// (for efficiency).
- /** Constructs the engine via reflection (and a class name). */
static class ReflectiveEngineConstructor implements EngineConstructor
{
-
private Class _engineClass;
ReflectiveEngineConstructor(Class engineClass)
@@ -72,11 +66,13 @@
{
try
{
- return (IEngine)_engineClass.newInstance();
+ return (IEngine) _engineClass.newInstance();
}
catch (Exception ex)
{
- throw new ApplicationRuntimeException(ImplMessages.errorInstantiatingEngine(_engineClass, ex), ex);
+ throw new ApplicationRuntimeException(ImplMessages.errorInstantiatingEngine(
+ _engineClass,
+ ex), ex);
}
}
}
@@ -87,7 +83,8 @@
// TODO: Check in web.xml first.
- if (engineClassName == null) engineClassName = _defaultEngineClassName;
+ if (engineClassName == null)
+ engineClassName = _defaultEngineClassName;
Class engineClass = _classResolver.checkForClass(engineClassName);
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineManagerImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineManagerImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineManagerImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineManagerImpl.java Sat Mar 11 12:54:27 2006
@@ -19,8 +19,8 @@
import org.apache.tapestry.IEngine;
import org.apache.tapestry.services.EngineFactory;
import org.apache.tapestry.services.EngineManager;
-import org.apache.tapestry.services.ObjectPool;
import org.apache.tapestry.services.RequestLocaleManager;
+import org.apache.tapestry.services.ObjectPool;
/**
* Implementation of service {@link org.apache.tapestry.services.EngineManager}.
@@ -72,4 +72,4 @@
{
_localeManager = manager;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/EngineServiceOuterProxy.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -23,22 +23,18 @@
import org.apache.tapestry.engine.ILink;
/**
- * Outer proxy for engine services. The inner proxy resolves the engine service
- * name to a engine service implementation and installed it into the outer proxy
- * as a delegate. Although HiveMind does provide a similar system of inner and
- * outer delegates, Tapestry's engine-service:
- * {@link org.apache.tapestry.services.impl.EngineServiceObjectProvider} object
- * provider can cause exceptions (recurive service build) when attempting to
- * link two services together. This extra layer of proxying resolves that issue.
+ * Outer proxy for engine services. The inner proxy resolves the engine service name to a engine
+ * service implementation and installed it into the outer proxy as a delegate. Although HiveMind
+ * does provide a similar system of inner and outer delegates, Tapestry's engine-service:
+ * {@link org.apache.tapestry.services.impl.EngineServiceObjectProvider} object provider can
+ * cause exceptions (recurive service build) when attempting to link two services together. This
+ * extra layer of proxying resolves that issue.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class EngineServiceOuterProxy implements IEngineService, Serializable
{
-
- private static final long serialVersionUID = 2050789495671401625L;
-
private final String _serviceName;
private IEngineService _delegate;
@@ -65,8 +61,7 @@
return _delegate.getLink(post, parameter);
}
- public void service(IRequestCycle cycle)
- throws IOException
+ public void service(IRequestCycle cycle) throws IOException
{
_delegate.service(cycle);
}
@@ -81,4 +76,4 @@
return ImplMessages.engineServiceOuterProxyToString(_serviceName);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ExtensionLookupParameter.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ExtensionLookupParameter.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ExtensionLookupParameter.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ExtensionLookupParameter.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -17,19 +17,17 @@
import org.apache.hivemind.impl.BaseLocatable;
/**
- * Parameters to the
- * {@link org.apache.tapestry.services.impl.ExtensionLookupFactory} service
- * implementation factory.
- *
+ * Parameters to the {@link org.apache.tapestry.services.impl.ExtensionLookupFactory}
+ * service implementation factory.
+ *
* @author Howard Lewis Ship
* @since 4.0
*/
public class ExtensionLookupParameter extends BaseLocatable
{
-
- private String _extensionName;
- private Object _default;
-
+ private String _extensionName;
+ private Object _default;
+
public String getExtensionName()
{
return _extensionName;
@@ -44,7 +42,7 @@
{
return _default;
}
-
+
public void setDefault(Object defaultValue)
{
_default = defaultValue;
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ImplMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -24,7 +24,6 @@
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.tapestry.IComponent;
@@ -39,88 +38,88 @@
* @author Howard Lewis Ship
* @since 4.0
*/
-final class ImplMessages
+class ImplMessages
{
-
- private final static Messages MESSAGES = new MessageFormatter(ImplMessages.class);
-
- /** @since 4.1 */
- private ImplMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(ImplMessages.class);
static String initializerContribution()
{
- return MESSAGES.getMessage("initializer-contribution");
+ return _formatter.getMessage("initializer-contribution");
}
static String noApplicationSpecification(HttpServlet servlet)
{
- return MESSAGES.format("no-application-specification", servlet.getServletName());
+ return _formatter.format("no-application-specification", servlet.getServletName());
}
static String errorInstantiatingEngine(Class engineClass, Throwable cause)
{
- return MESSAGES.format("error-instantiating-engine", engineClass.getName(), cause);
+ return _formatter.format("error-instantiating-engine", engineClass.getName(), cause);
}
static String noTemplateForComponent(String componentId, Locale locale)
{
- return MESSAGES.format("no-template-for-component", componentId, locale);
+ return _formatter.format("no-template-for-component", componentId, locale);
}
static String noTemplateForPage(String pageName, Locale locale)
{
- return MESSAGES.format("no-template-for-page", pageName, locale);
+ return _formatter.format("no-template-for-page", pageName, locale);
}
static String unableToReadTemplate(Object template)
{
- return MESSAGES.format("unable-to-read-template", template);
+ return _formatter.format("unable-to-read-template", template);
}
static String unableToParseTemplate(Resource resource)
{
- return MESSAGES.format("unable-to-parse-template", resource);
+ return _formatter.format("unable-to-parse-template", resource);
}
static String unableToParseSpecification(Resource resource)
{
- return MESSAGES.format("unable-to-parse-specification", resource);
+ return _formatter.format("unable-to-parse-specification", resource);
}
- static String unableToReadInfrastructureProperty(String propertyName, Infrastructure service, Throwable cause)
+ static String unableToReadInfrastructureProperty(String propertyName, Infrastructure service,
+ Throwable cause)
{
- return MESSAGES.format("unable-to-read-infrastructure-property", propertyName, service, cause);
+ return _formatter.format(
+ "unable-to-read-infrastructure-property",
+ propertyName,
+ service,
+ cause);
}
static String multipleComponentReferences(IComponent component, String id)
{
- return MESSAGES.format("multiple-component-references", component.getExtendedId(), id);
+ return _formatter.format("multiple-component-references", component.getExtendedId(), id);
}
static String dupeComponentId(String id, IContainedComponent containedComponent)
{
- return MESSAGES.format("dupe-component-id", id, HiveMind.getLocationString(containedComponent));
+ return _formatter.format("dupe-component-id", id, HiveMind
+ .getLocationString(containedComponent));
}
static String unbalancedCloseTags()
{
- return MESSAGES.getMessage("unbalanced-close-tags");
+ return _formatter.getMessage("unbalanced-close-tags");
}
- static String templateBindingForInformalParameter(IComponent loadComponent, String parameterName,
- IComponent component)
+ static String templateBindingForInformalParameter(IComponent loadComponent,
+ String parameterName, IComponent component)
{
- return MESSAGES.format("template-binding-for-informal-parameter", loadComponent.getExtendedId(), parameterName,
- component.getExtendedId());
+ return _formatter.format("template-binding-for-informal-parameter", loadComponent
+ .getExtendedId(), parameterName, component.getExtendedId());
}
- static String templateBindingForReservedParameter(IComponent loadComponent, String parameterName,
- IComponent component)
+ static String templateBindingForReservedParameter(IComponent loadComponent,
+ String parameterName, IComponent component)
{
- return MESSAGES.format("template-binding-for-reserved-parameter", loadComponent.getExtendedId(), parameterName,
- component.getExtendedId());
+ return _formatter.format("template-binding-for-reserved-parameter", loadComponent
+ .getExtendedId(), parameterName, component.getExtendedId());
}
static String missingComponentSpec(IComponent component, Collection ids)
@@ -129,141 +128,155 @@
List idList = new ArrayList(ids);
int count = idList.size();
- for(int i = 0; i < count; i++)
+ for (int i = 0; i < count; i++)
{
- if (i > 0) buffer.append(", ");
+ if (i > 0)
+ buffer.append(", ");
buffer.append(idList.get(i));
}
- return MESSAGES.format("missing-component-spec", component.getExtendedId(), new Integer(count), buffer
- .toString());
+ return _formatter.format("missing-component-spec", component.getExtendedId(), new Integer(
+ count), buffer.toString());
}
static String bodylessComponent()
{
- return MESSAGES.getMessage("bodyless-component");
+ return _formatter.getMessage("bodyless-component");
}
static String dupeTemplateBinding(String name, IComponent component, IComponent loadComponent)
{
- return MESSAGES.format("dupe-template-binding", name, component.getExtendedId(), loadComponent.getExtendedId());
+ return _formatter.format(
+ "dupe-template-binding",
+ name,
+ component.getExtendedId(),
+ loadComponent.getExtendedId());
}
static String unableToLoadProperties(URL url, Throwable cause)
{
- return MESSAGES.format("unable-to-load-properties", url, cause);
+ return _formatter.format("unable-to-load-properties", url, cause);
}
static String noSuchService(String name)
{
- return MESSAGES.format("no-such-service", name);
+ return _formatter.format("no-such-service", name);
}
static String dupeService(String name, EngineServiceContribution existing)
{
- return MESSAGES.format("dupe-service", name, HiveMind.getLocationString(existing));
+ return _formatter.format("dupe-service", name, HiveMind.getLocationString(existing));
}
static String unableToParseExpression(String expression, Throwable cause)
{
- return MESSAGES.format("unable-to-parse-expression", expression, cause);
+ return _formatter.format("unable-to-parse-expression", expression, cause);
}
static String parsedExpression()
{
- return MESSAGES.getMessage("parsed-expression");
+ return _formatter.getMessage("parsed-expression");
}
static String unableToReadExpression(String expression, Object target, Throwable cause)
{
- return MESSAGES.format("unable-to-read-expression", expression, target, cause);
+ return _formatter.format("unable-to-read-expression", expression, target, cause);
}
- static String unableToWriteExpression(String expression, Object target, Object value, Throwable cause)
+ static String unableToWriteExpression(String expression, Object target, Object value,
+ Throwable cause)
{
- return MESSAGES.format("unable-to-write-expression", new Object[] { expression, target, value, cause });
+ return _formatter.format("unable-to-write-expression", new Object[]
+ { expression, target, value, cause });
}
static String isConstantExpressionError(String expression, Exception ex)
{
- return MESSAGES.format("is-constant-expression-error", expression, ex);
+ return _formatter.format("is-constant-expression-error", expression, ex);
}
static String templateParameterName(String name)
{
- return MESSAGES.format("template-parameter-name", name);
+ return _formatter.format("template-parameter-name", name);
}
static String componentPropertySourceDescription(IComponentSpecification spec)
{
- return MESSAGES.format("component-property-source-description", spec.getSpecificationLocation());
+ return _formatter.format("component-property-source-description", spec
+ .getSpecificationLocation());
}
static String namespacePropertySourceDescription(INamespace namespace)
{
- return MESSAGES.format("namespace-property-source-description", namespace.getExtendedId());
+ return _formatter
+ .format("namespace-property-source-description", namespace.getExtendedId());
}
static String invalidEncoding(String encoding, Throwable cause)
{
- return MESSAGES.format("invalid-encoding", encoding, cause);
+ return _formatter.format("invalid-encoding", encoding, cause);
}
static String errorResetting(Throwable cause)
{
- return MESSAGES.format("error-resetting", cause);
+ return _formatter.format("error-resetting", cause);
}
static String engineServiceInnerProxyToString(String serviceName)
{
- return MESSAGES.format("engine-service-inner-proxy-to-string", serviceName);
+ return _formatter.format("engine-service-inner-proxy-to-string", serviceName);
}
static String engineServiceOuterProxyToString(String serviceName)
{
- return MESSAGES.format("engine-service-outer-proxy-to-string", serviceName);
+ return _formatter.format("engine-service-outer-proxy-to-string", serviceName);
}
static String serviceNameMismatch(IEngineService service, String expectedName, String actualName)
{
- return MESSAGES.format("service-name-mismatch", service, expectedName, actualName);
+ return _formatter.format("service-name-mismatch", service, expectedName, actualName);
}
static String infrastructureAlreadyInitialized(String newMode, String initializedMode)
{
- return MESSAGES.format("infrastructure-already-initialized", newMode, initializedMode);
+ return _formatter.format("infrastructure-already-initialized", newMode, initializedMode);
}
- static String duplicateInfrastructureContribution(InfrastructureContribution conflict, Location existingLocation)
+ static String duplicateInfrastructureContribution(InfrastructureContribution conflict,
+ Location existingLocation)
{
- return MESSAGES.format("duplicate-infrastructure-contribution", conflict.getProperty(), conflict.getMode(),
+ return _formatter.format(
+ "duplicate-infrastructure-contribution",
+ conflict.getProperty(),
+ conflict.getMode(),
existingLocation);
}
static String infrastructureNotInitialized()
{
- return MESSAGES.getMessage("infrastructure-not-initialized");
+ return _formatter.getMessage("infrastructure-not-initialized");
}
static String missingInfrastructureProperty(String propertyName)
{
- return MESSAGES.format("missing-infrastructure-property", propertyName);
+ return _formatter.format("missing-infrastructure-property", propertyName);
}
- public static String usedTemplateParameterAlias(OpenToken token, String attributeName, String parameterName)
+ public static String usedTemplateParameterAlias(OpenToken token, String attributeName,
+ String parameterName)
{
- return MESSAGES.format("used-template-parameter-alias", new Object[] { HiveMind.getLocationString(token),
- token.getType(), attributeName, parameterName });
+ return _formatter.format("used-template-parameter-alias", new Object[]
+ { HiveMind.getLocationString(token), token.getType(), attributeName, parameterName });
}
static String engineClassNotFound(String engineClassName)
{
- return MESSAGES.format("engine-class-not-found", engineClassName);
+ return _formatter.format("engine-class-not-found", engineClassName);
}
static String serviceNameIsNull()
{
- return MESSAGES.getMessage("service-name-is-null");
+ return _formatter.getMessage("service-name-is-null");
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/PropertyAccessorContribution.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/PropertyAccessorContribution.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/PropertyAccessorContribution.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/PropertyAccessorContribution.java Sat Mar 11 12:54:27 2006
@@ -14,10 +14,10 @@
package org.apache.tapestry.services.impl;
-import ognl.PropertyAccessor;
-
import org.apache.hivemind.impl.BaseLocatable;
+import ognl.PropertyAccessor;
+
/**
* A contribution to the <code>tapestry.ognl.PropertyAccessors</code> configuration point; this
* provides the Class and {@link ognl.PropertyAccessor}that will be passed to
@@ -51,4 +51,4 @@
{
_subjectClass = subjectClass;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ResponseRendererImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ResponseRendererImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ResponseRendererImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/ResponseRendererImpl.java Sat Mar 11 12:54:27 2006
@@ -34,6 +34,12 @@
*/
public class ResponseRendererImpl implements ResponseRenderer
{
+ private RequestLocaleManager _localeManager;
+
+ private MarkupWriterSource _markupWriterSource;
+
+ private WebResponse _webResponse;
+
/**
* Inside a {@link org.apache.tapestry.util.ContentType}, the output encoding is called
* "charset".
@@ -41,12 +47,6 @@
public static final String ENCODING_KEY = "charset";
- private RequestLocaleManager _localeManager;
-
- private MarkupWriterSource _markupWriterSource;
-
- private WebResponse _webResponse;
-
public void renderResponse(IRequestCycle cycle) throws IOException
{
_localeManager.persistLocale();
@@ -87,4 +87,4 @@
{
_webResponse = webResponse;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/TemplateSourceImpl.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/TemplateSourceImpl.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/TemplateSourceImpl.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/TemplateSourceImpl.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -52,26 +52,23 @@
import org.apache.tapestry.util.MultiKey;
/**
- * Implementation of {@link org.apache.tapestry.services.TemplateSource}.
- * Templates, once parsed, stay in memory until explicitly cleared.
+ * Implementation of {@link org.apache.tapestry.services.TemplateSource}. Templates, once parsed,
+ * stay in memory until explicitly cleared.
*
* @author Howard Lewis Ship
*/
public class TemplateSourceImpl implements TemplateSource, ResetEventListener, ReportStatusListener
{
+ private String _serviceId;
+
+ private Log _log;
// The name of the component/application/etc property that will be used to
// determine the encoding to use when loading the template
public static final String TEMPLATE_ENCODING_PROPERTY_NAME = "org.apache.tapestry.template-encoding";
- private static final int BUFFER_SIZE = 2000;
-
- private String _serviceId;
-
- private Log _log;
-
// Cache of previously retrieved templates. Key is a multi-key of
// specification resource path and locale (local may be null), value
// is the ComponentTemplate.
@@ -83,6 +80,8 @@
private Map _templates = Collections.synchronizedMap(new HashMap());
+ private static final int BUFFER_SIZE = 2000;
+
private ITemplateParser _parser;
/** @since 2.2 */
@@ -125,9 +124,9 @@
Iterator i = _templates.values().iterator();
- while(i.hasNext())
+ while (i.hasNext())
{
- ComponentTemplate template = (ComponentTemplate)i.next();
+ ComponentTemplate template = (ComponentTemplate) i.next();
templateCount++;
@@ -135,13 +134,13 @@
tokenCount += count;
- for(int j = 0; j < count; j++)
+ for (int j = 0; j < count; j++)
{
TemplateToken token = template.getToken(j);
if (token.getType() == TokenType.TEXT)
{
- TextToken tt = (TextToken)token;
+ TextToken tt = (TextToken) token;
characterCount += tt.getLength();
}
@@ -156,13 +155,13 @@
i = _templates.entrySet().iterator();
- while(i.hasNext())
+ while (i.hasNext())
{
- Map.Entry entry = (Map.Entry)i.next();
+ Map.Entry entry = (Map.Entry) i.next();
String key = entry.getKey().toString();
- ComponentTemplate template = (ComponentTemplate)entry.getValue();
+ ComponentTemplate template = (ComponentTemplate) entry.getValue();
event.property(key, template.getTokenCount());
}
@@ -179,10 +178,12 @@
Locale locale = component.getPage().getLocale();
- Object key = new MultiKey(new Object[] { resource, locale }, false);
+ Object key = new MultiKey(new Object[]
+ { resource, locale }, false);
ComponentTemplate result = searchCache(key);
- if (result != null) return result;
+ if (result != null)
+ return result;
result = findTemplate(cycle, resource, component, locale);
@@ -190,11 +191,12 @@
{
result = _delegate.findTemplate(cycle, component, locale);
- if (result != null) return result;
+ if (result != null)
+ return result;
- String message = component.getSpecification().isPageSpecification() ? ImplMessages.noTemplateForPage(
- component.getExtendedId(), locale) : ImplMessages.noTemplateForComponent(component.getExtendedId(),
- locale);
+ String message = component.getSpecification().isPageSpecification() ? ImplMessages
+ .noTemplateForPage(component.getExtendedId(), locale) : ImplMessages
+ .noTemplateForComponent(component.getExtendedId(), locale);
throw new ApplicationRuntimeException(message, component, component.getLocation(), null);
}
@@ -206,7 +208,7 @@
private ComponentTemplate searchCache(Object key)
{
- return (ComponentTemplate)_cache.get(key);
+ return (ComponentTemplate) _cache.get(key);
}
private void saveToCache(Object key, ComponentTemplate template)
@@ -220,30 +222,40 @@
* <ul>
* <li>If the component has a $template asset, use that
* <li>Look for a template in the same folder as the component
- * <li>If a page in the application namespace, search in the application
- * root
+ * <li>If a page in the application namespace, search in the application root
* <li>Fail!
* </ul>
*
* @return the template, or null if not found
*/
- private ComponentTemplate findTemplate(IRequestCycle cycle, Resource resource, IComponent component, Locale locale)
+ private ComponentTemplate findTemplate(IRequestCycle cycle, Resource resource,
+ IComponent component, Locale locale)
{
IAsset templateAsset = component.getAsset(TEMPLATE_ASSET_NAME);
- if (templateAsset != null) return readTemplateFromAsset(cycle, component, templateAsset);
+ if (templateAsset != null)
+ return readTemplateFromAsset(cycle, component, templateAsset);
String name = resource.getName();
int dotx = name.lastIndexOf('.');
String templateExtension = getTemplateExtension(component);
String templateBaseName = name.substring(0, dotx + 1) + templateExtension;
-
- ComponentTemplate result = findStandardTemplate(cycle, resource, component, templateBaseName, locale);
+
+ ComponentTemplate result = findStandardTemplate(
+ cycle,
+ resource,
+ component,
+ templateBaseName,
+ locale);
if (result == null && component.getSpecification().isPageSpecification()
&& component.getNamespace().isApplicationNamespace())
- result = findPageTemplateInApplicationRoot(cycle, (IPage)component, templateExtension, locale);
+ result = findPageTemplateInApplicationRoot(
+ cycle,
+ (IPage) component,
+ templateExtension,
+ locale);
return result;
}
@@ -252,27 +264,23 @@
String templateExtension, Locale locale)
{
// Note: a subtle change from release 3.0 to 4.0.
- // In release 3.0, you could use a <page> element to define a page named
- // Foo whose
- // specification was Bar.page. We would then search for /Bar.page.
- // Confusing? Yes.
- // In 4.0, we are more reliant on the page name, which may include a
- // folder prefix (i.e.,
- // "admin/EditUser", so when we search it is based on the page name and
- // not the
- // specification resource file name. We would search for Foo.html. Moral
- // of the
- // story is to use the page name for the page specifiation and the
- // template.
+ // In release 3.0, you could use a <page> element to define a page named Foo whose
+ // specification was Bar.page. We would then search for /Bar.page. Confusing? Yes.
+ // In 4.0, we are more reliant on the page name, which may include a folder prefix (i.e.,
+ // "admin/EditUser", so when we search it is based on the page name and not the
+ // specification resource file name. We would search for Foo.html. Moral of the
+ // story is to use the page name for the page specifiation and the template.
String templateBaseName = page.getPageName() + "." + templateExtension;
- if (_log.isDebugEnabled()) _log.debug("Checking for " + templateBaseName + " in application root");
+ if (_log.isDebugEnabled())
+ _log.debug("Checking for " + templateBaseName + " in application root");
Resource baseLocation = _contextRoot.getRelativeResource(templateBaseName);
Resource localizedLocation = _localizer.findLocalization(baseLocation, locale);
- if (localizedLocation == null) return null;
+ if (localizedLocation == null)
+ return null;
return getOrParseTemplate(cycle, localizedLocation, page);
}
@@ -281,7 +289,8 @@
* Reads an asset to get the template.
*/
- private ComponentTemplate readTemplateFromAsset(IRequestCycle cycle, IComponent component, IAsset asset)
+ private ComponentTemplate readTemplateFromAsset(IRequestCycle cycle, IComponent component,
+ IAsset asset)
{
InputStream stream = asset.getResourceAsStream();
@@ -306,81 +315,89 @@
}
/**
- * Search for the template corresponding to the resource and the locale.
- * This may be in the template map already, or may involve reading and
- * parsing the template.
+ * Search for the template corresponding to the resource and the locale. This may be in the
+ * template map already, or may involve reading and parsing the template.
*
* @return the template, or null if not found.
*/
- private ComponentTemplate findStandardTemplate(IRequestCycle cycle, Resource resource, IComponent component,
- String templateBaseName, Locale locale)
+ private ComponentTemplate findStandardTemplate(IRequestCycle cycle, Resource resource,
+ IComponent component, String templateBaseName, Locale locale)
{
if (_log.isDebugEnabled())
- _log.debug("Searching for localized version of template for " + resource + " in locale "
- + locale.getDisplayName());
-
+ _log.debug("Searching for localized version of template for " + resource
+ + " in locale " + locale.getDisplayName());
+
Resource baseTemplateLocation = resource.getRelativeResource(templateBaseName);
-
- Resource localizedTemplateLocation = _localizer.findLocalization(baseTemplateLocation, locale);
-
- if (localizedTemplateLocation == null) return null;
+
+ Resource localizedTemplateLocation = _localizer.findLocalization(
+ baseTemplateLocation,
+ locale);
+
+ if (localizedTemplateLocation == null)
+ return null;
return getOrParseTemplate(cycle, localizedTemplateLocation, component);
}
/**
- * Returns a previously parsed template at the specified location (which
- * must already be localized). If not already in the template Map, then the
- * location is parsed and stored into the templates Map, then returned.
+ * Returns a previously parsed template at the specified location (which must already be
+ * localized). If not already in the template Map, then the location is parsed and stored into
+ * the templates Map, then returned.
*/
- private ComponentTemplate getOrParseTemplate(IRequestCycle cycle, Resource resource, IComponent component)
+ private ComponentTemplate getOrParseTemplate(IRequestCycle cycle, Resource resource,
+ IComponent component)
{
- ComponentTemplate result = (ComponentTemplate)_templates.get(resource);
- if (result != null) return result;
+ ComponentTemplate result = (ComponentTemplate) _templates.get(resource);
+ if (result != null)
+ return result;
// Ok, see if it exists.
result = parseTemplate(cycle, resource, component);
- if (result != null) _templates.put(resource, result);
+ if (result != null)
+ _templates.put(resource, result);
return result;
}
/**
- * Reads the template for the given resource; returns null if the resource
- * doesn't exist. Note that this method is only invoked from a synchronized
- * block, so there shouldn't be threading issues here.
+ * Reads the template for the given resource; returns null if the resource doesn't exist. Note
+ * that this method is only invoked from a synchronized block, so there shouldn't be threading
+ * issues here.
*/
- private ComponentTemplate parseTemplate(IRequestCycle cycle, Resource resource, IComponent component)
+ private ComponentTemplate parseTemplate(IRequestCycle cycle, Resource resource,
+ IComponent component)
{
String encoding = getTemplateEncoding(component, resource.getLocale());
char[] templateData = readTemplate(resource, encoding);
- if (templateData == null) return null;
+ if (templateData == null)
+ return null;
return constructTemplateInstance(cycle, templateData, resource, component);
}
/**
- * This method is currently synchronized, because {@link TemplateParser}is
- * not threadsafe. Another good candidate for a pooling mechanism,
- * especially because parsing a template may take a while.
+ * This method is currently synchronized, because {@link TemplateParser}is not threadsafe.
+ * Another good candidate for a pooling mechanism, especially because parsing a template may
+ * take a while.
*/
- private synchronized ComponentTemplate constructTemplateInstance(IRequestCycle cycle, char[] templateData,
- Resource resource, IComponent component)
+ private synchronized ComponentTemplate constructTemplateInstance(IRequestCycle cycle,
+ char[] templateData, Resource resource, IComponent component)
{
- String componentAttributeName = _componentPropertySource.getComponentProperty(component,
+ String componentAttributeName = _componentPropertySource.getComponentProperty(
+ component,
"org.apache.tapestry.jwcid-attribute-name");
- ITemplateParserDelegate delegate = new DefaultParserDelegate(component, componentAttributeName, cycle,
- _componentSpecificationResolver);
+ ITemplateParserDelegate delegate = new DefaultParserDelegate(component,
+ componentAttributeName, cycle, _componentSpecificationResolver);
TemplateToken[] tokens;
@@ -393,30 +410,34 @@
throw new ApplicationRuntimeException(ImplMessages.unableToParseTemplate(resource), ex);
}
- if (_log.isDebugEnabled()) _log.debug("Parsed " + tokens.length + " tokens from template");
+ if (_log.isDebugEnabled())
+ _log.debug("Parsed " + tokens.length + " tokens from template");
return new ComponentTemplate(templateData, tokens);
}
/**
- * Reads the template, given the complete path to the resource. Returns null
- * if the resource doesn't exist.
+ * Reads the template, given the complete path to the resource. Returns null if the resource
+ * doesn't exist.
*/
private char[] readTemplate(Resource resource, String encoding)
{
- if (_log.isDebugEnabled()) _log.debug("Reading template " + resource);
+ if (_log.isDebugEnabled())
+ _log.debug("Reading template " + resource);
URL url = resource.getResourceURL();
if (url == null)
{
- if (_log.isDebugEnabled()) _log.debug("Template does not exist.");
+ if (_log.isDebugEnabled())
+ _log.debug("Template does not exist.");
return null;
}
- if (_log.isDebugEnabled()) _log.debug("Reading template from URL " + url);
+ if (_log.isDebugEnabled())
+ _log.debug("Reading template from URL " + url);
InputStream stream = null;
@@ -441,8 +462,7 @@
* Reads a Stream into memory as an array of characters.
*/
- private char[] readTemplateStream(InputStream stream, String encoding)
- throws IOException
+ private char[] readTemplateStream(InputStream stream, String encoding) throws IOException
{
char[] charBuffer = new char[BUFFER_SIZE];
StringBuffer buffer = new StringBuffer();
@@ -450,15 +470,17 @@
InputStreamReader reader;
if (encoding != null)
reader = new InputStreamReader(new BufferedInputStream(stream), encoding);
- else reader = new InputStreamReader(new BufferedInputStream(stream));
+ else
+ reader = new InputStreamReader(new BufferedInputStream(stream));
try
{
- while(true)
+ while (true)
{
int charsRead = reader.read(charBuffer, 0, BUFFER_SIZE);
- if (charsRead <= 0) break;
+ if (charsRead <= 0)
+ break;
buffer.append(charBuffer, 0, charsRead);
}
@@ -484,20 +506,23 @@
}
/**
- * Checks for the {@link Tapestry#TEMPLATE_EXTENSION_PROPERTY}in the
- * component's specification, then in the component's namespace's
- * specification. Returns {@link Tapestry#DEFAULT_TEMPLATE_EXTENSION}if not
- * otherwise overriden.
+ * Checks for the {@link Tapestry#TEMPLATE_EXTENSION_PROPERTY}in the component's specification,
+ * then in the component's namespace's specification. Returns
+ * {@link Tapestry#DEFAULT_TEMPLATE_EXTENSION}if not otherwise overriden.
*/
private String getTemplateExtension(IComponent component)
{
- return _componentPropertySource.getComponentProperty(component, Tapestry.TEMPLATE_EXTENSION_PROPERTY);
+ return _componentPropertySource.getComponentProperty(
+ component,
+ Tapestry.TEMPLATE_EXTENSION_PROPERTY);
}
private String getTemplateEncoding(IComponent component, Locale locale)
{
- return _componentPropertySource.getLocalizedComponentProperty(component, locale,
+ return _componentPropertySource.getLocalizedComponentProperty(
+ component,
+ locale,
TEMPLATE_ENCODING_PROPERTY_NAME);
}
@@ -552,4 +577,4 @@
{
_localizer = localizer;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebContextInitializer.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebContextInitializer.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebContextInitializer.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebContextInitializer.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -23,16 +23,14 @@
import org.apache.tapestry.web.WebContext;
/**
- * Gets the context from the servlet, creates a
- * {@link org.apache.tapestry.web.ServletWebContext}, and stores that into the
- * {@link org.apache.tapestry.services.ApplicationGlobals}.
+ * Gets the context from the servlet, creates a {@link org.apache.tapestry.web.ServletWebContext},
+ * and stores that into the {@link org.apache.tapestry.services.ApplicationGlobals}.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class WebContextInitializer implements ApplicationInitializer
{
-
private ApplicationGlobals _globals;
public void initialize(HttpServlet servlet)
@@ -48,4 +46,4 @@
{
_globals = globals;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebRequestServicerPipelineBridge.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebRequestServicerPipelineBridge.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebRequestServicerPipelineBridge.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/services/impl/WebRequestServicerPipelineBridge.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -29,10 +29,9 @@
import org.apache.tapestry.web.WebResponse;
/**
- * Bridges from the <code>tapestry.request.ServletRequestServicerPipeline</code>
- * to the <code>tapestry.request.WebRequestServicerPipeline</code>. Also,
- * stores the web request and web response into
- * {@link org.apache.tapestry.services.RequestGlobals}. Intercepts runtime
+ * Bridges from the <code>tapestry.request.ServletRequestServicerPipeline</code> to the
+ * <code>tapestry.request.WebRequestServicerPipeline</code>. Also, stores the web request and
+ * web response into {@link org.apache.tapestry.services.RequestGlobals}. Intercepts runtime
* exceptions and throws them wrapped as {@link javax.servlet.ServletException}.
*
* @author Howard M. Lewis Ship
@@ -40,13 +39,12 @@
*/
public class WebRequestServicerPipelineBridge implements ServletRequestServicer
{
-
private RequestGlobals _requestGlobals;
private WebRequestServicer _webRequestServicer;
public void service(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
+ throws IOException, ServletException
{
_requestGlobals.store(request, response);
@@ -72,4 +70,4 @@
{
_webRequestServicer = webRequestServicer;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ApplicationSpecification.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ApplicationSpecification.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ApplicationSpecification.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ApplicationSpecification.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -17,16 +17,18 @@
import org.apache.hivemind.util.ToStringBuilder;
/**
- * Defines the configuration for a Tapestry application. An
- * ApplicationSpecification extends {@link LibrarySpecification} by adding new
- * properties name and engineClassName.
- *
- * @author Howard Lewis Ship
- */
-
-public class ApplicationSpecification extends LibrarySpecification implements IApplicationSpecification
+ * Defines the configuration for a Tapestry application. An ApplicationSpecification
+ * extends {@link LibrarySpecification} by adding new properties
+ * name and engineClassName.
+ *
+ * @author Howard Lewis Ship
+ *
+ **/
+
+public class ApplicationSpecification
+ extends LibrarySpecification
+ implements IApplicationSpecification
{
-
private String _name;
private String _engineClassName;
@@ -56,4 +58,4 @@
builder.append("engineClassName", _engineClassName);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanLifecycle.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanLifecycle.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanLifecycle.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanLifecycle.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -21,7 +21,7 @@
* @since 1.0.4
*/
-public final class BeanLifecycle
+public class BeanLifecycle
{
/**
* No lifecycle; the bean is created fresh on each reference and not retained.
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanSpecification.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanSpecification.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanSpecification.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BeanSpecification.java Sat Mar 11 12:54:27 2006
@@ -28,16 +28,10 @@
public class BeanSpecification extends LocatablePropertyHolder implements IBeanSpecification
{
- protected String _className;
+ protected String className;
- protected BeanLifecycle _lifecycle;
+ protected BeanLifecycle lifecycle;
- /**
- * A List of {@link IBeanInitializer}.
- */
-
- protected List initializers;
-
/** @since 1.0.9 * */
private String description;
@@ -45,14 +39,20 @@
private String _propertyName;
+ /**
+ * A List of {@link IBeanInitializer}.
+ */
+
+ protected List initializers;
+
public String getClassName()
{
- return _className;
+ return className;
}
public BeanLifecycle getLifecycle()
{
- return _lifecycle;
+ return lifecycle;
}
/**
@@ -83,9 +83,9 @@
{
StringBuffer buffer = new StringBuffer("BeanSpecification[");
- buffer.append(_className);
+ buffer.append(className);
buffer.append(", lifecycle ");
- buffer.append(_lifecycle.getName());
+ buffer.append(lifecycle.getName());
if (initializers != null && initializers.size() > 0)
{
@@ -113,14 +113,14 @@
public void setClassName(String className)
{
- this._className = className;
+ this.className = className;
}
/** @since 3.0 * */
public void setLifecycle(BeanLifecycle lifecycle)
{
- this._lifecycle = lifecycle;
+ this.lifecycle = lifecycle;
}
/** @since 4.0 */
@@ -134,4 +134,4 @@
{
_propertyName = propertyName;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BindingSpecification.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BindingSpecification.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BindingSpecification.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/BindingSpecification.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -17,19 +17,19 @@
import org.apache.hivemind.impl.BaseLocatable;
/**
- * Stores a binding specification, which identifies the static value or OGNL
- * expression for the binding. The name of the binding (which matches a bindable
- * property of the contined component) is implicitly known.
+ * Stores a binding specification, which identifies the static value
+ * or OGNL expression for the binding. The name of the binding (which
+ * matches a bindable property of the contined component) is implicitly known.
+ *
+ * @author Howard Lewis Ship
*
- * @author Howard Lewis Ship
- */
+ **/
public class BindingSpecification extends BaseLocatable implements IBindingSpecification
{
-
private BindingType _type;
private String _value;
-
+
public BindingType getType()
{
return _type;
@@ -49,4 +49,4 @@
{
_value = value;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ComponentSpecification.java Sat Mar 11 12:54:27 2006
@@ -58,6 +58,12 @@
public class ComponentSpecification extends LocatablePropertyHolder implements
IComponentSpecification
{
+ private String _componentClassName;
+
+ /** @since 1.0.9 * */
+
+ private String _description;
+
/**
* Keyed on component id, value is {@link IContainedComponent}.
*/
@@ -94,12 +100,6 @@
protected Set _reservedParameterNames;
- private String _componentClassName;
-
- /** @since 1.0.9 * */
-
- private String _description;
-
/**
* Is the component allowed to have a body (that is, wrap other elements?).
*/
@@ -292,7 +292,7 @@
}
/**
- * Returns a <code>List</code> of the String names of all assets, in alphabetical order.
+ * Returns a <code>List</code> of the String names of all assets, in alphabetical order
*/
public List getAssetNames()
@@ -697,4 +697,4 @@
return Collections.unmodifiableSet(_reservedParameterNames);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ContainedComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ContainedComponent.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ContainedComponent.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ContainedComponent.java Sat Mar 11 12:54:27 2006
@@ -28,16 +28,16 @@
public class ContainedComponent extends LocatablePropertyHolder implements IContainedComponent
{
- private static final int MAP_SIZE = 3;
-
- protected Map bindings;
-
private String type;
private String copyOf;
private boolean inheritInformalParameters;
+ protected Map bindings;
+
+ private static final int MAP_SIZE = 3;
+
/** @since 4.0 */
private String _propertyName;
@@ -137,4 +137,4 @@
{
_propertyName = propertyName;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ExtensionSpecification.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ExtensionSpecification.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ExtensionSpecification.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/ExtensionSpecification.java Sat Mar 11 12:54:27 2006
@@ -40,10 +40,10 @@
{
private static final Log LOG = LogFactory.getLog(ExtensionSpecification.class);
- protected Map _configuration = new HashMap();
-
private String _className;
+ protected Map _configuration = new HashMap();
+
private boolean _immediate;
/** @since 4.0 */
@@ -150,17 +150,16 @@
private Object instantiateInstance(Class extensionClass, Object result)
{
- Object ret = null;
try
{
- ret = extensionClass.newInstance();
+ result = extensionClass.newInstance();
}
catch (Exception ex)
{
throw new ApplicationRuntimeException(ex.getMessage(), getLocation(), ex);
}
-
- return ret;
+
+ return result;
}
public String toString()
@@ -197,4 +196,4 @@
_immediate = immediate;
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/IContainedComponent.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/IContainedComponent.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/IContainedComponent.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/IContainedComponent.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -21,75 +21,73 @@
import org.apache.tapestry.util.IPropertyHolder;
/**
- * Defines a contained component. This includes the information needed to get
- * the contained component's specification, as well as any bindings for the
- * component.
- *
+ * Defines a contained component. This includes the information needed to
+ * get the contained component's specification, as well as any bindings
+ * for the component.
+
* @author glongman@intelligentworks.com
*/
public interface IContainedComponent extends IPropertyHolder, LocationHolder, Locatable, PropertyInjectable
{
-
/**
- * Returns the named binding, or null if the binding does not exist.
- */
+ * Returns the named binding, or null if the binding does not
+ * exist.
+ *
+ **/
public abstract IBindingSpecification getBinding(String name);
-
/**
- * Returns an umodifiable <code>Collection</code> of Strings, each the
- * name of one binding for the component.
- */
+ * Returns an umodifiable <code>Collection</code>
+ * of Strings, each the name of one binding
+ * for the component.
+ *
+ **/
public abstract Collection getBindingNames();
-
public abstract String getType();
-
public abstract void setBinding(String name, IBindingSpecification spec);
-
public abstract void setType(String value);
-
/**
- * Sets the String Id of the component being copied from. For use by IDE
- * tools like Spindle.
+ * Sets the String Id of the component being copied from.
+ * For use by IDE tools like Spindle.
*
- * @since 1.0.9
- */
+ * @since 1.0.9
+ **/
public abstract void setCopyOf(String id);
-
/**
- * Returns the id of the component being copied from. For use by IDE tools
- * like Spindle.
+ * Returns the id of the component being copied from.
+ * For use by IDE tools like Spindle.
*
- * @since 1.0.9
- */
+ * @since 1.0.9
+ **/
public abstract String getCopyOf();
/**
- * Returns whether the contained component will inherit the informal
- * parameters of its parent.
+ * Returns whether the contained component will inherit
+ * the informal parameters of its parent.
*
* @since 3.0
- */
+ **/
public abstract boolean getInheritInformalParameters();
/**
- * Sets whether the contained component will inherit the informal parameters
- * of its parent.
+ * Sets whether the contained component will inherit
+ * the informal parameters of its parent.
*
* @since 3.0
*/
public abstract void setInheritInformalParameters(boolean value);
-
+
/**
- * Returns the name of the property to be created for this component, or
- * null if no property should be created.
+ * Returns the name of the property to be created for this component,
+ * or null if no property should be created.
*
* @since 4.0
*/
public String getPropertyName();
-
+
/**
- * @since 4.0
+ *
+ * @since 4.0
*/
-
+
public void setPropertyName(String propertyName);
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/LocatablePropertyHolder.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/LocatablePropertyHolder.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/LocatablePropertyHolder.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/LocatablePropertyHolder.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -19,20 +19,20 @@
import org.apache.tapestry.util.BasePropertyHolder;
/**
- * Base class for implementing both interfaces
- * {@link org.apache.tapestry.util.IPropertyHolder} and
- * {@link org.apache.tapestry.ILocationHolder}. This is used by all the
- * specification classes.
- *
- * @author Howard Lewis Ship
- * @since 3.0
- */
+ * Base class for implementing both
+ * interfaces {@link org.apache.tapestry.util.IPropertyHolder} and
+ * {@link org.apache.tapestry.ILocationHolder}. This is
+ * used by all the specification classes.
+ *
+ * @author Howard Lewis Ship
+ * @since 3.0
+ *
+ **/
public class LocatablePropertyHolder extends BasePropertyHolder implements LocationHolder
{
-
- private Location _location;
-
+ private Location _location;
+
public Location getLocation()
{
return _location;
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/SpecMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/SpecMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/SpecMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/spec/SpecMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005 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.
@@ -15,50 +15,45 @@
package org.apache.tapestry.spec;
import org.apache.hivemind.HiveMind;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
/**
* @author Howard M. Lewis Ship
* @since 4.0
*/
-final class SpecMessages
+class SpecMessages
{
-
- private static final Messages MESSAGES = new MessageFormatter(SpecMessages.class);
-
- /** @since 4.1 */
- private SpecMessages()
- {
- }
+ private static final MessageFormatter _formatter = new MessageFormatter(SpecMessages.class);
static String claimedProperty(String propertyName, Object existing)
{
- return MESSAGES.format("claimed-property", propertyName, HiveMind.getLocationString(existing));
+ return _formatter.format("claimed-property", propertyName, HiveMind
+ .getLocationString(existing));
}
static String duplicateAsset(String name, IAssetSpecification previousAsset)
{
- return MESSAGES.format("duplicate-asset", name, HiveMind.getLocationString(previousAsset));
+ return _formatter
+ .format("duplicate-asset", name, HiveMind.getLocationString(previousAsset));
}
static String duplicateParameter(String name, IParameterSpecification existing)
{
- return MESSAGES.format("duplicate-parameter", name, HiveMind.getLocationString(existing));
+ return _formatter.format("duplicate-parameter", name, HiveMind.getLocationString(existing));
}
static String duplicateBean(String name, IBeanSpecification spec)
{
- return MESSAGES.format("duplicate-bean", name, HiveMind.getLocationString(spec));
+ return _formatter.format("duplicate-bean", name, HiveMind.getLocationString(spec));
}
static String duplicateProperty(String name, IPropertySpecification existing)
{
- return MESSAGES.format("duplicate-property", name, HiveMind.getLocationString(existing));
+ return _formatter.format("duplicate-property", name, HiveMind.getLocationString(existing));
}
static String duplicateComponent(String name, IContainedComponent existing)
{
- return MESSAGES.format("duplicate-component", name, HiveMind.getLocationString(existing));
+ return _formatter.format("duplicate-component", name, HiveMind.getLocationString(existing));
}
}
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/test/ScriptMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/test/ScriptMessages.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/test/ScriptMessages.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/test/ScriptMessages.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -14,41 +14,34 @@
package org.apache.tapestry.test;
-import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
import org.apache.hivemind.service.ClassFabUtils;
/**
- * Container of static methods to format logging and exception messages, used
- * within the org.apache.tapesty.test package (and a few sub-packages).
+ * Container of static methods to format logging and exception messages, used within the
+ * org.apache.tapesty.test package (and a few sub-packages).
* <p>
- * Technically, these are messages for the test package, and this class should
- * be called TestMessages ... but that's always a bad idea (it makes the class
- * look like a JUnit test suite).
+ * Technically, these are messages for the test package, and this class should be called
+ * TestMessages ... but that's always a bad idea (it makes the class look like a JUnit test suite).
* <p>
- * This class is public, not package private, because some related sub-packages
- * make use of it as well.
+ * This class is public, not package private, because some related sub-packages make use of it as
+ * well.
*
* @author Howard Lewis Ship
* @since 4.0
*/
-public final class ScriptMessages
+public class ScriptMessages
{
-
- private final static Messages MESSAGES = new MessageFormatter(ScriptMessages.class);
-
- /** @since 4.1 */
- private ScriptMessages()
- {
- }
+ private final static MessageFormatter _formatter = new MessageFormatter(ScriptMessages.class);
static String wrongTypeForEnhancement(Class type)
{
- return MESSAGES.format("wrong-type-for-enhancement", ClassFabUtils.getJavaClassName(type));
+ return _formatter
+ .format("wrong-type-for-enhancement", ClassFabUtils.getJavaClassName(type));
}
static String unableToInstantiate(Class abstractClass, Throwable cause)
{
- return MESSAGES.format("unable-to-instantiate", abstractClass.getName(), cause);
+ return _formatter.format("unable-to-instantiate", abstractClass.getName(), cause);
}
-}
+}
\ No newline at end of file
Modified: jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/ComponentAddress.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/ComponentAddress.java?rev=385164&r1=385163&r2=385164&view=diff
==============================================================================
--- jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/ComponentAddress.java (original)
+++ jakarta/tapestry/trunk/framework/src/java/org/apache/tapestry/util/ComponentAddress.java Sat Mar 11 12:54:27 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005, 2006 The Apache Software Foundation
+// Copyright 2004, 2005 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.
@@ -23,33 +23,30 @@
import org.apache.tapestry.IRequestCycle;
/**
- * The ComponentAddress class contains the path to a component, allowing it to
- * locate an instance of that component in a different
- * {@link org.apache.tapestry.IRequestCycle}.
+ * The ComponentAddress class contains the path to a component, allowing it to locate an instance of
+ * that component in a different {@link org.apache.tapestry.IRequestCycle}.
* <p>
- * This class needs to be used mostly when working with components accessed via
- * the {@link org.apache.tapestry.IRender}interface. It allows those components
- * to serialize and pass as a service parameter information about what component
- * they have to talk to if control returns back to them.
+ * This class needs to be used mostly when working with components accessed via the
+ * {@link org.apache.tapestry.IRender}interface. It allows those components to serialize and pass
+ * as a service parameter information about what component they have to talk to if control returns
+ * back to them.
* <p>
- * This situation often occurs when the component used via IRender contains
- * Direct or Action links.
+ * This situation often occurs when the component used via IRender contains Direct or Action links.
*
* @author mindbridge
* @since 2.2
*/
public class ComponentAddress implements Serializable
{
-
private static final long serialVersionUID = 533068199722072804L;
- private String _pageName;
+ private String _pageName;
private String _idPath;
/**
- * Creates a new ComponentAddress object that carries the identification
- * information of the given component (the page name and the ID path).
+ * Creates a new ComponentAddress object that carries the identification information of the
+ * given component (the page name and the ID path).
*
* @param component
* the component to get the address of
@@ -76,8 +73,8 @@
}
/**
- * Creates a new ComponentAddress using the given Page Name and ID Path
- * relative on the provided Namespace
+ * Creates a new ComponentAddress using the given Page Name and ID Path relative on the provided
+ * Namespace
*
* @param namespace
* the namespace of the page that contains the component
@@ -96,8 +93,7 @@
*
* @param cycle
* the RequestCycle to use to locate the component
- * @return IComponent a component that has been initialized for the given
- * RequestCycle
+ * @return IComponent a component that has been initialized for the given RequestCycle
*/
public IComponent findComponent(IRequestCycle cycle)
{
@@ -108,8 +104,8 @@
/**
* Returns the idPath of the component.
*
- * @return String the ID path of the component, or null if the address
- * references a page, not a component within a page.
+ * @return String the ID path of the component, or null if the address references a page, not a
+ * component within a page.
*/
public String getIdPath()
{
@@ -132,7 +128,8 @@
public int hashCode()
{
int hash = _pageName.hashCode() * 31;
- if (_idPath != null) hash += _idPath.hashCode();
+ if (_idPath != null)
+ hash += _idPath.hashCode();
return hash;
}
@@ -141,16 +138,19 @@
*/
public boolean equals(Object obj)
{
- if (!(obj instanceof ComponentAddress)) return false;
+ if (!(obj instanceof ComponentAddress))
+ return false;
- if (obj == this) return true;
+ if (obj == this)
+ return true;
- ComponentAddress objAddress = (ComponentAddress)obj;
- if (!getPageName().equals(objAddress.getPageName())) return false;
+ ComponentAddress objAddress = (ComponentAddress) obj;
+ if (!getPageName().equals(objAddress.getPageName()))
+ return false;
String idPath1 = getIdPath();
String idPath2 = objAddress.getIdPath();
return (idPath1 == idPath2) || (idPath1 != null && idPath1.equals(idPath2));
}
-}
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-dev-help@jakarta.apache.org