You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by bd...@apache.org on 2007/07/25 23:40:10 UTC
svn commit: r559620 - in /tapestry/tapestry4/trunk:
tapestry-annotations/src/descriptor/META-INF/
tapestry-annotations/src/java/org/apache/tapestry/annotations/
tapestry-annotations/src/test/org/apache/tapestry/annotations/
tapestry-framework/src/descr...
Author: bdotte
Date: Wed Jul 25 14:40:07 2007
New Revision: 559620
URL: http://svn.apache.org/viewvc?view=rev&rev=559620
Log:
Resolves TAPESTRY-1448. Add the ability to specify a default @Persist property persistence strategy in the .application file using the new org.apache.tapestry.default-property-persistence-strategy property rather than hardcoding the default on the annotation.
Modified:
tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/BeanAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectComponentAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectMetaAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectObjectAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectPageAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectScriptAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateFlagAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MessageAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MethodAnnotationEnhancementWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ParameterAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/Persist.java
tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/PersistAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java
tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java
tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.props.xml
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/descriptor/META-INF/hivemodule.xml Wed Jul 25 14:40:07 2007
@@ -29,6 +29,7 @@
<set-configuration property="methodWorkers" configuration-id="MethodWorkers" />
<set-configuration property="classWorkers" configuration-id="ClassWorkers" />
<set-configuration property="secondaryAnnotationWorkers" configuration-id="SecondaryAnnotationWorkers" />
+ <set-service property="propertySource" service-id="tapestry.props.ApplicationPropertySource" />
</construct>
</invoke-factory>
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AnnotationEnhancementWorker.java Wed Jul 25 14:40:07 2007
@@ -14,21 +14,22 @@
package org.apache.tapestry.annotations;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.ErrorLog;
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.hivemind.util.ClasspathResource;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.enhance.EnhancementWorker;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.util.DescribedLocation;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.List;
-import java.util.Map;
-
/**
* Implementation of {@link org.apache.tapestry.enhance.EnhancementWorker} that finds class and
* method annotations and delegates out to specific
@@ -50,6 +51,8 @@
private List<SecondaryAnnotationWorker> _secondaryAnnotationWorkers;
+ private IPropertySource _propertySource;
+
public void setClassWorkers(Map<Class, ClassAnnotationEnhancementWorker> classWorkers)
{
_classWorkers = classWorkers;
@@ -137,7 +140,7 @@
method,
annotation,
classResource);
- worker.performEnhancement(op, spec, method, location);
+ worker.performEnhancement(op, spec, method, location, _propertySource);
}
catch (Exception ex)
{
@@ -168,4 +171,9 @@
{
_secondaryAnnotationWorkers = workers;
}
+
+ public void setPropertySource(IPropertySource propertySource)
+ {
+ _propertySource = propertySource;
+ }
}
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/AssetAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -14,14 +14,15 @@
package org.apache.tapestry.annotations;
+import java.lang.reflect.Method;
+
import org.apache.hivemind.Location;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.AssetSpecification;
import org.apache.tapestry.spec.IAssetSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
-import java.lang.reflect.Method;
-
/**
* Uses the {@link org.apache.tapestry.annotations.Asset} annotation to create a new
* {@link org.apache.tapestry.spec.IAssetSpecification} which is then added to the
@@ -32,7 +33,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
Asset asset = method.getAnnotation(Asset.class);
String propertyName = AnnotationUtils.getPropertyName(method);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/BeanAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/BeanAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/BeanAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/BeanAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -23,6 +23,7 @@
import org.apache.tapestry.spec.BeanSpecification;
import org.apache.tapestry.spec.IBeanSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Creates a {@link org.apache.tapestry.spec.IBeanSpecification} from the
@@ -34,7 +35,7 @@
public class BeanAnnotationWorker implements MethodAnnotationEnhancementWorker
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
Bean bean = method.getAnnotation(Bean.class);
String propertyName = AnnotationUtils.getPropertyName(method);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ComponentAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -26,6 +26,7 @@
import org.apache.tapestry.spec.IBindingSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IContainedComponent;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Adds a {@link org.apache.tapestry.spec.IContainedComponent} to the
@@ -39,7 +40,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
Component component = method.getAnnotation(Component.class);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectComponentAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectComponentAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectComponentAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectComponentAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -20,6 +20,7 @@
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.enhance.InjectComponentWorker;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Injects a reference to a compent.
@@ -44,7 +45,7 @@
}
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
InjectComponent ic = method.getAnnotation(InjectComponent.class);
String propertyName = AnnotationUtils.getPropertyName(method);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectMetaAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectMetaAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectMetaAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectMetaAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.InjectSpecification;
import org.apache.tapestry.spec.InjectSpecificationImpl;
+import org.apache.tapestry.engine.IPropertySource;
/**
* @author Howard Lewis Ship
@@ -30,7 +31,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
String propertyName = AnnotationUtils.getPropertyName(method);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectObjectAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectObjectAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectObjectAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectObjectAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.enhance.InjectObjectWorker;
import org.apache.tapestry.services.InjectedValueProvider;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Performs injection of objects, in much the same way as the <inject> element in a
@@ -47,7 +48,7 @@
}
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
InjectObject io = method.getAnnotation(InjectObject.class);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectPageAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectPageAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectPageAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectPageAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.InjectSpecification;
import org.apache.tapestry.spec.InjectSpecificationImpl;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Uses the {@link org.apache.tapestry.annotations.InjectPage} annotation to add an
@@ -34,7 +35,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
InjectPage injectPage = method.getAnnotation(InjectPage.class);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectScriptAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectScriptAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectScriptAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectScriptAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.InjectSpecification;
import org.apache.tapestry.spec.InjectSpecificationImpl;
+import org.apache.tapestry.engine.IPropertySource;
/**
* @author Howard Lewis Ship
@@ -30,7 +31,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
InjectScript annotation = method.getAnnotation(InjectScript.class);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.InjectSpecification;
import org.apache.tapestry.spec.InjectSpecificationImpl;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Injects an Application State Object.
@@ -33,7 +34,7 @@
public class InjectStateAnnotationWorker implements MethodAnnotationEnhancementWorker
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
InjectState is = method.getAnnotation(InjectState.class);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateFlagAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateFlagAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateFlagAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/InjectStateFlagAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.InjectSpecification;
import org.apache.tapestry.spec.InjectSpecificationImpl;
+import org.apache.tapestry.engine.IPropertySource;
/**
*
@@ -30,7 +31,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
InjectStateFlag isv = method.getAnnotation(InjectStateFlag.class);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MessageAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MessageAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MessageAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MessageAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -22,6 +22,7 @@
import org.apache.hivemind.service.BodyBuilder;
import org.apache.hivemind.service.MethodSignature;
import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.IComponentSpecification;
@@ -35,7 +36,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
if (!method.getReturnType().equals(String.class))
throw new ApplicationRuntimeException(AnnotationMessages.returnStringOnly(method
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MethodAnnotationEnhancementWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MethodAnnotationEnhancementWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MethodAnnotationEnhancementWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/MethodAnnotationEnhancementWorker.java Wed Jul 25 14:40:07 2007
@@ -19,6 +19,7 @@
import org.apache.hivemind.Location;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.engine.IPropertySource;
/**
* Defines workers that perform annotation enhancements at the method level.
@@ -40,8 +41,10 @@
* the method to which the annotation is attached. The annotation
* may be obtained from the method.
* @param location TODO
+ * @param propertySource
+ * application properties for resolving default values
*/
void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location);
+ Method method, Location location, IPropertySource propertySource);
}
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ParameterAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ParameterAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ParameterAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/ParameterAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -20,6 +20,7 @@
import org.apache.hivemind.HiveMind;
import org.apache.hivemind.Location;
import org.apache.tapestry.IPage;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IParameterSpecification;
@@ -37,7 +38,7 @@
{
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
if (IPage.class.isAssignableFrom(method.getDeclaringClass()))
{
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/Persist.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/Persist.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/Persist.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/Persist.java Wed Jul 25 14:40:07 2007
@@ -35,9 +35,10 @@
public @interface Persist {
/**
- * The persistence strategy, defaulting to "session" (meaning, in the HttpSession, as a session
- * attribute). Tapestry includes another strategy, "client", and additional strategies can be
- * defined.
+ * The persistence strategy, defaulting to "session", as defined on the
+ * org.apache.tapestry.default-property-persistence-strategy property (meaning, in the
+ * HttpSession, as a session attribute). Tapestry includes another strategy, "client",
+ * and additional strategies can be defined.
*/
- String value() default "session";
+ String value() default "";
}
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/PersistAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/PersistAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/PersistAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/PersistAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -17,6 +17,7 @@
import java.lang.reflect.Method;
import org.apache.hivemind.Location;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IPropertySpecification;
@@ -37,14 +38,20 @@
*/
public class PersistAnnotationWorker implements MethodAnnotationEnhancementWorker
{
+ /**
+ * Application property that gives the default property persistence strategy to use for properties annotated by @Persist
+ */
+ public static final String DEFAULT_PROPERTY_PERSISTENCE_STRATEGY = "org.apache.tapestry.default-property-persistence-strategy";
+
public void performEnhancement(EnhancementOperation op, IComponentSpecification spec,
- Method method, Location location)
+ Method method, Location location, IPropertySource propertySource)
{
Persist p = method.getAnnotation(Persist.class);
InitialValue iv = method.getAnnotation(InitialValue.class);
String propertyName = AnnotationUtils.getPropertyName(method);
- String stategy = p.value();
+ String defaultStrategy = propertySource.getPropertyValue(DEFAULT_PROPERTY_PERSISTENCE_STRATEGY);
+ String stategy = p.value().length() == 0 ? defaultStrategy : p.value();
IPropertySpecification pspec = new PropertySpecification();
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java Wed Jul 25 14:40:07 2007
@@ -14,9 +14,6 @@
package org.apache.tapestry.annotations;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.expectLastCall;
-
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -29,9 +26,12 @@
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.DefaultClassResolver;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.util.DescribedLocation;
+import static org.easymock.EasyMock.expect;
+import static org.easymock.EasyMock.expectLastCall;
import org.testng.annotations.Test;
/**
@@ -82,6 +82,7 @@
EnhancementOperation op = newOp(AnnotatedPage.class);
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
MethodAnnotationEnhancementWorker methodWorker = newMethodAnnotationEnhancementWorker();
@@ -89,7 +90,7 @@
Location location = newMethodLocation(AnnotatedPage.class, m, InjectObject.class);
- methodWorker.performEnhancement(op, spec, m, location);
+ methodWorker.performEnhancement(op, spec, m, location, propertySource);
replay();
@@ -97,6 +98,7 @@
worker.setMethodWorkers(newMap(InjectObject.class, methodWorker));
worker.setClassResolver(resolver);
worker.setSecondaryAnnotationWorkers(Collections.EMPTY_LIST);
+ worker.setPropertySource(propertySource);
worker.performEnhancement(op, spec);
@@ -124,6 +126,7 @@
EnhancementOperation op = newOp(AnnotatedPageSubclass.class);
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
MethodAnnotationEnhancementWorker methodWorker = newMethodAnnotationEnhancementWorker();
@@ -131,7 +134,7 @@
Location location = newMethodLocation(AnnotatedPageSubclass.class, m, InjectObject.class);
- methodWorker.performEnhancement(op, spec, m, location);
+ methodWorker.performEnhancement(op, spec, m, location, propertySource);
replay();
@@ -139,6 +142,7 @@
worker.setMethodWorkers(newMap(InjectObject.class, methodWorker));
worker.setClassResolver(resolver);
worker.setSecondaryAnnotationWorkers(Collections.EMPTY_LIST);
+ worker.setPropertySource(propertySource);
worker.performEnhancement(op, spec);
@@ -154,6 +158,7 @@
EnhancementOperation op = newOp(AnnotatedPage.class);
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
MethodAnnotationEnhancementWorker methodWorker = newMethodAnnotationEnhancementWorker();
@@ -161,7 +166,7 @@
Location location = newMethodLocation(AnnotatedPage.class, m, InjectObject.class);
- methodWorker.performEnhancement(op, spec, m, location);
+ methodWorker.performEnhancement(op, spec, m, location, propertySource);
expectLastCall().andThrow(t);
log.error("An error occured processing annotation "
@@ -177,6 +182,7 @@
worker.setErrorLog(log);
worker.setClassResolver(resolver);
worker.setSecondaryAnnotationWorkers(Collections.EMPTY_LIST);
+ worker.setPropertySource(propertySource);
worker.performEnhancement(op, spec);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.hivemind.Resource;
import org.apache.hivemind.util.ClasspathResource;
import org.apache.tapestry.BaseComponentTestCase;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.IComponentSpecification;
@@ -73,4 +74,8 @@
classResource);
}
+ protected IPropertySource newPropertySource()
+ {
+ return newMock(IPropertySource.class);
+ }
}
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java Wed Jul 25 14:40:07 2007
@@ -17,10 +17,12 @@
import java.lang.reflect.Method;
import org.apache.hivemind.Location;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IPropertySpecification;
+import static org.easymock.EasyMock.expect;
import org.testng.annotations.Test;
/**
@@ -38,12 +40,13 @@
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = trainPropertySource();
- replay();
+ replay();
Method m = findMethod(AnnotatedPage.class, "getPersistentProperty");
- new PersistAnnotationWorker().performEnhancement(op, spec, m, l);
+ new PersistAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
@@ -55,18 +58,19 @@
assertNull(ps.getInitialValue());
}
- public void testStrategySpecified()
+ public void testStrategySpecified()
{
Location l = newLocation();
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = trainPropertySource();
- replay();
+ replay();
Method m = findMethod(AnnotatedPage.class, "getClientPersistentProperty");
- new PersistAnnotationWorker().performEnhancement(op, spec, m, l);
+ new PersistAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
@@ -84,12 +88,13 @@
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = trainPropertySource();
- replay();
+ replay();
Method m = findMethod(AnnotatedPage.class, "getPersistentPropertyWithInitialValue");
- new PersistAnnotationWorker().performEnhancement(op, spec, m, l);
+ new PersistAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
@@ -101,4 +106,11 @@
assertSame(l, ps.getLocation());
assertEquals("user.naturalName", ps.getInitialValue());
}
+
+ private IPropertySource trainPropertySource()
+ {
+ IPropertySource propertySource = newPropertySource();
+ expect(propertySource.getPropertyValue(PersistAnnotationWorker.DEFAULT_PROPERTY_PERSISTENCE_STRATEGY)).andReturn("session");
+ return propertySource;
+ }
}
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -14,16 +14,17 @@
package org.apache.tapestry.annotations;
+import java.lang.reflect.Method;
+
import org.apache.hivemind.Location;
import org.apache.hivemind.Resource;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IAssetSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.testng.annotations.Test;
-import java.lang.reflect.Method;
-
/**
* Tests for {@link org.apache.tapestry.annotations.AssetAnnotationWorker}.
*
@@ -38,12 +39,13 @@
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
spec.setSpecificationLocation(r);
+ IPropertySource propertySource = newPropertySource();
replay();
Method m = findMethod(AnnotatedPage.class, "getGlobalStylesheet");
- new AssetAnnotationWorker().performEnhancement(op, spec, m, l);
+ new AssetAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
@@ -61,12 +63,13 @@
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
spec.setSpecificationLocation(r);
+ IPropertySource propertySource = newPropertySource();
replay();
Method m = findMethod(AnnotatedPage.class, "getTextAsset");
- new AssetAnnotationWorker().performEnhancement(op, spec, m, l);
+ new AssetAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -14,8 +14,13 @@
package org.apache.tapestry.annotations;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.List;
+
import org.apache.hivemind.Location;
import org.apache.tapestry.bean.LightweightBeanInitializer;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.BeanLifecycle;
import org.apache.tapestry.spec.ComponentSpecification;
@@ -24,10 +29,6 @@
import static org.easymock.EasyMock.expect;
import org.testng.annotations.Test;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.List;
-
/**
* Tests for {@link org.apache.tapestry.annotations.BeanAnnotationWorker}.
*
@@ -42,12 +43,13 @@
Location l = newLocation();
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = newPropertySource();
Method m = findMethod(AnnotatedPage.class, "getMapBean");
replay();
- new BeanAnnotationWorker().performEnhancement(op, spec, m, l);
+ new BeanAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
@@ -74,12 +76,13 @@
Location l = newLocation();
EnhancementOperation op = newOp("hashMapBean", HashMap.class);
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = newPropertySource();
Method m = findMethod(AnnotatedPage.class, "getHashMapBean");
replay();
- new BeanAnnotationWorker().performEnhancement(op, spec, m, l);
+ new BeanAnnotationWorker().performEnhancement(op, spec, m, l, propertySource);
verify();
@@ -96,12 +99,13 @@
{
EnhancementOperation op = newOp("beanWithInitializer", TargetValues.class);
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = newPropertySource();
Method m = findMethod(AnnotatedPage.class, "getBeanWithInitializer");
replay();
- new BeanAnnotationWorker().performEnhancement(op, spec, m, null);
+ new BeanAnnotationWorker().performEnhancement(op, spec, m, null, propertySource);
verify();
@@ -117,12 +121,13 @@
{
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = newPropertySource();
Method m = findMethod(AnnotatedPage.class, "getRenderLifecycleBean");
replay();
- new BeanAnnotationWorker().performEnhancement(op, spec, m, null);
+ new BeanAnnotationWorker().performEnhancement(op, spec, m, null, propertySource);
verify();
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -24,6 +24,7 @@
import org.apache.tapestry.spec.IBindingSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IContainedComponent;
+import org.apache.tapestry.engine.IPropertySource;
import org.testng.annotations.Test;
/**
@@ -47,10 +48,11 @@
Method method = findMethod(AnnotatedPage.class, methodName);
EnhancementOperation op = newOp();
+ IPropertySource propertySource = newPropertySource();
replay();
- new ComponentAnnotationWorker().performEnhancement(op, spec, method, location);
+ new ComponentAnnotationWorker().performEnhancement(op, spec, method, location, propertySource);
verify();
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -18,6 +18,7 @@
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.enhance.InjectComponentWorker;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.engine.IPropertySource;
import org.testng.annotations.Test;
/**
@@ -42,6 +43,7 @@
Location l = newLocation();
EnhancementOperation op = newOp();
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
InjectComponentWorker delegate = org.easymock.classextension.EasyMock.createMock(InjectComponentWorker.class);
@@ -52,7 +54,7 @@
InjectComponentAnnotationWorker worker = new InjectComponentAnnotationWorker(delegate);
- worker.performEnhancement(op, spec, findMethod(AnnotatedPage.class, "getFredField"), l);
+ worker.performEnhancement(op, spec, findMethod(AnnotatedPage.class, "getFredField"), l, propertySource);
verify();
org.easymock.classextension.EasyMock.verify(delegate);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.enhance.InjectObjectWorker;
import org.apache.tapestry.services.InjectedValueProvider;
import org.apache.tapestry.spec.IComponentSpecification;
+import org.apache.tapestry.engine.IPropertySource;
import org.testng.annotations.Test;
/**
@@ -45,6 +46,7 @@
EnhancementOperation op = newOp();
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
InjectObjectWorker delegate = org.easymock.classextension.EasyMock.createNiceMock(InjectObjectWorker.class);
@@ -67,7 +69,7 @@
replay();
- worker.performEnhancement(op, spec, m, l);
+ worker.performEnhancement(op, spec, m, l, propertySource);
verify();
org.easymock.classextension.EasyMock.verify(delegate);
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -14,10 +14,6 @@
package org.apache.tapestry.annotations;
-import static org.easymock.EasyMock.aryEq;
-import static org.easymock.EasyMock.eq;
-import static org.easymock.EasyMock.expect;
-
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -26,12 +22,16 @@
import org.apache.hivemind.Messages;
import org.apache.hivemind.service.MethodSignature;
import org.apache.hivemind.service.impl.ClassFactoryImpl;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhanceUtils;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.enhance.EnhancementOperationImpl;
import org.apache.tapestry.services.ComponentConstructor;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
+import static org.easymock.EasyMock.aryEq;
+import static org.easymock.EasyMock.eq;
+import static org.easymock.EasyMock.expect;
import org.testng.annotations.Test;
@Test
@@ -69,6 +69,7 @@
{
EnhancementOperation op = newOp();
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
Method method = findMethod(AnnotatedPage.class, "voidMessage");
@@ -76,7 +77,7 @@
try
{
- new MessageAnnotationWorker().performEnhancement(op, spec, method, null);
+ new MessageAnnotationWorker().performEnhancement(op, spec, method, null, propertySource);
unreachable();
}
catch (ApplicationRuntimeException ex)
@@ -95,6 +96,7 @@
Location l = newLocation();
EnhancementOperation op = newOp();
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
Method method = findMethod(AnnotatedPage.class, "getLikeGetter");
@@ -107,7 +109,7 @@
replay();
- new MessageAnnotationWorker().performEnhancement(op, spec, method, l);
+ new MessageAnnotationWorker().performEnhancement(op, spec, method, l, propertySource);
verify();
}
@@ -117,6 +119,7 @@
Location l = newLocation();
EnhancementOperation op = newOp();
IComponentSpecification spec = newSpec();
+ IPropertySource propertySource = newPropertySource();
Method method = findMethod(AnnotatedPage.class, methodName);
@@ -124,7 +127,7 @@
replay();
- new MessageAnnotationWorker().performEnhancement(op, spec, method, l);
+ new MessageAnnotationWorker().performEnhancement(op, spec, method, l, propertySource);
verify();
}
@@ -136,6 +139,7 @@
ComponentSpecification spec = new ComponentSpecification();
EnhancementOperationImpl op = new EnhancementOperationImpl(getClassResolver(), spec,
baseClass, new ClassFactoryImpl(), null);
+ IPropertySource propertySource = newPropertySource();
op.addInjectedField("_messages", Messages.class, messages);
@@ -143,7 +147,7 @@
Method method = findMethod(baseClass, methodName);
- new MessageAnnotationWorker().performEnhancement(op, spec, method, l);
+ new MessageAnnotationWorker().performEnhancement(op, spec, method, l, propertySource);
ComponentConstructor cc = op.getConstructor();
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java Wed Jul 25 14:40:07 2007
@@ -14,16 +14,16 @@
package org.apache.tapestry.annotations;
-import static org.easymock.EasyMock.expect;
-
import java.lang.reflect.Method;
import org.apache.hivemind.ApplicationRuntimeException;
import org.apache.hivemind.Location;
+import org.apache.tapestry.engine.IPropertySource;
import org.apache.tapestry.enhance.EnhancementOperation;
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IParameterSpecification;
+import static org.easymock.EasyMock.expect;
import org.testng.annotations.Test;
/**
@@ -47,6 +47,7 @@
+ propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1));
EnhancementOperation op = newMock(EnhancementOperation.class);
+ IPropertySource propertySource = newPropertySource();
expect(op.getPropertyType(propertyName)).andReturn(m.getReturnType());
@@ -54,7 +55,7 @@
replay();
- new ParameterAnnotationWorker().performEnhancement(op, spec, m, location);
+ new ParameterAnnotationWorker().performEnhancement(op, spec, m, location, propertySource);
verify();
@@ -124,6 +125,7 @@
Method m = findMethod(AnnotatedPage.class, "getSimpleParameter");
EnhancementOperation op = newMock(EnhancementOperation.class);
+ IPropertySource propertySource = newPropertySource();
IComponentSpecification spec = new ComponentSpecification();
@@ -131,7 +133,7 @@
try
{
- new ParameterAnnotationWorker().performEnhancement(op, spec, m, null);
+ new ParameterAnnotationWorker().performEnhancement(op, spec, m, null, propertySource);
unreachable();
}
catch (ApplicationRuntimeException ex)
Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java Wed Jul 25 14:40:07 2007
@@ -21,6 +21,7 @@
import org.apache.tapestry.spec.ComponentSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.InjectSpecification;
+import org.apache.tapestry.engine.IPropertySource;
import org.testng.annotations.Test;
/**
@@ -150,12 +151,13 @@
{
EnhancementOperation op = newOp();
IComponentSpecification spec = new ComponentSpecification();
+ IPropertySource propertySource = newPropertySource();
Method method = findMethod(AnnotatedPage.class, methodName);
replay();
- worker.performEnhancement(op, spec, method, location);
+ worker.performEnhancement(op, spec, method, location, propertySource);
verify();
Modified: tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.props.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.props.xml?view=diff&rev=559620&r1=559619&r2=559620
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.props.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/descriptor/META-INF/tapestry.props.xml Wed Jul 25 14:40:07 2007
@@ -191,6 +191,7 @@
<default symbol="org.apache.tapestry.jwcid-attribute-name" value="jwcid"/>
<default symbol="org.apache.tapestry.default-binding-prefix" value="ognl"/>
<default symbol="org.apache.tapestry.renderTags" value="true" />
+ <default symbol="org.apache.tapestry.default-property-persistence-strategy" value="session"/>
</contribution>
<!-- This may need to be converted into an IPropertySource and injected into the ApplicationPropertySources