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

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

public class JDKProxyFactory
extends java.lang.Object
implements ProxyFactory

the default implementation of a wire service that uses JDK dynamic proxies


Field Summary
protected  InterfaceContractMapper contractMapper
           
 
Constructor Summary
JDKProxyFactory(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)
          Creates a Java proxy for the given callback reference
<T> T
createCallbackProxy(java.lang.Class<T> interfaze, java.util.List<RuntimeWire> wires)
          Creates a Java proxy for the service contract callback
<T> T
createProxy(org.osoa.sca.CallableReference<T> callableReference)
          Creates a Java proxy for the given CallableReference
<T> T
createProxy(java.lang.Class<T> interfaze, RuntimeWire wire)
          The original createProxy method assumes that the proxy doesn't want to share conversation state so sets the conversation object to null
 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
 

Field Detail

contractMapper

protected InterfaceContractMapper contractMapper
Constructor Detail

JDKProxyFactory

public JDKProxyFactory(MessageFactory messageFactory,
                       InterfaceContractMapper mapper)
Method Detail

createProxy

public <T> T createProxy(java.lang.Class<T> interfaze,
                         RuntimeWire wire)
              throws ProxyCreationException
The original createProxy method assumes that the proxy doesn't want to share conversation state so sets the conversation object to null

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
Description copied from interface: ProxyFactory
Creates a Java proxy for the given CallableReference

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
Description copied from interface: ProxyFactory
Creates a Java proxy for the service contract callback

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
Description copied from interface: ProxyFactory
Creates a Java proxy for the given callback reference

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)