dsg.smart.simul
Class WorkstationSession

java.lang.Object
  extended bydsg.smart.simul.WorkstationSession
All Implemented Interfaces:
ModuleEnv, Session

public class WorkstationSession
extends java.lang.Object
implements Session

Implementation of the Session interface for the simulated environment. Simulates a Session on a Smart workstation or iPaq.


Field Summary
 
Fields inherited from interface dsg.smart.Session
ST_IPAQ, ST_SMARTCENTRAL, ST_WEBSERVER, ST_WORKSTATION
 
Constructor Summary
WorkstationSession(UserID userID)
           
 
Method Summary
 void addModule(StreamModule mod)
          Register a module; returns an integer used to later identify that stream module within this session.
 void connectModules(StreamModule moduleA, int outputA, StreamModule moduleB, int inputB)
          Connect together two modules: output #outputA of module #moduleA is piped to input #inputB of module #moduleB.
 java.lang.String getStationID()
          ID of the iPaq or workstation on which we are running.
 int getStationRole()
          Type of workstation this is --- iPaq, Standalone, etc.
 UserID getUserID()
          User logged onto this station.
 SmartCentral openSmartCentral()
          Open a connection to Smart Central
 SmartDB openSmartDB()
          Open a connection to the Smart DB
 void removeModule(StreamModule[] mods)
          Removes a set of source modules and all downstream dependants.
 void startModule(dsg.smart.simul.WorkstationSession.SMInfo mi)
           
 void startModules(StreamModule[] mods)
          Starts a set of source (zero-input) modules running --- as well as all downstream modules as well.
 void stopModules(StreamModule[] mods)
          Stops a set of source (zero-input) modules from running --- as well as all dependnt downstream modules.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkstationSession

public WorkstationSession(UserID userID)
Method Detail

getStationID

public java.lang.String getStationID()
ID of the iPaq or workstation on which we are running. This is NOT the session key.

Specified by:
getStationID in interface Session

getUserID

public UserID getUserID()
User logged onto this station.

Specified by:
getUserID in interface Session

getStationRole

public int getStationRole()
Type of workstation this is --- iPaq, Standalone, etc.

Specified by:
getStationRole in interface Session

addModule

public void addModule(StreamModule mod)
Register a module; returns an integer used to later identify that stream module within this session.

Specified by:
addModule in interface ModuleEnv

connectModules

public void connectModules(StreamModule moduleA,
                           int outputA,
                           StreamModule moduleB,
                           int inputB)
                    throws SmartException
Description copied from interface: ModuleEnv
Connect together two modules: output #outputA of module #moduleA is piped to input #inputB of module #moduleB.

Specified by:
connectModules in interface ModuleEnv
Throws:
SmartException

startModule

public void startModule(dsg.smart.simul.WorkstationSession.SMInfo mi)

startModules

public void startModules(StreamModule[] mods)
                  throws NotSourceModuleException
Description copied from interface: ModuleEnv

Starts a set of source (zero-input) modules running --- as well as all downstream modules as well. That is, starts the module chains headed by the listed modules. Downstream modules will only start if all their inputs are active (i.e. bound; connected). Consider the module graph:

     d
     v
a -> b -> c

In this case, a call to startModule(a) will start just a running. A subsequent call to startModule(d) will start d, b and c as well. A call to startModules({a,d}) will start it all running in an atomic fashion.

Specified by:
startModules in interface ModuleEnv
Throws:
NotSourceModuleException

stopModules

public void stopModules(StreamModule[] mods)
                 throws NotSourceModuleException
Stops a set of source (zero-input) modules from running --- as well as all dependnt downstream modules. Exception thrown if

Specified by:
stopModules in interface ModuleEnv
Throws:
NotSourceModuleException

removeModule

public void removeModule(StreamModule[] mods)
                  throws SmartException

Removes a set of source modules and all downstream dependants. An exception will be thrown if the removal of some of the modules would leave other modules in place that are both: a) partially bound (i.e. one or more inputs is not bound) and b) running.

Theoretically, this can leave "incomplete" modules remaining --- modules in which only some of their inputs are bound. An IncompleteModuleException will be thrown in that case. An NotSourceModuleException is thrown if one or more of the modules being removed is not a source module.

Specified by:
removeModule in interface ModuleEnv
Throws:
SmartException

openSmartDB

public SmartDB openSmartDB()
                    throws SmartException
Open a connection to the Smart DB

Specified by:
openSmartDB in interface Session
Throws:
SmartException

openSmartCentral

public SmartCentral openSmartCentral()
                              throws SmartException
Open a connection to Smart Central

Specified by:
openSmartCentral in interface Session
Throws:
SmartException