You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jc...@apache.org on 2008/02/23 16:49:49 UTC
svn commit: r630456 - in /commons/proper/proxy/trunk: ./
src/main/java/org/apache/commons/proxy/
src/main/java/org/apache/commons/proxy/exception/
src/main/java/org/apache/commons/proxy/factory/cglib/
src/main/java/org/apache/commons/proxy/factory/java...
Author: jcarman
Date: Sat Feb 23 07:49:47 2008
New Revision: 630456
URL: http://svn.apache.org/viewvc?rev=630456&view=rev
Log:
Merging changes done during 1.0 release work back into trunk.
Added:
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/exception/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/exception/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/cglib/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/cglib/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/javassist/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/factory/util/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/filter/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/interceptor/filter/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/interceptor/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/invoker/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/invoker/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/provider/package.html
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/remoting/package.html
- copied unchanged from r630425, commons/proper/proxy/branches/proxy-1.0-work/src/main/java/org/apache/commons/proxy/provider/remoting/package.html
Modified:
commons/proper/proxy/trunk/NOTICE.txt
commons/proper/proxy/trunk/RELEASE-NOTES.txt
commons/proper/proxy/trunk/pom.xml
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/Invocation.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistInvocation.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/MethodSignature.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/InterceptorChain.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/MethodFilter.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/filter/SimpleFilter.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java
commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java
commons/proper/proxy/trunk/src/site/xdoc/index.xml
Modified: commons/proper/proxy/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/NOTICE.txt?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/NOTICE.txt (original)
+++ commons/proper/proxy/trunk/NOTICE.txt Sat Feb 23 07:49:47 2008
@@ -1,5 +1,5 @@
Apache Commons Proxy
-Copyright 2006-2007 The Apache Software Foundation
+Copyright 2005-2008 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
Modified: commons/proper/proxy/trunk/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/RELEASE-NOTES.txt?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/RELEASE-NOTES.txt (original)
+++ commons/proper/proxy/trunk/RELEASE-NOTES.txt Sat Feb 23 07:49:47 2008
@@ -0,0 +1,31 @@
+ Apache Commons Proxy Package
+ Version 1.0
+ Release Notes
+
+
+INTRODUCTION:
+
+Apache Commons Proxy is a package of utility classes which facilitate the
+creation of dynamic proxies in Java.
+
+REQUIREMENTS:
+
+JDK1.4+
+
+NOTES:
+
+*** This is the initial release ***
+
+
+FEEDBACK:
+
+Open source works best when you give feedback:
+http://commons.apache.org/proxy/
+
+Please direct all bug reports to JIRA
+http://issues.apache.org/jira/browse/PROXY
+
+Or subscribe to the commons-user mailing list (please prefix email subject with [proxy])
+http://commons.apache.org/mail-lists.html
+
+The Commons-Proxy Team
\ No newline at end of file
Modified: commons/proper/proxy/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/pom.xml?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/pom.xml (original)
+++ commons/proper/proxy/trunk/pom.xml Sat Feb 23 07:49:47 2008
@@ -17,7 +17,8 @@
~ specific language governing permissions and limitations
~ under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.commons</groupId>
@@ -25,7 +26,8 @@
<version>7</version>
</parent>
<artifactId>commons-proxy</artifactId>
- <version>1.0-SNAPSHOT</version>
+ <version>1.1-SNAPSHOT</version>
+ <packaging>bundle</packaging>
<name>Commons Proxy</name>
<description>Java library for dynamic proxying</description>
<url>http://commons.apache.org/proxy/</url>
@@ -121,8 +123,23 @@
<tarLongFileMode>gnu</tarLongFileMode>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>1.2.1</version>
+ <extensions>true</extensions>
+ <configuration>
+ <excludeDependencies>true</excludeDependencies>
+ <instructions>
+ <_nouses>true</_nouses>
+ <Bundle-SymbolicName>org.apache.commons.proxy</Bundle-SymbolicName>
+ <Export-Package>org.apache.commons.*;version=${pom.version}</Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
</plugins>
</build>
+
<dependencies>
<dependency>
<groupId>cglib</groupId>
@@ -202,15 +219,26 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-changelog-plugin</artifactId>
- <version>2.1</version>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <configLocation>checkstyle.xml</configLocation>
+ </configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-checkstyle-plugin</artifactId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+
<configuration>
- <configLocation>checkstyle.xml</configLocation>
+ <linksource>true</linksource>
+ <links>
+ <link>http://java.sun.com/j2se/1.3/docs/api/</link>
+ <link>http://ws.apache.org/xmlrpc/apidocs/</link>
+ <link>http://www.csg.is.titech.ac.jp/~chiba/javassist/html</link>
+ <link>http://aopalliance.sourceforge.net/doc/</link>
+ <link>http://gee.cs.oswego.edu/dl/classes/</link>
+ </links>
</configuration>
+
</plugin>
</plugins>
</reporting>
@@ -222,5 +250,96 @@
<url>scp://people.apache.org/www/commons.apache.org/proper/proxy/</url>
</site>
</distributionManagement>
+
+ <properties>
+ <maven.compile.source>1.4</maven.compile.source>
+ <maven.compile.target>1.4</maven.compile.target>
+ <releaseManager>${user.name}</releaseManager>
+ </properties>
+
+ <profiles>
+ <profile>
+ <id>rc</id>
+ <distributionManagement>
+ <site>
+ <id>stagingSite</id>
+ <name>Release Candidate Staging Site</name>
+ <url>
+ ${commons.deployment.protocol}://people.apache.org/home/${releaseManager}/public_html/${artifactId}-${version}
+ </url>
+ </site>
+ </distributionManagement>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <configuration>
+ <passphrase>${gpg.passphrase}</passphrase>
+ </configuration>
+ <executions>
+ <execution>
+ <id>sign-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>sign</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <createChecksum>true</createChecksum>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-source-jar</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- Pass these arguments to the deploy plugin. -->
+ <arguments>-Prc</arguments>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>create-javadoc-jar</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <source>${maven.compile.source}</source>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/Invocation.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/Invocation.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/Invocation.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/Invocation.java Sat Feb 23 07:49:47 2008
@@ -27,8 +27,30 @@
*/
public interface Invocation
{
+ /**
+ * Returns the method being called.
+ * @return the method being called
+ */
public Method getMethod();
+
+ /**
+ * Returns the arguments being passed to this method invocation. Changes in the elements of this array will be
+ * propagated to the recipient of this invocation.
+ *
+ * @return the arguments being passed to this method invocation
+ */
public Object[] getArguments();
+
+ /**
+ * Returns the proxy object on which this invocation was invoked.
+ * @return the proxy object on which this invocation was invoked
+ */
public Object getProxy();
+
+ /**
+ * Called in order to let the invocation proceed.
+ * @return the return value of the invocation
+ * @throws Throwable any exception or error that was thrown as a result of this invocation
+ */
public Object proceed() throws Throwable;
}
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistInvocation.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistInvocation.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistInvocation.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistInvocation.java Sat Feb 23 07:49:47 2008
@@ -31,6 +31,10 @@
import java.util.WeakHashMap;
/**
+ * A <a href="http://www.jboss.org/products/javassist">Javassist</a>-based {@link Invocation} implementation. This
+ * class actually serves as the superclass for all <a href="http://www.jboss.org/products/javassist">Javassist</a>-based
+ * method invocations. Subclasses are dynamically created to deal with specific interface methods (they're hard-wired).
+ *
* @author James Carman
* @since 1.0
*/
@@ -137,7 +141,15 @@
return cache;
}
- public synchronized static Class getMethodInvocationClass( ClassLoader classLoader,
+ /**
+ * Returns a method invocation class specifically coded to invoke the supplied interface method.
+ *
+ * @param classLoader the classloader to use
+ * @param interfaceMethod the interface method
+ * @return a method invocation class specifically coded to invoke the supplied interface method
+ * @throws CannotCompileException if a compilation error occurs
+ */
+ synchronized static Class getMethodInvocationClass( ClassLoader classLoader,
Method interfaceMethod )
throws CannotCompileException
{
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/javassist/JavassistUtils.java Sat Feb 23 07:49:47 2008
@@ -30,10 +30,12 @@
import java.util.Set;
/**
+ * Some utility methods for dealing with Javassist. This class is not part of the public API!
+ *
* @author James Carman
* @since 1.0
*/
-public class JavassistUtils
+class JavassistUtils
{
//----------------------------------------------------------------------------------------------------------------------
// Fields
@@ -52,12 +54,26 @@
// Static Methods
//----------------------------------------------------------------------------------------------------------------------
+ /**
+ * Adds a field to a class.
+ *
+ * @param fieldType the field's type
+ * @param fieldName the field name
+ * @param enclosingClass the class receiving the new field
+ * @throws CannotCompileException if a compilation problem occurs
+ */
public static void addField( Class fieldType, String fieldName, CtClass enclosingClass )
throws CannotCompileException
{
enclosingClass.addField( new CtField( resolve( fieldType ), fieldName, enclosingClass ) );
}
+ /**
+ * Finds the {@link CtClass} corresponding to the Java {@link Class} passed in.
+ *
+ * @param clazz the Java {@link Class}
+ * @return the {@link CtClass}
+ */
public static CtClass resolve( Class clazz )
{
synchronized( classLoaders )
@@ -80,6 +96,12 @@
}
}
+ /**
+ * Adds interfaces to a {@link CtClass}
+ *
+ * @param ctClass the {@link CtClass}
+ * @param proxyClasses the interfaces
+ */
public static void addInterfaces( CtClass ctClass, Class[] proxyClasses )
{
for( int i = 0; i < proxyClasses.length; i++ )
@@ -89,16 +111,35 @@
}
}
+ /**
+ * Creates a new {@link CtClass} derived from the Java {@link Class} using the default base name.
+ *
+ * @param superclass the superclass
+ * @return the new derived {@link CtClass}
+ */
public static CtClass createClass( Class superclass )
{
return createClass( DEFAULT_BASE_NAME, superclass );
}
+ /**
+ * Creates a new {@link CtClass} derived from the Java {@link Class} using the supplied base name.
+ *
+ * @param baseName the base name
+ * @param superclass the superclass
+ * @return the new derived {@link CtClass}
+ */
public synchronized static CtClass createClass( String baseName, Class superclass )
{
return classPool.makeClass( baseName + "_" + classNumber++, resolve( superclass ) );
}
+ /**
+ * Resolves an array of Java {@link Class}es to an array of their corresponding {@link CtClass}es.
+ *
+ * @param classes the Java {@link Class}es
+ * @return the corresponding {@link CtClass}es
+ */
public static CtClass[] resolve( Class[] classes )
{
final CtClass[] ctClasses = new CtClass[classes.length];
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/AbstractSubclassingProxyFactory.java Sat Feb 23 07:49:47 2008
@@ -27,6 +27,8 @@
import java.util.List;
/**
+ * A useful superclass for a {@link ProxyFactory} which supports subclassing rather than merely implementing interfaces.
+ *
* @author James Carman
* @since 1.0
*/
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/MethodSignature.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/MethodSignature.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/MethodSignature.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/MethodSignature.java Sat Feb 23 07:49:47 2008
@@ -22,6 +22,8 @@
import java.util.List;
/**
+ * A class for capturing the signature of a method (its name and parameter types).
+ *
* @author James Carman
* @since 1.0
*/
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassCache.java Sat Feb 23 07:49:47 2008
@@ -23,6 +23,10 @@
import java.util.WeakHashMap;
/**
+ * A cache for storing implementation classes for proxies based on a specific type of {@link ProxyClassGenerator}. A
+ * proxy class cache ensures that there is only one class for every
+ * {@link ProxyClassGenerator}/{@link ClassLoader}/proxy class array combination.
+ *
* @author James Carman
* @since 1.0
*/
@@ -48,6 +52,15 @@
// Other Methods
//----------------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns the proxy class generated by the {@link ProxyClassGenerator} using the specified {@link ClassLoader} and
+ * array of proxy classes.
+ *
+ * @param classLoader the classloader
+ * @param proxyClasses the proxy classes
+ * @return the proxy class generated by the {@link ProxyClassGenerator} using the specified {@link ClassLoader} and
+ * array of proxy classes
+ */
public synchronized Class getProxyClass( ClassLoader classLoader, Class[] proxyClasses )
{
final Map classCache = getClassCache( classLoader );
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/factory/util/ProxyClassGenerator.java Sat Feb 23 07:49:47 2008
@@ -18,6 +18,8 @@
package org.apache.commons.proxy.factory.util;
/**
+ * A proxy class generator generates specific type of proxies (interceptor, invoker, etc.).
+ *
* @author James Carman
* @since 1.0
*/
@@ -27,6 +29,12 @@
// Other Methods
//----------------------------------------------------------------------------------------------------------------------
+ /**
+ * Generates a proxy class for the supplied {@link ClassLoader} and proxy classes.
+ * @param classLoader the classloader
+ * @param proxyClasses the proxy classes
+ * @return the dynamically generated proxy class
+ */
public Class generateProxyClass( ClassLoader classLoader, Class[] proxyClasses );
}
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/InterceptorChain.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/InterceptorChain.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/InterceptorChain.java Sat Feb 23 07:49:47 2008
@@ -24,7 +24,17 @@
/**
* An <code>InterceptorChain</code> assists with creating proxies which go through a series of
- * <code>Interceptors</code>.
+ * {@link Interceptor interceptors}.
+ *
+ * <pre>
+ * MyServiceInterface serviceImpl = ...;
+ * ProxyFactory factory = ...;
+ * Interceptor[] interceptors = ...;
+ * InterceptorChain chain = new InterceptorChain(interceptors);
+ * ObjectProvider provider = chain.createProxyProvider(factory, serviceImpl);
+ * MyServiceInterface serviceProxy = ( MyServiceInterface )provider.getObject();
+ * serviceProxy.someServiceMethod(...); // This will go through the interceptors!
+ * </pre>
*
* @author James Carman
* @since 1.0
@@ -61,17 +71,53 @@
return currentTarget;
}
+ /**
+ * Creates an {@link ObjectProvider} which will return a proxy that sends method invocations through this
+ * chain of interceptors and ultimately arrive at the supplied terminus object. The proxy will support all
+ * interfaces implemented by the terminus object. The thread context classloader will be used to generate the
+ * proxy class.
+ *
+ * @param proxyFactory the {@link ProxyFactory} to use to create the proxy
+ * @param terminus the terminus
+ * @return an {@link ObjectProvider} which will return a proxy that sends method invocations through this
+ * chain of interceptors and ultimately arrive at the supplied terminus object
+ */
public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, Object terminus )
{
return createProxyProvider( proxyFactory, terminus, null );
}
+ /**
+ * Creates an {@link ObjectProvider} which will return a proxy that sends method invocations through this
+ * chain of interceptors and ultimately arrive at the supplied terminus object. The proxy will support only
+ * the specified interfaces/classes. The thread context classloader will be used to generate the
+ * proxy class.
+ *
+ * @param proxyFactory the {@link ProxyFactory} to use to create the proxy
+ * @param terminus the terminus
+ * @param proxyClasses the interfaces to support
+ * @return an {@link ObjectProvider} which will return a proxy that sends method invocations through this
+ * chain of interceptors and ultimately arrive at the supplied terminus object
+ */
public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, Object terminus, Class[] proxyClasses )
{
return createProxyProvider( proxyFactory, Thread.currentThread().getContextClassLoader(), terminus,
proxyClasses );
}
+ /**
+ * Creates an {@link ObjectProvider} which will return a proxy that sends method invocations through this
+ * chain of interceptors and ultimately arrive at the supplied terminus object. The proxy will support only
+ * the specified interfaces/classes. The specified classloader will be used to generate the
+ * proxy class.
+ *
+ * @param proxyFactory the {@link ProxyFactory} to use to create the proxy
+ * @param classLoader the classloader to be used to generate the proxy class
+ * @param terminus the terminus
+ * @param proxyClasses the interfaces to support
+ * @return an {@link ObjectProvider} which will return a proxy that sends method invocations through this
+ * chain of interceptors and ultimately arrive at the supplied terminus object
+ */
public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus,
Class[] proxyClasses )
{
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/MethodFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/MethodFilter.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/MethodFilter.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/MethodFilter.java Sat Feb 23 07:49:47 2008
@@ -31,6 +31,11 @@
// Other Methods
//----------------------------------------------------------------------------------------------------------------------
+ /**
+ * Returns whether or not this filter accepts this method.
+ * @param method the method
+ * @return whether or not this filter accepts this method
+ */
public boolean accepts( Method method );
}
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/filter/SimpleFilter.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/filter/SimpleFilter.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/filter/SimpleFilter.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/interceptor/filter/SimpleFilter.java Sat Feb 23 07:49:47 2008
@@ -42,11 +42,18 @@
// Constructors
//----------------------------------------------------------------------------------------------------------------------
+ /**
+ * Creates a simple filter that accepts no methods.
+ */
public SimpleFilter()
{
this.methodNames = new HashSet();
}
-
+
+ /**
+ * Creates a simple filter that accepts methods matching the supplied names.
+ * @param methodNames the names
+ */
public SimpleFilter( String[] methodNames )
{
this.methodNames = new HashSet( Arrays.asList( methodNames ) );
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/BeanProvider.java Sat Feb 23 07:49:47 2008
@@ -42,6 +42,10 @@
{
}
+ /**
+ * Constructs a provider which instantiates objects of the specified bean class.
+ * @param beanClass the bean class
+ */
public BeanProvider( Class beanClass )
{
this.beanClass = beanClass;
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/CloningProvider.java Sat Feb 23 07:49:47 2008
@@ -35,6 +35,11 @@
private final Cloneable cloneable;
private Method cloneMethod;
+ /**
+ * Constructs a provider which returns clone copies of the specified {@link Cloneable}
+ * object.
+ * @param cloneable the object to clone
+ */
public CloningProvider( Cloneable cloneable )
{
this.cloneable = cloneable;
Modified: commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java (original)
+++ commons/proper/proxy/trunk/src/main/java/org/apache/commons/proxy/provider/ProviderDecorator.java Sat Feb 23 07:49:47 2008
@@ -20,6 +20,10 @@
import org.apache.commons.proxy.ObjectProvider;
/**
+ * Returns the result of the inner {@link ObjectProvider provider}. Subclasses can override the {@link #getObject()}
+ * method and decorate what comes back from the inner provider in some way (by {@link SingletonProvider caching it} for
+ * example).
+ *
* @author James Carman
* @since 1.0
*/
Modified: commons/proper/proxy/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/commons/proper/proxy/trunk/src/site/xdoc/index.xml?rev=630456&r1=630455&r2=630456&view=diff
==============================================================================
--- commons/proper/proxy/trunk/src/site/xdoc/index.xml (original)
+++ commons/proper/proxy/trunk/src/site/xdoc/index.xml Sat Feb 23 07:49:47 2008
@@ -130,13 +130,30 @@
</table>
</section>
</section>
-
- <section name="Status">
- <ul>
- <li>The code is unreleased.</li>
- <li>Methods and classes can and will appear and disappear without warning.</li>
- <li>If you like the code and want to push it towards a release, join the mailing list!</li>
- </ul>
+ <section name="Releases">
+ <p>
+ The latest version is v1.0. -
+ <a href="http://commons.apache.org/downloads/download_proxy.cgi">Download now!</a><br />
+ </p>
+ <p>
+ For previous releases, see the <a href="http://archive.apache.org/dist/commons/proxy/">Apache Archive</a>
+ </p>
+ <p>
+ <i><b>Note:</b> The 1.x releases are compatible with JDK1.4+.</i>
+ </p>
+ </section>
+ <section name="Support">
+ <p>
+ The <a href="mail-lists.html">commons mailing lists</a> act as the main support forum.
+ The user list is suitable for most library usage queries.
+ The dev list is intended for the development discussion.
+ Please remember that the lists are shared between all commons components,
+ so prefix your email subject with [proxy].
+ </p>
+ <p>
+ Issues may be reported via <a href="issue-tracking.html">ASF JIRA</a>.
+ Please read the instructions carefully to submit a useful bug report or enhancement request.
+ </p>
</section>
</body>
</document>