|
Tuscany Core | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tuscany.core.context.impl.AbstractLifecycle
org.apache.tuscany.core.context.impl.AbstractContext
org.apache.tuscany.core.runtime.RuntimeContextImpl
public class RuntimeContextImpl
Implementation of a RuntimeContext
that forms the foundation for a Tuscany environment.
Field Summary |
---|
Fields inherited from class org.apache.tuscany.core.context.impl.AbstractLifecycle |
---|
lifecycleState, name |
Fields inherited from interface org.apache.tuscany.core.runtime.RuntimeContext |
---|
ROOT, RUNTIME, SYSTEM |
Fields inherited from interface org.apache.tuscany.core.context.Lifecycle |
---|
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STARTED, STOPPED, STOPPING, UNINITIALIZED |
Constructor Summary | |
---|---|
RuntimeContextImpl(MonitorFactory monitorFactory,
ContextFactoryBuilderRegistry builderRegistry,
HierarchicalWireBuilder wireBuilder)
|
Method Summary | ||
---|---|---|
void |
addBuilder(WireBuilder builder)
Adds a wire builder to the runtime |
|
void |
build(AssemblyObject model)
Creates or updates a context factory based on configuration contained in the given model object. |
|
void |
completeTargetChain(TargetWireFactory targetFactory,
Class targetType,
ScopeContext targetScopeContext)
Finishes processing the target side wire chain. |
|
void |
connect(SourceWireFactory sourceFactory,
TargetWireFactory targetFactory,
Class targetType,
boolean downScope,
ScopeContext targetScopeContext)
Connects wire configurations of the source proxy factory to corresponding ones in the target proxy to factory |
|
void |
fireEvent(int pEventType,
Object pMessage)
|
|
Composite |
getComposite()
Returns the composite managed by this composite context |
|
Context |
getContext(String ctxName)
Returns the child context associated with a given name |
|
Object |
getInstance(QualifiedName qName)
Returns the instance associated with the requested name, which may be in a atomic or composite form. |
|
CompositeContext |
getParent()
Returns the parent context, or null if the context does not have one |
|
CompositeContext |
getRootContext()
Returns the context that forms the root of the user component tree. |
|
SystemCompositeContext |
getSystemContext()
Returns the context that forms the root of the system component tree. |
|
String |
getURI()
|
|
Object |
locateInstance(QualifiedName serviceName)
|
|
Object |
locateService(QualifiedName serviceName)
|
|
void |
registerModelObject(Extensible model)
Adds a runtime artifact represented by the model object to the composite context by merging it with existing artifacts. |
|
void |
registerModelObjects(List<? extends Extensible> models)
Adds runtime artifacts represented by the set of model objects to the composite context by merging them with existing artifacts. |
|
void |
removeContext(String name)
|
|
|
resolveExternalInstance(Class<T> instanceInterface)
Invoked by a parent context to return an autowire target in a child. |
|
|
resolveInstance(Class<T> instanceInterface)
Invoked by child contexts to return an an autowire target. |
|
void |
setAssemblyContext(AssemblyContext context)
TODO remove this method |
|
void |
setParent(CompositeContext parent)
Sets the parent context |
|
void |
setURI(String uri)
|
|
void |
start()
Starts the Lifecycle. |
|
void |
stop()
Stops the Lifecycle. |
Methods inherited from class org.apache.tuscany.core.context.impl.AbstractLifecycle |
---|
addListener, addListener, getLifecycleState, getListeners, getName, publish, removeListener, setName, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.tuscany.core.context.EventPublisher |
---|
addListener, addListener, publish, removeListener |
Methods inherited from interface org.apache.tuscany.core.context.Lifecycle |
---|
getLifecycleState, getName, setName |
Constructor Detail |
---|
public RuntimeContextImpl(MonitorFactory monitorFactory, ContextFactoryBuilderRegistry builderRegistry, HierarchicalWireBuilder wireBuilder)
Method Detail |
---|
public void start() throws CoreRuntimeException
Lifecycle
start
in interface Lifecycle
CoreRuntimeException
public void stop() throws CoreRuntimeException
Lifecycle
stop
in interface Lifecycle
CoreRuntimeException
public void addBuilder(WireBuilder builder)
RuntimeContext
addBuilder
in interface RuntimeContext
public Context getContext(String ctxName)
CompositeContext
getContext
in interface CompositeContext
public CompositeContext getRootContext()
RuntimeContext
getRootContext
in interface RuntimeContext
public SystemCompositeContext getSystemContext()
RuntimeContext
getSystemContext
in interface RuntimeContext
public void registerModelObject(Extensible model) throws ConfigurationException
CompositeContext
Part
types.
registerModelObject
in interface CompositeContext
ConfigurationException
Component
,
ModuleComponent
,
AtomicComponent
,
EntryPoint
,
ExternalService
public void registerModelObjects(List<? extends Extensible> models) throws ConfigurationException
CompositeContext
Part
types.
registerModelObjects
in interface CompositeContext
ConfigurationException
Component
,
ModuleComponent
,
AtomicComponent
,
EntryPoint
,
ExternalService
public CompositeContext getParent()
CompositeContext
getParent
in interface CompositeContext
public void setParent(CompositeContext parent)
CompositeContext
setParent
in interface CompositeContext
public String getURI()
getURI
in interface CompositeContext
public void setURI(String uri)
setURI
in interface CompositeContext
public void setAssemblyContext(AssemblyContext context)
CompositeContext
setAssemblyContext
in interface CompositeContext
public void fireEvent(int pEventType, Object pMessage) throws EventException
EventException
public Object locateService(QualifiedName serviceName)
public Object locateInstance(QualifiedName serviceName)
public Object getInstance(QualifiedName qName) throws TargetException
Context
getInstance
in interface Context
qName
- a qualified name of the requested instance
TargetException
- if an error occurs retrieving the instance or the requested component is not an entry
point.CompositeContext
,
EntryPoint
public void build(AssemblyObject model) throws BuilderConfigException
ContextFactoryBuilder
build
in interface ContextFactoryBuilder
model
- the logical configuration model node
BuilderConfigException
public void connect(SourceWireFactory sourceFactory, TargetWireFactory targetFactory, Class targetType, boolean downScope, ScopeContext targetScopeContext) throws BuilderConfigException
WireBuilder
connect
in interface WireBuilder
sourceFactory
- the proxy factory used in constructing the source side of the wire chaintargetFactory
- the proxy factory used in constructing the target side of the wire chaintargetType
- the context type of the target. Used to determine if a paricular wire builder should construct
the wiredownScope
- true if the component containing the reference (source side) is of a lesser scope than the
target servicetargetScopeContext
- the scope context responsible for managing intance contexts of the target component
type
BuilderConfigException
- if an error occurs during the wire buildSource processpublic void completeTargetChain(TargetWireFactory targetFactory, Class targetType, ScopeContext targetScopeContext) throws BuilderConfigException
WireBuilder
TargetInvoker
used by target-side proxies is usually set during this
phase.
completeTargetChain
in interface WireBuilder
targetFactory
- the target-side proxy factorytargetType
- the target context typetargetScopeContext
- the target scope
BuilderConfigException
- if an error occurs during the wire buildSource processpublic <T> T resolveInstance(Class<T> instanceInterface) throws AutowireResolutionException
AutowireContext
resolveInstance
in interface AutowireContext
instanceInterface
- the type of service being requested
AutowireResolutionException
- if an error occurs attempting to resolve an autowirepublic <T> T resolveExternalInstance(Class<T> instanceInterface) throws AutowireResolutionException
AutowireContext
#resolveInstance(Class)
on P, which in turn could invoke the present method on B in order to resolve
a target.
resolveExternalInstance
in interface AutowireContext
instanceInterface
- the type of service being requested
AutowireResolutionException
- if an error occurs attempting to resolve an autowirepublic Composite getComposite()
CompositeContext
getComposite
in interface CompositeContext
public void removeContext(String name)
removeContext
in interface CompositeContext
|
Tuscany Core | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |