dsg.smart
Interface ModuleEnv

All Known Subinterfaces:
Session
All Known Implementing Classes:
WorkstationSession

public interface ModuleEnv

Portion of a Session interface, allowing the manipulation of modules on a computer. This is done either for the local machine (in which case it's just part of the Session interface), or as something on a remote machine (eg: SMART Central), in which it's a client-side proxy. Provides API to manipulate the StreamModule graph. StreamModules are kind of like threads: the state of each is either RUNNING or STOPPED.


Method Summary
 void addModule(StreamModule m)
          Register a module with the session; necessary before the module can be started, stopped, etc.
 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.
 void removeModule(StreamModule[] modules)
          Removes (disconnects) a set of source modules and all downstream dependants.
 void startModules(StreamModule[] m)
          Starts a set of source (zero-input) modules running --- as well as all downstream modules as well.
 void stopModules(StreamModule[] modules)
          Stops a set of source (zero-input) modules from running --- as well as all dependent downstream modules.
 

Method Detail

addModule

public void addModule(StreamModule m)
Register a module with the session; necessary before the module can be started, stopped, etc.


connectModules

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

Throws:
SmartException

startModules

public void startModules(StreamModule[] m)
                  throws NotSourceModuleException

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.

Throws:
NotSourceModuleException

stopModules

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

Throws:
NotSourceModuleException

removeModule

public void removeModule(StreamModule[] modules)
                  throws SmartException

Removes (disconnects) 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.

Throws:
SmartException