You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/12/03 20:35:28 UTC
svn commit: r723030 - in /tapestry/tapestry5/trunk:
tapestry-component-report/
tapestry-core/src/main/java/org/apache/tapestry5/annotations/
tapestry-core/src/main/java/org/apache/tapestry5/internal/events/
tapestry-core/src/main/java/org/apache/tapest...
Author: hlship
Date: Wed Dec 3 11:35:27 2008
New Revision: 723030
URL: http://svn.apache.org/viewvc?rev=723030&view=rev
Log:
TAP5-399: Modified ASO objects are not persisted back to the session ever
Removed:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/events/EndOfRequestEvent.java
Modified:
tapestry/tapestry5/trunk/tapestry-component-report/tapestry-component-report.iml
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Parameter.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/events/EndOfRequestListener.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHub.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImpl.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Environment.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Heartbeat.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImplTest.java
tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategyTest.java
Modified: tapestry/tapestry5/trunk/tapestry-component-report/tapestry-component-report.iml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-component-report/tapestry-component-report.iml?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-component-report/tapestry-component-report.iml (original)
+++ tapestry/tapestry5/trunk/tapestry-component-report/tapestry-component-report.iml Wed Dec 3 11:35:27 2008
@@ -5,6 +5,7 @@
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+ <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Environmental.java Wed Dec 3 11:35:27 2008
@@ -14,8 +14,6 @@
package org.apache.tapestry5.annotations;
-import org.apache.tapestry5.services.Environment;
-
import java.lang.annotation.Documented;
import static java.lang.annotation.ElementType.FIELD;
import java.lang.annotation.Retention;
@@ -23,7 +21,10 @@
import java.lang.annotation.Target;
/**
- * Defines a field that is replaced at runtime with a read-only value obtained from the {@link Environment} service.
+ * Defines a field of a component class that is replaced at runtime with a read-only value obtained from the {@link
+ * org.apache.tapestry5.services.Environment} service. <p>Most commonly, the field will be of type {@link
+ * org.apache.tapestry5.RenderSupport}, {@link org.apache.tapestry5.services.Heartbeat} or {@link
+ * org.apache.tapestry5.services.FormSupport}, though many other options are possible.
*/
@Target(FIELD)
@Documented
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Parameter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Parameter.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Parameter.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/annotations/Parameter.java Wed Dec 3 11:35:27 2008
@@ -23,8 +23,8 @@
import java.lang.annotation.Target;
/**
- * Annotation placed on a field to indicate that it is, in fact, an parameter. Parameters may be optional or required.
- * Required parameters must be bound.
+ * Annotation placed on a field to indicate that it is, in fact, a component parameter. Parameters may be optional or
+ * required. Required parameters must be bound.
*/
@Target(FIELD)
@Documented
@@ -34,7 +34,7 @@
/**
* The name of the parameter. If not specified, the name of the parameter is derived from the name of the field
- * (after stripping off leading punctuation) from the field name.
+ * (after stripping off leading and trailing punctuation).
*/
String name() default "";
@@ -48,19 +48,18 @@
* If true, and the parameter <em>is</em> bound, then the value for the parameter must not be null. The default is
* to allow nulls. This is different than required, in that the parameter may be bound, but bound to a null value.
*/
-
boolean allowNull() default true;
/**
* If true (the default), then the value for the parameter is cached while the component is, itself, rendering.
* Values from invariant bindings (such as literal strings) are always cached, regardless of this setting. Set this
- * attribute to false to force the parameter to be {@link org.apache.tapestry5.Binding#get() re-read} every time the
- * field is accessed, even while the component is rendering.
+ * attribute to false to force the parameter to be {@linkplain org.apache.tapestry5.Binding#get() re-read} every
+ * time the field is accessed, even while the component is rendering.
*/
boolean cache() default true;
/**
- * The default value for the parameter if not bound (at not the empty string). This is a binding expression,
+ * The default value for the parameter if not bound (and not the empty string). This is a binding expression,
* typically the name of a property of the component to bind.
*/
String value() default "";
@@ -88,7 +87,7 @@
/**
* Used to create a default binding, connecting the parameter to a property of the container whose property name
* matches the id of the component. This is frequently used for form element components. This default binding is
- * only used parameter is not bound.
+ * only used if there is no matching container property.
*
* @see org.apache.tapestry5.services.ComponentDefaultProvider#defaultBinding(String,
* org.apache.tapestry5.ComponentResources)
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/events/EndOfRequestListener.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/events/EndOfRequestListener.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/events/EndOfRequestListener.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/events/EndOfRequestListener.java Wed Dec 3 11:35:27 2008
@@ -16,14 +16,14 @@
/**
* Event listener interface for objects that need to know when the current request finishes.
+ *
+ * @see org.apache.tapestry5.internal.services.EndOfRequestListenerHub
*/
public interface EndOfRequestListener
{
/**
* Notified at the end of the request. This notification occurs after the response has been sent to the client,
* which means that it is to late to (for example) create a new HttpSession.
- *
- * @param event identifies the request which did complete
*/
- void requestDidComplete(EndOfRequestEvent event);
+ void requestDidComplete();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHub.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHub.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHub.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHub.java Wed Dec 3 11:35:27 2008
@@ -15,7 +15,6 @@
package org.apache.tapestry5.internal.services;
import org.apache.tapestry5.internal.events.EndOfRequestListener;
-import org.apache.tapestry5.services.Request;
/**
* Manages request notifications for the {@link org.apache.tapestry5.internal.events.EndOfRequestListener} interface.
@@ -28,8 +27,6 @@
/**
* Invoked at the end of the request to notify the listeners.
- *
- * @param request which just completed
*/
- void fire(Request request);
+ void fire();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImpl.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImpl.java Wed Dec 3 11:35:27 2008
@@ -14,10 +14,8 @@
package org.apache.tapestry5.internal.services;
-import org.apache.tapestry5.internal.events.EndOfRequestEvent;
import org.apache.tapestry5.internal.events.EndOfRequestListener;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-import org.apache.tapestry5.services.Request;
import java.util.List;
@@ -35,13 +33,11 @@
listeners.remove(listener);
}
- public void fire(Request request)
+ public void fire()
{
- EndOfRequestEvent event = new EndOfRequestEvent(request);
-
for (EndOfRequestListener l : listeners)
{
- l.requestDidComplete(event);
+ l.requestDidComplete();
}
}
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java Wed Dec 3 11:35:27 2008
@@ -15,7 +15,6 @@
package org.apache.tapestry5.internal.services;
import org.apache.tapestry5.OptimizedApplicationStateObject;
-import org.apache.tapestry5.internal.events.EndOfRequestEvent;
import org.apache.tapestry5.internal.events.EndOfRequestListener;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
import org.apache.tapestry5.services.ApplicationStateCreator;
@@ -112,13 +111,12 @@
return result;
}
- public void requestDidComplete(EndOfRequestEvent event)
+ public void requestDidComplete()
{
Map<String, Object> map = getASOMap();
for (String key : map.keySet())
{
-
Object aso = map.get(key);
if (aso == null) continue;
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Environment.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Environment.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Environment.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Environment.java Wed Dec 3 11:35:27 2008
@@ -17,12 +17,12 @@
import java.util.NoSuchElementException;
/**
- * Provides access to environment services, which are almost always provided to enclosed components by enclosing
+ * Provides access to environment objects, which are almost always provided to enclosed components by enclosing
* components. Environmental services are a form of very late binding.
* <p/>
- * The Environment acts like a collection of stacks. Each stack contains environmental service instances of a given
- * type. Most often, a stack has zero or one elements, but on occasion, a particular component will push an override
- * onto the stack for the benefit of the components it encloses.
+ * The Environment acts like a collection of stacks. Each stack contains environmental objects of a given type. Most
+ * often, a stack has zero or one elements, but on occasion, a particular component will push an override onto the stack
+ * for the benefit of the components it encloses.
*
* @see org.apache.tapestry5.annotations.Environmental
* @see org.apache.tapestry5.services.EnvironmentalShadowBuilder
@@ -32,28 +32,28 @@
/**
* Peeks at the current top of the indicated stack.
*
- * @param <T> the type of environmental service
- * @param type class used to select a service
- * @return the current service of that type, or null if no service of that type has been added
+ * @param <T> the type of environmental object
+ * @param type class used to select the object
+ * @return the current object of that type, or null if no service of that type has been added
*/
<T> T peek(Class<T> type);
/**
* Peeks at the current top of the indicated stack (which must have a non-null value).
*
- * @param <T> the type of environmental service
- * @param type class used to select a service
- * @return the current service
+ * @param <T> the type of environmental object
+ * @param type class used to select the object
+ * @return the current object of the specified type
* @throws RuntimeException if no service of that type has been added
*/
<T> T peekRequired(Class<T> type);
/**
- * Removes and returns the top environmental service of the selected type.
+ * Removes and returns the top environmental object of the selected type.
*
- * @param <T>
- * @param type
- * @return
+ * @param <T> the type of environmental object
+ * @param type class used to select the object
+ * @return the object just removed
* @throws NoSuchElementException if the environmental stack (for the specified type) is empty
*/
<T> T pop(Class<T> type);
@@ -61,9 +61,9 @@
/**
* Pushes a new service onto the stack. The old service at the top of the stack is returned (it may be null).
*
- * @param <T>
- * @param type the type of service to store
- * @param instance the service instance
+ * @param <T> the type of environmental object
+ * @param type class used to select the object
+ * @param instance the service object
* @return the previous top service
*/
<T> T push(Class<T> type, T instance);
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Heartbeat.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Heartbeat.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Heartbeat.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/Heartbeat.java Wed Dec 3 11:35:27 2008
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2008 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.
@@ -16,9 +16,9 @@
/**
* Allows for deferred execution of logic, useful when trying to get multiple components to coordinate behavior. A
- * component may add a command to be executed "{@link #end() at the end of the heartbeat}". The classic example of this
- * is a Label and the field it labels; since we don't know which order the two will render, we can't tell if the field's
- * id is correct until after both have rendered.
+ * component may add a command to be executed "{@linkplain #end() at the end of the heartbeat}". The classic example of
+ * this is a Label and the field it labels; since we don't know which order the two will render, we can't tell if the
+ * field's id is correct until after both have rendered.
* <p/>
* The Heartbeat is injected into components via the {@link org.apache.tapestry5.annotations.Environmental} annotation.
*/
Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TapestryModule.java Wed Dec 3 11:35:27 2008
@@ -184,8 +184,6 @@
binder.bind(BindingFactory.class, AssetBindingFactory.class).withId("AssetBindingFactory");
binder.bind(BindingFactory.class, NullFieldStrategyBindingFactory.class).withId(
"NullFieldStrategyBindingFactory");
- binder.bind(ApplicationStatePersistenceStrategy.class, SessionApplicationStatePersistenceStrategy.class).withId(
- "SessionApplicationStatePersistenceStrategy");
binder.bind(URLEncoder.class, URLEncoderImpl.class);
binder.bind(ContextPathEncoder.class, ContextPathEncoderImpl.class);
binder.bind(UpdateListenerHub.class, UpdateListenerHubImpl.class);
@@ -616,7 +614,7 @@
}
finally
{
- endOfRequestListenerHub.fire(request);
+ endOfRequestListenerHub.fire();
}
}
};
@@ -2156,4 +2154,12 @@
{
return messagesSource.getInvalidatonEventHub();
}
+
+ public ApplicationStatePersistenceStrategy buildSessionApplicationStatePersistenceStrategy(
+ @Autobuild SessionApplicationStatePersistenceStrategy service, EndOfRequestListenerHub hub)
+ {
+ hub.addEndOfRequestListener(service);
+
+ return service;
+ }
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImplTest.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/EndOfRequestListenerHubImplTest.java Wed Dec 3 11:35:27 2008
@@ -14,12 +14,8 @@
package org.apache.tapestry5.internal.services;
-import org.apache.tapestry5.internal.events.EndOfRequestEvent;
import org.apache.tapestry5.internal.events.EndOfRequestListener;
import org.apache.tapestry5.internal.test.InternalBaseTestCase;
-import org.apache.tapestry5.services.Request;
-import org.easymock.Capture;
-import static org.easymock.EasyMock.capture;
import org.testng.annotations.Test;
public class EndOfRequestListenerHubImplTest extends InternalBaseTestCase
@@ -28,23 +24,18 @@
public void add_and_notify()
{
EndOfRequestListenerHub hub = new EndOfRequestListenerHubImpl();
- final Request request = mockRequest();
EndOfRequestListener listener = newMock(EndOfRequestListener.class);
- Capture<EndOfRequestEvent> eventCapture = newCapture();
-
- listener.requestDidComplete(capture(eventCapture));
+ listener.requestDidComplete();
replay();
hub.addEndOfRequestListener(listener);
- hub.fire(request);
+ hub.fire();
verify();
-
- assertSame(eventCapture.getValue().getRequest(), request);
}
@@ -52,7 +43,6 @@
public void add_remove_notify()
{
EndOfRequestListenerHub hub = new EndOfRequestListenerHubImpl();
- final Request request = mockRequest();
EndOfRequestListener listener = newMock(EndOfRequestListener.class);
@@ -61,7 +51,7 @@
hub.addEndOfRequestListener(listener);
hub.removeEndOfRequestListener(listener);
- hub.fire(request);
+ hub.fire();
verify();
}
Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategyTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategyTest.java?rev=723030&r1=723029&r2=723030&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategyTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategyTest.java Wed Dec 3 11:35:27 2008
@@ -196,7 +196,7 @@
EndOfRequestListener strategy = new SessionApplicationStatePersistenceStrategy(request);
- strategy.requestDidComplete(null);
+ strategy.requestDidComplete();
verify();
}
@@ -215,10 +215,9 @@
EndOfRequestListener strategy = new SessionApplicationStatePersistenceStrategy(request);
- strategy.requestDidComplete(null);
+ strategy.requestDidComplete();
verify();
-
}
@@ -242,7 +241,7 @@
EndOfRequestListener strategy = new SessionApplicationStatePersistenceStrategy(request);
- strategy.requestDidComplete(null);
+ strategy.requestDidComplete();
verify();
}
@@ -267,7 +266,7 @@
EndOfRequestListener strategy = new SessionApplicationStatePersistenceStrategy(request);
- strategy.requestDidComplete(null);
+ strategy.requestDidComplete();
verify();
}
@@ -290,7 +289,7 @@
EndOfRequestListener strategy = new SessionApplicationStatePersistenceStrategy(request);
- strategy.requestDidComplete(null);
+ strategy.requestDidComplete();
verify();
}
@@ -304,6 +303,4 @@
return object;
}
-
-
}