org.apache.tuscany.sca.core.scope
Class StatelessScopeContainer<KEY>

java.lang.Object
  extended by org.apache.tuscany.sca.core.scope.AbstractScopeContainer<KEY>
      extended by org.apache.tuscany.sca.core.scope.StatelessScopeContainer<KEY>
All Implemented Interfaces:
java.util.EventListener, ScopeContainer<KEY>, RuntimeEventListener

public class StatelessScopeContainer<KEY>
extends AbstractScopeContainer<KEY>

A scope context which manages stateless atomic component instances in a non-pooled fashion.


Field Summary
 
Fields inherited from class org.apache.tuscany.sca.core.scope.AbstractScopeContainer
component, lifecycleState, scope, wrappers
 
Fields inherited from interface org.apache.tuscany.sca.core.scope.ScopeContainer
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
StatelessScopeContainer(RuntimeComponent component)
           
 
Method Summary
 InstanceWrapper getAssociatedWrapper(KEY contextId)
          Returns an implementation instance associated with the current scope context.
 InstanceWrapper getWrapper(KEY contextId)
          Returns an instance wrapper associated with the current scope context, creating one if necessary
 void returnWrapper(InstanceWrapper wrapper, KEY contextId)
          Return a wrapper after use (for example, after invoking the instance).
 
Methods inherited from class org.apache.tuscany.sca.core.scope.AbstractScopeContainer
addWrapperReference, checkInit, createInstanceWrapper, getComponent, getLifecycleState, getScope, isEagerInit, onEvent, registerWrapper, remove, setComponent, setLifecycleState, start, startContext, stop, stopContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StatelessScopeContainer

public StatelessScopeContainer(RuntimeComponent component)
Method Detail

getWrapper

public InstanceWrapper getWrapper(KEY contextId)
                           throws TargetResolutionException
Description copied from interface: ScopeContainer
Returns an instance wrapper associated with the current scope context, creating one if necessary

Specified by:
getWrapper in interface ScopeContainer<KEY>
Overrides:
getWrapper in class AbstractScopeContainer<KEY>
Parameters:
contextId - the id for the scope context
Returns:
the wrapper for the target instance
Throws:
TargetResolutionException - if there was a problem instantiating the target instance

getAssociatedWrapper

public InstanceWrapper getAssociatedWrapper(KEY contextId)
                                     throws TargetResolutionException
Description copied from interface: ScopeContainer
Returns an implementation instance associated with the current scope context. If no instance is found, a TargetNotFoundException is thrown.

Specified by:
getAssociatedWrapper in interface ScopeContainer<KEY>
Overrides:
getAssociatedWrapper in class AbstractScopeContainer<KEY>
Parameters:
contextId - the id for the scope context
Returns:
the wrapper for the target instance
Throws:
TargetResolutionException - if there was a problem instantiating the target instance

returnWrapper

public void returnWrapper(InstanceWrapper wrapper,
                          KEY contextId)
                   throws TargetDestructionException
Description copied from interface: ScopeContainer
Return a wrapper after use (for example, after invoking the instance).

Specified by:
returnWrapper in interface ScopeContainer<KEY>
Overrides:
returnWrapper in class AbstractScopeContainer<KEY>
Parameters:
wrapper - the wrapper for the target instance being returned
contextId - the id for the scope context
Throws:
TargetDestructionException - if there was a problem returning the target instance