jhomenet.hw.pollers
Class PollingService

java.lang.Object
  extended by jhomenet.hw.pollers.PollingService
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener, HardwareRegistryListener, Service

public class PollingService
extends java.lang.Object
implements Service, HardwareRegistryListener, java.beans.PropertyChangeListener

Manages the polling of sensor hardware.
Id: $Id: PollingService.java,v 1.18 2005/11/09 22:50:26 dhirwinjr Exp $

Author:
David Irwin

Nested Class Summary
static class PollingService.PollingTypes
          Define the different polling types.
 
Field Summary
static java.lang.String HARDWARE_POLLING
           
static java.lang.String POLLING_TYPE
           
 
Method Summary
 java.util.ArrayList<java.lang.String> getPollingList(PollingService.PollingTypes pollingType)
           
 PollingService.PollingTypes getPollingType(java.lang.String pollingTypeDesc)
          Get the polling type given the description.
 java.util.List<PollingService.PollingTypes> getPollingTypes()
          Return a list of polling types.
 Scheduler getSchedulerReference()
          Get a reference to the scheduler.
 void hardwareRegistered(HardwareRegistryEvent event)
          Receives hardware registry events.
 void hardwareUnregistered(HardwareRegistryEvent event)
          Receives a hardware unregistered event.
 void hardwareUpdate(HardwareRegistryEvent event)
          Receives a hardware update event.
 void initializeService()
          Initialize the polling service.
static PollingService instance()
          Return an instance of the polling manager.
 void propertyChange(java.beans.PropertyChangeEvent evt)
          Received a property change event.
 void startService()
          Start the service.
 void stopService()
          Stop the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

POLLING_TYPE

public static final java.lang.String POLLING_TYPE
See Also:
Constant Field Values

HARDWARE_POLLING

public static final java.lang.String HARDWARE_POLLING
See Also:
Constant Field Values
Method Detail

instance

public static PollingService instance()
Return an instance of the polling manager.

Returns:
A reference to the polling manager

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
Received a property change event. This method is used to watch for changes in hardware sensor objects, in particular the polling type. When a sensor's polling type changes, the polling service needs to be updated to reflect this change.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
See Also:
PropertyChangeListener.propertyChange(java.beans.PropertyChangeEvent)

initializeService

public void initializeService()
Initialize the polling service.

Specified by:
initializeService in interface Service

startService

public void startService()
Description copied from interface: Service
Start the service.

Specified by:
startService in interface Service
See Also:
Service.startService()

stopService

public void stopService()
Description copied from interface: Service
Stop the service.

Specified by:
stopService in interface Service
See Also:
Service.stopService()

getSchedulerReference

public Scheduler getSchedulerReference()
Description copied from interface: Service
Get a reference to the scheduler.

Specified by:
getSchedulerReference in interface Service
Returns:
Reference to the scheduler
See Also:
Service.getSchedulerReference()

getPollingTypes

public java.util.List<PollingService.PollingTypes> getPollingTypes()
Return a list of polling types.

Returns:
The list of polling types.

getPollingType

public PollingService.PollingTypes getPollingType(java.lang.String pollingTypeDesc)
Get the polling type given the description.

Parameters:
pollingTypeDesc - A description of the polling type.
Returns:
A reference to the corresponding polling type.

getPollingList

public java.util.ArrayList<java.lang.String> getPollingList(PollingService.PollingTypes pollingType)

hardwareRegistered

public void hardwareRegistered(HardwareRegistryEvent event)
Receives hardware registry events.

Specified by:
hardwareRegistered in interface HardwareRegistryListener
Parameters:
event - Hardware event
See Also:
jhomenet.hw.management.HardwareRegistryListener#hardwareRegistered(NewHardwareEvent)

hardwareUpdate

public void hardwareUpdate(HardwareRegistryEvent event)
Receives a hardware update event.

Specified by:
hardwareUpdate in interface HardwareRegistryListener
Parameters:
event - Hardware event
See Also:
HardwareRegistryListener.hardwareUpdate(jhomenet.hw.management.HardwareRegistryEvent)

hardwareUnregistered

public void hardwareUnregistered(HardwareRegistryEvent event)
Receives a hardware unregistered event.

Specified by:
hardwareUnregistered in interface HardwareRegistryListener
Parameters:
event - Hardware event
See Also:
HardwareRegistryListener.hardwareUnregistered(HardwareRegistryEvent)


Copyright © 2004-2005 David Irwin. All Rights Reserved.