Tuscany Core

org.apache.tuscany.core.context
Interface ScopeContext

All Superinterfaces:
java.util.EventListener, Lifecycle, RuntimeEventListener
All Known Implementing Classes:
AbstractScopeContext, CompositeScopeContext, ModuleScopeContext, RequestScopeContext, SessionScopeContext, StatelessScopeContext

public interface ScopeContext
extends Lifecycle, RuntimeEventListener

Manages the lifecycle and visibility of Contexts.

Version:
$Rev: 396520 $ $Date: 2006-04-24 07:38:07 -0400 (Mon, 24 Apr 2006) $
See Also:
Context

Field Summary
 
Fields inherited from interface org.apache.tuscany.core.context.Lifecycle
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STARTED, STOPPED, STOPPING, UNINITIALIZED
 
Method Summary
 Context getContext(java.lang.String name)
          Returns a context bound to the given name or null if the component does not exist.
 Context getContextByKey(java.lang.String name, java.lang.Object key)
          Returns a context bound to the given name and scoped to the given key or null if the context does not exist
 java.lang.Object getInstance(QualifiedName qName)
           
 boolean isCacheable()
          Returns whether implementation instances may be held for the duration of an wire
 void registerFactories(java.util.List<ContextFactory<Context>> configurations)
          Registers the context factory used to construct instance contexts for the scope
 void registerFactory(ContextFactory<Context> configuration)
          Adds a context factory to the scope
 void removeContext(java.lang.String name)
          Removes a context with the given name, determining the scope key from the thread context
 void removeContextByKey(java.lang.String name, java.lang.Object key)
          Removes a context bound to the given name and scope key
 
Methods inherited from interface org.apache.tuscany.core.context.Lifecycle
getLifecycleState, getName, setName, start, stop
 
Methods inherited from interface org.apache.tuscany.core.context.RuntimeEventListener
onEvent
 

Method Detail

getInstance

java.lang.Object getInstance(QualifiedName qName)
                             throws TargetException
Throws:
TargetException

isCacheable

boolean isCacheable()
Returns whether implementation instances may be held for the duration of an wire


registerFactories

void registerFactories(java.util.List<ContextFactory<Context>> configurations)
Registers the context factory used to construct instance contexts for the scope


registerFactory

void registerFactory(ContextFactory<Context> configuration)
Adds a context factory to the scope


getContext

Context getContext(java.lang.String name)
Returns a context bound to the given name or null if the component does not exist. The returned context is bound to a key determined from the thread context.


getContextByKey

Context getContextByKey(java.lang.String name,
                        java.lang.Object key)
Returns a context bound to the given name and scoped to the given key or null if the context does not exist


removeContext

void removeContext(java.lang.String name)
                   throws ScopeRuntimeException
Removes a context with the given name, determining the scope key from the thread context

Throws:
ScopeRuntimeException

removeContextByKey

void removeContextByKey(java.lang.String name,
                        java.lang.Object key)
                        throws ScopeRuntimeException
Removes a context bound to the given name and scope key

Throws:
ScopeRuntimeException

Tuscany Core

-