org.apache.tuscany.sca.core.invocation
Class CglibProxyFactory

java.lang.Object
  extended by org.apache.tuscany.sca.core.invocation.CglibProxyFactory
All Implemented Interfaces:
ProxyFactory

public class CglibProxyFactory
extends java.lang.Object
implements ProxyFactory

The implementation of a wire service that uses cglib dynamic proxies


Constructor Summary
CglibProxyFactory(MessageFactory messageFactory, InterfaceContractMapper mapper)
           
 
Method Summary
<B,R extends org.osoa.sca.CallableReference<B>>
R
cast(B target)
          Cast a proxy to a CallableReference.
<T> T
createCallbackProxy(CallbackReferenceImpl<T> callbackReference)
          create the callback proxy with cglib.
<T> T
createCallbackProxy(java.lang.Class<T> interfaze, java.util.List<RuntimeWire> wires)
          create the callback proxy with cglib.
<T> T
createProxy(org.osoa.sca.CallableReference<T> callableReference)
          create the proxy with cglib.
<T> T
createProxy(java.lang.Class<T> interfaze, RuntimeWire wire)
          Creates a Java proxy for the given wire
 boolean isProxyClass(java.lang.Class<?> clazz)
          Test if a given class is a generated proxy class by this factory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CglibProxyFactory

public CglibProxyFactory(MessageFactory messageFactory,
                         InterfaceContractMapper mapper)
Method Detail

createProxy

public <T> T createProxy(java.lang.Class<T> interfaze,
                         RuntimeWire wire)
              throws ProxyCreationException
Description copied from interface: ProxyFactory
Creates a Java proxy for the given wire

Specified by:
createProxy in interface ProxyFactory
Parameters:
interfaze - the interface the proxy implements
wire - the wire to proxy
Returns:
the proxy
Throws:
ProxyCreationException

createProxy

public <T> T createProxy(org.osoa.sca.CallableReference<T> callableReference)
              throws ProxyCreationException
create the proxy with cglib. use the same JDKInvocationHandler as JDKProxyService.

Specified by:
createProxy in interface ProxyFactory
Parameters:
callableReference - The CallableReference
Returns:
the proxy
Throws:
ProxyCreationException

createCallbackProxy

public <T> T createCallbackProxy(java.lang.Class<T> interfaze,
                                 java.util.List<RuntimeWire> wires)
                      throws ProxyCreationException
create the callback proxy with cglib. use the same JDKCallbackInvocationHandler as JDKProxyService.

Specified by:
createCallbackProxy in interface ProxyFactory
Parameters:
interfaze - the interface the proxy should implement
Returns:
the proxy
Throws:
ProxyCreationException

createCallbackProxy

public <T> T createCallbackProxy(CallbackReferenceImpl<T> callbackReference)
                      throws ProxyCreationException
create the callback proxy with cglib. use the same JDKCallbackInvocationHandler as JDKProxyService.

Specified by:
createCallbackProxy in interface ProxyFactory
Returns:
the proxy
Throws:
ProxyCreationException

cast

public <B,R extends org.osoa.sca.CallableReference<B>> R cast(B target)
                                                 throws java.lang.IllegalArgumentException
Description copied from interface: ProxyFactory
Cast a proxy to a CallableReference.

Specified by:
cast in interface ProxyFactory
Parameters:
target - a proxy generated by this implementation
Returns:
a CallableReference (or subclass) equivalent to this proxy
Throws:
java.lang.IllegalArgumentException - if the object supplied is not a proxy

isProxyClass

public boolean isProxyClass(java.lang.Class<?> clazz)
Description copied from interface: ProxyFactory
Test if a given class is a generated proxy class by this factory

Specified by:
isProxyClass in interface ProxyFactory
Parameters:
clazz - A java class or interface
Returns:
true if the class is a generated proxy class by this factory
See Also:
ProxyFactory.isProxyClass(java.lang.Class)