org.apache.tuscany.sca.core.scope
Class RequestScopeContainer

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

public class RequestScopeContainer
extends AbstractScopeContainer<java.lang.Thread>

A scope context which manages atomic component instances keyed on the current request context


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
RequestScopeContainer(RuntimeComponent component)
           
 
Method Summary
protected  InstanceWrapper getInstanceWrapper(boolean create)
           
 InstanceWrapper getWrapper(java.lang.Thread contextId)
          Returns an instance wrapper associated with the current scope context, creating one if necessary
 void onEvent(Event event)
          Accepts and event and acts on it
 void start()
          Starts the Lifecycle.
 void stop()
          Stops the Lifecycle.
 
Methods inherited from class org.apache.tuscany.sca.core.scope.AbstractScopeContainer
addWrapperReference, checkInit, createInstanceWrapper, getAssociatedWrapper, getComponent, getLifecycleState, getScope, isEagerInit, registerWrapper, remove, returnWrapper, setComponent, setLifecycleState, startContext, stopContext, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestScopeContainer

public RequestScopeContainer(RuntimeComponent component)
Method Detail

onEvent

public void onEvent(Event event)
Description copied from interface: RuntimeEventListener
Accepts and event and acts on it

Specified by:
onEvent in interface RuntimeEventListener
Overrides:
onEvent in class AbstractScopeContainer<java.lang.Thread>
Parameters:
event - The event to act on

start

public void start()
Description copied from interface: ScopeContainer
Starts the Lifecycle.

Specified by:
start in interface ScopeContainer<java.lang.Thread>
Overrides:
start in class AbstractScopeContainer<java.lang.Thread>

stop

public void stop()
Description copied from interface: ScopeContainer
Stops the Lifecycle.

Specified by:
stop in interface ScopeContainer<java.lang.Thread>
Overrides:
stop in class AbstractScopeContainer<java.lang.Thread>

getInstanceWrapper

protected InstanceWrapper getInstanceWrapper(boolean create)
                                      throws TargetResolutionException
Throws:
TargetResolutionException

getWrapper

public InstanceWrapper getWrapper(java.lang.Thread 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<java.lang.Thread>
Overrides:
getWrapper in class AbstractScopeContainer<java.lang.Thread>
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