You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2006/01/12 02:10:11 UTC
svn commit: r368196 [9/25] - in /jakarta/tapestry: branches/4.0/
branches/4.0/.settings/
branches/4.0/contrib/src/java/org/apache/tapestry/contrib/inspector/
branches/4.0/contrib/src/java/org/apache/tapestry/contrib/jdbc/
branches/4.0/contrib/src/java/...
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/AbstractPage.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/AbstractPage.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/AbstractPage.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/AbstractPage.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,11 +23,11 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.tapestry.event.ChangeObserver;
+import org.apache.tapestry.event.PageAttachListener;
import org.apache.tapestry.event.PageBeginRenderListener;
import org.apache.tapestry.event.PageDetachListener;
import org.apache.tapestry.event.PageEndRenderListener;
import org.apache.tapestry.event.PageEvent;
-import org.apache.tapestry.event.PageAttachListener;
import org.apache.tapestry.event.PageRenderListener;
import org.apache.tapestry.event.PageValidateListener;
import org.apache.tapestry.util.StringSplitter;
@@ -39,13 +39,14 @@
* @since 0.2.9
*/
-public abstract class AbstractPage extends BaseComponent implements IPage
-{
+public abstract class AbstractPage extends BaseComponent implements IPage {
+
private static final Log LOG = LogFactory.getLog(AbstractPage.class);
/**
- * Object to be notified when a observered property changes. Observered properties are the ones
- * that will be persisted between request cycles. Unobserved properties are reconstructed.
+ * Object to be notified when a observered property changes. Observered
+ * properties are the ones that will be persisted between request cycles.
+ * Unobserved properties are reconstructed.
*/
private ChangeObserver _changeObserver;
@@ -57,8 +58,8 @@
private IEngine _engine;
/**
- * The visit object, if any, for the application. Set inside {@link #attach(IEngine)}and
- * cleared by {@link #detach()}.
+ * The visit object, if any, for the application. Set inside
+ * {@link #attach(IEngine)}and cleared by {@link #detach()}.
*/
private Object _visit;
@@ -78,7 +79,8 @@
private IRequestCycle _requestCycle;
/**
- * The locale of the page, initially determined from the {@link IEngine engine}.
+ * The locale of the page, initially determined from the
+ * {@link IEngine engine}.
*/
private Locale _locale;
@@ -95,16 +97,16 @@
private EventListenerList _listenerList;
/**
- * The output encoding to be used when rendering this page. This value is cached from the
- * engine.
+ * The output encoding to be used when rendering this page. This value is
+ * cached from the engine.
*
* @since 3.0
*/
private String _outputEncoding;
/**
- * Standard constructor; invokes {@link #initialize()}to configure initial values for
- * properties of the page.
+ * Standard constructor; invokes {@link #initialize()}to configure initial
+ * values for properties of the page.
*
* @since 2.2
*/
@@ -118,12 +120,14 @@
* Prepares the page to be returned to the pool.
* <ul>
* <li>Clears the changeObserved property
- * <li>Invokes {@link PageDetachListener#pageDetached(PageEvent)}on all listeners
+ * <li>Invokes {@link PageDetachListener#pageDetached(PageEvent)}on all
+ * listeners
* <li>Invokes {@link #initialize()}to clear/reset any properties
* <li>Clears the engine, visit and requestCycle properties
* </ul>
* <p>
- * Subclasses may override this method, but must invoke this implementation (usually, last).
+ * Subclasses may override this method, but must invoke this implementation
+ * (usually, last).
*
* @see PageDetachListener
*/
@@ -147,8 +151,9 @@
}
/**
- * Method invoked from the constructor, and from {@link #detach()}to (re-)initialize properties
- * of the page. This is most useful when properties have non-null initial values.
+ * Method invoked from the constructor, and from {@link #detach()}to
+ * (re-)initialize properties of the page. This is most useful when
+ * properties have non-null initial values.
* <p>
* Subclasses may override this implementation (which is empty).
*
@@ -192,8 +197,8 @@
}
/**
- * Returns the locale for the page, which may be null if the locale is not known (null
- * corresponds to the "default locale").
+ * Returns the locale for the page, which may be null if the locale is not
+ * known (null corresponds to the "default locale").
*/
public Locale getLocale()
@@ -217,15 +222,13 @@
String[] elements;
int i;
- if (path == null)
- return this;
+ if (path == null) return this;
splitter = new StringSplitter('.');
current = this;
elements = splitter.splitToArray(path);
- for (i = 0; i < elements.length; i++)
- {
+ for(i = 0; i < elements.length; i++) {
current = current.getComponent(elements[i]);
}
@@ -234,16 +237,18 @@
}
/**
- * Called by the {@link IEngine engine}to attach the page to itself. Does <em>not</em> change
- * the locale, but since a page is selected from the
- * {@link org.apache.tapestry.engine.IPageSource}pool based on its locale matching the engine's
- * locale, they should match anyway.
+ * Called by the {@link IEngine engine}to attach the page to itself. Does
+ * <em>not</em> change the locale, but since a page is selected from the
+ * {@link org.apache.tapestry.engine.IPageSource}pool based on its locale
+ * matching the engine's locale, they should match anyway.
*/
public void attach(IEngine engine, IRequestCycle cycle)
{
if (_engine != null)
- LOG.error(this + " attach(" + engine + "), but engine = " + _engine);
+ LOG
+ .error(this + " attach(" + engine + "), but engine = "
+ + _engine);
_engine = engine;
_requestCycle = cycle;
@@ -252,30 +257,28 @@
}
/**
+ * Renders the page, following a series of steps.
* <ul>
* <li>Invokes {@link PageBeginRenderListener#pageBeginRender(PageEvent)}
* <li>Invokes {@link #beginResponse(IMarkupWriter, IRequestCycle)}
* <li>Invokes {@link IRequestCycle#commitPageChanges()}(if not rewinding)
* <li>Invokes {@link #render(IMarkupWriter, IRequestCycle)}
- * <li>Invokes {@link PageEndRenderListener#pageEndRender(PageEvent)}(this occurs even if a
- * previous step throws an exception)
+ * <li>Invokes {@link PageEndRenderListener#pageEndRender(PageEvent)}(this
+ * occurs even if a previous step throws an exception)
+ * </ul>
*/
public void renderPage(IMarkupWriter writer, IRequestCycle cycle)
{
- try
- {
+ try {
firePageBeginRender();
beginResponse(writer, cycle);
- if (!cycle.isRewinding())
- cycle.commitPageChanges();
+ if (!cycle.isRewinding()) cycle.commitPageChanges();
render(writer, cycle);
- }
- finally
- {
+ } finally {
firePageEndRender();
}
}
@@ -323,15 +326,15 @@
}
/**
- * Returns the visit object obtained from the engine via {@link IEngine#getVisit(IRequestCycle)}.
+ * Returns the visit object obtained from the engine via
+ * {@link IEngine#getVisit(IRequestCycle)}.
*
* @deprecated
*/
public Object getVisit()
{
- if (_visit == null)
- _visit = _engine.getVisit(_requestCycle);
+ if (_visit == null) _visit = _engine.getVisit(_requestCycle);
return _visit;
}
@@ -355,8 +358,7 @@
private void addListener(Class listenerClass, EventListener listener)
{
- if (_listenerList == null)
- _listenerList = new EventListenerList();
+ if (_listenerList == null) _listenerList = new EventListenerList();
_listenerList.add(listenerClass, listener);
}
@@ -408,20 +410,16 @@
public void firePageAttached()
{
- if (_listenerList == null)
- return;
+ if (_listenerList == null) return;
PageEvent event = null;
Object[] listeners = _listenerList.getListenerList();
- for (int i = 0; i < listeners.length; i += 2)
- {
- if (listeners[i] == PageAttachListener.class)
- {
- PageAttachListener l = (PageAttachListener) listeners[i + 1];
+ for(int i = 0; i < listeners.length; i += 2) {
+ if (listeners[i] == PageAttachListener.class) {
+ PageAttachListener l = (PageAttachListener)listeners[i + 1];
- if (event == null)
- event = new PageEvent(this, _requestCycle);
+ if (event == null) event = new PageEvent(this, _requestCycle);
l.pageAttached(event);
}
@@ -434,20 +432,16 @@
protected void firePageDetached()
{
- if (_listenerList == null)
- return;
+ if (_listenerList == null) return;
PageEvent event = null;
Object[] listeners = _listenerList.getListenerList();
- for (int i = 0; i < listeners.length; i += 2)
- {
- if (listeners[i] == PageDetachListener.class)
- {
- PageDetachListener l = (PageDetachListener) listeners[i + 1];
+ for(int i = 0; i < listeners.length; i += 2) {
+ if (listeners[i] == PageDetachListener.class) {
+ PageDetachListener l = (PageDetachListener)listeners[i + 1];
- if (event == null)
- event = new PageEvent(this, _requestCycle);
+ if (event == null) event = new PageEvent(this, _requestCycle);
l.pageDetached(event);
}
@@ -460,20 +454,16 @@
protected void firePageBeginRender()
{
- if (_listenerList == null)
- return;
+ if (_listenerList == null) return;
PageEvent event = null;
Object[] listeners = _listenerList.getListenerList();
- for (int i = 0; i < listeners.length; i += 2)
- {
- if (listeners[i] == PageBeginRenderListener.class)
- {
- PageBeginRenderListener l = (PageBeginRenderListener) listeners[i + 1];
+ for(int i = 0; i < listeners.length; i += 2) {
+ if (listeners[i] == PageBeginRenderListener.class) {
+ PageBeginRenderListener l = (PageBeginRenderListener)listeners[i + 1];
- if (event == null)
- event = new PageEvent(this, _requestCycle);
+ if (event == null) event = new PageEvent(this, _requestCycle);
l.pageBeginRender(event);
}
@@ -486,20 +476,16 @@
protected void firePageEndRender()
{
- if (_listenerList == null)
- return;
+ if (_listenerList == null) return;
PageEvent event = null;
Object[] listeners = _listenerList.getListenerList();
- for (int i = 0; i < listeners.length; i += 2)
- {
- if (listeners[i] == PageEndRenderListener.class)
- {
- PageEndRenderListener l = (PageEndRenderListener) listeners[i + 1];
+ for(int i = 0; i < listeners.length; i += 2) {
+ if (listeners[i] == PageEndRenderListener.class) {
+ PageEndRenderListener l = (PageEndRenderListener)listeners[i + 1];
- if (event == null)
- event = new PageEvent(this, _requestCycle);
+ if (event == null) event = new PageEvent(this, _requestCycle);
l.pageEndRender(event);
}
@@ -567,20 +553,16 @@
protected void firePageValidate()
{
- if (_listenerList == null)
- return;
+ if (_listenerList == null) return;
PageEvent event = null;
Object[] listeners = _listenerList.getListenerList();
- for (int i = 0; i < listeners.length; i += 2)
- {
- if (listeners[i] == PageValidateListener.class)
- {
- PageValidateListener l = (PageValidateListener) listeners[i + 1];
+ for(int i = 0; i < listeners.length; i += 2) {
+ if (listeners[i] == PageValidateListener.class) {
+ PageValidateListener l = (PageValidateListener)listeners[i + 1];
- if (event == null)
- event = new PageEvent(this, _requestCycle);
+ if (event == null) event = new PageEvent(this, _requestCycle);
l.pageValidate(event);
}
@@ -588,8 +570,8 @@
}
/**
- * Returns the output encoding to be used when rendering this page. This value is usually cached
- * from the Engine.
+ * Returns the output encoding to be used when rendering this page. This
+ * value is usually cached from the Engine.
*
* @since 3.0
*/
@@ -600,4 +582,4 @@
return _outputEncoding;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/ApplicationServlet.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/ApplicationServlet.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/ApplicationServlet.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/ApplicationServlet.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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.
@@ -40,11 +40,12 @@
import org.apache.tapestry.util.exception.ExceptionAnalyzer;
/**
- * Links a servlet container with a Tapestry application. The servlet init parameter
- * <code>org.apache.tapestry.application-specification</code> should be set to the complete
- * resource path (within the classpath) to the application specification, i.e.,
- * <code>/com/foo/bar/MyApp.application</code>. As of release 4.0, this servlet will also create
- * a HiveMind Registry and manage it.
+ * Links a servlet container with a Tapestry application. The servlet init
+ * parameter <code>org.apache.tapestry.application-specification</code> should
+ * be set to the complete resource path (within the classpath) to the
+ * application specification, i.e., <code>/com/foo/bar/MyApp.application</code>.
+ * As of release 4.0, this servlet will also create a HiveMind Registry and
+ * manage it.
*
* @author Howard Lewis Ship
* @see org.apache.tapestry.services.ApplicationInitializer
@@ -53,31 +54,39 @@
public class ApplicationServlet extends HttpServlet
{
- private static final long serialVersionUID = -8046042689991538059L;
+
+ private static final Log LOG = LogFactory.getLog(ApplicationServlet.class);
/**
- * Prefix used to store the HiveMind Registry into the ServletContext. This string is suffixed
- * with the servlet name (in case multiple Tapestry applications are executing within a single
- * web application).
+ * Prefix used to store the HiveMind Registry into the ServletContext. This
+ * string is suffixed with the servlet name (in case multiple Tapestry
+ * applications are executing within a single web application).
*
* @since 4.0
*/
private static final String REGISTRY_KEY_PREFIX = "org.apache.tapestry.Registry:";
- private static final Log LOG = LogFactory.getLog(ApplicationServlet.class);
+ private static final long serialVersionUID = -8046042689991538059L;
/**
- * Invokes {@link #doService(HttpServletRequest, HttpServletResponse)}.
+ * @since 4.0
+ */
+
+ private Registry _registry;
+
+ /**
+ * The key used to store the registry into the ServletContext.
*
- * @since 1.0.6
+ * @since 4.0
*/
- public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException,
- ServletException
- {
- doService(request, response);
- }
+ private String _registryKey;
+
+ /**
+ * @since 4.0
+ */
+ private ServletRequestServicer _requestServicer;
/**
* @since 2.3
@@ -86,35 +95,128 @@
private ClassResolver _resolver;
/**
- * The key used to store the registry into the ServletContext.
+ * Looks for a file in the servlet context; if it exists, it is expected to
+ * be a HiveMind module descriptor, and is added to the builder.
*
* @since 4.0
*/
- private String _registryKey;
+ protected void addModuleIfExists(RegistryBuilder builder, ServletContext context, String path)
+ {
+ Resource r = new ContextResource(context, path);
+
+ if (r.getResourceURL() == null) return;
+
+ builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver, r));
+ }
/**
+ * Invoked by {@link #constructRegistry(ServletConfig)} to create and return
+ * an {@link ErrorHandler} instance to be used when constructing the
+ * Registry (and then to handle any runtime exceptions). This implementation
+ * returns a new instance of
+ * {@link org.apache.hivemind.impl.StrictErrorHandler}.
+ *
* @since 4.0
*/
+ protected ErrorHandler constructErrorHandler(ServletConfig config)
+ {
+ return new StrictErrorHandler();
+ }
- private Registry _registry;
+ /**
+ * Invoked from {@link #init(ServletConfig)}to construct the Registry to be
+ * used by the application.
+ * <p>
+ * This looks in the standard places (on the classpath), but also in the
+ * WEB-INF/name and WEB-INF folders (where name is the name of the servlet).
+ *
+ * @since 4.0
+ */
+ protected Registry constructRegistry(ServletConfig config)
+ {
+ ErrorHandler errorHandler = constructErrorHandler(config);
+
+ RegistryBuilder builder = new RegistryBuilder(errorHandler);
+
+ builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver));
+
+ String name = config.getServletName();
+ ServletContext context = config.getServletContext();
+
+ addModuleIfExists(builder, context, "/WEB-INF/" + name + "/hivemodule.xml");
+ addModuleIfExists(builder, context, "/WEB-INF/hivemodule.xml");
+
+ return builder.constructRegistry(Locale.getDefault());
+ }
/**
+ * Invoked from {@link #init(ServletConfig)}to create a resource resolver
+ * for the servlet (which will utlimately be shared and used through the
+ * application).
+ * <p>
+ * This implementation constructs a {@link DefaultResourceResolver},
+ * subclasses may provide a different implementation.
+ *
+ * @see #getResourceResolver()
+ * @since 2.3
+ */
+
+ protected ClassResolver createClassResolver()
+ {
+ return new DefaultClassResolver();
+ }
+
+ /**
+ * Shuts down the registry (if it exists).
+ *
* @since 4.0
*/
- private ServletRequestServicer _requestServicer;
+ public void destroy()
+ {
+ getServletContext().removeAttribute(_registryKey);
+
+ if (_registry != null)
+ {
+ _registry.shutdown();
+ _registry = null;
+ }
+ }
+
+ /**
+ * Invokes {@link #doService(HttpServletRequest, HttpServletResponse)}.
+ *
+ * @since 1.0.6
+ */
+
+ public void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ doService(request, response);
+ }
+
+ /**
+ * Invokes {@link #doService(HttpServletRequest, HttpServletResponse)}.
+ */
+
+ public void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws IOException, ServletException
+ {
+ doService(request, response);
+ }
/**
* Handles the GET and POST requests. Performs the following:
* <ul>
* <li>Construct a {@link RequestContext}
- * <li>Invoke {@link #getEngine(RequestContext)}to get or create the {@link IEngine}
+ * <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)
- throws IOException, ServletException
+ throws IOException, ServletException
{
try
{
@@ -148,35 +250,17 @@
}
}
- protected void show(Exception ex)
- {
- System.err.println("\n\n**********************************************************\n\n");
-
- new ExceptionAnalyzer().reportException(ex, System.err);
-
- System.err.println("\n**********************************************************\n");
-
- }
-
- /**
- * Invokes {@link #doService(HttpServletRequest, HttpServletResponse)}.
- */
-
- public void doPost(HttpServletRequest request, HttpServletResponse response)
- throws IOException, ServletException
- {
- doService(request, response);
- }
-
/**
- * Reads the application specification when the servlet is first initialized. All
- * {@link IEngine engine instances}will have access to the specification via the servlet.
+ * Reads the application specification when the servlet is first
+ * initialized. All {@link IEngine engine instances}will have access to the
+ * specification via the servlet.
*
* @see #constructApplicationSpecification()
* @see #createResourceResolver()
*/
- public void init(ServletConfig config) throws ServletException
+ public void init(ServletConfig config)
+ throws ServletException
{
String name = config.getServletName();
@@ -212,112 +296,32 @@
}
/**
- * Invoked from {@link #init(ServletConfig)}to create a resource resolver for the servlet
- * (which will utlimately be shared and used through the application).
- * <p>
- * This implementation constructs a {@link DefaultResourceResolver}, subclasses may provide a
- * different implementation.
- *
- * @see #getResourceResolver()
- * @since 2.3
- */
-
- protected ClassResolver createClassResolver()
- {
- return new DefaultClassResolver();
- }
-
- /**
- * Invoked from {@link #init(ServletConfig)}to construct the Registry to be used by the
- * application.
- * <p>
- * This looks in the standard places (on the classpath), but also in the WEB-INF/name and
- * WEB-INF folders (where name is the name of the servlet).
- *
- * @since 4.0
- */
- protected Registry constructRegistry(ServletConfig config)
- {
- ErrorHandler errorHandler = constructErrorHandler(config);
-
- RegistryBuilder builder = new RegistryBuilder(errorHandler);
-
- builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver));
-
- String name = config.getServletName();
- ServletContext context = config.getServletContext();
-
- addModuleIfExists(builder, context, "/WEB-INF/" + name + "/hivemodule.xml");
- addModuleIfExists(builder, context, "/WEB-INF/hivemodule.xml");
-
- return builder.constructRegistry(Locale.getDefault());
- }
-
- /**
- * Invoked by {@link #constructRegistry(ServletConfig)} to create and return an
- * {@link ErrorHandler} instance to be used when constructing the Registry (and then to handle
- * any runtime exceptions). This implementation returns a new instance of
- * {@link org.apache.hivemind.impl.StrictErrorHandler}.
- *
- * @since 4.0
- */
- protected ErrorHandler constructErrorHandler(ServletConfig config)
- {
- return new StrictErrorHandler();
- }
-
- /**
- * Looks for a file in the servlet context; if it exists, it is expected to be a HiveMind module
- * descriptor, and is added to the builder.
- *
- * @since 4.0
- */
-
- protected void addModuleIfExists(RegistryBuilder builder, ServletContext context, String path)
- {
- Resource r = new ContextResource(context, path);
-
- if (r.getResourceURL() == null)
- return;
-
- builder.addModuleDescriptorProvider(new XmlModuleDescriptorProvider(_resolver, r));
- }
-
- /**
- * Invoked from {@link #init(ServletConfig)}, after the registry has been constructed, to
- * bootstrap the application via the <code>tapestry.MasterApplicationInitializer</code>
- * service.
+ * Invoked from {@link #init(ServletConfig)}, after the registry has been
+ * constructed, to bootstrap the application via the
+ * <code>tapestry.MasterApplicationInitializer</code> service.
*
* @since 4.0
*/
protected void initializeApplication()
{
- ApplicationInitializer ai = (ApplicationInitializer) _registry.getService(
- "tapestry.init.MasterInitializer",
+ ApplicationInitializer ai = (ApplicationInitializer)_registry.getService("tapestry.init.MasterInitializer",
ApplicationInitializer.class);
ai.initialize(this);
_registry.cleanupThread();
- _requestServicer = (ServletRequestServicer) _registry.getService(
- "tapestry.request.ServletRequestServicer",
+ _requestServicer = (ServletRequestServicer)_registry.getService("tapestry.request.ServletRequestServicer",
ServletRequestServicer.class);
}
- /**
- * Shuts down the registry (if it exists).
- *
- * @since 4.0
- */
- public void destroy()
+ protected void show(Exception ex)
{
- getServletContext().removeAttribute(_registryKey);
+ System.err.println("\n\n**********************************************************\n\n");
+
+ new ExceptionAnalyzer().reportException(ex, System.err);
+
+ System.err.println("\n**********************************************************\n");
- if (_registry != null)
- {
- _registry.shutdown();
- _registry = null;
- }
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/BindingException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/BindingException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/BindingException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/BindingException.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,18 +19,17 @@
import org.apache.hivemind.Location;
/**
- * A general exception describing an {@link IBinding}
- * and an {@link IComponent}.
- *
- * @author Howard Lewis Ship
- *
- **/
+ * A general exception describing an {@link IBinding} and an {@link IComponent}.
+ *
+ * @author Howard Lewis Ship
+ */
public class BindingException extends ApplicationRuntimeException
{
+
private static final long serialVersionUID = 1336659143140967861L;
-
- private transient IBinding _binding;
+
+ private transient IBinding _binding;
public BindingException(String message, IBinding binding)
{
@@ -42,19 +41,9 @@
this(message, null, null, binding, rootCause);
}
-
- public BindingException(
- String message,
- Object component,
- Location location,
- IBinding binding,
- Throwable rootCause)
+ public BindingException(String message, Object component, Location location, IBinding binding, Throwable rootCause)
{
- super(
- message,
- component,
- HiveMind.findLocation(new Object[] { location, binding, component }),
- rootCause);
+ super(message, component, HiveMind.findLocation(new Object[] { location, binding, component }), rootCause);
_binding = binding;
}
@@ -63,4 +52,4 @@
{
return _binding;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Constants.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Constants.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Constants.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Constants.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,16 +15,18 @@
package org.apache.tapestry;
/**
- * Constant values used inside Tapestry.
- *
+ * Constant values used inside Tapestry.
+ *
* @author Howard Lewis Ship
* @since 4.0
*/
public final class Constants
{
- /**
- * Key used to store and locate an {@link org.apache.tapestry.services.Infrastructure}
- * service instance as a request attribute.
- */
- public static final String INFRASTRUCTURE_KEY = "org.apache.tapestry.Infrastructure";
+
+ /**
+ * Key used to store and locate an
+ * {@link org.apache.tapestry.services.Infrastructure} service instance as a
+ * request attribute.
+ */
+ public static final String INFRASTRUCTURE_KEY = "org.apache.tapestry.Infrastructure";
}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/IBeanProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/IBeanProvider.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/IBeanProvider.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/IBeanProvider.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,65 +19,60 @@
import org.apache.hivemind.ClassResolver;
/**
- * An object that provides a component with access to helper beans.
- * Helper beans are JavaBeans associated with a page or component
- * that are used to extend the functionality of the component via
- * aggregation.
- *
- * @author Howard Lewis Ship
- * @since 1.0.4
- **/
-
+ * An object that provides a component with access to helper beans. Helper beans
+ * are JavaBeans associated with a page or component that are used to extend the
+ * functionality of the component via aggregation.
+ *
+ * @author Howard Lewis Ship
+ * @since 1.0.4
+ */
public interface IBeanProvider
{
- /**
- * Returns the JavaBean with the specified name. The bean is created as needed.
- *
- * @throws ApplicationRuntimeException if no such bean is available.
- *
- **/
-
- public Object getBean(String name);
-
- /**
- * Returns the {@link IComponent} (which may be a
- * {@link org.apache.tapestry.IPage}) for which
- * this bean provider is providing beans.
- *
- * @since 1.0.5
- **/
-
- public IComponent getComponent();
-
- /**
- * Returns a collection of the names of any beans which may
- * be provided.
- *
- * @since 1.0.6
- * @see org.apache.tapestry.spec.IComponentSpecification#getBeanNames()
- *
- **/
-
- public Collection getBeanNames();
-
+
+ /**
+ * Returns the JavaBean with the specified name. The bean is created as
+ * needed.
+ *
+ * @throws ApplicationRuntimeException
+ * if no such bean is available.
+ */
+
+ public Object getBean(String name);
+
+ /**
+ * Returns the {@link IComponent} (which may be a
+ * {@link org.apache.tapestry.IPage}) for which this bean provider is
+ * providing beans.
+ *
+ * @since 1.0.5
+ */
+
+ public IComponent getComponent();
+
/**
- * Returns true if the provider can provide the named bean.
+ * Returns a collection of the names of any beans which may be provided.
*
- * @since 2.2
+ * @since 1.0.6
+ * @see org.apache.tapestry.spec.IComponentSpecification#getBeanNames()
+ */
+
+ public Collection getBeanNames();
+
+ /**
+ * Returns true if the provider can provide the named bean.
*
- **/
-
+ * @since 2.2
+ */
+
public boolean canProvideBean(String name);
-
- /**
- * Returns a resource resolver.
- *
- * @since 1.0.8
- *
- **/
-
- public ClassResolver getClassResolver();
-
-}
+ /**
+ * Returns a resource resolver.
+ *
+ * @since 1.0.8
+ */
+
+ public ClassResolver getClassResolver();
+
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageNotFoundException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageNotFoundException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageNotFoundException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageNotFoundException.java Wed Jan 11 16:47:57 2006
@@ -17,18 +17,19 @@
import org.apache.hivemind.ApplicationRuntimeException;
/**
- * Subclass of {@link org.apache.hivemind.ApplicationRuntimeException} thrown when a requested
- * page does not exist.
+ * Subclass of {@link org.apache.hivemind.ApplicationRuntimeException} thrown
+ * when a requested page does not exist.
*
* @author Howard M. Lewis Ship
* @since 4.0
*/
public class PageNotFoundException extends ApplicationRuntimeException
{
+
private static final long serialVersionUID = -4776430599632429708L;
- public PageNotFoundException(String message)
+ public PageNotFoundException(String message)
{
super(message);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageRedirectException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageRedirectException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageRedirectException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/PageRedirectException.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,18 +17,20 @@
import org.apache.hivemind.ApplicationRuntimeException;
/**
- * Exception thrown by a {@link IComponent component} or {@link org.apache.tapestry.engine.IEngineService}
- * that wishes to force the application to a particular page. This is often used
- * to protect a sensitive page until the user is authenticated.
- *
- * @author Howard Lewis Ship
- **/
+ * Exception thrown by a {@link IComponent component} or
+ * {@link org.apache.tapestry.engine.IEngineService} that wishes to force the
+ * application to a particular page. This is often used to protect a sensitive
+ * page until the user is authenticated.
+ *
+ * @author Howard Lewis Ship
+ */
public class PageRedirectException extends ApplicationRuntimeException
{
+
private static final long serialVersionUID = -7693744317997065965L;
-
- private String _targetPageName;
+
+ private final String _targetPageName;
public PageRedirectException(String targetPageName)
{
@@ -40,11 +42,7 @@
this(page.getPageName());
}
- public PageRedirectException(
- String message,
- Object component,
- Throwable rootCause,
- String targetPageName)
+ public PageRedirectException(String message, Object component, Throwable rootCause, String targetPageName)
{
super(message, component, null, rootCause);
@@ -55,4 +53,4 @@
{
return _targetPageName;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RedirectException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RedirectException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RedirectException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RedirectException.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,46 +17,45 @@
import org.apache.hivemind.ApplicationRuntimeException;
/**
- * Exception thrown to force a redirection to an arbitrary location.
- * This is used when, after processing a request (such as a form
- * submission or a link being clicked), it is desirable to go
- * to some arbitrary new location.
- *
- * @author Howard Lewis Ship
- * @since 1.0.6
- *
- **/
+ * Exception thrown to force a redirection to an arbitrary location. This is
+ * used when, after processing a request (such as a form submission or a link
+ * being clicked), it is desirable to go to some arbitrary new location.
+ *
+ * @author Howard Lewis Ship
+ * @since 1.0.6
+ */
public class RedirectException extends ApplicationRuntimeException
{
- private static final long serialVersionUID = -9215837473156146010L;
-
- private String _redirectLocation;
-
- public RedirectException(String redirectLocation)
- {
- this(null, redirectLocation);
- }
-
- /**
- * @param message A message describing why the redirection is taking place.
- * @param redirectLocation The location to redirect to, may be a relative path (relative
- * to the {@link javax.servlet.ServletContext}).
- *
- * @see javax.servlet.http.HttpServletResponse#sendRedirect(String)
- * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(String)
- *
- **/
-
- public RedirectException(String message, String redirectLocation)
- {
- super(message);
-
- _redirectLocation = redirectLocation;
- }
-
- public String getRedirectLocation()
- {
- return _redirectLocation;
- }
-}
\ No newline at end of file
+
+ private static final long serialVersionUID = -9215837473156146010L;
+
+ private String _redirectLocation;
+
+ public RedirectException(String redirectLocation)
+ {
+ this(null, redirectLocation);
+ }
+
+ /**
+ * @param message
+ * A message describing why the redirection is taking place.
+ * @param redirectLocation
+ * The location to redirect to, may be a relative path (relative
+ * to the {@link javax.servlet.ServletContext}).
+ * @see javax.servlet.http.HttpServletResponse#sendRedirect(String)
+ * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(String)
+ */
+
+ public RedirectException(String message, String redirectLocation)
+ {
+ super(message);
+
+ _redirectLocation = redirectLocation;
+ }
+
+ public String getRedirectLocation()
+ {
+ return _redirectLocation;
+ }
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RenderRewoundException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RenderRewoundException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RenderRewoundException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/RenderRewoundException.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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.ApplicationRuntimeException;
/**
- * A special subclass of {@link ApplicationRuntimeException} that can be thrown
- * when a component has determined that the state of the page has been
- * rewound.
- *
+ * A special subclass of {@link ApplicationRuntimeException} that can be thrown
+ * when a component has determined that the state of the page has been rewound.
+ *
* @author Howard Lewis Ship
- **/
+ */
public class RenderRewoundException extends ApplicationRuntimeException
{
+
private static final long serialVersionUID = -4212602864703507206L;
- public RenderRewoundException(Object component)
+ public RenderRewoundException(Object component)
{
super(null, component, null, null);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleLinkException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleLinkException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleLinkException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleLinkException.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,45 +17,39 @@
import org.apache.hivemind.ApplicationRuntimeException;
/**
- * Exception thrown by an {@link org.apache.tapestry.engine.IEngineService} when it discovers that
- * the an action link was for an out-of-date version of the page.
- *
- * <p>The application should redirect to the StaleLink page.
- *
- *
- * @author Howard Lewis Ship
+ * Exception thrown by an {@link org.apache.tapestry.engine.IEngineService} when
+ * it discovers that the an action link was for an out-of-date version of the
+ * page.
+ * <p>
+ * The application should redirect to the StaleLink page.
*
- **/
+ * @author Howard Lewis Ship
+ */
public class StaleLinkException extends ApplicationRuntimeException
{
+
private static final long serialVersionUID = -1266992401198999606L;
-
- private transient IPage _page;
- private String _pageName;
- private String _targetIdPath;
- private String _targetActionId;
- public StaleLinkException()
- {
- super(null, null, null, null);
- }
+ private final transient IPage _page;
+ private final String _pageName;
+ private final String _targetIdPath;
+ private final String _targetActionId;
+
+ // public StaleLinkException()
+ // {
+ // super(null, null, null, null);
+ // }
/**
- * Constructor used when the action id is found, but the target id path
- * did not match the actual id path.
- *
- **/
+ * Constructor used when the action id is found, but the target id path did
+ * not match the actual id path.
+ */
public StaleLinkException(IComponent component, String targetActionId, String targetIdPath)
{
- super(
- Tapestry.format(
- "StaleLinkException.action-mismatch",
- new String[] { targetActionId, component.getIdPath(), targetIdPath }),
- component,
- null,
- null);
+ super(Tapestry.format("StaleLinkException.action-mismatch", new String[] { targetActionId,
+ component.getIdPath(), targetIdPath }), component, null, null);
_page = component.getPage();
_pageName = _page.getPageName();
@@ -65,46 +59,40 @@
}
/**
- * Constructor used when the target action id is not found.
- *
- **/
+ * Constructor used when the target action id is not found.
+ */
public StaleLinkException(IPage page, String targetActionId, String targetIdPath)
{
- this(
- Tapestry.format(
- "StaleLinkException.component-mismatch",
- targetActionId,
- targetIdPath),
- page);
-
- _targetActionId = targetActionId;
- _targetIdPath = targetIdPath;
+ this(Tapestry.format("StaleLinkException.component-mismatch", targetActionId, targetIdPath), page);
}
public StaleLinkException(String message, IComponent component)
{
super(message, component, null, null);
+
+ _targetActionId = null;
+ _targetIdPath = null;
+ _page = null;
+ _pageName = null;
}
-
-
+
public String getPageName()
{
return _pageName;
}
/**
- * Returns the page referenced by the service URL, if known,
- * or null otherwise.
- *
- **/
+ * Returns the page referenced by the service URL, if known, or null
+ * otherwise.
+ */
public IPage getPage()
{
return _page;
}
-
+
public String getTargetActionId()
{
return _targetActionId;
@@ -115,4 +103,4 @@
return _targetIdPath;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleSessionException.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleSessionException.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleSessionException.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/StaleSessionException.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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,24 +17,22 @@
import org.apache.hivemind.ApplicationRuntimeException;
/**
- * Exception thrown by an {@link org.apache.tapestry.engine.IEngineService} when it discovers that
- * the {@link javax.servlet.http.HttpSession}
- * has timed out (and been replaced by a new, empty
- * one).
- *
- * <p>The application should redirect to the stale-session page.
- *
- *
- * @author Howard Lewis Ship
- *
- **/
+ * Exception thrown by an {@link org.apache.tapestry.engine.IEngineService} when
+ * it discovers that the {@link javax.servlet.http.HttpSession} has timed out
+ * (and been replaced by a new, empty one).
+ * <p>
+ * The application should redirect to the stale-session page.
+ *
+ * @author Howard Lewis Ship
+ */
public class StaleSessionException extends ApplicationRuntimeException
{
+
private static final long serialVersionUID = 6733303549871198597L;
-
- private transient IPage _page;
- private String _pageName;
+
+ private final transient IPage _page;
+ private final String _pageName;
public StaleSessionException()
{
@@ -46,8 +44,7 @@
super(message, page, null, null);
_page = page;
- if (page != null)
- _pageName = page.getPageName();
+ _pageName = (page == null) ? null : page.getPageName();
}
public String getPageName()
@@ -56,12 +53,12 @@
}
/**
- * Returns the page referenced by the service URL, if known, or null otherwise.
- *
- **/
+ * Returns the page referenced by the service URL, if known, or null
+ * otherwise.
+ */
public IPage getPage()
{
return _page;
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Tapestry.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Tapestry.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Tapestry.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/Tapestry.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2004, 2005 The Apache Software Foundation
+// Copyright 2004, 2005, 2006 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.
@@ -39,8 +39,8 @@
import org.apache.tapestry.util.StringSplitter;
/**
- * A placeholder for a number of (static) methods that don't belong elsewhere, as well as a global
- * location for static constants.
+ * A placeholder for a number of (static) methods that don't belong elsewhere,
+ * as well as a global location for static constants.
*
* @since 1.0.1
* @author Howard Lewis Ship
@@ -48,62 +48,77 @@
public final class Tapestry
{
+
/**
- * The name ("action") of a service that allows behavior to be associated with an
- * {@link IAction} component, such as {@link org.apache.tapestry.link.ActionLink }or
+ * The version of the framework; this is updated for major releases.
+ */
+
+ public static final String VERSION;
+
+ /**
+ * The name ("action") of a service that allows behavior to be associated
+ * with an {@link IAction} component, such as
+ * {@link org.apache.tapestry.link.ActionLink }or
* {@link org.apache.tapestry.form.Form}.
* <p>
- * This service is used with actions that are tied to the dynamic state of the page, and which
- * require a rewind of the page.
+ * This service is used with actions that are tied to the dynamic state of
+ * the page, and which require a rewind of the page.
*/
- public final static String ACTION_SERVICE = "action";
+ public static final String ACTION_SERVICE = "action";
/**
- * The name ("direct") of a service that allows stateless behavior for an {@link
- * org.apache.tapestry.link.DirectLink} component.
+ * The name ("direct") of a service that allows stateless behavior for an
+ * {@link org.apache.tapestry.link.DirectLink} component.
* <p>
- * This service rolls back the state of the page but doesn't rewind the the dynamic state of the
- * page the was the action service does, which is more efficient but less powerful.
+ * This service rolls back the state of the page but doesn't rewind the the
+ * dynamic state of the page the was the action service does, which is more
+ * efficient but less powerful.
* <p>
- * An array of String parameters may be included with the service URL; these will be made
- * available to the {@link org.apache.tapestry.link.DirectLink} component's listener.
+ * An array of String parameters may be included with the service URL; these
+ * will be made available to the {@link org.apache.tapestry.link.DirectLink}
+ * component's listener.
*/
- public final static String DIRECT_SERVICE = "direct";
+ public static final String DIRECT_SERVICE = "direct";
/**
- * The name ("external") of a service that a allows {@link IExternalPage} to be selected.
- * Associated with a {@link org.apache.tapestry.link.ExternalLink} component.
+ * The name ("external") of a service that a allows {@link IExternalPage} to
+ * be selected. Associated with a
+ * {@link org.apache.tapestry.link.ExternalLink} component.
* <p>
- * This service enables {@link IExternalPage}s to be accessed via a URL. External pages may be
- * booked marked using their URL for future reference.
+ * This service enables {@link IExternalPage}s to be accessed via a URL.
+ * External pages may be booked marked using their URL for future reference.
* <p>
- * An array of Object parameters may be included with the service URL; these will be passed to
- * the {@link IExternalPage#activateExternalPage(Object[], IRequestCycle)} method.
+ * An array of Object parameters may be included with the service URL; these
+ * will be passed to the
+ * {@link IExternalPage#activateExternalPage(Object[], IRequestCycle)}
+ * method.
*/
- public final static String EXTERNAL_SERVICE = "external";
+ public static final String EXTERNAL_SERVICE = "external";
/**
- * The name ("page") of a service that allows a new page to be selected. Associated with a
- * {@link org.apache.tapestry.link.PageLink} component.
+ * The name ("page") of a service that allows a new page to be selected.
+ * Associated with a {@link org.apache.tapestry.link.PageLink} component.
* <p>
* The service requires a single parameter: the name of the target page.
*/
- public final static String PAGE_SERVICE = "page";
+ public static final String PAGE_SERVICE = "page";
/**
- * The name ("home") of a service that jumps to the home page. A stand-in for when no service is
- * provided, which is typically the entrypoint to the application.
+ * The name ("home") of a service that jumps to the home page. A stand-in
+ * for when no service is provided, which is typically the entrypoint to the
+ * application.
*/
- public final static String HOME_SERVICE = "home";
+ public static final String HOME_SERVICE = "home";
/**
- * The name ("restart") of a service that invalidates the session and restarts the application.
- * Typically used just to recover from an exception.
+ * The name ("restart") of a service that invalidates the session and
+ * restarts the application. Typically used just to recover from an
+ * exception.
*/
public static final String RESTART_SERVICE = "restart";
@@ -115,13 +130,15 @@
public static final String ASSET_SERVICE = "asset";
/**
- * The name ("reset") of a service used to clear cached template and specification data and
- * remove all pooled pages. This is only used when debugging as a quick way to clear the out
- * cached data, to allow updated versions of specifications and templates to be loaded (without
- * stopping and restarting the servlet container).
+ * The name ("reset") of a service used to clear cached template and
+ * specification data and remove all pooled pages. This is only used when
+ * debugging as a quick way to clear the out cached data, to allow updated
+ * versions of specifications and templates to be loaded (without stopping
+ * and restarting the servlet container).
* <p>
* This service is only available if the Java system property
- * <code>org.apache.tapestry.enable-reset-service</code> is set to <code>true</code>.
+ * <code>org.apache.tapestry.enable-reset-service</code> is set to
+ * <code>true</code>.
*/
public static final String RESET_SERVICE = "reset";
@@ -131,30 +148,33 @@
*
* @since 1.0.3
* @deprecated To be removed in 4.1. Use
- * {@link org.apache.tapestry.services.ServiceConstants#SERVICE} instead.
+ * {@link org.apache.tapestry.services.ServiceConstants#SERVICE}
+ * instead.
*/
public static final String SERVICE_QUERY_PARAMETER_NAME = ServiceConstants.SERVICE;
/**
- * The query parameter for application specific parameters to the service (this is used with the
- * direct service). Each of these values is encoded with
- * {@link java.net.URLEncoder#encode(String)} before being added to the URL. Multiple values are
- * handle by repeatedly establishing key/value pairs (this is a change from behavior in 2.1 and
- * earlier).
+ * The query parameter for application specific parameters to the service
+ * (this is used with the direct service). Each of these values is encoded
+ * with {@link java.net.URLEncoder#encode(String)} before being added to the
+ * URL. Multiple values are handle by repeatedly establishing key/value
+ * pairs (this is a change from behavior in 2.1 and earlier).
*
* @since 1.0.3
* @deprecated To be removed in 4.1. Use
- * {@link org.apache.tapestry.services.ServiceConstants#PARAMETER} instead.
+ * {@link org.apache.tapestry.services.ServiceConstants#PARAMETER}
+ * instead.
*/
public static final String PARAMETERS_QUERY_PARAMETER_NAME = ServiceConstants.PARAMETER;
/**
- * Property name used to get the extension used for templates. This may be set in the page or
- * component specification, or in the page (or component's) immediate container (library or
- * application specification). Unlike most properties, value isn't inherited all the way up the
- * chain. The default template extension is "html".
+ * Property name used to get the extension used for templates. This may be
+ * set in the page or component specification, or in the page (or
+ * component's) immediate container (library or application specification).
+ * Unlike most properties, value isn't inherited all the way up the chain.
+ * The default template extension is "html".
*
* @since 3.0
*/
@@ -162,16 +182,17 @@
public static final String TEMPLATE_EXTENSION_PROPERTY = "org.apache.tapestry.template-extension";
/**
- * The name of an {@link org.apache.tapestry.IRequestCycle} attribute in which the currently
- * rendering {@link org.apache.tapestry.components.ILinkComponent} is stored. Link components do
- * not nest.
+ * The name of an {@link org.apache.tapestry.IRequestCycle} attribute in
+ * which the currently rendering
+ * {@link org.apache.tapestry.components.ILinkComponent} is stored. Link
+ * components do not nest.
*/
public static final String LINK_COMPONENT_ATTRIBUTE_NAME = "org.apache.tapestry.active-link-component";
/**
- * Suffix appended to a parameter name to form the name of a property that stores the binding
- * for the parameter.
+ * Suffix appended to a parameter name to form the name of a property that
+ * stores the binding for the parameter.
*
* @since 3.0
*/
@@ -179,8 +200,9 @@
public static final String PARAMETER_PROPERTY_NAME_SUFFIX = "Binding";
/**
- * Key used to obtain an extension from the application specification. The extension, if it
- * exists, implements {@link org.apache.tapestry.request.IRequestDecoder}.
+ * Key used to obtain an extension from the application specification. The
+ * extension, if it exists, implements
+ * {@link org.apache.tapestry.request.IRequestDecoder}.
*
* @since 2.2
*/
@@ -188,9 +210,10 @@
public static final String REQUEST_DECODER_EXTENSION_NAME = "org.apache.tapestry.request-decoder";
/**
- * Name of optional application extension for the multipart decoder used by the application. The
- * extension must implement {@link org.apache.tapestry.multipart.IMultipartDecoder} (and is
- * generally a configured instance of
+ * Name of optional application extension for the multipart decoder used by
+ * the application. The extension must implement
+ * {@link org.apache.tapestry.multipart.IMultipartDecoder} (and is generally
+ * a configured instance of
* {@link org.apache.tapestry.multipart.DefaultMultipartDecoder}).
*
* @since 3.0
@@ -199,7 +222,8 @@
public static final String MULTIPART_DECODER_EXTENSION_NAME = "org.apache.tapestry.multipart-decoder";
/**
- * Method id used to check that {@link IPage#validate(IRequestCycle)} is invoked.
+ * Method id used to check that {@link IPage#validate(IRequestCycle)} is
+ * invoked.
*
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
@@ -217,9 +241,10 @@
public static final String ABSTRACTPAGE_DETACH_METHOD_ID = "AbstractPage.detach()";
/**
- * Regular expression defining a simple property name. Used by several different parsers. Simple
- * property names match Java variable names; a leading letter (or underscore), followed by
- * letters, numbers and underscores.
+ * Regular expression defining a simple property name. Used by several
+ * different parsers. Simple property names match Java variable names; a
+ * leading letter (or underscore), followed by letters, numbers and
+ * underscores.
*
* @since 3.0
*/
@@ -228,8 +253,8 @@
/**
* Name of an application extension used as a factory for
- * {@link org.apache.tapestry.engine.IMonitor}instances. The extension must implement
- * {@link org.apache.tapestry.engine.IMonitorFactory}.
+ * {@link org.apache.tapestry.engine.IMonitor}instances. The extension must
+ * implement {@link org.apache.tapestry.engine.IMonitorFactory}.
*
* @since 3.0
*/
@@ -237,24 +262,19 @@
public static final String MONITOR_FACTORY_EXTENSION_NAME = "org.apache.tapestry.monitor-factory";
/**
- * Class name of an {@link ognl.TypeConverter}implementing class to use as a type converter for
- * {@link org.apache.tapestry.binding.ExpressionBinding}
+ * Class name of an {@link ognl.TypeConverter}implementing class to use as
+ * a type converter for
+ * {@link org.apache.tapestry.binding.ExpressionBinding}.
*/
public static final String OGNL_TYPE_CONVERTER = "org.apache.tapestry.ognl-type-converter";
/**
- * Prevent instantiation.
+ * Used for tracking if a particular super-class method has been invoked.
*/
- private Tapestry()
- {
- }
-
- /**
- * The version of the framework; this is updated for major releases.
- */
+ private static final ThreadLocal INVOKED_METHOD_IDS_HOLDER = new ThreadLocal();
- public static final String VERSION = readVersion();
+ private static final String UNKNOWN_VERSION = "Unknown";
/**
* Contains strings loaded from TapestryStrings.properties.
@@ -265,46 +285,50 @@
private static ResourceBundle _strings;
/**
- * A {@link Map}that links Locale names (as in {@link Locale#toString()}to {@link Locale}
- * instances. This prevents needless duplication of Locales.
+ * A {@link Map}that links Locale names (as in {@link Locale#toString()}to
+ * {@link Locale} instances. This prevents needless duplication of Locales.
*/
- private static final Map _localeMap = new HashMap();
+ private static final Map LOCALE_MAP = new HashMap();
static
{
+ VERSION = readVersion();
+
Locale[] locales = Locale.getAvailableLocales();
- for (int i = 0; i < locales.length; i++)
+ for(int i = 0; i < locales.length; i++)
{
- _localeMap.put(locales[i].toString(), locales[i]);
+ LOCALE_MAP.put(locales[i].toString(), locales[i]);
}
}
/**
- * Used for tracking if a particular super-class method has been invoked.
+ * Prevent instantiation.
*/
- private static final ThreadLocal _invokedMethodIds = new ThreadLocal();
+ private Tapestry()
+ {
+ }
/**
- * Copys all informal {@link IBinding bindings}from a source component to the destination
- * component. Informal bindings are bindings for informal parameters. This will overwrite
- * parameters (formal or informal) in the destination component if there is a naming conflict.
+ * Copys all informal {@link IBinding bindings}from a source component to
+ * the destination component. Informal bindings are bindings for informal
+ * parameters. This will overwrite parameters (formal or informal) in the
+ * destination component if there is a naming conflict.
*/
public static void copyInformalBindings(IComponent source, IComponent destination)
{
Collection names = source.getBindingNames();
- if (names == null)
- return;
+ if (names == null) return;
IComponentSpecification specification = source.getSpecification();
Iterator i = names.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- String name = (String) i.next();
+ String name = (String)i.next();
// If not a formal parameter, then copy it over.
@@ -319,17 +343,17 @@
/**
* Gets the {@link Locale}for the given string, which is the result of
- * {@link Locale#toString()}. If no such locale is already registered, a new instance is
- * created, registered and returned.
+ * {@link Locale#toString()}. If no such locale is already registered, a
+ * new instance is created, registered and returned.
*/
public static Locale getLocale(String s)
{
Locale result = null;
- synchronized (_localeMap)
+ synchronized(LOCALE_MAP)
{
- result = (Locale) _localeMap.get(s);
+ result = (Locale)LOCALE_MAP.get(s);
}
if (result == null)
@@ -337,31 +361,31 @@
StringSplitter splitter = new StringSplitter('_');
String[] terms = splitter.splitToArray(s);
- switch (terms.length)
+ switch(terms.length)
{
- case 1:
+ case 1:
- result = new Locale(terms[0], "");
- break;
+ result = new Locale(terms[0], "");
+ break;
- case 2:
+ case 2:
- result = new Locale(terms[0], terms[1]);
- break;
+ result = new Locale(terms[0], terms[1]);
+ break;
- case 3:
+ case 3:
- result = new Locale(terms[0], terms[1], terms[2]);
- break;
+ result = new Locale(terms[0], terms[1], terms[2]);
+ break;
- default:
+ default:
- throw new IllegalArgumentException("Unable to convert '" + s + "' to a Locale.");
+ throw new IllegalArgumentException("Unable to convert '" + s + "' to a Locale.");
}
- synchronized (_localeMap)
+ synchronized(LOCALE_MAP)
{
- _localeMap.put(s, result);
+ LOCALE_MAP.put(s, result);
}
}
@@ -392,21 +416,20 @@
}
/**
- * Gets a string from the TapestryStrings resource bundle. The string in the bundle is treated
- * as a pattern for {@link MessageFormat#format(java.lang.String, java.lang.Object[])}.
+ * Gets a string from the TapestryStrings resource bundle. The string in the
+ * bundle is treated as a pattern for
+ * {@link MessageFormat#format(java.lang.String, java.lang.Object[])}.
*
* @since 1.0.8
*/
public static String format(String key, Object[] args)
{
- if (_strings == null)
- _strings = ResourceBundle.getBundle("org.apache.tapestry.TapestryStrings");
+ if (_strings == null) _strings = ResourceBundle.getBundle("org.apache.tapestry.TapestryStrings");
String pattern = _strings.getString(key);
- if (args == null)
- return pattern;
+ if (args == null) return pattern;
return MessageFormat.format(pattern, args);
}
@@ -430,8 +453,7 @@
public static String format(String key, Object arg)
{
- return format(key, new Object[]
- { arg });
+ return format(key, new Object[] { arg });
}
/**
@@ -442,8 +464,7 @@
public static String format(String key, Object arg1, Object arg2)
{
- return format(key, new Object[]
- { arg1, arg2 });
+ return format(key, new Object[] { arg1, arg2 });
}
/**
@@ -454,17 +475,14 @@
public static String format(String key, Object arg1, Object arg2, Object arg3)
{
- return format(key, new Object[]
- { arg1, arg2, arg3 });
+ return format(key, new Object[] { arg1, arg2, arg3 });
}
- private static final String UNKNOWN_VERSION = "Unknown";
-
/**
* Invoked when the class is initialized to read the current version file.
*/
- private static final String readVersion()
+ private static String readVersion()
{
Properties props = new Properties();
@@ -472,8 +490,7 @@
{
InputStream in = Tapestry.class.getResourceAsStream("version.properties");
- if (in == null)
- return UNKNOWN_VERSION;
+ if (in == null) return UNKNOWN_VERSION;
props.load(in);
@@ -496,8 +513,7 @@
public static int size(Collection c)
{
- if (c == null)
- return 0;
+ if (c == null) return 0;
return c.size();
}
@@ -510,8 +526,7 @@
public static int size(Object[] array)
{
- if (array == null)
- return 0;
+ if (array == null) return 0;
return array.length;
}
@@ -539,21 +554,22 @@
}
/**
- * Converts a {@link Map} to an even-sized array of key/value pairs. This may be useful when
- * using a Map as service parameters (with {@link org.apache.tapestry.link.DirectLink}.
- * Assuming the keys and values are simple objects (String, Boolean, Integer, etc.), then the
+ * Converts a {@link Map} to an even-sized array of key/value pairs. This
+ * may be useful when using a Map as service parameters (with
+ * {@link org.apache.tapestry.link.DirectLink}. Assuming the keys and
+ * values are simple objects (String, Boolean, Integer, etc.), then the
* representation as an array will encode more efficiently (via
- * {@link org.apache.tapestry.util.io.DataSqueezerImpl} than serializing the Map and its
- * contents.
+ * {@link org.apache.tapestry.util.io.DataSqueezerImpl} than serializing the
+ * Map and its contents.
*
- * @return the array of keys and values, or null if the input Map is null or empty
+ * @return the array of keys and values, or null if the input Map is null or
+ * empty
* @since 2.2
*/
public static Object[] convertMapToArray(Map map)
{
- if (isEmpty(map))
- return null;
+ if (isEmpty(map)) return null;
Set entries = map.entrySet();
@@ -561,9 +577,9 @@
int x = 0;
Iterator i = entries.iterator();
- while (i.hasNext())
+ while(i.hasNext())
{
- Map.Entry entry = (Map.Entry) i.next();
+ Map.Entry entry = (Map.Entry)i.next();
result[x++] = entry.getKey();
result[x++] = entry.getValue();
@@ -582,16 +598,14 @@
public static Map convertArrayToMap(Object[] array)
{
- if (array == null || array.length == 0)
- return null;
+ if (array == null || array.length == 0) return null;
- if (array.length % 2 != 0)
- throw new IllegalArgumentException(getMessage("Tapestry.even-sized-array"));
+ if (array.length % 2 != 0) throw new IllegalArgumentException(getMessage("Tapestry.even-sized-array"));
Map result = new HashMap();
int x = 0;
- while (x < array.length)
+ while(x < array.length)
{
Object key = array[x++];
Object value = array[x++];
@@ -603,8 +617,8 @@
}
/**
- * Given a Class, creates a presentable name for the class, even if the class is a scalar type
- * or Array type.
+ * Given a Class, creates a presentable name for the class, even if the
+ * class is a scalar type or Array type.
*
* @since 3.0
* @deprecated To be removed in 4.1.
@@ -628,31 +642,28 @@
/** @since 3.0 * */
- public static ApplicationRuntimeException createNoSuchComponentException(IComponent component,
- String id, Location location)
+ public static ApplicationRuntimeException createNoSuchComponentException(IComponent component, String id,
+ Location location)
{
- return new ApplicationRuntimeException(format("no-such-component", component
- .getExtendedId(), id), component, location, null);
+ return new ApplicationRuntimeException(format("no-such-component", component.getExtendedId(), id), component,
+ location, null);
}
/** @since 3.0 * */
- public static BindingException createRequiredParameterException(IComponent component,
- String parameterName)
+ public static BindingException createRequiredParameterException(IComponent component, String parameterName)
{
- return new BindingException(format("required-parameter", parameterName, component
- .getExtendedId()), component, null, component.getBinding(parameterName), null);
+ return new BindingException(format("required-parameter", parameterName, component.getExtendedId()), component,
+ null, component.getBinding(parameterName), null);
}
/** @since 3.0 * */
- public static ApplicationRuntimeException createRenderOnlyPropertyException(
- IComponent component, String propertyName)
+ public static ApplicationRuntimeException createRenderOnlyPropertyException(IComponent component,
+ String propertyName)
{
- return new ApplicationRuntimeException(format(
- "render-only-property",
- propertyName,
- component.getExtendedId()), component, null, null);
+ return new ApplicationRuntimeException(format("render-only-property", propertyName, component.getExtendedId()),
+ component, null, null);
}
/**
@@ -664,12 +675,12 @@
public static void clearMethodInvocations()
{
- _invokedMethodIds.set(null);
+ INVOKED_METHOD_IDS_HOLDER.set(null);
}
/**
- * Adds a method invocation to the list of invocations. This is done in a super-class
- * implementations.
+ * Adds a method invocation to the list of invocations. This is done in a
+ * super-class implementations.
*
* @see #checkMethodInvocation(Object, String, Object)
* @since 3.0
@@ -677,46 +688,47 @@
public static void addMethodInvocation(Object methodId)
{
- List methodIds = (List) _invokedMethodIds.get();
+ List methodIds = (List)INVOKED_METHOD_IDS_HOLDER.get();
if (methodIds == null)
{
methodIds = new ArrayList();
- _invokedMethodIds.set(methodIds);
+ INVOKED_METHOD_IDS_HOLDER.set(methodIds);
}
methodIds.add(methodId);
}
/**
- * Checks to see if a particular method has been invoked. The method is identified by a methodId
- * (usually a String). The methodName and object are used to create an error message.
+ * Checks to see if a particular method has been invoked. The method is
+ * identified by a methodId (usually a String). The methodName and object
+ * are used to create an error message.
* <p>
- * The caller should invoke {@link #clearMethodInvocations()}, then invoke a method on the
- * object. The super-class implementation should invoke {@link #addMethodInvocation(Object)} to
- * indicate that it was, in fact, invoked. The caller then invokes this method to validate that
- * the super-class implementation was invoked.
+ * The caller should invoke {@link #clearMethodInvocations()}, then invoke
+ * a method on the object. The super-class implementation should invoke
+ * {@link #addMethodInvocation(Object)} to indicate that it was, in fact,
+ * invoked. The caller then invokes this method to validate that the
+ * super-class implementation was invoked.
* <p>
- * The list of method invocations is stored in a {@link ThreadLocal} variable.
+ * The list of method invocations is stored in a {@link ThreadLocal}
+ * variable.
*
* @since 3.0
*/
public static void checkMethodInvocation(Object methodId, String methodName, Object object)
{
- List methodIds = (List) _invokedMethodIds.get();
+ List methodIds = (List)INVOKED_METHOD_IDS_HOLDER.get();
- if (methodIds != null && methodIds.contains(methodId))
- return;
+ if (methodIds != null && methodIds.contains(methodId)) return;
- throw new ApplicationRuntimeException(Tapestry.format(
- "Tapestry.missing-method-invocation",
- object.getClass().getName(),
- methodName));
+ throw new ApplicationRuntimeException(Tapestry.format("Tapestry.missing-method-invocation", object.getClass()
+ .getName(), methodName));
}
/**
- * Method used by pages and components to send notifications about property changes.
+ * Method used by pages and components to send notifications about property
+ * changes.
*
* @param component
* the component containing the property
@@ -730,8 +742,7 @@
{
ChangeObserver observer = component.getPage().getChangeObserver();
- if (observer == null)
- return;
+ if (observer == null) return;
ObservedChangeEvent event = new ObservedChangeEvent(component, propertyName, newValue);
@@ -741,12 +752,13 @@
/**
* Returns true if the input is null or contains only whitespace.
* <p>
- * Note: Yes, you'd think we'd use <code>StringUtils</code>, but with the change in names and
- * behavior between releases, it is smarter to just implement our own little method!
+ * Note: Yes, you'd think we'd use <code>StringUtils</code>, but with the
+ * change in names and behavior between releases, it is smarter to just
+ * implement our own little method!
*
* @since 3.0
- * @deprecated To be removed in Tapestry 4.1. Use {@link HiveMind#isBlank(java.lang.String)}
- * instead.
+ * @deprecated To be removed in Tapestry 4.1. Use
+ * {@link HiveMind#isBlank(java.lang.String)} instead.
*/
public static boolean isBlank(String input)
@@ -758,12 +770,12 @@
* Returns true if the input is not null and not empty (or only whitespace).
*
* @since 3.0
- * @deprecated To be removed in Tapestry 4.1. Use {@link HiveMind#isNonBlank(java.lang.String)}
- * instead.
+ * @deprecated To be removed in Tapestry 4.1. Use
+ * {@link HiveMind#isNonBlank(java.lang.String)} instead.
*/
public static boolean isNonBlank(String input)
{
return HiveMind.isNonBlank(input);
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryConstants.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryConstants.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryConstants.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryConstants.java Wed Jan 11 16:47:57 2006
@@ -1,4 +1,4 @@
-// Copyright 2005 The Apache Software Foundation
+// Copyright 2005, 2006 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.
@@ -18,10 +18,12 @@
* @author Howard M. Lewis Ship
* @since 4.0
*/
-public class TapestryConstants
+public final class TapestryConstants
{
+
/**
- * Name of the cookie written to the client web browser to identify the locale.
+ * Name of the cookie written to the client web browser to identify the
+ * locale.
*/
public static final String LOCALE_COOKIE_NAME = "org.apache.tapestry.locale";
@@ -33,8 +35,8 @@
public static final String PAGE_CLASS_NAME = "org.apache.tapestry.default-page-class";
/**
- * Name of meta-data property used to determine the default binding prefix. The meta default for
- * this is "ognl".
+ * Name of meta-data property used to determine the default binding prefix.
+ * The meta default for this is "ognl".
*/
public static final String DEFAULT_BINDING_PREFIX_NAME = "org.apache.tapestry.default-binding-prefix";
@@ -42,4 +44,4 @@
private TapestryConstants()
{
}
-}
\ No newline at end of file
+}
Modified: jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryMessages.java
URL: http://svn.apache.org/viewcvs/jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryMessages.java?rev=368196&r1=368195&r2=368196&view=diff
==============================================================================
--- jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryMessages.java (original)
+++ jakarta/tapestry/branches/4.0/framework/src/java/org/apache/tapestry/TapestryMessages.java Wed Jan 11 16:47:57 2006
@@ -14,62 +14,65 @@
package org.apache.tapestry;
+import org.apache.hivemind.Messages;
import org.apache.hivemind.impl.MessageFormatter;
/**
* @author Howard Lewis Ship
* @since 4.0
*/
-class TapestryMessages
+final class TapestryMessages
{
- private final static MessageFormatter _formatter = new MessageFormatter(TapestryMessages.class,
- "TapestryStrings2");
+
+ private static final Messages MESSAGES = new MessageFormatter(TapestryMessages.class, "TapestryStrings2");
+
+ /** @since 4.1 */
+ private TapestryMessages()
+ {
+ }
static String servletInitFailure(Throwable cause)
{
- return _formatter.format("servlet-init-failure", cause);
+ return MESSAGES.format("servlet-init-failure", cause);
}
static String componentIsLocked(IComponent component)
{
- return _formatter.format("component-is-locked", component.getExtendedId());
+ return MESSAGES.format("component-is-locked", component.getExtendedId());
}
static String servletInit(String name, long elapsedToRegistry, long elapsedOverall)
{
- return _formatter.format("servlet-init", name, new Long(elapsedToRegistry), new Long(
- elapsedOverall));
+ return MESSAGES.format("servlet-init", name, new Long(elapsedToRegistry), new Long(elapsedOverall));
}
static String nonUniqueAttribute(Object newInstance, String key, Object existingInstance)
{
- return _formatter.format("non-unique-attribute", newInstance, key, existingInstance);
+ return MESSAGES.format("non-unique-attribute", newInstance, key, existingInstance);
}
static String noPageRenderSupport(IComponent component)
{
- return _formatter.format("no-page-render-support", component.getExtendedId());
+ return MESSAGES.format("no-page-render-support", component.getExtendedId());
}
static String noForm(IComponent component)
{
- return _formatter.format("no-form", component.getExtendedId());
+ return MESSAGES.format("no-form", component.getExtendedId());
}
static String providedByEnhancement(String methodName)
{
- return _formatter.format("provided-by-enhancement", methodName);
+ return MESSAGES.format("provided-by-enhancement", methodName);
}
static String attemptToChangeContainedComponent(IComponent component)
{
- return _formatter
- .format("attempt-to-change-contained-component", component.getExtendedId());
+ return MESSAGES.format("attempt-to-change-contained-component", component.getExtendedId());
}
static String componentWrongType(IComponent component, Class expectedType)
{
- return _formatter.format("component-wrong-type", component.getExtendedId(), expectedType
- .getName());
+ return MESSAGES.format("component-wrong-type", component.getExtendedId(), expectedType.getName());
}
-}
\ 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