org.opennms.bb.dp.discovery.components
Class IPPollRange

java.lang.Object
  |
  +--org.opennms.bb.dp.discovery.components.IPPollRange

public class IPPollRange
extends Object

The IPPollRange class is used to encapsulate a range of addresses that are assocaited with a timeout and retry count. The core class encapsulated is the IPAddressRange class.

The IPPollRange class can generate either an Iterator or an Enumeration to cycle over the addresses. The generated objects encapsulate generators returned by the IPAddressRange object and simply attach the correct timeout and retry for the new objects.

Version:
$Revision: 1.5 $
Author:
Sowmya, Brian Weaver, OpenNMS

Inner Class Summary
private  class IPPollRange.IPPollRangeGenerator
          The purpose of the IPPollRangeGenerator class is to provide an Enumeration or Iterator object that can be returned by the encapsulating class.
 
Field Summary
private  IPAddressRange m_range
          The range to cycle over.
private  long m_retries
          The number of retries for each generate object.
private  long m_timeout
          The timeout in milliseconds (1/1000th)
 
Constructor Summary
IPPollRange(InetAddress start, InetAddress end, long timeout, long retries)
          Creates an IPPollRange object that can be used to generate IPPollAddress objects.
IPPollRange(IPAddressRange range, long timeout, long retries)
          Creates an IPPollRange object that can be used to generate IPPollAddress objects.
IPPollRange(String fromIP, String toIP, long timeout, long retries)
          Creates an IPPollRange object that can be used to generate IPPollAddress objects.
 
Method Summary
 Enumeration elements()
          Returns an Enumeration that can be used to cycle over the range of pollable addresses.
 IPAddressRange getAddressRange()
          Returns the configured address ranges that are encapsulated by this object.
 long getRetries()
          Returns the retry count for the object.
 long getTimeout()
          Returns the timeout set for the object.
 Iterator iterator()
          Returns an Iterator object that can be used to cycle over the range of pollable address information.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_range

private IPAddressRange m_range
The range to cycle over.

m_timeout

private long m_timeout
The timeout in milliseconds (1/1000th)

m_retries

private long m_retries
The number of retries for each generate object.
Constructor Detail

IPPollRange

public IPPollRange(String fromIP,
                   String toIP,
                   long timeout,
                   long retries)
            throws UnknownHostException

Creates an IPPollRange object that can be used to generate IPPollAddress objects. The addresses are encapsulated by the range object and the values of timeout and retry are set in each generated IPPollAddress object.

Parameters:
fromIP - The start of the address range to cycle over.
toIP - The end of the address range to cycle over.
timeout - The timeout for each generated IPPollAddress.
retries - The number of retries for generated addresses.
See Also:
IPPollAddress, IPAddressRange

IPPollRange

public IPPollRange(InetAddress start,
                   InetAddress end,
                   long timeout,
                   long retries)

Creates an IPPollRange object that can be used to generate IPPollAddress objects. The addresses are encapsulated by the range [start..end] and the values of timeout and retry are set in each generated IPPollAddress object.

Parameters:
start - The start of the address range to cycle over.
end - The end of the address range to cycle over.
timeout - The timeout for each generated IPPollAddress.
retries - The number of retries for generated addresses.
See Also:
IPPollAddress, IPAddressRange

IPPollRange

public IPPollRange(IPAddressRange range,
                   long timeout,
                   long retries)

Creates an IPPollRange object that can be used to generate IPPollAddress objects. The addresses are encapsulated by the range object and the values of timeout and retry are set in each generated IPPollAddress object.

Parameters:
range - The address range to cycle over.
timeout - The timeout for each generated IPPollAddress.
retries - The number of retries for generated addresses.
See Also:
IPPollAddress
Method Detail

getTimeout

public long getTimeout()

Returns the timeout set for the object. The timeout should be in 1/1000th of a second increments.


getRetries

public long getRetries()

Returns the retry count for the object.


getAddressRange

public IPAddressRange getAddressRange()

Returns the configured address ranges that are encapsulated by this object.


elements

public Enumeration elements()

Returns an Enumeration that can be used to cycle over the range of pollable addresses.


iterator

public Iterator iterator()

Returns an Iterator object that can be used to cycle over the range of pollable address information.