org.openejb.util.proxy
Class ProxyManager
java.lang.Object
|
+--org.openejb.util.proxy.ProxyManager
- public class ProxyManager
- extends java.lang.Object
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ProxyManager
public ProxyManager()
registerFactory
public static ProxyFactory registerFactory(java.lang.String factoryName,
ProxyFactory factory)
unregisterFactory
public static ProxyFactory unregisterFactory(java.lang.String factoryName)
checkDefaultFactory
public static void checkDefaultFactory()
getFactory
public static ProxyFactory getFactory(java.lang.String factoryName)
setDefaultFactory
public static ProxyFactory setDefaultFactory(java.lang.String factoryName)
- Sets the default factory.
The factory must already be registered.
- Parameters:
factoryName
-
getDefaultFactory
public static ProxyFactory getDefaultFactory()
getDefaultFactoryName
public static java.lang.String getDefaultFactoryName()
getInvocationHandler
public static InvocationHandler getInvocationHandler(java.lang.Object proxy)
- Casts the object passed in to the appropriate proxy type and retreives
the InvocationHandler assigned to it.
Executes on the default ProxyFactory instance.
- Parameters:
proxy
- The Proxy object to retreive the InvocationHandler from.- Returns:
- The implementation of InvocationHandler handling invocations on the specified Proxy object.
setInvocationHandler
public static java.lang.Object setInvocationHandler(java.lang.Object proxy,
InvocationHandler handler)
- Casts the object passed in to the appropriate proxy type and sets
the InvocationHandler assigned to it.
- Parameters:
proxy
- The Proxy object to retreive the InvocationHandler from.- Returns:
- The Proxy object with the new InvocationHandler.
getProxyClass
public static java.lang.Class getProxyClass(java.lang.Class interfaceType)
throws java.lang.IllegalAccessException
- Loads and returns the proxy implementation for the specified interface.
The Class object is loaded using ProxyClassLoader.loadClass. If the class
definition is not found, the findClass method will be called by the VM; at which
point, the proxy class byte code will be generated by ProxyFactory and resolved by
the VM.
- Parameters:
interfaceType
- - Returns:
-
- Throws:
java.lang.IllegalAccessException
-
getProxyClass
public static java.lang.Class getProxyClass(java.lang.Class[] interfaces)
throws java.lang.IllegalAccessException
newProxyInstance
public static java.lang.Object newProxyInstance(java.lang.Class interfaceType,
InvocationHandler h)
throws java.lang.IllegalAccessException
- Throws a RuntimeException if there is a problem
instantiating the new proxy instance.
- Parameters:
interfaceType
- A bean's home or remote interface that the Proxy
object should implement.h
- - Returns:
-
- Throws:
java.lang.IllegalAccessException
-
newProxyInstance
public static java.lang.Object newProxyInstance(java.lang.Class[] interfaces,
InvocationHandler h)
throws java.lang.IllegalAccessException
isProxyClass
public static boolean isProxyClass(java.lang.Class cl)
- Parameters:
cl
- - Returns:
-
newProxyInstance
public static java.lang.Object newProxyInstance(java.lang.Class proxyClass)
throws java.lang.IllegalAccessException
- Create a new proxy instance given a proxy class.