hkontrol.module.mythtv
Class Module

java.lang.Object
  extended by hkontrol.core.AbstractModule
      extended by hkontrol.module.mythtv.Module
All Implemented Interfaces:
java.lang.Runnable

public class Module
extends AbstractModule


Constructor Summary
Module()
           
 
Method Summary
protected  HKConnection getConnection()
          returns a HKConnection object if a connection is associated with the calling module instance.
protected  boolean init()
          is being called within the construct method to give the module the chance to initialize itself while knowing about its configuration.
 int work()
          is called repeatedly by run in a seperate thread.
 
Methods inherited from class hkontrol.core.AbstractModule
construct, getConfig, getState, run
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Module

public Module()
Method Detail

init

protected boolean init()
Description copied from class: AbstractModule
is being called within the construct method to give the module the chance to initialize itself while knowing about its configuration. If init returns false, the module won't be used!

Overrides:
init in class AbstractModule
Returns:
true, if the module could be initialized successfully, false otherwise

work

public int work()
         throws ModuleException
Description copied from class: AbstractModule
is called repeatedly by run in a seperate thread. Since doing some work and then sleeping some time is a common use case, work must return the number of milliseconds that will have to pass before work should be called again. As a matter of fact, the implementing modules can be designed easily not to use this mechanism but implement their own.

Specified by:
work in class AbstractModule
Returns:
number of milliseconds to wait before the call of work. If the returned value is negative the module will cease execution.
Throws:
ModuleException - which will be caught and logged

getConnection

protected HKConnection getConnection()
                              throws ModuleException
returns a HKConnection object if a connection is associated with the calling module instance.

Returns:
the associated connection or null if no connection is configured
Throws:
ModuleException - if connection could not be established