org.apache.tuscany.sca.implementation.osgi.runtime
Class OSGiTargetInvoker<T>

java.lang.Object
  extended by org.apache.tuscany.sca.implementation.osgi.runtime.OSGiTargetInvoker<T>
All Implemented Interfaces:
Invoker
Direct Known Subclasses:
OSGiRemotableInvoker

public class OSGiTargetInvoker<T>
extends java.lang.Object
implements Invoker

Java->OSGi references use OSGiTargetInvoker to call methods from OSGi bundles OSGi->Java references use JDKProxyService and invocation handler and do not use this class OSGi->OSGi references go through OSGi reference mechanisms when a proxy is not used When a proxy is used, this invoker is used to call methods from OSGi bundles A proxy is used for OSGi->OSGi if 1) target reference properties are specified OR 2) there are one or more non-blocking methods in the target interface OR 3) scope is not COMPOSITE


Field Summary
protected  InstanceWrapper<T> target
           
 
Constructor Summary
OSGiTargetInvoker(Operation operation, OSGiImplementationProvider provider, RuntimeComponentService service)
           
 
Method Summary
protected  InstanceWrapper getInstance(java.lang.Object contextId)
          Resolves the target service instance or returns a cached one
 Message invoke(Message msg)
          Process a synchronous wire
protected  java.lang.Object invokeMethod(java.lang.Object instance, java.lang.reflect.Method m, Message msg)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

target

protected InstanceWrapper<T> target
Constructor Detail

OSGiTargetInvoker

public OSGiTargetInvoker(Operation operation,
                         OSGiImplementationProvider provider,
                         RuntimeComponentService service)
Method Detail

getInstance

protected InstanceWrapper getInstance(java.lang.Object contextId)
                               throws TargetResolutionException,
                                      TargetInvocationException
Resolves the target service instance or returns a cached one

Throws:
TargetResolutionException
TargetInvocationException

invokeMethod

protected java.lang.Object invokeMethod(java.lang.Object instance,
                                        java.lang.reflect.Method m,
                                        Message msg)
                                 throws java.lang.reflect.InvocationTargetException
Throws:
java.lang.reflect.InvocationTargetException

invoke

public Message invoke(Message msg)
Description copied from interface: Invoker
Process a synchronous wire

Specified by:
invoke in interface Invoker
Parameters:
msg - The request Message for the wire
Returns:
The response Message from the wire