Package org.sensorhub.api.module
Interface IModuleBase<T extends ModuleConfigBase>
- All Known Subinterfaces:
IClientModule<ConfigType>
,ICommNetwork<ConfigType>
,ICommProvider<ConfigType>
,IDataProducerModule<ConfigType>
,IHttpServer<T>
,IMessageQueuePush<T>
,IModule<T>
,IObsSystemDatabaseModule<ConfigType>
,IProcessModule<ConfigType>
,ISensorModule<ConfigType>
,IServiceModule<ConfigType>
,ISubModule<T>
public interface IModuleBase<T extends ModuleConfigBase>
Base interface for main modules and submodules
- Since:
- Feb 28, 2025
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves a copy of the module configuration (i.e.getName()
Helper method to get the module's namevoid
Initializes the module with the specified configuration.
This is equivalent to calling#setConfiguration(ModuleConfig)
and then#init()
with no arguments.void
start()
Requests the module to start.
Implementations of this method can be synchronous or asynchronous, but when this method returns without error, the module state is guaranteed to be eitherModuleEvent.ModuleState.STARTING
orModuleEvent.ModuleState.STARTED
.
Module should be inModuleEvent.ModuleState.INITIALIZED
state before calling this method.void
stop()
Requests the module to stop.
Implementations of this method can be synchronous or asynchronous, but when this method returns without error, the module state is guaranteed to be eitherModuleEvent.ModuleState.STOPPING
orModuleEvent.ModuleState.STOPPED
.
-
Method Details
-
init
Initializes the module with the specified configuration.
This is equivalent to calling#setConfiguration(ModuleConfig)
and then#init()
with no arguments.- Parameters:
config
-- Throws:
SensorHubException
- if an error occurs during synchronous execution. If an error occurs asynchronously, it can be retrieved with#getCurrentError()
-
start
Requests the module to start.
Implementations of this method can be synchronous or asynchronous, but when this method returns without error, the module state is guaranteed to be eitherModuleEvent.ModuleState.STARTING
orModuleEvent.ModuleState.STARTED
.
Module should be inModuleEvent.ModuleState.INITIALIZED
state before calling this method.- Throws:
SensorHubException
- if an error occurs during synchronous execution. If an error occurs asynchronously, it can be retrieved with#getCurrentError()
-
stop
Requests the module to stop.
Implementations of this method can be synchronous or asynchronous, but when this method returns without error, the module state is guaranteed to be eitherModuleEvent.ModuleState.STOPPING
orModuleEvent.ModuleState.STOPPED
.- Throws:
SensorHubException
- if an error occurs during synchronous execution. If an error occurs asynchronously, it can be retrieved with#getCurrentError()
-
getConfiguration
T getConfiguration()Retrieves a copy of the module configuration (i.e. for reading only since changes won't have any effect until updateConfig is called)- Returns:
- a copy of the configuration object associated to this module
-
getName
String getName()Helper method to get the module's name- Returns:
- name string
-