Tuscany Core

org.apache.tuscany.core.context
Interface AutowireContext

All Superinterfaces:
CompositeContext, Context, EventPublisher, Lifecycle
All Known Subinterfaces:
RuntimeContext, SystemCompositeContext
All Known Implementing Classes:
AbstractCompositeContext, CompositeContextImpl, RuntimeContextImpl, SystemCompositeContextImpl

public interface AutowireContext
extends CompositeContext

A specialization of a CompositeContext that is able to automatically resolve references for its children using EntryPoint or Service interfaces exposed by it or, recursively, any of it parents.

Version:
$Rev: 395110 $ $Date: 2006-04-18 22:32:30 -0400 (Tue, 18 Apr 2006) $

Field Summary
 
Fields inherited from interface org.apache.tuscany.core.context.Lifecycle
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STARTED, STOPPED, STOPPING, UNINITIALIZED
 
Method Summary
<T> T
resolveExternalInstance(java.lang.Class<T> instanceInterface)
          Invoked by a parent context to return an autowire target in a child.
<T> T
resolveInstance(java.lang.Class<T> instanceInterface)
          Invoked by child contexts to return an an autowire target.
 
Methods inherited from interface org.apache.tuscany.core.context.CompositeContext
getComposite, getContext, getParent, getURI, registerModelObject, registerModelObjects, removeContext, setAssemblyContext, setParent, setURI
 
Methods inherited from interface org.apache.tuscany.core.context.Context
getInstance
 
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, start, stop
 

Method Detail

resolveInstance

<T> T resolveInstance(java.lang.Class<T> instanceInterface)
                  throws AutowireResolutionException
Invoked by child contexts to return an an autowire target. Resolved targets may be entry points or components in the parent or its ancestors, or entry points in a sibling context

Parameters:
instanceInterface - the type of service being requested
Returns:
a reference to the requested service or null if none can be found
Throws:
AutowireResolutionException - if an error occurs attempting to resolve an autowire

resolveExternalInstance

<T> T resolveExternalInstance(java.lang.Class<T> instanceInterface)
                          throws AutowireResolutionException
Invoked by a parent context to return an autowire target in a child. Resolved targets must be entry points. For example, given a parent P and two siblings, A and B, A would request an autowire by invoking #resolveInstance(Class) on P, which in turn could invoke the present method on B in order to resolve a target.

Parameters:
instanceInterface - the type of service being requested
Returns:
a reference to the requested service or null if none can be found
Throws:
AutowireResolutionException - if an error occurs attempting to resolve an autowire

Tuscany Core

-