sophware.home.io
Class HomeEventHandler

java.lang.Object
  extended by sophware.home.io.HomeEventHandler
Direct Known Subclasses:
InsteonEventHandler, X10EventHandler

public abstract class HomeEventHandler
extends java.lang.Object

The HomeEventHandler handles home events

Version:
1.0, 03/19/07
Author:
Russell Soph

Constructor Summary
HomeEventHandler()
           
 
Method Summary
static HomeEventHandler getEventHandler(java.lang.Class<? extends HomeEvent> c)
          Gets the event handler for this event
 boolean isActive()
          Check if this handler is active
 void setActive(boolean active)
          Sets the active state of this handler
static void setAllActive(boolean active)
          Sets active state for all event handlers
static void setEventHandler(java.lang.Class<? extends HomeEvent> c, HomeEventHandler handler)
          Sets the event handler for this event
abstract  void update(HomeEvent event, Home home)
          Apply this event to a Home
abstract  void update(HomeEvent event, Home home, HomeDevice device)
          Apply this event to a HomeDevice
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HomeEventHandler

public HomeEventHandler()
Method Detail

getEventHandler

public static HomeEventHandler getEventHandler(java.lang.Class<? extends HomeEvent> c)
Gets the event handler for this event

Parameters:
c - the HomeEvent class
Returns:
the HomeEventHandler

setEventHandler

public static void setEventHandler(java.lang.Class<? extends HomeEvent> c,
                                   HomeEventHandler handler)
Sets the event handler for this event

Parameters:
c - the HomeEvent class
handler - the HomeEventHandler

setAllActive

public static void setAllActive(boolean active)
Sets active state for all event handlers

Parameters:
active - the active state

update

public abstract void update(HomeEvent event,
                            Home home)
Apply this event to a Home

Parameters:
event - the HomeEvent
home - the Home

update

public abstract void update(HomeEvent event,
                            Home home,
                            HomeDevice device)
Apply this event to a HomeDevice

Parameters:
event - the HomeEvent
home - the Home
device - the HomeDevice

isActive

public boolean isActive()
Check if this handler is active

Active handlers will query devices for certain event types however a network only wants one active handler processing events. Handlers are active by default.

Returns:
true if handler is active

setActive

public void setActive(boolean active)
Sets the active state of this handler

Active handlers will query devices for certain event types however a network only wants one active handler processing events. Handlers are active by default.

Parameters:
active - the active status