Class Module

All Implemented Interfaces:
ModuloEntity
Direct Known Subclasses:
ModuleAdapter

public abstract class Module extends ConfigurableEntity
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
  • 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 the ModuleManager
      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 the ModuleLoader (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

      public Module(ModuleConfig config)
      Init your module by passing the ModuleConfig object
      Parameters:
      config - the configuration of your module
    • Module

      public Module()
      Init your module with an empty ModuleConfig object
  • Method Details

    • onLoad

      protected abstract <E extends Throwable> void onLoad() throws E
      Method called when the load() method is called
      Throws:
      E extends Throwable
    • onStart

      protected abstract <E extends Throwable> void onStart() throws E, IOException
      Method called when the start() method is called
      Throws:
      E extends Throwable
      IOException
    • onStop

      protected abstract <E extends Throwable> void onStop() throws E
      Method called when the stop() method is called
      Throws:
      E extends Throwable
    • load

      public void load()
      Method calls to load the module
      First method call by the ModuleLoader
      Call the onLoad() method
    • start

      public void start()
      Method calls to start the module
      Call the onStart() method
      Specified by:
      start in interface ModuloEntity
      Overrides:
      start in class ModuleEntityAdapter
    • 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 the onStop() method
      Specified by:
      stop in interface ModuloEntity
      Overrides:
      stop in class ConfigurableEntity
    • info

      public void info(String message)
      Use the Logger class to log an info message.
      Parameters:
      message - the message to log.
    • debug

      public void debug(String message)
      Use the Logger class to log a debug message.
      Parameters:
      message - the message to log.
    • error

      public void error(String message)
      Use the Logger class to log an error message.
      Parameters:
      message - the message to log.
    • getName

      public String getName()
    • setName

      public void setName(String name)
    • getVersion

      public String getVersion()
    • setVersion

      public void setVersion(String version)
    • getAuthors

      public List<String> getAuthors()
    • setAuthors

      public void setAuthors(List<String> authors)
    • getDependencies

      public List<String> getDependencies()
    • setDependencies

      public void setDependencies(List<String> dependencies)
    • getSoftDependencies

      public List<String> getSoftDependencies()
    • setSoftDependencies

      public void setSoftDependencies(List<String> softDependencies)
    • getMain

      public String getMain()
    • setMain

      public void setMain(String main)
    • getConfig

      public ModuleConfig getConfig()
    • setConfig

      public void setConfig(ModuleConfig config)
    • getJarFile

      public JarFile getJarFile()
    • setJarFile

      public void setJarFile(JarFile jarFile)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object