Tuscany Core

org.apache.tuscany.core.system.context
Class SystemCompositeContextImpl

java.lang.Object
  extended by org.apache.tuscany.core.context.impl.AbstractLifecycle
      extended by org.apache.tuscany.core.context.impl.AbstractContext
          extended by org.apache.tuscany.core.context.impl.AbstractCompositeContext
              extended by org.apache.tuscany.core.system.context.SystemCompositeContextImpl
All Implemented Interfaces:
ContextFactoryBuilder, WireBuilder, AutowireContext, CompositeContext, ConfigurationContext, Context, EventPublisher, Lifecycle, ScopeAwareContext, SystemCompositeContext

public class SystemCompositeContextImpl
extends AbstractCompositeContext
implements SystemCompositeContext

Implements an composite context for system components. By default a system context uses the scopes specified by SystemScopeStrategy. In addition, it implements an autowire policy where entry points configured with a SystemBinding are matched according to their exposed interface. A system context may contain child composite contexts but an entry point in a child context will only be outwardly accessible if there is an entry point that exposes it configured in the top-level system context.

Version:
$Rev: 408581 $ $Date: 2006-05-21 23:34:24 -0700 (Sun, 21 May 2006) $

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.tuscany.core.context.impl.AbstractCompositeContext
AbstractCompositeContext.NameToScope
 
Field Summary
 
Fields inherited from class org.apache.tuscany.core.context.impl.AbstractCompositeContext
assemblyContext, configurationContext, configurations, DEFAULT_WAIT, eventContext, immutableScopeContexts, initialized, initializeLatch, lock, module, parentContext, scopeContexts, scopeIndex, scopeStrategy
 
Fields inherited from class org.apache.tuscany.core.context.impl.AbstractLifecycle
lifecycleState, name
 
Fields inherited from interface org.apache.tuscany.core.context.Lifecycle
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STARTED, STOPPED, STOPPING, UNINITIALIZED
 
Fields inherited from interface org.apache.tuscany.core.context.Lifecycle
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STARTED, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
SystemCompositeContextImpl()
           
SystemCompositeContextImpl(String name, CompositeContext parent, AutowireContext autowire, ScopeStrategy strategy, EventContext ctx, ConfigurationContext configCtx)
           
 
Method Summary
 void registerJavaObject(String componentName, Class<?> service, Object instance)
          Register a simple Java Object as a system component.
<T> T
resolveInstance(Class<T> instanceInterface)
          Invoked by child contexts to return an an autowire target.
 
Methods inherited from class org.apache.tuscany.core.context.impl.AbstractCompositeContext
build, buildTarget, checkInit, completeTargetChain, connect, fireEvent, getComposite, getContext, getInstance, getParent, getScopeContexts, getURI, initializeScopes, initializeWireFactories, publish, registerAutowireExternal, registerAutowireInternal, registerConfiguration, registerModelObject, registerModelObjects, removeContext, resolveExternalInstance, setAssemblyContext, setAutowireContext, setConfigurationContext, setEventContext, setModule, setParent, setURI, start, stop, wireSource
 
Methods inherited from class org.apache.tuscany.core.context.impl.AbstractLifecycle
addListener, addListener, getLifecycleState, getListeners, getName, 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.AutowireContext
resolveExternalInstance
 
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
 
Methods inherited from interface org.apache.tuscany.core.context.ScopeAwareContext
getScopeContexts
 
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
 
Methods inherited from interface org.apache.tuscany.core.builder.ContextFactoryBuilder
build
 
Methods inherited from interface org.apache.tuscany.core.builder.WireBuilder
completeTargetChain, connect
 

Constructor Detail

SystemCompositeContextImpl

public SystemCompositeContextImpl()

SystemCompositeContextImpl

public SystemCompositeContextImpl(String name,
                                  CompositeContext parent,
                                  AutowireContext autowire,
                                  ScopeStrategy strategy,
                                  EventContext ctx,
                                  ConfigurationContext configCtx)
Method Detail

registerJavaObject

public void registerJavaObject(String componentName,
                               Class<?> service,
                               Object instance)
                        throws ConfigurationException
Description copied from interface: SystemCompositeContext
Register a simple Java Object as a system component. This is primarily intended for use by bootstrap code to create the initial configuration components.

Specified by:
registerJavaObject in interface SystemCompositeContext
Parameters:
componentName - the name of the resulting component
instance - the Object that will become the component's implementation
Throws:
ConfigurationException

resolveInstance

public <T> T resolveInstance(Class<T> instanceInterface)
                  throws AutowireResolutionException
Description copied from interface: AutowireContext
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

Specified by:
resolveInstance in interface AutowireContext
Overrides:
resolveInstance in class AbstractCompositeContext
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

-