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

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

public class NetworkInterfaceIPv4
extends Object
implements NetworkInterface

This class implements the NetworkInterface interface for IPv4 addresses. Currently only used for the purpose of testing the service monitor implementations.

Version:
$Revision: 1.1 $
Author:
Mike, OpenNMS

Field Summary
private static Map m_attributes
           
private static IPv4Address m_interface
           
private static int m_type
           
 
Fields inherited from interface org.opennms.bb.dp.poller.plugins.NetworkInterface
TYPE_IPV4, TYPE_UNKNOWN
 
Constructor Summary
NetworkInterfaceIPv4(String address)
           
 
Method Summary
 Object getAddress()
          Returns the address information for the interface.
 Object getAttribute(String property)
          This method is used to return the object that is associated with the property name.
 int getType()
          Returns the interface type for the network interface.
 Object setAttribute(String property, Object value)
          This method is used to associate an object value with a textual key.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

m_type

private static final int m_type

m_interface

private static IPv4Address m_interface

m_attributes

private static Map m_attributes
Constructor Detail

NetworkInterfaceIPv4

public NetworkInterfaceIPv4(String address)
Method Detail

getType

public int getType()
Description copied from interface: NetworkInterface

Returns the interface type for the network interface.

Specified by:
getType in interface NetworkInterface

getAddress

public Object getAddress()
Description copied from interface: NetworkInterface

Returns the address information for the interface. If the interface then this should be either an IPv4Address or InetAddress object.

Specified by:
getAddress in interface NetworkInterface

getAttribute

public Object getAttribute(String property)
Description copied from interface: NetworkInterface

This method is used to return the object that is associated with the property name. This is very similar to the java.util.Map get() method, but requires that the lookup be performed using a String name. The object may be of any instance that the monitor previous stored.

If there is no matching object for the property key, then a null pointer is returned to the application.

Specified by:
getAttribute in interface NetworkInterface
Following copied from interface: org.opennms.bb.dp.poller.plugins.NetworkInterface
Parameters:
property - The key for the lookup.
Returns:
The resulting value for the key, null if no value exist.
Throws:
IllegalArgumentException - Thrown if the passed key is empty or null.
See Also:
Map.get(java.lang.Object)

setAttribute

public Object setAttribute(String property,
                           Object value)
Description copied from interface: NetworkInterface

This method is used to associate an object value with a textual key. If a previous value was associated with the key then the old value is returned to the caller. This is identical to the behavior defined by the java.util.Map put() method. The only restriction is that the key must be a java string instance.

Specified by:
setAttribute in interface NetworkInterface
Following copied from interface: org.opennms.bb.dp.poller.plugins.NetworkInterface
Parameters:
property - The key
value - The value to associate with the key
Returns:
The object that was previously associated with the key. Null is returned if there was no previous value associated.
Throws:
IllegalArgumentException - Thrown if the property name is empty or null.
See Also:
Map.put(java.lang.Object, java.lang.Object)