Apache Tuscany SCA Kernel Sub-Project

org.apache.tuscany.spi.component
Interface CompositeComponent

All Superinterfaces:
Component, EventListener, EventPublisher, Lifecycle, RuntimeEventListener, SCAObject
All Known Subinterfaces:
RuntimeComponent
All Known Implementing Classes:
CompositeComponentExtension

public interface CompositeComponent
extends Component, RuntimeEventListener

The runtime instantiation of an SCA composite component. Composites may contain child components, offer services, and have references. Children are contained in two namespaces, an application namespace for end-user components deployed to a runtime, and a system namespace for components that provide system services.

Version:
$Rev: 451895 $ $Date: 2006-10-01 23:58:18 -0700 (Sun, 01 Oct 2006) $

Field Summary
 
Fields inherited from interface org.apache.tuscany.spi.Lifecycle
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STOPPED, STOPPING, UNINITIALIZED
 
Method Summary
 SCAObject getChild(String name)
          Returns the child associated with a given name
 List<SCAObject> getChildren()
          Returns the children contained by the composite
 Document getPropertyValue(String name)
          Returns the value of a Property of this composite.
 List<Reference> getReferences()
          Returns the references contained by the composite
 Service getService(String name)
          Returns the service associated with the given name
 List<Service> getServices()
          Returns the services contained by the composite
 SCAObject getSystemChild(String name)
          Returns the system child associated with a given name
 List<SCAObject> getSystemChildren()
          Returns the system children contained by the composite
 List<Reference> getSystemReferences()
          Returns the system references contained by the composite
 Service getSystemService(String name)
          Returns the system service associated with the given name
 Object getSystemServiceInstance(String name)
          Returns a system service associated with the given name
 List<Service> getSystemServices()
          Returns the system services contained by the composite
<T> T
locateService(Class<T> serviceInterface, String serviceName)
          Returns the service instance for associated with the child registered for the given name
<T> T
locateSystemService(Class<T> serviceInterface, String serviceName)
          Returns the system service instance for associated with the child registered for the given name
 void register(SCAObject context)
          Registers a child of this composite.
<S,I extends S>
void
registerJavaObject(String name, Class<S> service, I instance)
          Register a simple Java Object as a system component.
<T> T
resolveExternalInstance(Class<T> instanceInterface)
          Invoked by a parent component to return an autowire target in a child.
<T> T
resolveInstance(Class<T> instanceInterface)
          Invoked by child components to return an an autowire target.
<T> T
resolveSystemExternalInstance(Class<T> instanceInterface)
          Invoked by a parent component to return a system autowire target in a child.
<T> T
resolveSystemInstance(Class<T> instanceInterface)
          Invoked by system child components to return an an autowire target.
 void setScopeContainer(ScopeContainer scopeContainer)
           
 
Methods inherited from interface org.apache.tuscany.spi.component.Component
addInboundWire, addOutboundWire, addOutboundWires, createAsyncTargetInvoker, createTargetInvoker, getInboundWire, getInboundWires, getOutboundWires, getServiceInstance, getServiceInterfaces
 
Methods inherited from interface org.apache.tuscany.spi.component.SCAObject
getExtensions, getName, getParent, getScope, getServiceInstance, isSystem, prepare
 
Methods inherited from interface org.apache.tuscany.spi.event.EventPublisher
addListener, addListener, publish, removeListener
 
Methods inherited from interface org.apache.tuscany.spi.Lifecycle
getLifecycleState, start, stop
 
Methods inherited from interface org.apache.tuscany.spi.event.RuntimeEventListener
onEvent
 

Method Detail

register

void register(SCAObject context)
              throws InvalidComponentTypeException
Registers a child of this composite.

Parameters:
context - the context to add as a child
Throws:
InvalidComponentTypeException

registerJavaObject

<S,I extends S> void registerJavaObject(String name,
                                        Class<S> service,
                                        I instance)
                        throws ObjectRegistrationException
Register a simple Java Object as a system component. This is primarily intended for use by bootstrap code to create the initial configuration components.

Parameters:
name - the name of the resulting component
service - the service interface the component should expose
instance - the Object that will become the component's implementation
Throws:
ObjectRegistrationException

getChild

SCAObject getChild(String name)
Returns the child associated with a given name


getSystemChild

SCAObject getSystemChild(String name)
Returns the system child associated with a given name


getChildren

List<SCAObject> getChildren()
Returns the children contained by the composite


getSystemChildren

List<SCAObject> getSystemChildren()
Returns the system children contained by the composite


getServices

List<Service> getServices()
Returns the services contained by the composite


getSystemServices

List<Service> getSystemServices()
Returns the system services contained by the composite


getService

Service getService(String name)
                   throws ComponentNotFoundException
Returns the service associated with the given name

Throws:
ComponentNotFoundException

getSystemService

Service getSystemService(String name)
                         throws ComponentNotFoundException
Returns the system service associated with the given name

Throws:
ComponentNotFoundException

getSystemServiceInstance

Object getSystemServiceInstance(String name)
                                throws TargetException
Returns a system service associated with the given name

Throws:
TargetException - if an error occurs retrieving the service instance

getReferences

List<Reference> getReferences()
Returns the references contained by the composite


getSystemReferences

List<Reference> getSystemReferences()
Returns the system references contained by the composite


locateService

<T> T locateService(Class<T> serviceInterface,
                    String serviceName)
Returns the service instance for associated with the child registered for the given name


locateSystemService

<T> T locateSystemService(Class<T> serviceInterface,
                          String serviceName)
Returns the system service instance for associated with the child registered for the given name


setScopeContainer

void setScopeContainer(ScopeContainer scopeContainer)
Parameters:
scopeContainer -

getPropertyValue

Document getPropertyValue(String name)
Returns the value of a Property of this composite.

Parameters:
name - the name of the Property
Returns:
its value, or null if there is not such property or if it has no defined value

resolveInstance

<T> T resolveInstance(Class<T> instanceInterface)
                  throws AutowireResolutionException
Invoked by child components to return an an autowire target. Resolved targets may be services or components in the parent or its ancestors, or references in a sibling component

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

resolveSystemInstance

<T> T resolveSystemInstance(Class<T> instanceInterface)
                        throws AutowireResolutionException
Invoked by system child components to return an an autowire target. Resolved targets may be system services or components in the parent or its ancestors, or references in a sibling component

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(Class<T> instanceInterface)
                          throws AutowireResolutionException
Invoked by a parent component to return an autowire target in a child. Resolved targets must be services. 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

resolveSystemExternalInstance

<T> T resolveSystemExternalInstance(Class<T> instanceInterface)
                                throws AutowireResolutionException
Invoked by a parent component to return a system autowire target in a child. Resolved targets must be system services. 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

Apache Tuscany SCA Kernel Sub-Project

-