seda.sandStorm.internal
Class sandStormMgr

java.lang.Object
  extended by seda.sandStorm.internal.sandStormMgr
All Implemented Interfaces:
SystemManagerIF, ManagerIF, sandStormConst

public class sandStormMgr
extends java.lang.Object
implements ManagerIF, SystemManagerIF, sandStormConst

This class provides management functionality for the Sandstorm runtime system. It is responsible for initializing the system, creating and registering stages and thread managers, and other administrative functions. Stages and thread managers can interact with this class through the ManagerIF and SystemManagerIF interfaces; this class should not be used directly.

See Also:
ManagerIF, SystemManagerIF

Field Summary
private  ThreadManagerIF defaulttm
           
private  SandstormConfig mgrconfig
           
private  sandStormProfiler profiler
           
private  SignalMgr signalMgr
           
private  java.util.Vector stagestoinit
           
private  java.util.Hashtable stagetbl
           
private  boolean started
           
private  java.util.Hashtable tmtbl
           
 
Fields inherited from interface seda.sandStorm.api.ManagerIF
MAINSINK
 
Fields inherited from interface seda.sandStorm.internal.sandStormConst
MAJOR_VERSION, MINOR_VERSION, VERSION_STRING, WELCOME_STRING
 
Constructor Summary
sandStormMgr(SandstormConfig mgrconfig)
          Create a sandStormMgr which reads its configuration from the given file.
 
Method Summary
 void addThreadManager(java.lang.String name, ThreadManagerIF tm)
          Add a thread manager with the given name.
 StageIF createStage(StageWrapperIF wrapper, boolean initialize)
          Create a stage from the given stage wrapper.
 StageIF createStage(java.lang.String stageName, EventHandlerIF evHandler, java.lang.String[] initargs)
          Create a stage with the given name from the given event handler with the given initial arguments.
private  void destroyStages()
           
 SandstormConfig getConfig()
          Return the SandstormConfig used to initialize this manager.
 ProfilerIF getProfiler()
          Return the system profiler.
 SignalMgrIF getSignalMgr()
          Return the system signal manager.
 StageIF getStage(java.lang.String stagename)
          Return a handle to given stage.
 ThreadManagerIF getThreadManager()
          Return the default thread manager.
 ThreadManagerIF getThreadManager(java.lang.String name)
          Return the thread manager with the given name.
private  void initialize_io()
           
private  void initStages()
           
private  void loadInitialStages()
           
private  void loadStage(stageDescr descr)
           
 void start()
          Start the manager.
 void stop()
          Stop the manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaulttm

private ThreadManagerIF defaulttm

tmtbl

private java.util.Hashtable tmtbl

mgrconfig

private SandstormConfig mgrconfig

stagetbl

private java.util.Hashtable stagetbl

stagestoinit

private java.util.Vector stagestoinit

started

private boolean started

profiler

private sandStormProfiler profiler

signalMgr

private SignalMgr signalMgr
Constructor Detail

sandStormMgr

public sandStormMgr(SandstormConfig mgrconfig)
             throws java.lang.Exception
Create a sandStormMgr which reads its configuration from the given file.

Throws:
java.lang.Exception
Method Detail

start

public void start()
Start the manager.


stop

public void stop()
Stop the manager.


getStage

public StageIF getStage(java.lang.String stagename)
                 throws NoSuchStageException
Return a handle to given stage.

Specified by:
getStage in interface ManagerIF
Throws:
NoSuchStageException - Thrown if the stage does not exist.

initialize_io

private void initialize_io()
                    throws java.lang.Exception
Throws:
java.lang.Exception

loadInitialStages

private void loadInitialStages()
                        throws java.lang.Exception
Throws:
java.lang.Exception

getThreadManager

public ThreadManagerIF getThreadManager()
Return the default thread manager.

Specified by:
getThreadManager in interface SystemManagerIF

getThreadManager

public ThreadManagerIF getThreadManager(java.lang.String name)
Return the thread manager with the given name.

Specified by:
getThreadManager in interface SystemManagerIF

addThreadManager

public void addThreadManager(java.lang.String name,
                             ThreadManagerIF tm)
Add a thread manager with the given name.

Specified by:
addThreadManager in interface SystemManagerIF

loadStage

private void loadStage(stageDescr descr)
                throws java.lang.Exception
Throws:
java.lang.Exception

createStage

public StageIF createStage(java.lang.String stageName,
                           EventHandlerIF evHandler,
                           java.lang.String[] initargs)
                    throws java.lang.Exception
Create a stage with the given name from the given event handler with the given initial arguments.

Specified by:
createStage in interface ManagerIF
Parameters:
stageName - The name under which the new stage should be registered.
evHandler - The event handler object which should be associated with the new stage.
initargs - The initial arguments to the stage, to be passed to the new stage through a ConfigDataIF.
Returns:
A handle to the newly-created stage.
Throws:
java.lang.Exception - If an exception occurred during stage creation or initialization.
See Also:
SystemManagerIF, ConfigDataIF

createStage

public StageIF createStage(StageWrapperIF wrapper,
                           boolean initialize)
                    throws java.lang.Exception
Create a stage from the given stage wrapper. If 'initialize' is true, initialize this stage immediately.

Specified by:
createStage in interface SystemManagerIF
Throws:
java.lang.Exception

getProfiler

public ProfilerIF getProfiler()
Return the system profiler.

Specified by:
getProfiler in interface ManagerIF

getSignalMgr

public SignalMgrIF getSignalMgr()
Return the system signal manager.

Specified by:
getSignalMgr in interface ManagerIF

getConfig

public SandstormConfig getConfig()
Return the SandstormConfig used to initialize this manager. Actually returns a copy of the SandstormConfig; this prevents options from being changed once the system has been initialized.

Specified by:
getConfig in interface ManagerIF

initStages

private void initStages()

destroyStages

private void destroyStages()