Tuscany Core

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

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.system.context.SystemAtomicContext
All Implemented Interfaces:
AtomicContext, Context, EventPublisher, Lifecycle

public class SystemAtomicContext
extends AbstractContext
implements AtomicContext

Manages system component implementation instances

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

Field Summary
protected  int type
           
 
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
 
Constructor Summary
SystemAtomicContext(String name, ObjectFactory objectFactory, boolean eagerInit, EventInvoker<Object> initInvoker, EventInvoker<Object> destroyInvoker, boolean stateless)
           
 
Method Summary
 void destroy()
          Notifies the context of a destroy event
 Object getInstance(QualifiedName qName)
          Returns the instance associated with the requested name, which may be in a atomic or composite form.
 Object getTargetInstance()
          Returns the target instance associated with the context.
 int getType()
           
 void init()
          Notifies the context of an initialization event
 boolean isDestroyable()
          Returns whether the context should be called back when its scope ends
 boolean isEagerInit()
          Returns whether the context should be eagerly initialized
 void setName(String name)
          Sets the name of the Lifecycle.
 void setType(int type)
           
 void start()
          Starts the Lifecycle.
 void stop()
          Stops the Lifecycle.
 
Methods inherited from class org.apache.tuscany.core.context.impl.AbstractLifecycle
addListener, addListener, getLifecycleState, getListeners, getName, publish, removeListener, 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.EventPublisher
addListener, addListener, publish, removeListener
 
Methods inherited from interface org.apache.tuscany.core.context.Lifecycle
getLifecycleState, getName
 

Field Detail

type

protected int type
Constructor Detail

SystemAtomicContext

public SystemAtomicContext(String name,
                           ObjectFactory objectFactory,
                           boolean eagerInit,
                           EventInvoker<Object> initInvoker,
                           EventInvoker<Object> destroyInvoker,
                           boolean stateless)
Method Detail

setName

public void setName(String name)
Description copied from interface: Lifecycle
Sets the name of the Lifecycle.

Specified by:
setName in interface Lifecycle
Overrides:
setName in class AbstractLifecycle
Parameters:
name - the name of the Lifecycle

getType

public int getType()

setType

public void setType(int type)

init

public void init()
          throws TargetException
Description copied from interface: AtomicContext
Notifies the context of an initialization event

Specified by:
init in interface AtomicContext
Throws:
TargetException

destroy

public void destroy()
             throws TargetException
Description copied from interface: AtomicContext
Notifies the context of a destroy event

Specified by:
destroy in interface AtomicContext
Throws:
TargetException

getInstance

public Object getInstance(QualifiedName qName)
                   throws TargetException
Description copied from interface: Context
Returns the instance associated with the requested name, which may be in a atomic or composite form. Atomic (i.e. leaf) contexts will return an instance associated with the service name part of the compound name, which may be null.

Composite contexts will return an instance (likely a proxy) of a contained entry point context. In this case, the port name on the qualified name will correspond to the composite context name and the part name will be used to retrieve the contained entry point context. The latter may be null. If the contained context is not an entry point context, an exception will be thrown.

Specified by:
getInstance in interface Context
Parameters:
qName - a qualified name of the requested instance
Returns:
the implementation instance or a proxy to it
Throws:
TargetException - if an error occurs retrieving the instance or the requested component is not an entry point.
See Also:
CompositeContext, EntryPoint

getTargetInstance

public Object getTargetInstance()
                         throws TargetException
Description copied from interface: AtomicContext
Returns the target instance associated with the context. A target instance is the actual object a request is dispatched to sans proxy wire chain.

Specified by:
getTargetInstance in interface AtomicContext
Throws:
TargetException

isEagerInit

public boolean isEagerInit()
Description copied from interface: AtomicContext
Returns whether the context should be eagerly initialized

Specified by:
isEagerInit in interface AtomicContext

isDestroyable

public boolean isDestroyable()
Description copied from interface: AtomicContext
Returns whether the context should be called back when its scope ends

Specified by:
isDestroyable in interface AtomicContext

start

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

Specified by:
start in interface Lifecycle
Throws:
ContextInitException

stop

public void stop()
Description copied from interface: Lifecycle
Stops the Lifecycle.

Specified by:
stop in interface Lifecycle

Tuscany Core

-