Apache Tuscany SCA Kernel Sub-Project

org.apache.tuscany.spi.extension
Class AtomicComponentExtension

java.lang.Object
  extended by org.apache.tuscany.spi.AbstractLifecycle
      extended by org.apache.tuscany.spi.component.AbstractSCAObject
          extended by org.apache.tuscany.spi.extension.AtomicComponentExtension
All Implemented Interfaces:
AtomicComponent, Component, SCAObject, EventPublisher, Lifecycle
Direct Known Subclasses:
SystemAtomicComponentExtension

public abstract class AtomicComponentExtension
extends AbstractSCAObject
implements AtomicComponent

An extension point for atomic component type, which new implementation types may extend

Version:
$$Rev: 441893 $$ $$Date: 2006-09-09 20:41:09 -0700 (Sat, 09 Sep 2006) $$

Field Summary
protected  Map<String,List<OutboundWire>> referenceWires
           
protected  Scope scope
           
protected  ScopeContainer scopeContainer
           
protected  Map<String,InboundWire> serviceWires
           
protected  WireService wireService
           
protected  WorkContext workContext
           
protected  WorkScheduler workScheduler
           
 
Fields inherited from class org.apache.tuscany.spi.component.AbstractSCAObject
listeners, parent, TRUE_FILTER
 
Fields inherited from class org.apache.tuscany.spi.AbstractLifecycle
lifecycleState
 
Fields inherited from interface org.apache.tuscany.spi.Lifecycle
CONFIG_ERROR, ERROR, INITIALIZED, INITIALIZING, RUNNING, STOPPED, STOPPING, UNINITIALIZED
 
Constructor Summary
protected AtomicComponentExtension(String name, CompositeComponent parent, ScopeContainer scopeContainer, WireService wireService, WorkContext workContext, WorkScheduler workScheduler, int initLevel)
           
 
Method Summary
 void addInboundWire(InboundWire wire)
          Adds a target-side wire.
 void addOutboundWire(OutboundWire wire)
          Adds a source-side wire for the given reference.
 void addOutboundWires(Class<?> multiplicityClass, List<OutboundWire> wires)
          Adds a set of source-side multiplicity wires for the given reference.
 TargetInvoker createAsyncTargetInvoker(InboundWire wire, Operation operation)
          Callback to create a TargetInvoker which dispatches to a service offered by the component
 void destroy(Object instance)
          Notifies the given instance of a destroy event
 InboundWire getInboundWire(String serviceName)
          Returns the target-side wire associated with the given service name
 Map<String,InboundWire> getInboundWires()
          Returns a map of inbound wires for a service.
 int getInitLevel()
          Returns the initialization level for this component.
 Map<String,List<OutboundWire>> getOutboundWires()
          Returns a map of source-side wires for references.
 Scope getScope()
          Returns the artifact scope
 void init(Object instance)
          Notifies the given instance of an initialization event
 boolean isEagerInit()
          Returns whether component instances should be eagerly initialized
protected  void onReferenceWire(OutboundWire wire)
           
protected  void onReferenceWires(Class<?> multiplicityClass, List<OutboundWire> wires)
           
protected  void onServiceWire(InboundWire wire)
           
 void start()
          Starts the Lifecycle.
 
Methods inherited from class org.apache.tuscany.spi.component.AbstractSCAObject
addListener, addListener, getExtensions, getListeners, getName, getParent, isSystem, prepare, publish, removeListener, toString
 
Methods inherited from class org.apache.tuscany.spi.AbstractLifecycle
getLifecycleState, setLifecycleState, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.tuscany.spi.component.AtomicComponent
createInstance
 
Methods inherited from interface org.apache.tuscany.spi.component.Component
createTargetInvoker, getServiceInstance, getServiceInterfaces
 
Methods inherited from interface org.apache.tuscany.spi.component.SCAObject
getExtensions, getName, getParent, 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, stop
 

Field Detail

scopeContainer

protected ScopeContainer scopeContainer

scope

protected Scope scope

serviceWires

protected Map<String,InboundWire> serviceWires

referenceWires

protected Map<String,List<OutboundWire>> referenceWires

wireService

protected WireService wireService

workContext

protected WorkContext workContext

workScheduler

protected WorkScheduler workScheduler
Constructor Detail

AtomicComponentExtension

protected AtomicComponentExtension(String name,
                                   CompositeComponent parent,
                                   ScopeContainer scopeContainer,
                                   WireService wireService,
                                   WorkContext workContext,
                                   WorkScheduler workScheduler,
                                   int initLevel)
Method Detail

getScope

public Scope getScope()
Description copied from interface: SCAObject
Returns the artifact scope

Specified by:
getScope in interface SCAObject

getInitLevel

public int getInitLevel()
Description copied from interface: AtomicComponent
Returns the initialization level for this component.

Specified by:
getInitLevel in interface AtomicComponent
Returns:
the initialization level for this component
See Also:
ComponentDefinition.getInitLevel()

isEagerInit

public boolean isEagerInit()
Description copied from interface: AtomicComponent
Returns whether component instances should be eagerly initialized

Specified by:
isEagerInit in interface AtomicComponent

start

public void start()
           throws CoreRuntimeException
Description copied from interface: Lifecycle
Starts the Lifecycle.

Specified by:
start in interface Lifecycle
Overrides:
start in class AbstractLifecycle
Throws:
CoreRuntimeException

init

public void init(Object instance)
          throws TargetException
Description copied from interface: AtomicComponent
Notifies the given instance of an initialization event

Specified by:
init in interface AtomicComponent
Throws:
TargetException

destroy

public void destroy(Object instance)
             throws TargetException
Description copied from interface: AtomicComponent
Notifies the given instance of a destroy event

Specified by:
destroy in interface AtomicComponent
Throws:
TargetException

addInboundWire

public void addInboundWire(InboundWire wire)
Description copied from interface: Component
Adds a target-side wire. Target-side wire factories contain the invocation chains associated with the destination service of a wire

Specified by:
addInboundWire in interface Component

getInboundWire

public InboundWire getInboundWire(String serviceName)
Description copied from interface: Component
Returns the target-side wire associated with the given service name

Specified by:
getInboundWire in interface Component

getInboundWires

public Map<String,InboundWire> getInboundWires()
Description copied from interface: Component
Returns a map of inbound wires for a service.

Specified by:
getInboundWires in interface Component

addOutboundWire

public void addOutboundWire(OutboundWire wire)
Description copied from interface: Component
Adds a source-side wire for the given reference. Source-side wires contain the invocation chains for a reference in the implementation associated with the instance wrapper created by this configuration.

Specified by:
addOutboundWire in interface Component

getOutboundWires

public Map<String,List<OutboundWire>> getOutboundWires()
Description copied from interface: Component
Returns a map of source-side wires for references. There may be 1..n wires per reference.

Specified by:
getOutboundWires in interface Component

addOutboundWires

public void addOutboundWires(Class<?> multiplicityClass,
                             List<OutboundWire> wires)
Description copied from interface: Component
Adds a set of source-side multiplicity wires for the given reference. Source-side wires contain the invocation chains for a reference in the implementation associated with the instance wrapper created by this configuration.

Specified by:
addOutboundWires in interface Component

createAsyncTargetInvoker

public TargetInvoker createAsyncTargetInvoker(InboundWire wire,
                                              Operation operation)
Description copied from interface: Component
Callback to create a TargetInvoker which dispatches to a service offered by the component

Specified by:
createAsyncTargetInvoker in interface Component
operation - the operation to invoke

onReferenceWire

protected void onReferenceWire(OutboundWire wire)

onReferenceWires

protected void onReferenceWires(Class<?> multiplicityClass,
                                List<OutboundWire> wires)

onServiceWire

protected void onServiceWire(InboundWire wire)

Apache Tuscany SCA Kernel Sub-Project

-