|
Tuscany Core | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ContextFactory<T extends Context>
Implementations create Context
s based on an assembly configuration.
ContextFactoryBuilder
s analyze an assembly, producing
ContextFactory
s for Component
s, EntryPoint
s, and ExternalService
s. During this
phase, WireFactory
s for source- and target-side wires are produced for the
ContextFactory
s. �
The second build phase connects the source- and target-side WireFactories
, thereby completing wire configuration.
At runtime, ContextFactory
s are called to create new Context
s when a new implementation instance is
required for a component, entry point, or external service. The Context
is then responsible for instantiating and
managing the actual implementation instance. When a Context
creates a new instance, the previously configured
WireFactory
s are used to create wires to and from the instance. A wire is a collection of stateless invocation
chains that are managed by the Context
's ContextFactory
.
Method Summary | |
---|---|
void |
addProperty(String propertyName,
Object value)
Adds a property to the context |
void |
addSourceWireFactories(String referenceName,
Class referenceInterface,
List<SourceWireFactory> factory,
boolean multiplicity)
Adds a set of source-side wire factories for the given reference. |
void |
addSourceWireFactory(String referenceName,
SourceWireFactory factory)
Adds a source-side wire factory for the given reference. |
void |
addTargetWireFactory(String serviceName,
TargetWireFactory factory)
Adds a target-side wire factory for the given service name. |
T |
createContext()
Creates a Context based on configuration supplied by a logical model assembly |
String |
getName()
Returns the name of the Context produced by the current factory |
Scope |
getScope()
Returns the scope identifier associated with the type of contexts produced by the current factory |
List<SourceWireFactory> |
getSourceWireFactories()
Returns a collection of source-side wire factories for references. |
Map<String,TargetWireFactory> |
getTargetWireFactories()
Returns a collection of target-side wire factories keyed by service name |
TargetWireFactory |
getTargetWireFactory(String serviceName)
Returns the target-side wire factory associated with the given service name |
void |
prepare(CompositeContext parent)
Called to signal to the configuration that its parent context has been activated and that it shoud perform any required initialization steps |
Method Detail |
---|
T createContext() throws ContextCreationException
Context
based on configuration supplied by a logical model assembly
ContextCreationException
- if an error occurs creating the contextScope getScope()
String getName()
Context
produced by the current factory
void addProperty(String propertyName, Object value)
void addTargetWireFactory(String serviceName, TargetWireFactory factory)
TargetWireFactory getTargetWireFactory(String serviceName)
Map<String,TargetWireFactory> getTargetWireFactories()
void addSourceWireFactory(String referenceName, SourceWireFactory factory)
referenceName
- factory
- void addSourceWireFactories(String referenceName, Class referenceInterface, List<SourceWireFactory> factory, boolean multiplicity)
referenceName
- referenceInterface
- factory
- multiplicity
- List<SourceWireFactory> getSourceWireFactories()
void prepare(CompositeContext parent)
parent
- the parent context
|
Tuscany Core | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |