ConfigType
- public interface IModule<ConfigType extends ModuleConfig> extends IEventProducer
Generic interface for all modules in the system.
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Cleans up all ressources used by the module when deleted
All persistent resources created by the module should be cleaned
when this is called
|
ConfigType |
getConfiguration()
Retrieves a copy of the module configuration
(i.e.
|
String |
getLocalID()
Helper method to get the module's local ID
|
String |
getName()
Helper method to get the module's name
|
void |
init(ConfigType config)
Initializes the module with the specified configuration
|
boolean |
isEnabled()
Checks if module is enabled
|
void |
loadState(IModuleStateManager loader)
Restores the state of this module from info provided by the input stream
|
void |
registerListener(IEventListener listener)
Registers a listener to receive events generated by this module
|
void |
saveState(IModuleStateManager saver)
Saves the state of this module to the provided output stream
|
void |
start()
Starts the module with the current configuration.
init() should always be called before start(). |
void |
stop()
Stops the module.
All temporary resources created by the module should be cleaned when this is called (ex: memory, files, connections, etc.) stop() can be called right after init() even if start() hasn't been called. |
void |
unregisterListener(IEventListener listener)
Unregisters a listener and thus stop receiving events generayed by this module
|
void |
updateConfig(ConfigType config)
Updates the module's configuration dynamically.
The module must honor this new configuration unless an error is detected. |
ConfigType getConfiguration()
String getName()
String getLocalID()
boolean isEnabled()
void init(ConfigType config) throws SensorHubException
config
- SensorHubException
void updateConfig(ConfigType config) throws SensorHubException
config
- SensorHubException
void start() throws SensorHubException
SensorHubException
void stop() throws SensorHubException
SensorHubException
void saveState(IModuleStateManager saver) throws SensorHubException
saver
- SensorHubException
void loadState(IModuleStateManager loader) throws SensorHubException
loader
- SensorHubException
void cleanup() throws SensorHubException
SensorHubException
void registerListener(IEventListener listener)
registerListener
in interface IEventProducer
listener
- void unregisterListener(IEventListener listener)
unregisterListener
in interface IEventProducer
listener
- Copyright © 2015 Sensia Software LLC. All rights reserved.