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 emptyModuleConfig
objectModule(ModuleConfig config)
Init your module by passing theModuleConfig
objectModule(String name, String version, List<String> authors, List<String> dependencies, List<String> softDependencies, String main)
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Use theLogger
class to log a debug message.boolean
void
Use theLogger
class to log an error message.getMain()
getName()
void
Use theLogger
class to log an info message.void
load()
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 calledvoid
setAuthors(List<String> authors)
void
setConfig(ModuleConfig config)
void
setDependencies(List<String> dependencies)
void
setJarFile(JarFile jarFile)
void
void
void
setSoftDependencies(List<String> softDependencies)
void
setVersion(String version)
void
start()
Method calls to start the module
Call theonStart()
methodvoid
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()
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 theModuleManager
version
- 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 theModuleConfig
object- Parameters:
config
- the configuration of your module
-
Module
public Module()Init your module with an emptyModuleConfig
object
-
-
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 Throwable
IOException
-
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:
start
in interfaceModuloEntity
- Overrides:
start
in 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:
stop
in interfaceModuloEntity
- Overrides:
stop
in classConfigurableEntity
-
info
Use theLogger
class to log an info message.- Parameters:
message
- the message to log.
-
debug
Use theLogger
class to log a debug message.- Parameters:
message
- the message to log.
-
error
Use theLogger
class 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
-