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

java.lang.Object
  extended by org.apache.tuscany.sca.implementation.osgi.runtime.OSGiInstanceWrapper<T>
All Implemented Interfaces:
InstanceWrapper<T>

public class OSGiInstanceWrapper<T>
extends java.lang.Object
implements InstanceWrapper<T>

InstanceWrapper for creating instances for OSGi components. This class needs to implement InstanceWrapper since the wrapper is stored in the scope container. But getInstance() is called on this wrapper only through the OSGi target invoker. OSGiTargetInvoker always invokes getInstance for a specific service since one OSGi SCA component can associate different objects with different services (this is different from Java SCA components which always associate a single component instance with multiple services).


Constructor Summary
OSGiInstanceWrapper(OSGiImplementationProvider provider, OSGiAnnotations annotationProcessor, BundleContext bundleContext)
           
 
Method Summary
 T getInstance()
           
 T getInstance(ComponentService service)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OSGiInstanceWrapper

public OSGiInstanceWrapper(OSGiImplementationProvider provider,
                           OSGiAnnotations annotationProcessor,
                           BundleContext bundleContext)
Method Detail

getInstance

public T getInstance(ComponentService service)
              throws TargetInitializationException
Throws:
TargetInitializationException

getInstance

public T getInstance()
Specified by:
getInstance in interface InstanceWrapper<T>
Returns:

start

public void start()
           throws TargetInitializationException
Specified by:
start in interface InstanceWrapper<T>
Throws:
TargetInitializationException

stop

public void stop()
          throws TargetDestructionException
Specified by:
stop in interface InstanceWrapper<T>
Throws:
TargetDestructionException