Author: hlship
Date: Fri Apr 29 22:53:38 2011
New Revision: 1097981
URL: http://svn.apache.org/viewvc?rev=1097981&view=rev
Log:
TAP5-853: Initial work on converting component class transformation to work on
top of Plastic
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/CCTWToCCTW2Coercion.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker2.java
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodAdvice.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodInvocation.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentValueProvider.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/MethodAccess.java
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TransformField.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/FieldValueConduit.java
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java?rev=1097981&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/BridgeClassTransformation.java
Fri Apr 29 22:53:38 2011
@@ -0,0 +1,569 @@
+// Copyright 2011 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.transform;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.func.F;
+import org.apache.tapestry5.func.Mapper;
+import org.apache.tapestry5.func.Predicate;
+import org.apache.tapestry5.internal.plastic.PlasticInternalUtils;
+import org.apache.tapestry5.ioc.internal.util.InternalUtils;
+import org.apache.tapestry5.ioc.services.FieldValueConduit;
+import org.apache.tapestry5.model.MutableComponentModel;
+import org.apache.tapestry5.plastic.ComputedValue;
+import org.apache.tapestry5.plastic.FieldConduit;
+import org.apache.tapestry5.plastic.FieldHandle;
+import org.apache.tapestry5.plastic.InstanceContext;
+import org.apache.tapestry5.plastic.MethodAdvice;
+import org.apache.tapestry5.plastic.MethodDescription;
+import org.apache.tapestry5.plastic.MethodHandle;
+import org.apache.tapestry5.plastic.MethodInvocation;
+import org.apache.tapestry5.plastic.PlasticClass;
+import org.apache.tapestry5.plastic.PlasticField;
+import org.apache.tapestry5.plastic.PlasticMethod;
+import org.apache.tapestry5.plastic.PlasticUtils;
+import org.apache.tapestry5.runtime.Component;
+import org.apache.tapestry5.runtime.ComponentEvent;
+import org.apache.tapestry5.services.ClassTransformation;
+import org.apache.tapestry5.services.ComponentEventHandler;
+import org.apache.tapestry5.services.ComponentInstanceOperation;
+import org.apache.tapestry5.services.ComponentMethodAdvice;
+import org.apache.tapestry5.services.ComponentMethodInvocation;
+import org.apache.tapestry5.services.ComponentValueProvider;
+import org.apache.tapestry5.services.FieldAccess;
+import org.apache.tapestry5.services.MethodAccess;
+import org.apache.tapestry5.services.MethodInvocationResult;
+import org.apache.tapestry5.services.TransformConstants;
+import org.apache.tapestry5.services.TransformField;
+import org.apache.tapestry5.services.TransformMethod;
+import org.apache.tapestry5.services.TransformMethodSignature;
+import org.slf4j.Logger;
+
+/**
+ * A re-implementation of {@link ClassTransformation} around an instance of
{@link PlasticClass}, acting as a bridge
+ * for code written against the 5.2 and earlier APIs to work with the 5.3 API.
+ *
+ * @since 5.3.0
+ */
+@SuppressWarnings("deprecation")
+public class BridgeClassTransformation implements ClassTransformation
+{
+ private final PlasticClass plasticClass;
+
+ private final MutableComponentModel model;
+
+ private static <T> ComputedValue<T> toComputedValue(final
ComponentValueProvider<T> provider)
+ {
+ return new ComputedValue<T>()
+ {
+ public T get(InstanceContext context)
+ {
+ ComponentResources resources =
context.get(ComponentResources.class);
+
+ return provider.get(resources);
+ }
+ };
+ }
+
+ private static class BridgeTransformField implements TransformField
+ {
+ private final PlasticField plasticField;
+
+ public BridgeTransformField(PlasticField plasticField)
+ {
+ this.plasticField = plasticField;
+ }
+
+ public int compareTo(TransformField o)
+ {
+ throw new IllegalStateException("compareTo() not yet
implemented.");
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+ {
+ return plasticField.getAnnotation(annotationClass);
+ }
+
+ public String getName()
+ {
+ return plasticField.getName();
+ }
+
+ public String getType()
+ {
+ return plasticField.getTypeName();
+ }
+
+ public String getSignature()
+ {
+ throw new IllegalStateException("getSignature() not yet
implemented.");
+ }
+
+ public void claim(Object tag)
+ {
+ plasticField.claim(tag);
+ }
+
+ public void replaceAccess(final
ComponentValueProvider<FieldValueConduit> conduitProvider)
+ {
+ throw new IllegalStateException("replaceAccess() not yet
implemented.");
+ }
+
+ public void replaceAccess(TransformField conduitField)
+ {
+ throw new IllegalStateException("replaceAccess() not yet
implemented.");
+ }
+
+ public void replaceAccess(final FieldValueConduit conduit)
+ {
+ plasticField.setConduit(new FieldConduit()
+ {
+ public Object get(InstanceContext context)
+ {
+ return conduit.get();
+ }
+
+ public void set(InstanceContext context, Object newValue)
+ {
+ conduit.set(newValue);
+ }
+ });
+ }
+
+ public int getModifiers()
+ {
+ throw new IllegalStateException("getModifiers() not yet
implemented.");
+ }
+
+ public void inject(Object value)
+ {
+ plasticField.inject(value);
+ }
+
+ public <T> void injectIndirect(ComponentValueProvider<T> provider)
+ {
+ plasticField.injectComputed(toComputedValue(provider));
+ }
+
+ public FieldAccess getAccess()
+ {
+ final FieldHandle handle = plasticField.getHandle();
+
+ return new FieldAccess()
+ {
+
+ public void write(Object instance, Object value)
+ {
+ handle.set(instance, value);
+ }
+
+ public Object read(Object instance)
+ {
+ return handle.get(instance);
+ }
+ };
+ }
+ }
+
+ private static Mapper<PlasticField, TransformField> TO_TRANSFORM_FIELD =
new Mapper<PlasticField, TransformField>()
+ {
+ public TransformField map(PlasticField element)
+ {
+ return new BridgeTransformField(element);
+ }
+ };
+
+ private static class BridgeTransformMethod implements TransformMethod
+ {
+ private final PlasticMethod plasticMethod;
+
+ public BridgeTransformMethod(PlasticMethod plasticMethod)
+ {
+ this.plasticMethod = plasticMethod;
+ }
+
+ public int compareTo(TransformMethod o)
+ {
+ throw new IllegalStateException("compareTo() not yet
implemented.");
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+ {
+ return plasticMethod.getAnnotation(annotationClass);
+ }
+
+ public TransformMethodSignature getSignature()
+ {
+ throw new IllegalStateException("getSignature() not yet
implemented.");
+ }
+
+ public String getName()
+ {
+ return plasticMethod.getDescription().methodName;
+ }
+
+ public MethodAccess getAccess()
+ {
+ final MethodHandle handle = plasticMethod.getHandle();
+
+ return new MethodAccess()
+ {
+ public MethodInvocationResult invoke(Object target, Object...
arguments)
+ {
+ final org.apache.tapestry5.plastic.MethodInvocationResult
plasticResult = handle.invoke(target,
+ arguments);
+
+ return new MethodInvocationResult()
+ {
+ public void rethrow()
+ {
+ plasticResult.rethrow();
+ }
+
+ public boolean isFail()
+ {
+ return plasticResult.didThrowCheckedException();
+ }
+
+ public <T extends Throwable> T getThrown(Class<T>
throwableClass)
+ {
+ return
plasticResult.getCheckedException(throwableClass);
+ }
+
+ public Object getReturnValue()
+ {
+ return plasticResult.getReturnValue();
+ }
+ };
+ }
+ };
+ }
+
+ public void addAdvice(final ComponentMethodAdvice advice)
+ {
+ MethodAdvice plasticAdvice = new MethodAdvice()
+ {
+ public void advise(final MethodInvocation invocation)
+ {
+ advice.advise(new ComponentMethodInvocation()
+ {
+ public ComponentResources getComponentResources()
+ {
+ return
invocation.getInstanceContext().get(ComponentResources.class);
+ }
+
+ public void rethrow()
+ {
+ invocation.rethrow();
+ }
+
+ public void proceed()
+ {
+ invocation.proceed();
+ }
+
+ public void overrideThrown(Exception thrown)
+ {
+ invocation.setCheckedException(thrown);
+ }
+
+ public void overrideResult(Object newResult)
+ {
+ invocation.setReturnValue(newResult);
+ }
+
+ public void override(int index, Object newParameter)
+ {
+ invocation.setParameter(index, newParameter);
+ }
+
+ public boolean isFail()
+ {
+ return invocation.didThrowCheckedException();
+ }
+
+ public <T extends Throwable> T getThrown(Class<T>
throwableClass)
+ {
+ return
invocation.getCheckedException(throwableClass);
+ }
+
+ public Class getResultType()
+ {
+ return invocation.getReturnType();
+ }
+
+ public Object getResult()
+ {
+ return invocation.getReturnValue();
+ }
+
+ public Class getParameterType(int index)
+ {
+ return invocation.getParameterType(index);
+ }
+
+ public int getParameterCount()
+ {
+ return invocation.getParameterCount();
+ }
+
+ public Object getParameter(int index)
+ {
+ return invocation.getParameter(index);
+ }
+
+ public String getMethodName()
+ {
+ return invocation.getMethodName();
+ }
+
+ public <T extends Annotation> T
getMethodAnnotation(Class<T> annotationClass)
+ {
+ return invocation.getAnnotation(annotationClass);
+ }
+
+ public Component getInstance()
+ {
+ return (Component) invocation.getInstance();
+ }
+ });
+ }
+ };
+
+ plasticMethod.addAdvice(plasticAdvice);
+ }
+
+ public void addOperationBefore(final ComponentInstanceOperation
operation)
+ {
+ addAdvice(new ComponentMethodAdvice()
+ {
+ public void advise(ComponentMethodInvocation invocation)
+ {
+ operation.invoke(invocation.getInstance());
+
+ invocation.proceed();
+ }
+ });
+ }
+
+ public void addOperationAfter(final ComponentInstanceOperation
operation)
+ {
+ addAdvice(new ComponentMethodAdvice()
+ {
+ public void advise(ComponentMethodInvocation invocation)
+ {
+ invocation.proceed();
+
+ operation.invoke(invocation.getInstance());
+ }
+ });
+ }
+
+ public String getMethodIdentifier()
+ {
+ throw new IllegalStateException("getMethodIdentifer() not yet
implemented");
+ }
+
+ public boolean isOverride()
+ {
+ throw new IllegalStateException("isOverride() not yet
implemented");
+ }
+
+ public <A extends Annotation> A getParameterAnnotation(int index,
Class<A> annotationType)
+ {
+ return
plasticMethod.getParameters().get(index).getAnnotation(annotationType);
+ }
+
+ }
+
+ private static final Mapper<PlasticMethod, TransformMethod>
TO_TRANSFORM_METHOD = new Mapper<PlasticMethod, TransformMethod>()
+ {
+ public TransformMethod map(PlasticMethod element)
+ {
+ return new BridgeTransformMethod(element);
+ }
+ };
+
+ public BridgeClassTransformation(PlasticClass plasticClass,
MutableComponentModel model)
+ {
+ this.plasticClass = plasticClass;
+ this.model = model;
+ }
+
+ public <T extends Annotation> T getAnnotation(Class<T> annotationClass)
+ {
+ return plasticClass.getAnnotation(annotationClass);
+ }
+
+ public String getClassName()
+ {
+ return plasticClass.getClassName();
+ }
+
+ public String newMemberName(String suggested)
+ {
+ return newMemberName("_",
PlasticInternalUtils.toPropertyName(suggested));
+ }
+
+ public String newMemberName(String prefix, String baseName)
+ {
+ return new
StringBuilder(prefix).append(PlasticUtils.nextUID()).append(baseName).toString();
+ }
+
+ public List<TransformField> matchFieldsWithAnnotation(Class<? extends
Annotation> annotationClass)
+ {
+ return
F.flow(plasticClass.getFieldsWithAnnotation(annotationClass)).map(TO_TRANSFORM_FIELD).toList();
+ }
+
+ public List<TransformMethod> matchMethods(Predicate<TransformMethod>
predicate)
+ {
+ return
F.flow(plasticClass.getMethods()).map(TO_TRANSFORM_METHOD).filter(predicate).toList();
+ }
+
+ public List<TransformMethod> matchMethodsWithAnnotation(Class<? extends
Annotation> annotationType)
+ {
+ return
F.flow(plasticClass.getMethodsWithAnnotation(annotationType)).map(TO_TRANSFORM_METHOD).toList();
+ }
+
+ public List<TransformField> matchFields(Predicate<TransformField>
predicate)
+ {
+ return
F.flow(plasticClass.getUnclaimedFields()).map(TO_TRANSFORM_FIELD).filter(predicate).toList();
+ }
+
+ public TransformField getField(String fieldName)
+ {
+ throw new IllegalArgumentException("getField() not yet implemented.");
+ }
+
+ public List<TransformField> matchUnclaimedFields()
+ {
+ return
F.flow(plasticClass.getUnclaimedFields()).map(TO_TRANSFORM_FIELD).toList();
+ }
+
+ public boolean isField(String fieldName)
+ {
+ throw new IllegalArgumentException("isField() not yet implemented.");
+ }
+
+ public TransformField createField(int modifiers, String type, String
suggestedName)
+ {
+ // TODO: modifiers are ignored
+
+ PlasticField newField = plasticClass.introduceField(type,
suggestedName);
+
+ return new BridgeTransformField(newField);
+ }
+
+ public String addInjectedField(Class type, String suggestedName, Object
value)
+ {
+ // TODO: The injected field is not actually protected or shared
+
+ PlasticField field = plasticClass.introduceField(type,
suggestedName).inject(value);
+
+ return field.getName();
+ }
+
+ public <T> TransformField addIndirectInjectedField(Class<T> type, String
suggestedName,
+ ComponentValueProvider<T> provider)
+ {
+
+ PlasticField field = plasticClass.introduceField(type,
suggestedName).injectComputed(toComputedValue(provider));
+
+ return new BridgeTransformField(field);
+ }
+
+ public void addImplementedInterface(Class interfaceClass)
+ {
+ plasticClass.introduceInterface(interfaceClass);
+ }
+
+ public Class toClass(String type)
+ {
+ throw new IllegalArgumentException("toClass() not yet implemented.");
+ }
+
+ public Logger getLogger()
+ {
+ return model.getLogger();
+ }
+
+ public boolean isRootTransformation()
+ {
+ throw new IllegalArgumentException("isRootTransformation() not yet
implemented.");
+ }
+
+ public TransformMethod getOrCreateMethod(TransformMethodSignature
signature)
+ {
+ MethodDescription md = new MethodDescription(signature.getModifiers(),
signature.getReturnType(),
+ signature.getMethodName(), signature.getParameterTypes(),
signature.getExceptionTypes());
+
+ PlasticMethod plasticMethod = plasticClass.introduceMethod(md);
+
+ return new BridgeTransformMethod(plasticMethod);
+ }
+
+ public boolean isDeclaredMethod(TransformMethodSignature signature)
+ {
+ throw new IllegalArgumentException("isDeclaredMethod() not yet
implemented.");
+ }
+
+ // TODO: This is very handy, there should be an additional object passed
around that encapsulates
+ // this kind of logic.
+
+ public void addComponentEventHandler(String eventType, int
minContextValues, String methodDescription,
+ ComponentEventHandler handler)
+ {
+ assert InternalUtils.isNonBlank(eventType);
+ assert InternalUtils.isNonBlank(methodDescription);
+ assert handler != null;
+
+ model.addEventHandler(eventType);
+
+
getOrCreateMethod(TransformConstants.DISPATCH_COMPONENT_EVENT).addAdvice(
+ createEventHandlerAdvice(eventType, minContextValues,
methodDescription, handler));
+
+ }
+
+ private static ComponentMethodAdvice createEventHandlerAdvice(final String
eventType, final int minContextValues,
+ final String methodDescription, final ComponentEventHandler
handler)
+ {
+ return new ComponentMethodAdvice()
+ {
+ public void advise(ComponentMethodInvocation invocation)
+ {
+ // Invoke the super-class implementation first.
+
+ invocation.proceed();
+
+ ComponentEvent event = (ComponentEvent)
invocation.getParameter(0);
+
+ if (!event.isAborted() && event.matches(eventType, "",
minContextValues))
+ {
+ event.setMethodDescription(methodDescription);
+
+ handler.handleEvent(invocation.getInstance(), event);
+
+ // Ensure that the caller knows that some event handler
method
+ // was invoked.
+ invocation.overrideResult(true);
+ }
+ }
+ };
+ }
+
+}
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/CCTWToCCTW2Coercion.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/CCTWToCCTW2Coercion.java?rev=1097981&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/CCTWToCCTW2Coercion.java
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/transform/CCTWToCCTW2Coercion.java
Fri Apr 29 22:53:38 2011
@@ -0,0 +1,43 @@
+// Copyright 2011 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.internal.transform;
+
+import org.apache.tapestry5.ioc.services.Coercion;
+import org.apache.tapestry5.ioc.services.CoercionTuple;
+import org.apache.tapestry5.model.MutableComponentModel;
+import org.apache.tapestry5.plastic.PlasticClass;
+import org.apache.tapestry5.services.ClassTransformation;
+import org.apache.tapestry5.services.ComponentClassTransformWorker;
+import org.apache.tapestry5.services.ComponentClassTransformWorker2;
+
+@SuppressWarnings("deprecation")
+public class CCTWToCCTW2Coercion implements
Coercion<ComponentClassTransformWorker, ComponentClassTransformWorker2>
+{
+ public ComponentClassTransformWorker2 coerce(final
ComponentClassTransformWorker oldStyleWorker)
+ {
+ return new ComponentClassTransformWorker2()
+ {
+ public void transform(PlasticClass plasticClass,
MutableComponentModel model)
+ {
+ ClassTransformation ct = new
BridgeClassTransformation(plasticClass, model);
+
+ oldStyleWorker.transform(ct, model);
+ }
+ };
+ }
+
+ public static final CoercionTuple<ComponentClassTransformWorker,
ComponentClassTransformWorker2> TUPLE = new
CoercionTuple<ComponentClassTransformWorker, ComponentClassTransformWorker2>(
+ ComponentClassTransformWorker.class,
ComponentClassTransformWorker2.class, new CCTWToCCTW2Coercion());
+}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ClassTransformation.java
Fri Apr 29 22:53:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2006, 2007, 2008, 2010 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -21,6 +21,7 @@ import org.apache.tapestry5.ComponentRes
import org.apache.tapestry5.func.Predicate;
import org.apache.tapestry5.ioc.AnnotationProvider;
import org.apache.tapestry5.model.MutableComponentModel;
+import org.apache.tapestry5.plastic.PlasticClass;
import org.apache.tapestry5.runtime.Component;
import org.apache.tapestry5.runtime.Event;
import org.slf4j.Logger;
@@ -55,6 +56,8 @@ import org.slf4j.Logger;
*
* @see
org.apache.tapestry5.services.TapestryModule#contributeComponentClassTransformWorker(org.apache.tapestry5.ioc.OrderedConfiguration,
* org.apache.tapestry5.ioc.ObjectLocator, InjectionProvider,
ComponentClassResolver)
+ * @deprecated In 5.3
+ * @see {@link PlasticClass}
*/
public interface ClassTransformation extends AnnotationProvider
{
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker.java
Fri Apr 29 22:53:38 2011
@@ -1,10 +1,10 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2011 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.
// You may obtain a copy of the License at
//
-// http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@@ -18,14 +18,18 @@ import org.apache.tapestry5.model.Mutabl
/**
* Interface for a set of objects that can perform component class
transformations. Implementations should be
- * multithreaded, ideally they should be stateless (all necessary state can be
stored in the {@link
- * org.apache.tapestry5.services.ClassTransformation}).
+ * multithreaded, ideally they should be stateless (all necessary state can be
stored in the
+ * {@link org.apache.tapestry5.services.ClassTransformation}).
+ *
+ * @deprecated In 5.3
+ * @see {@link ComponentClassTransformWorker2}
*/
public interface ComponentClassTransformWorker
{
/**
- * Invoked to perform a transformation on an as-yet unloaded component
class, represented by the {@link
- * ClassTransformation} instance. In some cases, the worker may make
changes to the component model -- for example,
+ * Invoked to perform a transformation on an as-yet unloaded component
class, represented by the
+ * {@link ClassTransformation} instance. In some cases, the worker may
make changes to the component model -- for
+ * example,
* a worker that deals with parameters may update the model to reflect
those parameters.
*/
void transform(ClassTransformation transformation, MutableComponentModel
model);
Added:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker2.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker2.java?rev=1097981&view=auto
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker2.java
(added)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentClassTransformWorker2.java
Fri Apr 29 22:53:38 2011
@@ -0,0 +1,37 @@
+// Copyright 2011 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.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry5.services;
+
+import org.apache.tapestry5.ioc.annotations.UsesOrderedConfiguration;
+import org.apache.tapestry5.ioc.services.ChainBuilder;
+import org.apache.tapestry5.model.MutableComponentModel;
+import org.apache.tapestry5.plastic.PlasticClass;
+
+/**
+ * Interface for a set of objects that can perform transformation of component
classes. Implementations should
+ * be thread safe and ideally stateless (all necessary state can be stored
inside the {@link PlasticClass}).
+ * <p>
+ * The ComponentClassTransformWorker service uses an ordered configuration of
these works as a {@linkplain ChainBuilder
+ * chain of command}. For compatibility with the code compiled for Tapestry
5.2, contributions of type
+ * {@link ComponentClassTransformWorker} are type coerced into this type
automatically.
+ *
+ * @since 5.3
+ * @see {@link PlasticClass}
+ */
+@UsesOrderedConfiguration(ComponentClassTransformWorker2.class)
+public interface ComponentClassTransformWorker2
+{
+ void transform(PlasticClass plasticClass, MutableComponentModel model);
+}
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodAdvice.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodAdvice.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodAdvice.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodAdvice.java
Fri Apr 29 22:53:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2008, 2010 The Apache Software Foundation
+// Copyright 2008, 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,6 +14,10 @@
package org.apache.tapestry5.services;
+import org.apache.tapestry5.plastic.MethodAdvice;
+import org.apache.tapestry5.plastic.PlasticClass;
+import org.apache.tapestry5.plastic.PlasticMethod;
+
/**
* An object that receives control around an "advised" method of a component.
The advise can query or even replace
* method parameters. After invoking {@link
org.apache.tapestry5.services.ComponentMethodInvocation#proceed()}, the
@@ -21,6 +25,8 @@ package org.apache.tapestry5.services;
*
* @see TransformMethod#addAdvice(ComponentMethodAdvice)
* @see ComponentInstanceOperation
+ * @deprecated Deprecated in 5.3
+ * @see {@link PlasticClass}, {@link PlasticMethod}, {@link MethodAdvice}
*/
public interface ComponentMethodAdvice
{
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodInvocation.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodInvocation.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodInvocation.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentMethodInvocation.java
Fri Apr 29 22:53:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2008 The Apache Software Foundation
+// Copyright 2008, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,6 +15,10 @@
package org.apache.tapestry5.services;
import org.apache.tapestry5.ioc.Invocation;
+import org.apache.tapestry5.plastic.MethodAdvice;
+import org.apache.tapestry5.plastic.MethodInvocation;
+import org.apache.tapestry5.plastic.PlasticClass;
+import org.apache.tapestry5.plastic.PlasticMethod;
import org.apache.tapestry5.runtime.Component;
import org.apache.tapestry5.runtime.ComponentResourcesAware;
@@ -22,6 +26,9 @@ import org.apache.tapestry5.runtime.Comp
* Encapsulates the parameters, thrown exceptions, and result of a method
invocation, allowing a
* {@link org.apache.tapestry5.services.ComponentMethodAdvice} to encapsulate
the invocation. Extends Invocation with
* the {@link org.apache.tapestry5.ComponentResources} of the component for
which a method is being advised.
+ *
+ * @deprecated Deprecated in 5.3
+ * @see {@link PlasticClass}, {@link PlasticMethod}, {@link MethodAdvice},
{@link MethodInvocation}
*/
public interface ComponentMethodInvocation extends Invocation,
ComponentResourcesAware
{
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentValueProvider.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentValueProvider.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentValueProvider.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/ComponentValueProvider.java
Fri Apr 29 22:53:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,17 +15,20 @@
package org.apache.tapestry5.services;
import org.apache.tapestry5.ComponentResources;
+import org.apache.tapestry5.plastic.ComputedValue;
+import org.apache.tapestry5.plastic.PlasticField;
/**
* An object used to provide a value of a specific type to a component
(represented by an
* instance of {@link ComponentResources}). The provider will create and
return the value
* (some providers may be smart enough to cache a value, but should be
implemented in
- * a thread-safe manner). Often the provider is an inner class of a
- * {@link ComponentClassTransformWorker}.
+ * a thread-safe manner). Often the provider is an inner class of a {@link
ComponentClassTransformWorker}.
*
* @param <T>
* type of object provided
* @since 5.2.0
+ * @deprecated Deprecated in 5.3.0, using Plastic equivalents
+ * @see {@link PlasticField}, {@link ComputedValue}
*/
public interface ComponentValueProvider<T>
{
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/MethodAccess.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/MethodAccess.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/MethodAccess.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/MethodAccess.java
Fri Apr 29 22:53:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,6 +14,10 @@
package org.apache.tapestry5.services;
+import org.apache.tapestry5.plastic.MethodHandle;
+import org.apache.tapestry5.plastic.PlasticClass;
+import org.apache.tapestry5.plastic.PlasticMethod;
+
/**
* Represents a bridge to an object method, when that method may not be
public. A MethodAccess object
* encapsulates the approach for invoking the method and capturing the result
(either the return value,
@@ -21,6 +25,8 @@ package org.apache.tapestry5.services;
*
* @since 5.2.0
* @see TransformMethod#getAccess()
+ * @deprecated Deprecated in 5.3.0
+ * @see {@link PlasticClass}, {@link {@link PlasticMethod}, {@link
MethodHandle}
*/
public interface MethodAccess
{
Modified:
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TransformField.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TransformField.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TransformField.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/services/TransformField.java
Fri Apr 29 22:53:38 2011
@@ -41,7 +41,7 @@ public interface TransformField extends
String getType();
/**
- * Returns the fields fully qualified generic type, or null if not defined.
+ * Returns the field's fully qualified generic type, or null if not
defined.
* (in Java source syntax, i.e., "()Ljava/util/List<Ljava/lang/String;>;"
*
* @since 5.3.0
Modified:
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/FieldValueConduit.java
URL:
http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/FieldValueConduit.java?rev=1097981&r1=1097980&r2=1097981&view=diff
==============================================================================
---
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/FieldValueConduit.java
(original)
+++
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/FieldValueConduit.java
Fri Apr 29 22:53:38 2011
@@ -1,4 +1,4 @@
-// Copyright 2010 The Apache Software Foundation
+// Copyright 2010, 2011 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,11 +14,15 @@
package org.apache.tapestry5.ioc.services;
+import org.apache.tapestry5.plastic.FieldConduit;
+import org.apache.tapestry5.plastic.PlasticField;
/**
* Used as a replacement for a field.
*
* @since 5.2.0
+ * @deprecated Deprecated in 5.3.0, using Plastic equivalents
+ * @see {@link PlasticField}, {@link FieldConduit}
*/
public interface FieldValueConduit
{