|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The NetworkInterface class is designed to be a well defined front for passing interfaces to a service monitor. There are many different types of network in use today including IPv4, IPv6, IPX, and others. To accomidate the possible differences this class provides the basic information that a monitor can use to determine the type of interface and its expected address type.
In addition to providing typing and address information, the interface allows for the monitor to associate key-value pairs with an interface. This can be used to save state information between the various invocations if neccessary. The attributes may be shared with other monitors concurrently, so a monitor must be careful to choose unique keys to prevent namespace collisions.
Field Summary | |
static int |
TYPE_IPV4
Defines a standard IPv4 address. |
static int |
TYPE_UNKNOWN
Defines an unknown interface that has no associated address information. |
Method Summary | |
java.lang.Object |
getAddress()
Returns the address information for the interface. |
java.lang.Object |
getAttribute(java.lang.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. |
java.lang.Object |
setAttribute(java.lang.String property,
java.lang.Object value)
This method is used to associate an object value with a textual key. |
Field Detail |
public static final int TYPE_UNKNOWN
public static final int TYPE_IPV4
Defines a standard IPv4 address. This is usually modeled by an InetAddress object.
Method Detail |
public int getType()
Returns the interface type for the network interface.
public java.lang.Object getAddress()
Returns the address information for the interface. If the interface then this should be either an InetAddress or an object for specialized address types.
public java.lang.Object getAttribute(java.lang.String property)
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.
property
- The key for the lookup.
java.lang.IllegalArgumentException
- Thrown if the passed key is empty or null.Map.get(java.lang.Object)
public java.lang.Object setAttribute(java.lang.String property, java.lang.Object value)
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.
property
- The keyvalue
- The value to associate with the key
java.lang.IllegalArgumentException
- Thrown if the property name is empty or null.Map.put(java.lang.Object, java.lang.Object)
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |