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 2003/03/26 20:53:22 UTC
cvs commit: jakarta-tapestry/framework/src/org/apache/tapestry/record PageRecorder.java
hlship 2003/03/26 11:53:22
Modified: framework/src/org/apache/tapestry/parse TemplateParser.java
ITemplateParserDelegate.java
framework/src/org/apache/tapestry/enhance
ComponentClassFactory.java
junit/src/org/apache/tapestry/junit/parse
TestTemplateParser.java
framework/src/org/apache/tapestry TapestryStrings.properties
Tapestry.java
junit build.xml
. TODO.html
framework/src/org/apache/tapestry/pageload PageLoader.java
framework/src/org/apache/tapestry/engine
DefaultTemplateSource.java
framework/src/org/apache/tapestry/resolver
ComponentSpecificationResolver.java
web new.html
junit/src/org/apache/tapestry/junit/mock/c9 Four.java
framework/src/org/apache/tapestry/record PageRecorder.java
Log:
Continue fixes to attach locations to objects and exceptions.
Revision Changes Path
1.5 +3 -3 jakarta-tapestry/framework/src/org/apache/tapestry/parse/TemplateParser.java
Index: TemplateParser.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/TemplateParser.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TemplateParser.java 18 Mar 2003 20:54:42 -0000 1.4
+++ TemplateParser.java 26 Mar 2003 19:53:21 -0000 1.5
@@ -938,7 +938,7 @@
if (jwcId == null)
jwcId = _idAllocator.allocateId("$" + simpleType);
- allowBody = _delegate.getAllowBody(libraryId, simpleType);
+ allowBody = _delegate.getAllowBody(libraryId, simpleType, startLocation);
}
else
@@ -963,7 +963,7 @@
jwcId),
startLocation);
- allowBody = _delegate.getAllowBody(jwcId);
+ allowBody = _delegate.getAllowBody(jwcId, startLocation);
}
}
1.3 +7 -5 jakarta-tapestry/framework/src/org/apache/tapestry/parse/ITemplateParserDelegate.java
Index: ITemplateParserDelegate.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/parse/ITemplateParserDelegate.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ITemplateParserDelegate.java 15 Mar 2003 21:22:19 -0000 1.2
+++ ITemplateParserDelegate.java 26 Mar 2003 19:53:21 -0000 1.3
@@ -55,6 +55,8 @@
package org.apache.tapestry.parse;
+import org.apache.tapestry.Location;
+
/**
* Provides a {@link TemplateParser} with additional information about
* dynamic components.
@@ -79,11 +81,11 @@
* otherwise. The parser uses this information to determine
* if it should ignore the body of a tag.
*
- * @throws NoSuchComponentException if no such component exists
+ * @throws ApplicationRuntimeException if no such component exists
*
**/
- public boolean getAllowBody(String componentId);
+ public boolean getAllowBody(String componentId, Location location);
/**
* Used with implicit components to determine if the component
@@ -92,11 +94,11 @@
* @param libraryId the specified library id, possibly null
* @param type the component type
*
- * @throws PageLoaderException if the specification cannot be found
+ * @throws ApplicationRuntimeException if the specification cannot be found
*
* @since 2.4
*
**/
- public boolean getAllowBody(String libraryId, String type);
+ public boolean getAllowBody(String libraryId, String type, Location location);
}
1.9 +14 -4 jakarta-tapestry/framework/src/org/apache/tapestry/enhance/ComponentClassFactory.java
Index: ComponentClassFactory.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/enhance/ComponentClassFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ComponentClassFactory.java 23 Mar 2003 23:18:29 -0000 1.8
+++ ComponentClassFactory.java 26 Mar 2003 19:53:21 -0000 1.9
@@ -241,7 +241,7 @@
/**
* Returns true if the {@link PropertyDescriptor} is null, or
- * (if non-null), if both accessor methods are abstract.
+ * (if non-null), if either accessor method is abstract (or missing).
*
**/
@@ -250,7 +250,7 @@
if (pd == null)
return true;
- return isAbstract(pd.getReadMethod()) && isAbstract(pd.getWriteMethod());
+ return isAbstract(pd.getReadMethod()) || isAbstract(pd.getWriteMethod());
}
/**
@@ -479,7 +479,7 @@
String fieldName,
String propertyName,
String readMethodName)
- {
+ {
String methodName =
readMethodName == null ? buildMethodName("get", propertyName) : readMethodName;
@@ -697,6 +697,16 @@
String propertyName = ps.getName();
Location location = ps.getLocation();
Class propertyType = convertPropertyType(ps.getType(), location);
+
+ PropertyDescriptor pd = getPropertyDescriptor(propertyName);
+
+ if (!isAbstract(pd))
+ {
+ // Make sure the property is at least the right type.
+
+ checkPropertyType(pd, propertyType, location);
+ return;
+ }
String readMethodName = checkAccessors(propertyName, propertyType, location);
1.9 +8 -7 jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/TestTemplateParser.java
Index: TestTemplateParser.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/parse/TestTemplateParser.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- TestTemplateParser.java 18 Mar 2003 20:55:32 -0000 1.8
+++ TestTemplateParser.java 26 Mar 2003 19:53:21 -0000 1.9
@@ -65,6 +65,7 @@
import junit.framework.TestCase;
import org.apache.tapestry.IResourceLocation;
+import org.apache.tapestry.Location;
import org.apache.tapestry.parse.AttributeType;
import org.apache.tapestry.parse.ITemplateParserDelegate;
import org.apache.tapestry.parse.LocalizationToken;
@@ -95,12 +96,12 @@
return true;
}
- public boolean getAllowBody(String componentId)
+ public boolean getAllowBody(String componentId, Location location)
{
return true;
}
- public boolean getAllowBody(String libraryId, String type)
+ public boolean getAllowBody(String libraryId, String type, Location location)
{
return true;
}
@@ -416,12 +417,12 @@
return !componentId.equals("row");
}
- public boolean getAllowBody(String componentId)
+ public boolean getAllowBody(String componentId, Location location)
{
return true;
}
- public boolean getAllowBody(String libraryId, String type)
+ public boolean getAllowBody(String libraryId, String type, Location location)
{
return true;
}
@@ -459,12 +460,12 @@
return true;
}
- public boolean getAllowBody(String id)
+ public boolean getAllowBody(String id, Location location)
{
return id.equals("form");
}
- public boolean getAllowBody(String libraryId, String type)
+ public boolean getAllowBody(String libraryId, String type, Location location)
{
return true;
}
1.11 +1 -2 jakarta-tapestry/framework/src/org/apache/tapestry/TapestryStrings.properties
Index: TapestryStrings.properties
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/TapestryStrings.properties,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TapestryStrings.properties 25 Mar 2003 04:37:53 -0000 1.10
+++ TapestryStrings.properties 26 Mar 2003 19:53:21 -0000 1.11
@@ -323,8 +323,7 @@
PageRecorder.change-after-lock=Page recorder for page {0} is locked after a commit(), but received a change to property {1} of component {2}.
PageRecorder.unable-to-persist=Unable to persist property {0} of component {1} as {2}.
PageRecorder.null-property-name=A change event for component {0} failed to specify the name of the updated property.
-
-RollbackException.message=Unable to set property {0} of component {1} to {2}.
+PageRecorder.unable-to-rollback=Unable to set property {0} of component {1} to {2}: {3}
# org.apache.tapestry.resource
1.7 +4 -3 jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java
Index: Tapestry.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/Tapestry.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- Tapestry.java 23 Mar 2003 16:12:38 -0000 1.6
+++ Tapestry.java 26 Mar 2003 19:53:21 -0000 1.7
@@ -1206,11 +1206,12 @@
public static ApplicationRuntimeException createNoSuchComponentException(
IComponent component,
- String id)
+ String id,
+ Location location)
{
return new ApplicationRuntimeException(
getString("no-such-component", component.getExtendedId(), id),
- component);
+ component, location, null);
}
/** @since 2.4 **/
1.29 +16 -3 jakarta-tapestry/junit/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/build.xml,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- build.xml 25 Mar 2003 04:37:54 -0000 1.28
+++ build.xml 26 Mar 2003 19:53:21 -0000 1.29
@@ -93,7 +93,19 @@
<path refid="junit.classpath"/>
</path>
- <target name="clover" depends="compile" description="Run tests and construct Clover report.">
+ <target name="clover" description="Run the entire Tapestry test suite and construct the Clover report.">
+ <antcall target="run-clover">
+ <param name="suite" value="org.apache.tapestry.junit.TapestrySuite"/>
+ </antcall>
+ </target>
+
+ <target name="fast-clover" description="Run a subset of the Tapestry test suite (excluding mock unit tests), and construct the Clover report.">
+ <antcall target="run-clover">
+ <param name="suite" value="org.apache.tapestry.junit.BasicTestSuite"/>
+ </antcall>
+ </target>
+
+ <target name="run-clover" depends="compile" description="Run tests and construct the Clover report.">
<mkdir dir="${clover-classes.dir}"/>
<mkdir dir="${clover-db.dir}"/>
@@ -104,13 +116,14 @@
<classpath refid="base.classpath"/>
</javac>
+ <echo>Executing suite ${suite} ...</echo>
<echo>Clover Run #1: No logging enabled ...</echo>
<java fork="true" classname="junit.textui.TestRunner"
failonerror="true">
<classpath refid="clover.classpath"/>
- <arg value="org.apache.tapestry.junit.TapestrySuite"/>
+ <arg value="${suite}"/>
<sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/>
</java>
@@ -120,7 +133,7 @@
<java fork="true" classname="junit.textui.TestRunner"
failonerror="true">
<classpath refid="clover.classpath"/>
- <arg value="org.apache.tapestry.junit.TapestrySuite"/>
+ <arg value="${suite}"/>
<sysproperty key="log4j.configuration" value="log4j-slow.properties"/>
<sysproperty key="org.apache.tapestry.enable-reset-service" value="true"/>
</java>
1.12 +4 -1 jakarta-tapestry/TODO.html
Index: TODO.html
===================================================================
RCS file: /home/cvs/jakarta-tapestry/TODO.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TODO.html 23 Mar 2003 23:31:00 -0000 1.11
+++ TODO.html 26 Mar 2003 19:53:21 -0000 1.12
@@ -14,6 +14,9 @@
<p><i>This list is anything but final!</i>
<UL>
+
+ <li>Properly sign the distribution and have it mirrored with the other Jakarta downloads.</li>
+
<li>Deal with character sets and localization properly
<li>Handle change of locale correctly, by reloading new
1.7 +5 -4 jakarta-tapestry/framework/src/org/apache/tapestry/pageload/PageLoader.java
Index: PageLoader.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/pageload/PageLoader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PageLoader.java 23 Mar 2003 23:18:29 -0000 1.6
+++ PageLoader.java 26 Mar 2003 19:53:22 -0000 1.7
@@ -473,8 +473,9 @@
ContainedComponent contained = containerSpec.getComponent(id);
String type = contained.getType();
+ Location location = contained.getLocation();
- _componentResolver.resolve(cycle, namespace, type);
+ _componentResolver.resolve(cycle, namespace, type, location);
ComponentSpecification componentSpecification =
_componentResolver.getSpecification();
@@ -489,7 +490,7 @@
id,
componentSpecification,
componentNamespace,
- contained.getLocation());
+ location);
// Add it, by name, to the container.
@@ -562,7 +563,7 @@
{
IPage page = container.getPage();
- _componentResolver.resolve(cycle, container.getNamespace(), componentType);
+ _componentResolver.resolve(cycle, container.getNamespace(), componentType, location);
INamespace componentNamespace = _componentResolver.getNamespace();
ComponentSpecification spec = _componentResolver.getSpecification();
1.4 +6 -5 jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultTemplateSource.java
Index: DefaultTemplateSource.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/engine/DefaultTemplateSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultTemplateSource.java 23 Mar 2003 01:28:15 -0000 1.3
+++ DefaultTemplateSource.java 26 Mar 2003 19:53:22 -0000 1.4
@@ -78,6 +78,7 @@
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IResourceLocation;
import org.apache.tapestry.IResourceResolver;
+import org.apache.tapestry.Location;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.parse.ComponentTemplate;
import org.apache.tapestry.parse.ITemplateParserDelegate;
@@ -155,21 +156,21 @@
return _component.getSpecification().getComponent(componentId) != null;
}
- public boolean getAllowBody(String componentId)
+ public boolean getAllowBody(String componentId, Location location)
{
IComponent embedded = _component.getComponent(componentId);
if (embedded == null)
- throw Tapestry.createNoSuchComponentException(_component, componentId);
+ throw Tapestry.createNoSuchComponentException(_component, componentId, location);
return embedded.getSpecification().getAllowBody();
}
- public boolean getAllowBody(String libraryId, String type)
+ public boolean getAllowBody(String libraryId, String type, Location location)
{
INamespace namespace = _component.getNamespace();
- _resolver.resolve(_cycle, namespace, libraryId, type);
+ _resolver.resolve(_cycle, namespace, libraryId, type, location);
ComponentSpecification spec = _resolver.getSpecification();
1.4 +15 -7 jakarta-tapestry/framework/src/org/apache/tapestry/resolver/ComponentSpecificationResolver.java
Index: ComponentSpecificationResolver.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/resolver/ComponentSpecificationResolver.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ComponentSpecificationResolver.java 23 Mar 2003 01:27:23 -0000 1.3
+++ ComponentSpecificationResolver.java 26 Mar 2003 19:53:22 -0000 1.4
@@ -57,11 +57,11 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-
import org.apache.tapestry.ApplicationRuntimeException;
import org.apache.tapestry.INamespace;
import org.apache.tapestry.IRequestCycle;
import org.apache.tapestry.IResourceLocation;
+import org.apache.tapestry.Location;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.spec.ComponentSpecification;
@@ -133,7 +133,11 @@
*
**/
- public void resolve(IRequestCycle cycle, INamespace containerNamespace, String type)
+ public void resolve(
+ IRequestCycle cycle,
+ INamespace containerNamespace,
+ String type,
+ Location location)
{
int colonx = type.indexOf(':');
@@ -142,10 +146,10 @@
String libraryId = type.substring(0, colonx);
String simpleType = type.substring(colonx + 1);
- resolve(cycle, containerNamespace, libraryId, simpleType);
+ resolve(cycle, containerNamespace, libraryId, simpleType, location);
}
else
- resolve(cycle, containerNamespace, null, type);
+ resolve(cycle, containerNamespace, null, type, location);
}
/**
@@ -158,6 +162,7 @@
* @param libraryId the library id within the container namespace, or null
* @param type the component specification
* to find as a simple name (without a library prefix)
+ * @param location of reference to be resolved
* @throws ApplicationRuntimeException if the type cannot be resolved
*
**/
@@ -166,7 +171,8 @@
IRequestCycle cycle,
INamespace containerNamespace,
String libraryId,
- String type)
+ String type,
+ Location location)
{
reset();
_type = type;
@@ -198,7 +204,9 @@
Tapestry.getString(
"Namespace.no-such-component-type",
type,
- namespace.getNamespaceId()));
+ namespace.getNamespaceId()),
+ location,
+ null);
}
}
1.144 +16 -2 jakarta-tapestry/web/new.html
Index: new.html
===================================================================
RCS file: /home/cvs/jakarta-tapestry/web/new.html,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- new.html 24 Mar 2003 16:12:44 -0000 1.143
+++ new.html 26 Mar 2003 19:53:22 -0000 1.144
@@ -11,6 +11,20 @@
<tr>
<td valign="top" align="left"><IMG alt="[Tapestry Banner]" src="images/Tapestry-Banner.png" border="0">
+<h3>Release 2.4-beta-1</h3>
+
+<ul>
+<li>Major refurbishment of the Virtual Library example to use all the latest and greatest Tapestry facilities.</li>
+<li>Removed the "rows" and "columns" parameters from TextArea; use informal parameters "rows" and "cols" instead.</li>
+<li>Removed unused/unneeded exceptions <code>RollbackException</code> and <code>PageRecorderSerializationException</code>.</li>
+<li>The default for the <a href="doc/ComponentReference/Hidden.html">Hidden</a> component is now to encode its parameter.</li>
+</ul>
+
+<pre>
+[ 18340 ] ApplicationRuntimeException doesn't compile on jdk 1.3.
+[ 18336 ] Tapestry 2.4a5 - LOGGING images missing for Inspector component
+</pre>
+
<h3>Release 2.4-alpha-5</h3>
<ul>
@@ -29,7 +43,7 @@
<li>Severely refactored exceptions, removing many exception classes and flattening all others
under ApplicationRuntimeException.</li>
<li>Simplified the URL format, merging the "service" and "context" parameters together.</li>
-<li>Removed the "width" and "displayWidth" and "maxLength" parameters from TextField and ValidField
+<li>Removed the "displayWidth" and "maxLength" parameters from TextField and ValidField
(HTML attributes "size" and "maxlength", as informal parameters, are sufficient).</li>\
<li>Added two new application extensions to allow page and component specifications and templates
to be provided in non-standard ways (when not found using the default rules).</li>
1.2 +4 -8 jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c9/Four.java
Index: Four.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/junit/src/org/apache/tapestry/junit/mock/c9/Four.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Four.java 5 Mar 2003 23:19:50 -0000 1.1
+++ Four.java 26 Mar 2003 19:53:22 -0000 1.2
@@ -66,18 +66,14 @@
* @since 2.4
**/
-public class Four extends BasePage
+public abstract class Four extends BasePage
{
private String _word;
- public String getWord()
- {
- return _word;
- }
+ public abstract String getWord();
public void setWord(String word)
{
- _word = word;
+ _word = word;
}
-
}
1.3 +6 -3 jakarta-tapestry/framework/src/org/apache/tapestry/record/PageRecorder.java
Index: PageRecorder.java
===================================================================
RCS file: /home/cvs/jakarta-tapestry/framework/src/org/apache/tapestry/record/PageRecorder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- PageRecorder.java 15 Mar 2003 21:22:30 -0000 1.2
+++ PageRecorder.java 26 Mar 2003 19:53:22 -0000 1.3
@@ -113,7 +113,6 @@
**/
public boolean isDirty()
-
{
return _dirty;
}
@@ -244,7 +243,11 @@
}
catch (Throwable t)
{
- throw new RollbackException(component, propertyName, storedValue, t);
+ throw new ApplicationRuntimeException(
+ Tapestry.getString(
+ "PageRecorder.unable-to-rollback",
+ new Object[] { propertyName, component, storedValue, t.getMessage()}),
+ t);
}
}
}