OpenNMS API 1.2.9

## org.opennms.netmgt.discovery
Class IPGenerator

    java.lang.Object
      org.opennms.netmgt.discovery.IPGenerator

All Implemented Interfaces:
  FifoQueue

final class IPGenerator
extends java.lang.Object
implements FifoQueue

Author:
  Sowmya , OpenNMS

Nested Class Summary
`(package private) static class` `IPGenerator.IteratorChain` This class is used to chain a set of common iterators together so that when on iterator is exhausted the next one is polled.

Field Summary
`private long` `m_createTime` The system time when this instance was created.
`private java.util.List` `m_includeRanges` The range of items to be enumerated through
`private long` `m_initialWait` The initial wait time.
`private boolean` `m_isInitial` Set true until the initial wait time is over.
`private boolean` `m_isRestarted` Set to true if the end of the iterators has been reached and restarted.
`private java.util.Iterator` `m_iter` The iterator used to cycle through the ranges.
`private long` `m_restartTime` The time the end of the iteration was reached in system milliseconds.
`private long` `m_restartWait` The time to wait between restarts.
`private java.util.List` `m_specificAddresses` The specific list items to be iterated through

Constructor Summary
`(package private)` `IPGenerator(java.util.List specifics, java.util.List ranges, long initialWait, long restartWait)` Constructs a new instance of the class that can be used to iterate over the list of encapsulated objects.

Method Summary
`void` `add(java.lang.Object element)` This method is used to add an element to the queue.
`boolean` `add(java.lang.Object element, long timeout)` This method is used to add an element to the queue.
`private boolean` `doWait(long maxWait)` This method is used to block a thread the generator is in a timed wait.
`boolean` `isEmpty()` Returns true if the generator is empty.
`(package private) java.util.Iterator` `iterator()` Returns an iterator that may be used to step through all the encapsualted `pollableaddresses` in the generator.
`java.lang.Object` `remove()` Returns the next element in the internal interator.
`java.lang.Object` `remove(long timeout)` Returns the next element in the internal interator.
`int` `size()` Returns the current size of the queue.
`private void` `sync()` Synchronizes the Discovered IP Manager with the database.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### m_specificAddresses

    private java.util.List m_specificAddresses

  The specific list items to be iterated through

### m_includeRanges

    private java.util.List m_includeRanges

  The range of items to be enumerated through

### m_iter

    private java.util.Iterator m_iter

  The iterator used to cycle through the ranges.

### m_isInitial

    private boolean m_isInitial

  Set true until the initial wait time is over.

### m_createTime

    private long m_createTime

  The system time when this instance was created.

### m_isRestarted

    private boolean m_isRestarted

  Set to true if the end of the iterators has been reached and restarted.

### m_restartTime

    private long m_restartTime

  The time the end of the iteration was reached in system milliseconds.

### m_initialWait

    private long m_initialWait

  The initial wait time.

### m_restartWait

    private long m_restartWait

  The time to wait between restarts.

Constructor Detail

### IPGenerator

    IPGenerator(java.util.List specifics,
                java.util.List ranges,
                long initialWait,
                long restartWait)

  Constructs a new instance of the class that can be used to iterate over the list of encapsulated objects.

Parameters:
  `specifics` - The list of specific nodes.
  `ranges` - The range list for address generation
  `initialWait` - The initial wait time in milliseconds.
  `restartWait` - The cycle wait time in milliseconds.

Method Detail

### sync

    private void sync()

  Synchronizes the Discovered IP Manager with the database.

### doWait

    private boolean doWait(long maxWait)
                    throws java.lang.InterruptedException

  This method is used to block a thread the generator is in a timed wait. If there is no timed wait then the thread returns immediantly. If the lock is not released in the time passed to the method then a false value is returned.

  Parameters:
    `maxWait` - The maximum time to wait, or zero for indefinite.
  Returns:
    True if the wait was successful.
  Throws:
    `java.lang.InterruptedException`

### iterator

    java.util.Iterator iterator()

  Returns an iterator that may be used to step through all the encapsualted `pollableaddresses` in the generator. Each call to the `next` method on the returned iterator returns an instance of a `pollable address`.

  Returns:
    An iterator to traverse the encapsualted addresses.

### add

    public void add(java.lang.Object element)
             throws java.lang.InterruptedException,
                    FifoQueueException

  This method is used to add an element to the queue. The method is not implemented in this class and the exception `UnsupportedOperationException` is always generated.

  Specified by:
    `add` in interface `FifoQueue`
  Parameters:
    `element` - The element to add.
  Throws:
    `java.lang.UnsupportedOperationException` - Always thrown.
    `java.lang.InterruptedException` - Thrown if the thread is interrupted.
    `FifoQueueException` - Thrown if a queue error occurs.

### add

    public boolean add(java.lang.Object element,
                       long timeout)
                throws java.lang.InterruptedException,
                       FifoQueueException

  This method is used to add an element to the queue. The method is not implemented in this class and the exception `UnsupportedOperationException` is always generated.

  Specified by:
    `add` in interface `FifoQueue`
  Parameters:
    `element` - The element to add.
    `timeout` - The maximum time spent trying to add.
  Returns:
    True if the object is successfully added.
  Throws:
    `java.lang.UnsupportedOperationException` - Always thrown.
    `java.lang.InterruptedException` - Thrown if the thread is interrupted.
    `FifoQueueException` - Thrown if a queue error occurs.

### remove

    public java.lang.Object remove()
                            throws java.lang.InterruptedException,
                                   FifoQueueException

  Returns the next element in the internal interator. If the iterator has reached it's end, then the iterator is regenerated and thus this call will always return a valid element.

  Specified by:
    `remove` in interface `FifoQueue`
  Returns:
    The next element in the range(s).
  Throws:
    `FifoQueueException` - Thrown if a queue error occurs.
    `java.lang.InterruptedException` - Thrown if the thread is interrupted.

### remove

    public java.lang.Object remove(long timeout)
                            throws java.lang.InterruptedException,
                                   FifoQueueException

  Returns the next element in the internal interator. If the iterator has reached it's end, then the iterator is regenerated and thus this call will always return a valid element.

  Specified by:
    `remove` in interface `FifoQueue`
  Parameters:
    `timeout` - The maximum time to wait (ignored).
  Returns:
    The next element in the range(s).
  Throws:
    `java.lang.InterruptedException` - Thrown if the thread is interrupted.
    `FifoQueueException` - Thrown if a queue error occurs.

### size

    public int size()

  Returns the current size of the queue. Since the queue size is not easily determined, this method will always return `1`.

  Specified by:
    `size` in interface `FifoQueue`
  Returns:
    The constant value 1.

### isEmpty

    public boolean isEmpty()

  Returns true if the generator is empty. This method always returns `true`.

  Specified by:
    `isEmpty` in interface `FifoQueue`
  Returns:
    True.

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.