org.appdapter.api.module
Interface Module<ParentModulator extends Modulator>

All Known Implementing Classes:
BasicModule, BasicModuleTestOne.PowerModule, EmptyTimedModule, NullModule, TimedModule

public interface Module<ParentModulator extends Modulator>

A Module has 5 ActionMethods = [initModule(), start(), runOnce(), stop(), releaseModule()] and 8 formal states. A Module has a ParentModulator which it may use to perform any system interactions, as permitted by the type interface of the PM.

Author:
Stu B.

Nested Class Summary
static class Module.State
           
 
Method Summary
 void failDuringInitOrStartup()
           
 ParentModulator getParentModulator()
          The Module must have a valid parentModulator whenever it is inside a module action callback.
 Module.State getState()
           
 void initModule()
          Modulator must be set when initModule is called.
 boolean isStopRequested()
           
 void markStopRequested()
           
 void releaseModule()
          Required pre-state is POST_STOP_OR_FAILED_STARTUP.
 void runOnce()
          Required pre-state is WAIT_TO_RUN_OR_STOP.
 void setParentModulator(ParentModulator pm)
           
 void start()
          Required pre-state is WAIT_TO_START.
 void stop()
          Required pre-state is WAIT_TO_RUN_OR_STOP.
 

Method Detail

getState

Module.State getState()
Returns:
Current state, subject to synchronization behavior of this module.

setParentModulator

void setParentModulator(ParentModulator pm)

getParentModulator

ParentModulator getParentModulator()
The Module must have a valid parentModulator whenever it is inside a module action callback.

Returns:
Current Modulator, subject to synchronization behavior of this module.

initModule

void initModule()
Modulator must be set when initModule is called. initModule is called exactly once, by the modulator, and can be First method called on Module, and called only once. Can only be called by the modulatorModule Upon return, must be in WAIT_TO_START, or or POST_STOP_OR_FAILED_STARTUP.


start

void start()
Required pre-state is WAIT_TO_START. During-state is IN_START Upon return, state is WAIT_TO_RUN_OR_STOP, or POST_STOP_OR_FAILED_STARTUP.


runOnce

void runOnce()
Required pre-state is WAIT_TO_RUN_OR_STOP. During-state is IN_RUN. Upon return, state is WAIT_TO_RUN_OR_STOP.


stop

void stop()
Required pre-state is WAIT_TO_RUN_OR_STOP. During-state is IN_STOP. Upon return, state is POST_STOP_OR_FAILED_STARTUP.


releaseModule

void releaseModule()
Required pre-state is POST_STOP_OR_FAILED_STARTUP. Module is no longer usable as soon as call begins. Should not throw.


markStopRequested

void markStopRequested()

isStopRequested

boolean isStopRequested()

failDuringInitOrStartup

void failDuringInitOrStartup()


Copyright © 2010-2012. All Rights Reserved.