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

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

public class CompositeScopeContainer<KEY>
extends AbstractScopeContainer<KEY>

A scope context which manages atomic component instances keyed by composite


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
CompositeScopeContainer(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 start()
          Starts the Lifecycle.
 void stop()
          Stops the Lifecycle.
 
Methods inherited from class org.apache.tuscany.sca.core.scope.AbstractScopeContainer
addWrapperReference, checkInit, createInstanceWrapper, getComponent, getLifecycleState, getScope, isEagerInit, onEvent, 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

CompositeScopeContainer

public CompositeScopeContainer(RuntimeComponent component)
Method Detail

stop

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

Specified by:
stop in interface ScopeContainer<KEY>
Overrides:
stop in class AbstractScopeContainer<KEY>

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

start

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

Specified by:
start in interface ScopeContainer<KEY>
Overrides:
start in class AbstractScopeContainer<KEY>