org.netxms.client.snmp
Class SnmpObjectId

java.lang.Object
  extended by org.netxms.client.snmp.SnmpObjectId

public class SnmpObjectId
extends java.lang.Object

This class represents SNMP Object Id (OID)


Constructor Summary
SnmpObjectId()
          Create empty OID
SnmpObjectId(long[] value)
          Create OID from array of OID elements
SnmpObjectId(SnmpObjectId parent, long id)
          Create child OID - add given value at the end of parent OID.
 
Method Summary
 int compareTo(SnmpObjectId oid)
          Compare two object identifiers.
 boolean equals(java.lang.Object obj)
           
 long getIdFromPos(int pos)
          Get part of object ID from given position.
 int getLength()
          Get object identifier length.
 int hashCode()
           
static SnmpObjectId parseSnmpObjectId(java.lang.String s)
          Parse string argument as SNMP OID.
 void setNXCPVariable(NXCPMessage msg, long varId)
          Set NXCP variable to OID's value
 boolean startsWith(SnmpObjectId oid)
          Check if this object id starts with given object id.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SnmpObjectId

public SnmpObjectId()
Create empty OID


SnmpObjectId

public SnmpObjectId(long[] value)
Create OID from array of OID elements

Parameters:
value - OID elements

SnmpObjectId

public SnmpObjectId(SnmpObjectId parent,
                    long id)
Create child OID - add given value at the end of parent OID.

Parameters:
value - parent OID
Method Detail

parseSnmpObjectId

public static SnmpObjectId parseSnmpObjectId(java.lang.String s)
                                      throws SnmpObjectIdFormatException
Parse string argument as SNMP OID. Expected to be ion format .n.n.n.n.n

Parameters:
s - string to parse
Returns:
SNMP OID object
Throws:
SnmpObjectIdFormatException - when string passed is not a valid SNMP OID

getLength

public int getLength()
Get object identifier length.

Returns:
OID length

setNXCPVariable

public void setNXCPVariable(NXCPMessage msg,
                            long varId)
Set NXCP variable to OID's value

Parameters:
msg - NXCP message
varId - Variable ID

startsWith

public boolean startsWith(SnmpObjectId oid)
Check if this object id starts with given object id.

Parameters:
oid - Object id to check
Returns:
true if this object id starts with given object id

compareTo

public int compareTo(SnmpObjectId oid)
Compare two object identifiers. The return value is -1 if this object identifier is less than given object identifier, 0 if they are equal, and 1 if this object identifier is greater then given object identifier.

Parameters:
oid - object identifier to compare with
Returns:
-1, 0, or 1 (see above for details)

getIdFromPos

public long getIdFromPos(int pos)
Get part of object ID from given position.

Parameters:
pos - position
Returns:
part of object id from given position or -1 if position is invalid

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011. All Rights Reserved.