org.openejb.client.proxy
Class Jdk13ProxyFactory

java.lang.Object
  extended by org.openejb.client.proxy.Jdk13ProxyFactory
All Implemented Interfaces:
ProxyFactory

public class Jdk13ProxyFactory
extends java.lang.Object
implements ProxyFactory

Implementation of ProxyFactory for JDK 1.3 Proxies. This only compiles on JDK 1.3 or better. It is very fast because it builds the proxies out of raw bytecode.

Author:
Aaron Mulder (ammulder@alumni.princeton.edu)

Constructor Summary
Jdk13ProxyFactory()
           
 
Method Summary
 InvocationHandler getInvocationHandler(java.lang.Object proxy)
          Returns the invocation handler for the specified proxy instance.
 java.lang.Class getProxyClass(java.lang.Class interfce)
          Returns the java.lang.Class object for a proxy class given a class loader and an array of interfaces.
 java.lang.Class getProxyClass(java.lang.Class[] interfaces)
          Returns the java.lang.Class object for a proxy class given a class loader and an array of interfaces.
 void init(java.util.Properties props)
          Prepare the factory for use.
 boolean isProxyClass(java.lang.Class cl)
          Returns true if and only if the specified class was dynamically generated to be a proxy class using the getProxyClass method or the newProxyInstance method.
 java.lang.Object newProxyInstance(java.lang.Class proxyClass)
          Creates a new proxy instance using the handler of the proxy passed in.
 java.lang.Object newProxyInstance(java.lang.Class[] interfaces, InvocationHandler h)
          Returns an instance of a proxy class for the specified interface that dispatches method invocations to the specified invocation handler.
 java.lang.Object newProxyInstance(java.lang.Class interfce, InvocationHandler h)
          Returns an instance of a proxy class for the specified interface that dispatches method invocations to the specified invocation handler.
 java.lang.Object setInvocationHandler(java.lang.Object proxy, InvocationHandler handler)
          Sets the invocation handler for the specified proxy instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Jdk13ProxyFactory

public Jdk13ProxyFactory()
Method Detail

init

public void init(java.util.Properties props)
Prepare the factory for use. Called once when the ProxyFactory is instaniated.

Specified by:
init in interface ProxyFactory
Parameters:
props -

getInvocationHandler

public InvocationHandler getInvocationHandler(java.lang.Object proxy)
                                       throws java.lang.IllegalArgumentException
Returns the invocation handler for the specified proxy instance.

Specified by:
getInvocationHandler in interface ProxyFactory
Throws:
java.lang.IllegalArgumentException

setInvocationHandler

public java.lang.Object setInvocationHandler(java.lang.Object proxy,
                                             InvocationHandler handler)
                                      throws java.lang.IllegalArgumentException
Sets the invocation handler for the specified proxy instance.

Specified by:
setInvocationHandler in interface ProxyFactory
Throws:
java.lang.IllegalArgumentException

getProxyClass

public java.lang.Class getProxyClass(java.lang.Class interfce)
                              throws java.lang.IllegalArgumentException
Returns the java.lang.Class object for a proxy class given a class loader and an array of interfaces.

Specified by:
getProxyClass in interface ProxyFactory
Parameters:
interfce -
Returns:
Class
Throws:
java.lang.IllegalArgumentException

getProxyClass

public java.lang.Class getProxyClass(java.lang.Class[] interfaces)
                              throws java.lang.IllegalArgumentException
Returns the java.lang.Class object for a proxy class given a class loader and an array of interfaces.

Specified by:
getProxyClass in interface ProxyFactory
Parameters:
interfaces -
Returns:
Class
Throws:
java.lang.IllegalArgumentException

isProxyClass

public boolean isProxyClass(java.lang.Class cl)
Returns true if and only if the specified class was dynamically generated to be a proxy class using the getProxyClass method or the newProxyInstance method.

Specified by:
isProxyClass in interface ProxyFactory
Parameters:
cl -
Returns:
boolean

newProxyInstance

public java.lang.Object newProxyInstance(java.lang.Class proxyClass)
                                  throws java.lang.IllegalArgumentException
Creates a new proxy instance using the handler of the proxy passed in.

Specified by:
newProxyInstance in interface ProxyFactory
Parameters:
proxyClass -
Returns:
Object
Throws:
java.lang.IllegalArgumentException

newProxyInstance

public java.lang.Object newProxyInstance(java.lang.Class interfce,
                                         InvocationHandler h)
                                  throws java.lang.IllegalArgumentException
Returns an instance of a proxy class for the specified interface that dispatches method invocations to the specified invocation handler.

Specified by:
newProxyInstance in interface ProxyFactory
Parameters:
interfce -
h -
Returns:
Object
Throws:
java.lang.IllegalArgumentException

newProxyInstance

public java.lang.Object newProxyInstance(java.lang.Class[] interfaces,
                                         InvocationHandler h)
                                  throws java.lang.IllegalArgumentException
Returns an instance of a proxy class for the specified interface that dispatches method invocations to the specified invocation handler.

Specified by:
newProxyInstance in interface ProxyFactory
Parameters:
interfaces -
h -
Returns:
Object
Throws:
java.lang.IllegalArgumentException


Copyright © 1999-2011 OpenEJB. All Rights Reserved.