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 2011/04/30 02:16:27 UTC
svn commit: r1098029 - in /tapestry/tapestry5/trunk:
plastic/src/main/java/org/apache/tapestry5/plastic/
tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/
tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/
tapestry-ioc/src/main/j...
Author: hlship
Date: Sat Apr 30 00:16:27 2011
New Revision: 1098029
URL: http://svn.apache.org/viewvc?rev=1098029&view=rev
Log:
TAP5-853: Mark more classes as deprecated and cleanup some imports
Modified:
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodAdvice.java
tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodInvocation.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/Invocation.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdvice.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdviceReceiver.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectDecoratorImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectInterceptorBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/BridgeBuilder.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PipelineBuilderImpl.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java
tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ClassFabUtils.java
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodAdvice.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodAdvice.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodAdvice.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodAdvice.java Sat Apr 30 00:16:27 2011
@@ -23,9 +23,14 @@ package org.apache.tapestry5.plastic;
public interface MethodAdvice
{
/**
- * Advice the method, usually invoking {@link MethodInvocation#proceed()} at some point.
+ * Advise the method, usually invoking {@link MethodInvocation#proceed()} at some point.
+ * The advice is free to inspect and even replace parameters. Most
+ * Aspects will then invoke {@link MethodInvocation#proceed()}. The advice may then inspect and
+ * replace any checked thrown exceptions. Some advice (for example, caching) may selectively decide to bypass the
+ * invocation entirely, and instead invoke some other method or otherwise set a return value or thrown exception.
*
* @param invocation
+ * identifies the method being invoked, including parameters
*/
void advise(MethodInvocation invocation);
}
Modified: tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodInvocation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodInvocation.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodInvocation.java (original)
+++ tapestry/tapestry5/trunk/plastic/src/main/java/org/apache/tapestry5/plastic/MethodInvocation.java Sat Apr 30 00:16:27 2011
@@ -18,6 +18,8 @@ package org.apache.tapestry5.plastic;
* A representation of the invocation of a method that allows the behavior of the method to be advised: either by
* changing parameter values, or by changing the return value, or by catch or throwing different exceptions. Provides
* access to annotations on the advised method.
+ *
+ * @see MethodAdvice
*/
public interface MethodInvocation extends MethodInvocationResult, AnnotationAccess
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/Invocation.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/Invocation.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/Invocation.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/Invocation.java Sat Apr 30 00:16:27 2011
@@ -16,8 +16,12 @@ package org.apache.tapestry5.ioc;
import java.lang.annotation.Annotation;
+import org.apache.tapestry5.plastic.MethodInvocation;
+
/**
* A method invocation passed to a {@link org.apache.tapestry5.ioc.MethodAdvice}.
+ *
+ * @deprecated Deprecated in 5.3, to be removed in 5.4. Replaced with {@link MethodInvocation}.
*/
public interface Invocation
{
@@ -106,16 +110,16 @@ public interface Invocation
* Overrides the result. Clears the thrown exception (if any).
*/
void overrideResult(Object newResult);
-
+
/**
* Returns the annotation, placed on the method being invoked, for the specified type. If
* such an annotation is present, else null.
-
- * @param annotationClass the Class object corresponding to the
- * annotation type
+ *
+ * @param annotationClass
+ * the Class object corresponding to the
+ * annotation type
* @return method's annotation for the specified annotation type if
- * present on this element, else null
- *
+ * present on this element, else null
* @since 5.3.0
*/
<T extends Annotation> T getMethodAnnotation(Class<T> annotationClass);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdvice.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdvice.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdvice.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdvice.java Sat Apr 30 00:16:27 2011
@@ -1,10 +1,10 @@
-// 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.
// 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,18 +18,20 @@ package org.apache.tapestry5.ioc;
* For Tapestry IoC, Aspects provide a limited amount of advise, i.e., advising method invocations. That's the only join
* point available (method invocations of service interface methods); full AOP systems such as AspectJ can do much, much
* more, such as advising field access and even object construction.
- *
+ *
* @see org.apache.tapestry5.ioc.services.AspectDecorator
+ * @deprecated Deprecated in 5.3, to be removed in 5.4. Use {@link org.apache.tapestry5.plastic.MethodAdvice}.
*/
public interface MethodAdvice
{
/**
- * Allows the Aspect to advise the invocation. The Aspect is free to inspect and even replace parameters. Most
- * Aspects will then invoke {@link org.apache.tapestry5.ioc.Invocation#proceed()}. The Aspect may then inspect and
+ * Allows the Aspect to advise the invocation. The Aspect is free to inspect and even replace parameters. Most
+ * Aspects will then invoke {@link org.apache.tapestry5.ioc.Invocation#proceed()}. The Aspect may then inspect and
* replace any checked thrown exceptions. Some Aspects (for example, caching) may selectively decide to bypass the
* invocation entirely, and instead invoke some other method or otherwise set a return value or thrown exception.
- *
- * @param invocation to advise
+ *
+ * @param invocation
+ * to advise
*/
void advise(Invocation invocation);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdviceReceiver.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdviceReceiver.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdviceReceiver.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/MethodAdviceReceiver.java Sat Apr 30 00:16:27 2011
@@ -30,15 +30,39 @@ public interface MethodAdviceReceiver ex
* advice is allowed for a single method; the advice will be executed in the order it is added.
* @param advice
* the advice for this particular method. Advice must be threadsafe.
+ * @deprecated Deprecated in 5.3, to be removed in 5.4. Replaced with
+ * {@link #adviseMethod(Method, org.apache.tapestry5.plastic.MethodAdvice)}
*/
void adviseMethod(Method method, MethodAdvice advice);
/**
* Advises <em>all</em> methods of the interface with the given advice.
+ *
+ * @deprecated Deprecated in 5.3, to be removed in 5.4. Replaced with
+ * {@link #adviseAllMethods(org.apache.tapestry5.plastic.MethodAdvice)}.
*/
void adviseAllMethods(MethodAdvice advice);
/**
+ * Adds advice for a specific method of the aspect interceptor being constructed.
+ *
+ * @param method
+ * method (of the interface for which an interceptor is being constructed) to be advised. Multiple
+ * advice is allowed for a single method; the advice will be executed in the order it is added.
+ * @param advice
+ * the advice for this particular method. Advice must be threadsafe.
+ * @since 5.3.0
+ */
+ void adviseMethod(Method method, org.apache.tapestry5.plastic.MethodAdvice advice);
+
+ /**
+ * Advises <em>all</em> methods of the interface with the given advice.
+ *
+ * @since 5.3.0
+ */
+ void adviseAllMethods(org.apache.tapestry5.plastic.MethodAdvice advice);
+
+ /**
* Returns the interface for which methods may be advised.
*
* @see org.apache.tapestry5.ioc.services.MethodIterator
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectDecoratorImpl.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectDecoratorImpl.java Sat Apr 30 00:16:27 2011
@@ -76,6 +76,16 @@ public class AspectDecoratorImpl impleme
getBuilder().adviseAllMethods(advice);
}
+ public void adviseMethod(Method method, org.apache.tapestry5.plastic.MethodAdvice advice)
+ {
+ getBuilder().adviseMethod(method, advice);
+ }
+
+ public void adviseAllMethods(org.apache.tapestry5.plastic.MethodAdvice advice)
+ {
+ getBuilder().adviseAllMethods(advice);
+ }
+
public Class getInterface()
{
return serviceInterface;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectInterceptorBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectInterceptorBuilderImpl.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectInterceptorBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/AspectInterceptorBuilderImpl.java Sat Apr 30 00:16:27 2011
@@ -66,15 +66,10 @@ public class AspectInterceptorBuilderImp
assert method != null;
assert advice != null;
- if (!allMethods.contains(method))
- throw new IllegalArgumentException(String.format("Method %s is not defined for interface %s.", method,
- serviceInterface));
-
AnnotationProvider methodAnnotationProvider = getMethodAnnotationProvider(method.getName(),
method.getParameterTypes());
- plasticClass.introduceMethod(method).addAdvice(
- InternalUtils.toPlasticMethodAdvice(advice, methodAnnotationProvider));
+ adviseMethod(method, InternalUtils.toPlasticMethodAdvice(advice, methodAnnotationProvider));
}
public void adviseAllMethods(MethodAdvice advice)
@@ -83,6 +78,26 @@ public class AspectInterceptorBuilderImp
adviseMethod(m, advice);
}
+ public void adviseMethod(Method method, org.apache.tapestry5.plastic.MethodAdvice advice)
+ {
+ assert method != null;
+ assert advice != null;
+
+ if (!allMethods.contains(method))
+ throw new IllegalArgumentException(String.format("Method %s is not defined for interface %s.", method,
+ serviceInterface));
+
+ plasticClass.introduceMethod(method).addAdvice(advice);
+ }
+
+ public void adviseAllMethods(org.apache.tapestry5.plastic.MethodAdvice advice)
+ {
+ for (Method m : serviceInterface.getMethods())
+ {
+ adviseMethod(m, advice);
+ }
+ }
+
public Class getInterface()
{
return serviceInterface;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/BridgeBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/BridgeBuilder.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/BridgeBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/BridgeBuilder.java Sat Apr 30 00:16:27 2011
@@ -14,17 +14,10 @@
package org.apache.tapestry5.ioc.internal.services;
-import static java.lang.String.format;
-import static org.apache.tapestry5.ioc.internal.util.CollectionFactory.newList;
-
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Modifier;
import java.util.Iterator;
import java.util.List;
import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
-import org.apache.tapestry5.ioc.services.ClassFab;
-import org.apache.tapestry5.ioc.services.ClassFactory;
import org.apache.tapestry5.ioc.services.MethodIterator;
import org.apache.tapestry5.ioc.services.MethodSignature;
import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
@@ -56,12 +49,6 @@ class BridgeBuilder<S, F>
private ClassInstantiator<S> instantiator;
- BridgeBuilder(Logger logger, Class<S> serviceInterface, Class<F> filterInterface, ClassFactory classFactory,
- PlasticProxyFactory proxyFactory)
- {
- this(logger, serviceInterface, filterInterface, proxyFactory);
- }
-
BridgeBuilder(Logger logger, Class<S> serviceInterface, Class<F> filterInterface, PlasticProxyFactory proxyFactory)
{
this.logger = logger;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PipelineBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PipelineBuilderImpl.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PipelineBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/internal/services/PipelineBuilderImpl.java Sat Apr 30 00:16:27 2011
@@ -14,15 +14,14 @@
package org.apache.tapestry5.ioc.internal.services;
+import java.util.List;
+
import org.apache.tapestry5.ioc.services.Builtin;
-import org.apache.tapestry5.ioc.services.ClassFactory;
import org.apache.tapestry5.ioc.services.DefaultImplementationBuilder;
import org.apache.tapestry5.ioc.services.PipelineBuilder;
import org.apache.tapestry5.ioc.services.PlasticProxyFactory;
import org.slf4j.Logger;
-import java.util.List;
-
public class PipelineBuilderImpl implements PipelineBuilder
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/AspectDecorator.java Sat Apr 30 00:16:27 2011
@@ -14,8 +14,8 @@
package org.apache.tapestry5.ioc.services;
-import org.apache.tapestry5.ioc.MethodAdvice;
import org.apache.tapestry5.ioc.AnnotationAccess;
+import org.apache.tapestry5.ioc.MethodAdvice;
/**
* A decorator used to create an interceptor that delegates each method's invocation to an
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ClassFabUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ClassFabUtils.java?rev=1098029&r1=1098028&r2=1098029&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ClassFabUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/services/ClassFabUtils.java Sat Apr 30 00:16:27 2011
@@ -25,6 +25,8 @@ import org.apache.tapestry5.ioc.internal
/**
* Handy method useful when creating new classes using {@link org.apache.tapestry5.ioc.services.ClassFab}.
+ *
+ * @deprecated Deprecated in Tapestry 5.3, to be removed in 5.4 with no replacement
*/
@SuppressWarnings("all")
public final class ClassFabUtils