org.opennms.bb.dp.poller.plugins
Class PollerTask

java.lang.Object
  |
  +--org.opennms.bb.dp.poller.plugins.PollerTask
All Implemented Interfaces:
NetworkInterface, Runnable

public class PollerTask
extends Object
implements Runnable, NetworkInterface

This class provides the main class construct that will be used to schedule interfaces for polling. A PollerTask object will be placed on a producer/consumer queue and processed as a thread by the run() method. The polling service will be invoked during the execution of the run() method.

Version:
$Revision: 1.5 $
Author:
Jason Johns, OpenNMS

Field Summary
private  int m_currentInterval
           
private  int m_currentStatus
          The status of the task updated for each call of the poller.
private  EventProxy m_eventProxy
          The object through which the ServiceMonitor can send events
private  Object m_interfaceAddress
          The address that the ServiceMonitor must poll
private  ServiceMonitor m_monitor
          The object that will be called to do the actual service polling
private  int m_packageIndex
           
private  boolean m_processing
           
private  Map m_properties
          The map that a ServiceMonitor can use to persist data
 
Fields inherited from interface org.opennms.bb.dp.poller.plugins.NetworkInterface
TYPE_IPV4, TYPE_UNKNOWN
 
Constructor Summary
PollerTask(ServiceMonitor aMonitor, Object iface, EventProxy anEventProxy, Map props)
          Constructor, initializes the members.
 
Method Summary
 Object getAddress()
          This method returns the ip address of the service interface
 Object getAttribute(String property)
          This method returns an attribute from the m_properties member.
 int getCurrentInterval()
           
 int getPackageIndex()
           
 int getStatus()
          This method returns the status of the service that was recieved when last polled.
 int getType()
          Returns the interface type for the network interface.
 boolean isProcessing()
           
 void run()
          This method fulfills the Runnable interface.
 Object setAttribute(String property, Object value)
          This method sets an attribute in the m_properties member
 void setCurrentInterval(int newInterval)
           
 void setPackageIndex(int aPackageIndex)
           
 void setProcessing(boolean aBool)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_monitor

private ServiceMonitor m_monitor
The object that will be called to do the actual service polling

m_interfaceAddress

private Object m_interfaceAddress
The address that the ServiceMonitor must poll

m_eventProxy

private EventProxy m_eventProxy
The object through which the ServiceMonitor can send events

m_properties

private Map m_properties
The map that a ServiceMonitor can use to persist data

m_processing

private boolean m_processing

m_currentInterval

private int m_currentInterval

m_packageIndex

private int m_packageIndex

m_currentStatus

private int m_currentStatus
The status of the task updated for each call of the poller. Used by the scheduler to base the next schedule update of this ServiceMonitor.
Constructor Detail

PollerTask

public PollerTask(ServiceMonitor aMonitor,
                  Object iface,
                  EventProxy anEventProxy,
                  Map props)
Constructor, initializes the members.
Parameters:
ServiceMonitor - aMonitor, the monitor to do the polling
IPv4Address - iface, the service interface ip address
EventProxy - anEventProxy, the object for sending events
Map - props, a map used for persiting data
Method Detail

setCurrentInterval

public void setCurrentInterval(int newInterval)

getCurrentInterval

public int getCurrentInterval()

setPackageIndex

public void setPackageIndex(int aPackageIndex)

getPackageIndex

public int getPackageIndex()

isProcessing

public boolean isProcessing()

setProcessing

public void setProcessing(boolean aBool)

run

public void run()
This method fulfills the Runnable interface. When this PollerTask is pulled from the producer queue this method will be called and will perform the actual poll for the service. The status is updated and the PollerTask will be placed onto a consumer queue for the scheduler to consume.
Specified by:
run in interface Runnable

getStatus

public int getStatus()
This method returns the status of the service that was recieved when last polled.
Returns:
int, the constant indicating the current status

getAddress

public Object getAddress()
This method returns the ip address of the service interface
Specified by:
getAddress in interface NetworkInterface
Returns:
Object, the object encapulating the address

getAttribute

public Object getAttribute(String property)
This method returns an attribute from the m_properties member.
Specified by:
getAttribute in interface NetworkInterface
Parameters:
String - property, the property to look up
Returns:
Object, and Object encapulating the attribute

setAttribute

public Object setAttribute(String property,
                           Object value)
This method sets an attribute in the m_properties member
Specified by:
setAttribute in interface NetworkInterface
Parameters:
String - property, the property to set
Object - value, the Object encapulating the attribute
Returns:
Object, previous value associated with specified key, or null if there was no mapping for key

getType

public int getType()
Description copied from interface: NetworkInterface

Returns the interface type for the network interface.

Specified by:
getType in interface NetworkInterface