commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jcar...@apache.org
Subject svn commit: r240386 [3/5] - in /jakarta/commons/sandbox/proxy/trunk: ./ src/java/org/apache/commons/proxy/ src/java/org/apache/commons/proxy/exception/ src/java/org/apache/commons/proxy/factory/ src/java/org/apache/commons/proxy/factory/cglib/ src/java...
Date Sat, 27 Aug 2005 03:52:30 GMT
Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java Fri Aug 26 20:51:56 2005
@@ -1,240 +1,240 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.javassist;
-
-import javassist.CannotCompileException;
-import javassist.ClassPool;
-import javassist.CtClass;
-import javassist.CtConstructor;
-import javassist.CtField;
-import javassist.CtMethod;
-import javassist.NotFoundException;
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-import org.apache.commons.proxy.ObjectProvider;
-import org.apache.commons.proxy.exception.ObjectProviderException;
-import org.apache.commons.proxy.exception.ProxyFactoryException;
-import org.apache.commons.proxy.factory.AbstractProxyFactory;
-
-import java.lang.reflect.Method;
-
-/**
- * A <a href="http://www.jboss.org/products/javassist">Javassist</a>-based {@link org.apache.commons.proxy.ProxyFactory}
- * implementation.
- *
- * @author James Carman
- * @version 1.0
- */
-public class JavassistProxyFactory extends AbstractProxyFactory
-{
-    private static int classNumber = 0;
-    private static final ClassPool classPool = ClassPool.getDefault();
-
-    private void addField( Class fieldType, String fieldName, CtClass enclosingClass )
-    {
-        try
-        {
-            enclosingClass.addField( new CtField( resolve( fieldType ), fieldName, enclosingClass ) );
-        }
-        catch( CannotCompileException e )
-        {
-            throw new ProxyFactoryException( "Unable to add field named " + fieldName + " of type " + fieldType.getName() + " to class " + enclosingClass.getName(), e );
-        }
-    }
-
-    public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor, Class... proxyInterfaces )
-    {
-        try
-        {
-            final CtClass proxyClass = createClass();
-            addField( target.getClass(), "target", proxyClass );
-            addField( MethodInterceptor.class, "interceptor", proxyClass );
-            final CtConstructor proxyConstructor = new CtConstructor( resolve( new Class[]{target.getClass(), MethodInterceptor.class} ), proxyClass );
-            proxyConstructor.setBody( "{ this.target = $1;\nthis.interceptor = $2; }" );
-            proxyClass.addConstructor( proxyConstructor );
-            for( Class proxyInterface : proxyInterfaces )
-            {
-                proxyClass.addInterface( resolve( proxyInterface ) );
-                final Method[] methods = proxyInterface.getMethods();
-                for( int i = 0; i < methods.length; ++i )
-                {
-                    final CtMethod method = new CtMethod( resolve( methods[i].getReturnType() ), methods[i].getName(), resolve( methods[i].getParameterTypes() ), proxyClass );
-                    final Class invocationClass = createMethodInvocationClass( methods[i], target.getClass(), classLoader );
-                    final String body = "{\n\t return ( $r ) interceptor.invoke( new " + invocationClass.getName() + "( target, $$ ) );\n }";
-                    log.debug( method.getName() + "() method body:\n" + body );
-                    method.setBody( body );
-                    proxyClass.addMethod( method );
-                }
-            }
-            final Class clazz = proxyClass.toClass( classLoader );
-            return clazz.getConstructor( target.getClass(), MethodInterceptor.class ).newInstance( target, interceptor );
-        }
-        catch( CannotCompileException e )
-        {
-            throw new ProxyFactoryException( "Could not compile class.", e );
-        }
-        catch( NoSuchMethodException e )
-        {
-            throw new ProxyFactoryException( "Could not find constructor in generated proxy class.", e );
-        }
-        catch( Exception e )
-        {
-            throw new ProxyFactoryException( "Unable to instantiate proxy from generated proxy class.", e );
-        }
-    }
-
-    private Class createMethodInvocationClass( Method method, Class targetClass, ClassLoader classLoader )
-    {
-        try
-        {
-            final CtClass invocationClass = createClass();
-            invocationClass.addInterface( resolve( MethodInvocation.class ) );
-            addField( targetClass, "target", invocationClass );
-            final Class[] argumentTypes = method.getParameterTypes();
-            final Class[] constructorArgs = new Class[argumentTypes.length + 1];
-            constructorArgs[0] = targetClass;
-            for( int i = 0; i < argumentTypes.length; i++ )
-            {
-                Class argumentType = argumentTypes[i];
-                final CtField argumentField = new CtField( resolve( argumentType ), "argument" + i, invocationClass );
-                invocationClass.addField( argumentField );
-                constructorArgs[i + 1] = argumentType;
-            }
-            final CtConstructor constructor = new CtConstructor( resolve( constructorArgs ), invocationClass );
-            final StringBuffer constructorBody = new StringBuffer( "{\n" );
-            constructorBody.append( "\tthis.target = $1;\n" );
-            for( int i = 0; i < argumentTypes.length; i++ )
-            {
-                constructorBody.append( "\tthis.argument" ).append( i ).append( " = $" ).append( 2 + i ).append( ";\n" );
-
-            }
-            constructorBody.append( "}" );
-            log.debug( "Constructor body:\n" + constructorBody );
-            constructor.setBody( constructorBody.toString() );
-            invocationClass.addConstructor( constructor );
-            // proceed()...
-            final CtMethod proceedMethod = new CtMethod( resolve( Object.class ), "proceed", new CtClass[0], invocationClass );
-            final String proceedBody = generateProceedBody( method, argumentTypes );
-            log.debug( "Proceed method body:\n" + proceedBody );
-            proceedMethod.setBody( proceedBody.toString() );
-            invocationClass.addMethod( proceedMethod );
-            return invocationClass.toClass( classLoader );
-        }
-        catch( CannotCompileException e )
-        {
-            throw new ProxyFactoryException( "Could not compile Javassist generated class.", e );
-        }
-    }
-
-    private String generateProceedBody( Method method, Class[] argumentTypes )
-    {
-        final StringBuffer proceedBody = new StringBuffer( "{\n" );
-        if( !Void.TYPE.equals( method.getReturnType() ) )
-        {
-            proceedBody.append( "\treturn " );
-        }
-        else
-        {
-            proceedBody.append( "\t" );
-        }
-        proceedBody.append( "target." ).append( method.getName() ).append( "(" );
-        for( int i = 0; i < argumentTypes.length; ++i )
-        {
-            proceedBody.append( "argument" ).append( i );
-            if( i != argumentTypes.length - 1 )
-            {
-                proceedBody.append( ", " );
-            }
-        }
-        proceedBody.append( ");\n" );
-        if( Void.TYPE.equals( method.getReturnType() ) )
-        {
-            proceedBody.append( "return null;" );
-        }
-        proceedBody.append( "}" );
-        return proceedBody.toString();
-    }
-
-    public Object createProxy( ClassLoader classLoader, ObjectProvider targetProvider, Class... proxyInterfaces )
-    {
-        try
-        {
-            final CtClass proxyClass = createClass();
-            final CtField providerField = new CtField( resolve( targetProvider.getClass() ), "provider", proxyClass );
-            proxyClass.addField( providerField );
-            final CtConstructor proxyConstructor = new CtConstructor( resolve( new Class[]{targetProvider.getClass()} ), proxyClass );
-            proxyConstructor.setBody( "{ this.provider = $1; }" );
-            proxyClass.addConstructor( proxyConstructor );
-            for( Class proxyInterface : proxyInterfaces )
-            {
-                proxyClass.addInterface( resolve( proxyInterface ) );
-                final Method[] methods = proxyInterface.getMethods();
-                for( int i = 0; i < methods.length; ++i )
-                {
-                    final CtMethod method = new CtMethod( resolve( methods[i].getReturnType() ), methods[i].getName(), resolve( methods[i].getParameterTypes() ), proxyClass );
-                    method.setBody( "{ return ( $r ) ( ( " + proxyInterface.getName() + " )provider.getObject() )." + methods[i].getName() + "($$); }" );
-                    proxyClass.addMethod( method );
-                }
-            }
-            final Class clazz = proxyClass.toClass( classLoader );
-            return clazz.getConstructor( targetProvider.getClass() ).newInstance( targetProvider );
-        }
-        catch( CannotCompileException e )
-        {
-            throw new ProxyFactoryException( "Could not compile class.", e );
-        }
-        catch( NoSuchMethodException e )
-        {
-            throw new ProxyFactoryException( "Could not find constructor in generated proxy class.", e );
-        }
-        catch( Exception e )
-        {
-            throw new ProxyFactoryException( "Unable to instantiate proxy from generated proxy class.", e );
-        }
-    }
-
-    public static CtClass resolve( Class clazz )
-    {
-        try
-        {
-            return classPool.get( clazz.getName() );
-        }
-        catch( NotFoundException e )
-        {
-            throw new ObjectProviderException( "Unable to find class " + clazz.getName() + " in default Javassist class pool.", e );
-        }
-    }
-
-    public static CtClass[] resolve( Class[] classes )
-    {
-        final CtClass[] ctClasses = new CtClass[classes.length];
-        for( int i = 0; i < ctClasses.length; ++i )
-        {
-            ctClasses[i] = resolve( classes[i] );
-        }
-        return ctClasses;
-    }
-
-    public static CtClass createClass()
-    {
-        return createClass( Object.class );
-    }
-
-    public static CtClass createClass( Class superclass )
-    {
-        return classPool.makeClass( "JavassistProxyFactoryGenerated_" + ( ++classNumber ), resolve( superclass ) );
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.factory.javassist;
+
+import javassist.CannotCompileException;
+import javassist.ClassPool;
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.CtMethod;
+import javassist.NotFoundException;
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+import org.apache.commons.proxy.ObjectProvider;
+import org.apache.commons.proxy.exception.ObjectProviderException;
+import org.apache.commons.proxy.exception.ProxyFactoryException;
+import org.apache.commons.proxy.factory.AbstractProxyFactory;
+
+import java.lang.reflect.Method;
+
+/**
+ * A <a href="http://www.jboss.org/products/javassist">Javassist</a>-based {@link org.apache.commons.proxy.ProxyFactory}
+ * implementation.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class JavassistProxyFactory extends AbstractProxyFactory
+{
+    private static int classNumber = 0;
+    private static final ClassPool classPool = ClassPool.getDefault();
+
+    private void addField( Class fieldType, String fieldName, CtClass enclosingClass )
+    {
+        try
+        {
+            enclosingClass.addField( new CtField( resolve( fieldType ), fieldName, enclosingClass ) );
+        }
+        catch( CannotCompileException e )
+        {
+            throw new ProxyFactoryException( "Unable to add field named " + fieldName + " of type " + fieldType.getName() + " to class " + enclosingClass.getName(), e );
+        }
+    }
+
+    public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor, Class... proxyInterfaces )
+    {
+        try
+        {
+            final CtClass proxyClass = createClass();
+            addField( target.getClass(), "target", proxyClass );
+            addField( MethodInterceptor.class, "interceptor", proxyClass );
+            final CtConstructor proxyConstructor = new CtConstructor( resolve( new Class[]{target.getClass(), MethodInterceptor.class} ), proxyClass );
+            proxyConstructor.setBody( "{ this.target = $1;\nthis.interceptor = $2; }" );
+            proxyClass.addConstructor( proxyConstructor );
+            for( Class proxyInterface : proxyInterfaces )
+            {
+                proxyClass.addInterface( resolve( proxyInterface ) );
+                final Method[] methods = proxyInterface.getMethods();
+                for( int i = 0; i < methods.length; ++i )
+                {
+                    final CtMethod method = new CtMethod( resolve( methods[i].getReturnType() ), methods[i].getName(), resolve( methods[i].getParameterTypes() ), proxyClass );
+                    final Class invocationClass = createMethodInvocationClass( methods[i], target.getClass(), classLoader );
+                    final String body = "{\n\t return ( $r ) interceptor.invoke( new " + invocationClass.getName() + "( target, $$ ) );\n }";
+                    log.debug( method.getName() + "() method body:\n" + body );
+                    method.setBody( body );
+                    proxyClass.addMethod( method );
+                }
+            }
+            final Class clazz = proxyClass.toClass( classLoader );
+            return clazz.getConstructor( target.getClass(), MethodInterceptor.class ).newInstance( target, interceptor );
+        }
+        catch( CannotCompileException e )
+        {
+            throw new ProxyFactoryException( "Could not compile class.", e );
+        }
+        catch( NoSuchMethodException e )
+        {
+            throw new ProxyFactoryException( "Could not find constructor in generated proxy class.", e );
+        }
+        catch( Exception e )
+        {
+            throw new ProxyFactoryException( "Unable to instantiate proxy from generated proxy class.", e );
+        }
+    }
+
+    private Class createMethodInvocationClass( Method method, Class targetClass, ClassLoader classLoader )
+    {
+        try
+        {
+            final CtClass invocationClass = createClass();
+            invocationClass.addInterface( resolve( MethodInvocation.class ) );
+            addField( targetClass, "target", invocationClass );
+            final Class[] argumentTypes = method.getParameterTypes();
+            final Class[] constructorArgs = new Class[argumentTypes.length + 1];
+            constructorArgs[0] = targetClass;
+            for( int i = 0; i < argumentTypes.length; i++ )
+            {
+                Class argumentType = argumentTypes[i];
+                final CtField argumentField = new CtField( resolve( argumentType ), "argument" + i, invocationClass );
+                invocationClass.addField( argumentField );
+                constructorArgs[i + 1] = argumentType;
+            }
+            final CtConstructor constructor = new CtConstructor( resolve( constructorArgs ), invocationClass );
+            final StringBuffer constructorBody = new StringBuffer( "{\n" );
+            constructorBody.append( "\tthis.target = $1;\n" );
+            for( int i = 0; i < argumentTypes.length; i++ )
+            {
+                constructorBody.append( "\tthis.argument" ).append( i ).append( " = $" ).append( 2 + i ).append( ";\n" );
+
+            }
+            constructorBody.append( "}" );
+            log.debug( "Constructor body:\n" + constructorBody );
+            constructor.setBody( constructorBody.toString() );
+            invocationClass.addConstructor( constructor );
+            // proceed()...
+            final CtMethod proceedMethod = new CtMethod( resolve( Object.class ), "proceed", new CtClass[0], invocationClass );
+            final String proceedBody = generateProceedBody( method, argumentTypes );
+            log.debug( "Proceed method body:\n" + proceedBody );
+            proceedMethod.setBody( proceedBody.toString() );
+            invocationClass.addMethod( proceedMethod );
+            return invocationClass.toClass( classLoader );
+        }
+        catch( CannotCompileException e )
+        {
+            throw new ProxyFactoryException( "Could not compile Javassist generated class.", e );
+        }
+    }
+
+    private String generateProceedBody( Method method, Class[] argumentTypes )
+    {
+        final StringBuffer proceedBody = new StringBuffer( "{\n" );
+        if( !Void.TYPE.equals( method.getReturnType() ) )
+        {
+            proceedBody.append( "\treturn " );
+        }
+        else
+        {
+            proceedBody.append( "\t" );
+        }
+        proceedBody.append( "target." ).append( method.getName() ).append( "(" );
+        for( int i = 0; i < argumentTypes.length; ++i )
+        {
+            proceedBody.append( "argument" ).append( i );
+            if( i != argumentTypes.length - 1 )
+            {
+                proceedBody.append( ", " );
+            }
+        }
+        proceedBody.append( ");\n" );
+        if( Void.TYPE.equals( method.getReturnType() ) )
+        {
+            proceedBody.append( "return null;" );
+        }
+        proceedBody.append( "}" );
+        return proceedBody.toString();
+    }
+
+    public Object createProxy( ClassLoader classLoader, ObjectProvider targetProvider, Class... proxyInterfaces )
+    {
+        try
+        {
+            final CtClass proxyClass = createClass();
+            final CtField providerField = new CtField( resolve( targetProvider.getClass() ), "provider", proxyClass );
+            proxyClass.addField( providerField );
+            final CtConstructor proxyConstructor = new CtConstructor( resolve( new Class[]{targetProvider.getClass()} ), proxyClass );
+            proxyConstructor.setBody( "{ this.provider = $1; }" );
+            proxyClass.addConstructor( proxyConstructor );
+            for( Class proxyInterface : proxyInterfaces )
+            {
+                proxyClass.addInterface( resolve( proxyInterface ) );
+                final Method[] methods = proxyInterface.getMethods();
+                for( int i = 0; i < methods.length; ++i )
+                {
+                    final CtMethod method = new CtMethod( resolve( methods[i].getReturnType() ), methods[i].getName(), resolve( methods[i].getParameterTypes() ), proxyClass );
+                    method.setBody( "{ return ( $r ) ( ( " + proxyInterface.getName() + " )provider.getObject() )." + methods[i].getName() + "($$); }" );
+                    proxyClass.addMethod( method );
+                }
+            }
+            final Class clazz = proxyClass.toClass( classLoader );
+            return clazz.getConstructor( targetProvider.getClass() ).newInstance( targetProvider );
+        }
+        catch( CannotCompileException e )
+        {
+            throw new ProxyFactoryException( "Could not compile class.", e );
+        }
+        catch( NoSuchMethodException e )
+        {
+            throw new ProxyFactoryException( "Could not find constructor in generated proxy class.", e );
+        }
+        catch( Exception e )
+        {
+            throw new ProxyFactoryException( "Unable to instantiate proxy from generated proxy class.", e );
+        }
+    }
+
+    public static CtClass resolve( Class clazz )
+    {
+        try
+        {
+            return classPool.get( clazz.getName() );
+        }
+        catch( NotFoundException e )
+        {
+            throw new ObjectProviderException( "Unable to find class " + clazz.getName() + " in default Javassist class pool.", e );
+        }
+    }
+
+    public static CtClass[] resolve( Class[] classes )
+    {
+        final CtClass[] ctClasses = new CtClass[classes.length];
+        for( int i = 0; i < ctClasses.length; ++i )
+        {
+            ctClasses[i] = resolve( classes[i] );
+        }
+        return ctClasses;
+    }
+
+    public static CtClass createClass()
+    {
+        return createClass( Object.class );
+    }
+
+    public static CtClass createClass( Class superclass )
+    {
+        return classPool.makeClass( "JavassistProxyFactoryGenerated_" + ( ++classNumber ), resolve( superclass ) );
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/javassist/JavassistProxyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java Fri Aug 26 20:51:56 2005
@@ -1,52 +1,52 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.reflect;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Proxy;
-
-/**
- * A useful baseclass for implementing invocation handlers.
- *
- * @author James Carman
- * @version 1.0
- */
-public abstract class AbstractInvocationHandler implements InvocationHandler
-{
-    /**
-     * Creates a proxy object which implements the specified proxy interfaces.
-     * @param proxyInterfaces the proxy interfaces
-     * @return a proxy object which implements the specified proxy interfaces
-     */
-    public Object createProxy( Class... proxyInterfaces )
-    {
-        return createProxy( Thread.currentThread().getContextClassLoader(), proxyInterfaces );
-    }
-
-    /**
-     * Creates a proxy object which implements the specified proxy interfaces, using the
-     * specified class loader.
-     * @param classLoader the class loader
-     * @param proxyInterfaces the proxy interfaces
-     * @return a proxy object which implements the specified proxy interfaces, using the
-     * specified class loader.
-     */
-    public Object createProxy( ClassLoader classLoader, Class... proxyInterfaces )
-    {
-        return Proxy.newProxyInstance( classLoader, proxyInterfaces, this );
-    }
-}
-
+/*
+ *  Copyright 2005 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.commons.proxy.factory.reflect;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Proxy;
+
+/**
+ * A useful baseclass for implementing invocation handlers.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public abstract class AbstractInvocationHandler implements InvocationHandler
+{
+    /**
+     * Creates a proxy object which implements the specified proxy interfaces.
+     * @param proxyInterfaces the proxy interfaces
+     * @return a proxy object which implements the specified proxy interfaces
+     */
+    public Object createProxy( Class... proxyInterfaces )
+    {
+        return createProxy( Thread.currentThread().getContextClassLoader(), proxyInterfaces );
+    }
+
+    /**
+     * Creates a proxy object which implements the specified proxy interfaces, using the
+     * specified class loader.
+     * @param classLoader the class loader
+     * @param proxyInterfaces the proxy interfaces
+     * @return a proxy object which implements the specified proxy interfaces, using the
+     * specified class loader.
+     */
+    public Object createProxy( ClassLoader classLoader, Class... proxyInterfaces )
+    {
+        return Proxy.newProxyInstance( classLoader, proxyInterfaces, this );
+    }
+}
+

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/AbstractInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/DelegatingInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/DelegatingInvocationHandler.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/DelegatingInvocationHandler.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/DelegatingInvocationHandler.java Fri Aug 26 20:51:56 2005
@@ -1,55 +1,55 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.reflect;
-
-import java.lang.reflect.Method;
-
-/**
- * An invocation handler which delegates to another object.
- *
- * @author James Carman
- * @version 1.0
- */
-public abstract class DelegatingInvocationHandler extends AbstractInvocationHandler
-{
-    protected abstract Object getDelegate();
-
-    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
-    {
-        return method.invoke( getDelegate(), args );
-    }
-
-    /**
-     * A simplified proxy creation method which merely creates a proxy which supports
-     * all the interfaces implemented by the delegate.
-     * @return a proxy which supports all the interfaces implemented by the delegate
-     */
-    public Object createProxy()
-    {
-        return createProxy( getDelegate().getClass().getInterfaces() );
-    }
-
-    /**
-     * A simplified proxy creation method which merely creates a proxy which supports
-     * all the interfaces implemented by the delegate, using the specified class loader.
-     * @return a proxy which supports all the interfaces implemented by the delegate,
-     * using the specified class loader.
-     */
-    public Object createProxy( ClassLoader classLoader )
-    {
-        return createProxy( classLoader, getDelegate().getClass().getInterfaces() );
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.factory.reflect;
+
+import java.lang.reflect.Method;
+
+/**
+ * An invocation handler which delegates to another object.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public abstract class DelegatingInvocationHandler extends AbstractInvocationHandler
+{
+    protected abstract Object getDelegate();
+
+    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
+    {
+        return method.invoke( getDelegate(), args );
+    }
+
+    /**
+     * A simplified proxy creation method which merely creates a proxy which supports
+     * all the interfaces implemented by the delegate.
+     * @return a proxy which supports all the interfaces implemented by the delegate
+     */
+    public Object createProxy()
+    {
+        return createProxy( getDelegate().getClass().getInterfaces() );
+    }
+
+    /**
+     * A simplified proxy creation method which merely creates a proxy which supports
+     * all the interfaces implemented by the delegate, using the specified class loader.
+     * @return a proxy which supports all the interfaces implemented by the delegate,
+     * using the specified class loader.
+     */
+    public Object createProxy( ClassLoader classLoader )
+    {
+        return createProxy( classLoader, getDelegate().getClass().getInterfaces() );
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/DelegatingInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/MethodInterceptorInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/MethodInterceptorInvocationHandler.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/MethodInterceptorInvocationHandler.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/MethodInterceptorInvocationHandler.java Fri Aug 26 20:51:56 2005
@@ -1,45 +1,45 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.reflect;
-
-import org.aopalliance.intercept.MethodInterceptor;
-
-import java.lang.reflect.Method;
-
-/**
- * An invocation handler that passes through a <code>MethodInterceptor</code>.
- * 
- * @author James Carman
- * @version 1.0
- */
-public class MethodInterceptorInvocationHandler extends AbstractInvocationHandler
-{
-    private final Object target;
-    private final MethodInterceptor methodInterceptor;
-
-    public MethodInterceptorInvocationHandler( Object target, MethodInterceptor methodInterceptor )
-    {
-        this.target = target;
-        this.methodInterceptor = methodInterceptor;
-    }
-
-    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
-    {
-        final ReflectionMethodInvocation invocation = new ReflectionMethodInvocation( target, method, args );
-        return methodInterceptor.invoke( invocation );
-    }
-}
-
+/*
+ *  Copyright 2005 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.commons.proxy.factory.reflect;
+
+import org.aopalliance.intercept.MethodInterceptor;
+
+import java.lang.reflect.Method;
+
+/**
+ * An invocation handler that passes through a <code>MethodInterceptor</code>.
+ * 
+ * @author James Carman
+ * @version 1.0
+ */
+public class MethodInterceptorInvocationHandler extends AbstractInvocationHandler
+{
+    private final Object target;
+    private final MethodInterceptor methodInterceptor;
+
+    public MethodInterceptorInvocationHandler( Object target, MethodInterceptor methodInterceptor )
+    {
+        this.target = target;
+        this.methodInterceptor = methodInterceptor;
+    }
+
+    public Object invoke( Object proxy, Method method, Object[] args ) throws Throwable
+    {
+        final ReflectionMethodInvocation invocation = new ReflectionMethodInvocation( target, method, args );
+        return methodInterceptor.invoke( invocation );
+    }
+}
+

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/MethodInterceptorInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ObjectProviderInvocationHandler.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ObjectProviderInvocationHandler.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ObjectProviderInvocationHandler.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ObjectProviderInvocationHandler.java Fri Aug 26 20:51:56 2005
@@ -1,38 +1,38 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.reflect;
-
-import org.apache.commons.proxy.ObjectProvider;
-
-/**
- * An invocation handler which delegates to an object supplied by an {@link ObjectProvider}.
- * @author James Carman
- * @version 1.0
- */
-public class ObjectProviderInvocationHandler extends DelegatingInvocationHandler
-{
-    private final ObjectProvider objectProvider;
-
-    public ObjectProviderInvocationHandler( ObjectProvider objectProvider )
-    {
-        this.objectProvider = objectProvider;
-    }
-
-    protected Object getDelegate()
-    {
-        return objectProvider.getObject();
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.factory.reflect;
+
+import org.apache.commons.proxy.ObjectProvider;
+
+/**
+ * An invocation handler which delegates to an object supplied by an {@link ObjectProvider}.
+ * @author James Carman
+ * @version 1.0
+ */
+public class ObjectProviderInvocationHandler extends DelegatingInvocationHandler
+{
+    private final ObjectProvider objectProvider;
+
+    public ObjectProviderInvocationHandler( ObjectProvider objectProvider )
+    {
+        this.objectProvider = objectProvider;
+    }
+
+    protected Object getDelegate()
+    {
+        return objectProvider.getObject();
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ObjectProviderInvocationHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionMethodInvocation.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionMethodInvocation.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionMethodInvocation.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionMethodInvocation.java Fri Aug 26 20:51:56 2005
@@ -1,66 +1,66 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.reflect;
-
-import org.aopalliance.intercept.MethodInvocation;
-
-import java.lang.reflect.AccessibleObject;
-import java.lang.reflect.Method;
-
-/**
- * A reflection-based implementation of the <code>MethodInvocation</code> interface.
- * 
- * @author James Carman
- * @version 1.0
- */
-class ReflectionMethodInvocation implements MethodInvocation
-{
-    private final Method method;
-    private final Object[] arguments;
-    private final Object target;
-
-    public ReflectionMethodInvocation( Object target, Method method, Object[] arguments )
-    {
-        this.method = method;
-        this.arguments = arguments;
-        this.target = target;
-    }
-
-    public Object[] getArguments()
-    {
-        return arguments;
-    }
-
-    public Method getMethod()
-    {
-        return method;
-    }
-
-    public Object proceed() throws Throwable
-    {
-        return method.invoke( target, arguments );
-    }
-
-    public Object getThis()
-    {
-        return target;
-    }
-
-    public AccessibleObject getStaticPart()
-    {
-        return method;
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.factory.reflect;
+
+import org.aopalliance.intercept.MethodInvocation;
+
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Method;
+
+/**
+ * A reflection-based implementation of the <code>MethodInvocation</code> interface.
+ * 
+ * @author James Carman
+ * @version 1.0
+ */
+class ReflectionMethodInvocation implements MethodInvocation
+{
+    private final Method method;
+    private final Object[] arguments;
+    private final Object target;
+
+    public ReflectionMethodInvocation( Object target, Method method, Object[] arguments )
+    {
+        this.method = method;
+        this.arguments = arguments;
+        this.target = target;
+    }
+
+    public Object[] getArguments()
+    {
+        return arguments;
+    }
+
+    public Method getMethod()
+    {
+        return method;
+    }
+
+    public Object proceed() throws Throwable
+    {
+        return method.invoke( target, arguments );
+    }
+
+    public Object getThis()
+    {
+        return target;
+    }
+
+    public AccessibleObject getStaticPart()
+    {
+        return method;
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionMethodInvocation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java Fri Aug 26 20:51:56 2005
@@ -1,41 +1,41 @@
-/*
- *  Copyright 2005 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.commons.proxy.factory.reflect;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.apache.commons.proxy.ObjectProvider;
-import org.apache.commons.proxy.factory.AbstractProxyFactory;
-
-import java.lang.reflect.Proxy;
-
-/**
- * A JDK proxy-based {@link org.apache.commons.proxy.ProxyFactory} implementation.
- * @author James Carman
- * @version 1.0
- */
-public class ReflectionProxyFactory extends AbstractProxyFactory
-{
-    public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor, Class... proxyInterfaces )
-    {
-        return new MethodInterceptorInvocationHandler( target, interceptor ).createProxy( classLoader, proxyInterfaces );
-    }
-
-    public Object createProxy( ClassLoader classLoader, ObjectProvider targetProvider, Class... proxyInterfaces )
-    {
-        return Proxy.newProxyInstance( classLoader, proxyInterfaces, new ObjectProviderInvocationHandler( targetProvider ) );
-    }
-
-}
+/*
+ *  Copyright 2005 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.commons.proxy.factory.reflect;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.apache.commons.proxy.ObjectProvider;
+import org.apache.commons.proxy.factory.AbstractProxyFactory;
+
+import java.lang.reflect.Proxy;
+
+/**
+ * A JDK proxy-based {@link org.apache.commons.proxy.ProxyFactory} implementation.
+ * @author James Carman
+ * @version 1.0
+ */
+public class ReflectionProxyFactory extends AbstractProxyFactory
+{
+    public Object createInterceptorProxy( ClassLoader classLoader, Object target, MethodInterceptor interceptor, Class... proxyInterfaces )
+    {
+        return new MethodInterceptorInvocationHandler( target, interceptor ).createProxy( classLoader, proxyInterfaces );
+    }
+
+    public Object createProxy( ClassLoader classLoader, ObjectProvider targetProvider, Class... proxyInterfaces )
+    {
+        return Proxy.newProxyInstance( classLoader, proxyInterfaces, new ObjectProviderInvocationHandler( targetProvider ) );
+    }
+
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/factory/reflect/ReflectionProxyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/FilteredMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/FilteredMethodInterceptor.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/FilteredMethodInterceptor.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/FilteredMethodInterceptor.java Fri Aug 26 20:51:56 2005
@@ -1,50 +1,50 @@
-/*
- *  Copyright 2005 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.commons.proxy.interceptor;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.aopalliance.intercept.MethodInvocation;
-
-/**
- * Decorates another <code>MethodInterceptor</code> by only calling it if the
- * method is accepted by the supplied <code>MethodFilter</code>.
- *
- * @author James Carman
- * @version 1.0
- */
-public class FilteredMethodInterceptor implements MethodInterceptor
-{
-    private final MethodInterceptor inner;
-    private final MethodFilter filter;
-
-    public FilteredMethodInterceptor( MethodInterceptor inner, MethodFilter filter )
-    {
-        this.inner = inner;
-        this.filter = filter;
-    }
-
-    public Object invoke( MethodInvocation methodInvocation ) throws Throwable
-    {
-        if( filter.accepts( methodInvocation.getMethod() ) )
-        {
-            return inner.invoke( methodInvocation );
-        }
-        else
-        {
-            return methodInvocation.proceed();
-        }
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.interceptor;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.aopalliance.intercept.MethodInvocation;
+
+/**
+ * Decorates another <code>MethodInterceptor</code> by only calling it if the
+ * method is accepted by the supplied <code>MethodFilter</code>.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class FilteredMethodInterceptor implements MethodInterceptor
+{
+    private final MethodInterceptor inner;
+    private final MethodFilter filter;
+
+    public FilteredMethodInterceptor( MethodInterceptor inner, MethodFilter filter )
+    {
+        this.inner = inner;
+        this.filter = filter;
+    }
+
+    public Object invoke( MethodInvocation methodInvocation ) throws Throwable
+    {
+        if( filter.accepts( methodInvocation.getMethod() ) )
+        {
+            return inner.invoke( methodInvocation );
+        }
+        else
+        {
+            return methodInvocation.proceed();
+        }
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/FilteredMethodInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodFilter.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodFilter.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodFilter.java Fri Aug 26 20:51:56 2005
@@ -1,29 +1,29 @@
-/*
- *  Copyright 2005 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.commons.proxy.interceptor;
-
-import java.lang.reflect.Method;
-
-/**
- * A <code>MethodFilter</code> determines whether or not a method is accepted.
- * 
- * @author James Carman
- * @version 1.0
- */
-public interface MethodFilter
-{
-    public boolean accepts( Method method );
-}
+/*
+ *  Copyright 2005 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.commons.proxy.interceptor;
+
+import java.lang.reflect.Method;
+
+/**
+ * A <code>MethodFilter</code> determines whether or not a method is accepted.
+ * 
+ * @author James Carman
+ * @version 1.0
+ */
+public interface MethodFilter
+{
+    public boolean accepts( Method method );
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java Fri Aug 26 20:51:56 2005
@@ -1,83 +1,83 @@
-/*
- *  Copyright 2005 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.commons.proxy.interceptor;
-
-import org.aopalliance.intercept.MethodInterceptor;
-import org.apache.commons.proxy.ProxyFactory;
-import org.apache.commons.proxy.ObjectProvider;
-import org.apache.commons.proxy.provider.AbstractObjectProvider;
-
-/**
- * A <code>MethodInterceptorChain</code> assists with creating proxies which go through
- * a series of <code>MethodInterceptors</code>.
- * 
- * @author James Carman
- * @version 1.0
- */
-public class MethodInterceptorChain
-{
-    private final MethodInterceptor[] interceptors;
-
-    public MethodInterceptorChain( MethodInterceptor... interceptors )
-    {
-        this.interceptors = interceptors;
-    }
-
-    public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class... proxyInterfaces )
-    {
-        if( proxyInterfaces.length == 0 )
-        {
-            proxyInterfaces = terminus.getClass().getInterfaces();
-        }
-        return new ProxyObjectProvider( proxyFactory, classLoader, terminus, proxyInterfaces );
-    }
-
-    public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, Object terminus, Class... proxyInterfaces )
-    {
-        return createProxyProvider( proxyFactory, Thread.currentThread().getContextClassLoader(), terminus, proxyInterfaces );
-    }
-
-    private Object createProxy( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class... proxyInterfaces )
-    {
-        Object currentTarget = terminus;
-        for( int i = interceptors.length - 1; i >= 0; --i )
-        {
-            currentTarget = proxyFactory.createInterceptorProxy( classLoader, currentTarget, interceptors[i], proxyInterfaces );
-        }
-        return currentTarget;
-    }
-
-    private class ProxyObjectProvider extends AbstractObjectProvider
-    {
-        private final ClassLoader classLoader;
-        private final Class[] proxyInterfaces;
-        private final Object terminus;
-        private final ProxyFactory proxyFactory;
-
-        public ProxyObjectProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class[] proxyInterfaces )
-        {
-            this.classLoader = classLoader;
-            this.proxyInterfaces = proxyInterfaces;
-            this.terminus = terminus;
-            this.proxyFactory = proxyFactory;
-        }
-
-        public Object getObject()
-        {
-            return createProxy( proxyFactory, classLoader, terminus, proxyInterfaces );
-        }
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.interceptor;
+
+import org.aopalliance.intercept.MethodInterceptor;
+import org.apache.commons.proxy.ProxyFactory;
+import org.apache.commons.proxy.ObjectProvider;
+import org.apache.commons.proxy.provider.AbstractObjectProvider;
+
+/**
+ * A <code>MethodInterceptorChain</code> assists with creating proxies which go through
+ * a series of <code>MethodInterceptors</code>.
+ * 
+ * @author James Carman
+ * @version 1.0
+ */
+public class MethodInterceptorChain
+{
+    private final MethodInterceptor[] interceptors;
+
+    public MethodInterceptorChain( MethodInterceptor... interceptors )
+    {
+        this.interceptors = interceptors;
+    }
+
+    public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class... proxyInterfaces )
+    {
+        if( proxyInterfaces.length == 0 )
+        {
+            proxyInterfaces = terminus.getClass().getInterfaces();
+        }
+        return new ProxyObjectProvider( proxyFactory, classLoader, terminus, proxyInterfaces );
+    }
+
+    public ObjectProvider createProxyProvider( ProxyFactory proxyFactory, Object terminus, Class... proxyInterfaces )
+    {
+        return createProxyProvider( proxyFactory, Thread.currentThread().getContextClassLoader(), terminus, proxyInterfaces );
+    }
+
+    private Object createProxy( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class... proxyInterfaces )
+    {
+        Object currentTarget = terminus;
+        for( int i = interceptors.length - 1; i >= 0; --i )
+        {
+            currentTarget = proxyFactory.createInterceptorProxy( classLoader, currentTarget, interceptors[i], proxyInterfaces );
+        }
+        return currentTarget;
+    }
+
+    private class ProxyObjectProvider extends AbstractObjectProvider
+    {
+        private final ClassLoader classLoader;
+        private final Class[] proxyInterfaces;
+        private final Object terminus;
+        private final ProxyFactory proxyFactory;
+
+        public ProxyObjectProvider( ProxyFactory proxyFactory, ClassLoader classLoader, Object terminus, Class[] proxyInterfaces )
+        {
+            this.classLoader = classLoader;
+            this.proxyInterfaces = proxyInterfaces;
+            this.terminus = terminus;
+            this.proxyFactory = proxyFactory;
+        }
+
+        public Object getObject()
+        {
+            return createProxy( proxyFactory, classLoader, terminus, proxyInterfaces );
+        }
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/MethodInterceptorChain.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/PatternMethodFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/PatternMethodFilter.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/PatternMethodFilter.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/PatternMethodFilter.java Fri Aug 26 20:51:56 2005
@@ -1,42 +1,42 @@
-/*
- *  Copyright 2005 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.commons.proxy.interceptor.filter;
-
-import org.apache.commons.proxy.interceptor.MethodFilter;
-
-import java.lang.reflect.Method;
-
-/**
- * A method filter implementation that returns true if the method's name
- * matches a supplied regular expression (JDK regex) pattern string.
- *
- * @author James Carman
- * @version 1.0
- */
-public class PatternMethodFilter implements MethodFilter
-{
-    private final String pattern;
-
-    public PatternMethodFilter( String pattern )
-    {
-        this.pattern = pattern;
-    }
-
-    public boolean accepts( Method method )
-    {
-        return method.getName().matches( pattern );
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.interceptor.filter;
+
+import org.apache.commons.proxy.interceptor.MethodFilter;
+
+import java.lang.reflect.Method;
+
+/**
+ * A method filter implementation that returns true if the method's name
+ * matches a supplied regular expression (JDK regex) pattern string.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class PatternMethodFilter implements MethodFilter
+{
+    private final String pattern;
+
+    public PatternMethodFilter( String pattern )
+    {
+        this.pattern = pattern;
+    }
+
+    public boolean accepts( Method method )
+    {
+        return method.getName().matches( pattern );
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/PatternMethodFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/SimpleMethodFilter.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/SimpleMethodFilter.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/SimpleMethodFilter.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/SimpleMethodFilter.java Fri Aug 26 20:51:56 2005
@@ -1,45 +1,45 @@
-/*
- *  Copyright 2005 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.commons.proxy.interceptor.filter;
-
-import org.apache.commons.proxy.interceptor.MethodFilter;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * A simple method filter implementation that merely returns true if the
- * method's name is in a set of accepted names.
- * 
- * @author James Carman
- * @version 1.0
- */
-public class SimpleMethodFilter implements MethodFilter
-{
-    private final Set<String> methodNames;
-
-    public SimpleMethodFilter( String... methodNames )
-    {
-        this.methodNames = new HashSet<String>( Arrays.asList( methodNames ) );
-    }
-
-    public boolean accepts( Method method )
-    {
-        return methodNames.contains( method.getName() );
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.interceptor.filter;
+
+import org.apache.commons.proxy.interceptor.MethodFilter;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * A simple method filter implementation that merely returns true if the
+ * method's name is in a set of accepted names.
+ * 
+ * @author James Carman
+ * @version 1.0
+ */
+public class SimpleMethodFilter implements MethodFilter
+{
+    private final Set<String> methodNames;
+
+    public SimpleMethodFilter( String... methodNames )
+    {
+        this.methodNames = new HashSet<String>( Arrays.asList( methodNames ) );
+    }
+
+    public boolean accepts( Method method )
+    {
+        return methodNames.contains( method.getName() );
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/interceptor/filter/SimpleMethodFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/AbstractObjectProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/AbstractObjectProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/AbstractObjectProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/AbstractObjectProvider.java Fri Aug 26 20:51:56 2005
@@ -1,34 +1,34 @@
-/*
- *  Copyright 2005 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.commons.proxy.provider;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.proxy.ObjectProvider;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public abstract class AbstractObjectProvider<T> implements ObjectProvider<T>
-{
-    protected Log log = LogFactory.getLog( getClass() );
-
-    public void setLog( Log log )
-    {
-        this.log = log;
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.provider;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.proxy.ObjectProvider;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public abstract class AbstractObjectProvider<T> implements ObjectProvider<T>
+{
+    protected Log log = LogFactory.getLog( getClass() );
+
+    public void setLog( Log log )
+    {
+        this.log = log;
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/AbstractObjectProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java Fri Aug 26 20:51:56 2005
@@ -1,50 +1,50 @@
-/*
- *  Copyright 2005 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.exception.ObjectProviderException;
-
-/**
- * Uses <code>Class.newInstance()</code> to instantiate an object.
- *
- * @author James Carman
- * @version $Rev: 57 $
- */
-public class BeanProvider<T> extends AbstractObjectProvider<T>
-{
-    private final Class<? extends T> beanClass;
-
-    public BeanProvider( Class<? extends T> beanClass )
-    {
-        this.beanClass = beanClass;
-    }
-
-    public T getObject()
-    {
-        try
-        {
-            return beanClass.newInstance();
-        }
-        catch( InstantiationException e )
-        {
-            throw new ObjectProviderException( "Class " + beanClass.getName() + " is not concrete.", e );
-        }
-        catch( IllegalAccessException e )
-        {
-            throw new ObjectProviderException( "Constructor for class " + beanClass.getName() + " is not accessible.", e );
-        }
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.exception.ObjectProviderException;
+
+/**
+ * Uses <code>Class.newInstance()</code> to instantiate an object.
+ *
+ * @author James Carman
+ * @version $Rev: 57 $
+ */
+public class BeanProvider<T> extends AbstractObjectProvider<T>
+{
+    private final Class<? extends T> beanClass;
+
+    public BeanProvider( Class<? extends T> beanClass )
+    {
+        this.beanClass = beanClass;
+    }
+
+    public T getObject()
+    {
+        try
+        {
+            return beanClass.newInstance();
+        }
+        catch( InstantiationException e )
+        {
+            throw new ObjectProviderException( "Class " + beanClass.getName() + " is not concrete.", e );
+        }
+        catch( IllegalAccessException e )
+        {
+            throw new ObjectProviderException( "Constructor for class " + beanClass.getName() + " is not accessible.", e );
+        }
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BeanProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java Fri Aug 26 20:51:56 2005
@@ -1,51 +1,51 @@
-/*
- *  Copyright 2005 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.commons.proxy.provider;
-
-import com.caucho.burlap.client.BurlapProxyFactory;
-import org.apache.commons.proxy.exception.ObjectProviderException;
-
-import java.net.MalformedURLException;
-
-/**
- * Provides a burlap service object.
- *
- * @author James Carman
- * @version 1.0
- */
-public class BurlapProvider<T> extends AbstractObjectProvider<T>
-{
-    private final Class<T> serviceInterface;
-    private final String url;
-
-    public BurlapProvider( Class<T> serviceInterface, String url )
-    {
-        this.serviceInterface = serviceInterface;
-        this.url = url;
-    }
-
-    public T getObject()
-    {
-        try
-        {
-            return serviceInterface.cast( new BurlapProxyFactory().create( serviceInterface, url ) );
-        }
-        catch( MalformedURLException e )
-        {
-            throw new ObjectProviderException( "Invalid url given.", e );
-        }
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.provider;
+
+import com.caucho.burlap.client.BurlapProxyFactory;
+import org.apache.commons.proxy.exception.ObjectProviderException;
+
+import java.net.MalformedURLException;
+
+/**
+ * Provides a burlap service object.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class BurlapProvider<T> extends AbstractObjectProvider<T>
+{
+    private final Class<T> serviceInterface;
+    private final String url;
+
+    public BurlapProvider( Class<T> serviceInterface, String url )
+    {
+        this.serviceInterface = serviceInterface;
+        this.url = url;
+    }
+
+    public T getObject()
+    {
+        try
+        {
+            return serviceInterface.cast( new BurlapProxyFactory().create( serviceInterface, url ) );
+        }
+        catch( MalformedURLException e )
+        {
+            throw new ObjectProviderException( "Invalid url given.", e );
+        }
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/BurlapProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java Fri Aug 26 20:51:56 2005
@@ -1,51 +1,51 @@
-/*
- *  Copyright 2005 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.commons.proxy.provider;
-
-import org.apache.commons.proxy.ObjectProvider;
-import org.apache.commons.proxy.provider.cache.Cache;
-
-/**
- * @author James Carman
- * @version 1.0
- */
-public class CachedProvider<T> extends ProviderDecorator<T>
-{
-    private final Object cacheKey = new Object();
-
-    private Cache cache;
-
-    public CachedProvider( ObjectProvider<? extends T> inner )
-    {
-        super( inner );
-    }
-
-    public void setCache( Cache cache )
-    {
-        this.cache = cache;
-    }
-
-    public T getObject()
-    {
-        T object = ( T )cache.retrieveObject( cacheKey );
-        if( object == null )
-        {
-            object = super.getObject();
-            cache.storeObject( cacheKey, object );
-        }
-        return object;
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.provider;
+
+import org.apache.commons.proxy.ObjectProvider;
+import org.apache.commons.proxy.provider.cache.Cache;
+
+/**
+ * @author James Carman
+ * @version 1.0
+ */
+public class CachedProvider<T> extends ProviderDecorator<T>
+{
+    private final Object cacheKey = new Object();
+
+    private Cache cache;
+
+    public CachedProvider( ObjectProvider<? extends T> inner )
+    {
+        super( inner );
+    }
+
+    public void setCache( Cache cache )
+    {
+        this.cache = cache;
+    }
+
+    public T getObject()
+    {
+        T object = ( T )cache.retrieveObject( cacheKey );
+        if( object == null )
+        {
+            object = super.getObject();
+            cache.storeObject( cacheKey, object );
+        }
+        return object;
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/CachedProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java?rev=240386&r1=240385&r2=240386&view=diff
==============================================================================
--- jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java (original)
+++ jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java Fri Aug 26 20:51:56 2005
@@ -1,37 +1,37 @@
-/*
- *  Copyright 2005 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.commons.proxy.provider;
-
-/**
- * Always returns the same object.
- *
- * @author James Carman
- * @version 1.0
- */
-public class ConstantProvider<T> extends AbstractObjectProvider<T>
-{
-    private final T constant;
-
-    public ConstantProvider( T constant )
-    {
-        this.constant = constant;
-    }
-
-    public T getObject()
-    {
-        return constant;
-    }
-}
+/*
+ *  Copyright 2005 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.commons.proxy.provider;
+
+/**
+ * Always returns the same object.
+ *
+ * @author James Carman
+ * @version 1.0
+ */
+public class ConstantProvider<T> extends AbstractObjectProvider<T>
+{
+    private final T constant;
+
+    public ConstantProvider( T constant )
+    {
+        this.constant = constant;
+    }
+
+    public T getObject()
+    {
+        return constant;
+    }
+}

Propchange: jakarta/commons/sandbox/proxy/trunk/src/java/org/apache/commons/proxy/provider/ConstantProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message