Package com.chillycheesy.modulo.modules
Class Module
java.lang.Object
com.chillycheesy.modulo.modules.ModuleEntityAdapter
com.chillycheesy.modulo.config.ConfigurableEntity
com.chillycheesy.modulo.modules.Module
- All Implemented Interfaces:
ModuloEntity
- Direct Known Subclasses:
ModuleAdapter
HTModule is the superclass of all the HomeTracker module.
A module is a functionality of HomeTracker that has its own management and behaviour.
To create your own HTModule you just have to extend HTModule
A module is a functionality of HomeTracker that has its own management and behaviour.
To create your own HTModule you just have to extend HTModule
-
Field Summary
Fields inherited from class com.chillycheesy.modulo.config.ConfigurableEntity
autoSave, configurationFactory, defaultConfiguration, loaderStrategy -
Constructor Summary
ConstructorsConstructorDescriptionModule()Init your module with an emptyModuleConfigobjectModule(ModuleConfig config)Init your module by passing theModuleConfigobjectModule(String name, String version, List<String> authors, List<String> dependencies, List<String> softDependencies, String main) -
Method Summary
Modifier and TypeMethodDescriptionvoidUse theLoggerclass to log a debug message.booleanvoidUse theLoggerclass to log an error message.getMain()getName()voidUse theLoggerclass to log an info message.voidload()protected abstract <E extends Throwable>
voidonLoad()Method called when theload()method is calledprotected abstract <E extends Throwable>
voidonStart()Method called when thestart()method is calledprotected abstract <E extends Throwable>
voidonStop()Method called when thestop()method is calledvoidsetAuthors(List<String> authors)voidsetConfig(ModuleConfig config)voidsetDependencies(List<String> dependencies)voidsetJarFile(JarFile jarFile)voidvoidvoidsetSoftDependencies(List<String> softDependencies)voidsetVersion(String version)voidstart()Method calls to start the module
Call theonStart()methodvoidstop()Method calls to stop the module
Also called when an error occurs and the module can't keep working, and when HomeTracker shut down Call theonStop()methodMethods inherited from class com.chillycheesy.modulo.config.ConfigurableEntity
enableAutoSave, getConfiguration, getConfigurationFactory, getLoaderStrategy, load, setConfiguration, setConfigurationFactory
-
Constructor Details
-
Module
public Module(String name, String version, List<String> authors, List<String> dependencies, List<String> softDependencies, String main)- Parameters:
name- it's how your HTModule will be call by HomeTracker
note that two HTModules can't have the same name (you won't be able to add it to theModuleManagerversion- the actual version of your module.authors- the list of persons that works on your module.dependencies- the list of modules that your module name need to work, the dependencies will be load before your module get load by theModuleLoader(your module cannot load without them).softDependencies- the list of modules that your module name can use to work with but without being an obligation (your module can load without them).main- the main file of your jar (example: com.dev.MyAwesomeModule).
-
Module
Init your module by passing theModuleConfigobject- Parameters:
config- the configuration of your module
-
Module
public Module()Init your module with an emptyModuleConfigobject
-
-
Method Details
-
onLoad
Method called when theload()method is called- Throws:
E extends Throwable
-
onStart
Method called when thestart()method is called- Throws:
E extends ThrowableIOException
-
onStop
Method called when thestop()method is called- Throws:
E extends Throwable
-
load
public void load() -
start
public void start()Method calls to start the module
Call theonStart()method- Specified by:
startin interfaceModuloEntity- Overrides:
startin classModuleEntityAdapter
-
stop
public void stop()Method calls to stop the module
Also called when an error occurs and the module can't keep working, and when HomeTracker shut down Call theonStop()method- Specified by:
stopin interfaceModuloEntity- Overrides:
stopin classConfigurableEntity
-
info
Use theLoggerclass to log an info message.- Parameters:
message- the message to log.
-
debug
Use theLoggerclass to log a debug message.- Parameters:
message- the message to log.
-
error
Use theLoggerclass to log an error message.- Parameters:
message- the message to log.
-
getName
-
setName
-
getVersion
-
setVersion
-
getAuthors
-
setAuthors
-
getDependencies
-
setDependencies
-
getSoftDependencies
-
setSoftDependencies
-
getMain
-
setMain
-
getConfig
-
setConfig
-
getJarFile
-
setJarFile
-
equals
-