|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--org.netsnmp.util.ValueCollector
Utility class, based on the GET_NEXT request, to collect values from a column of objects. For example:
ValueCollector c = new ValueCollector(String host, String community, new DefaultOID("IF-MIB::ifIndex")) ;
ints [] ifIndicies = c.ints() ;
This would collect all of the indexes for installed interfaces.
| Constructor Summary | |
ValueCollector(NetSNMPSession copySession,
OID baseOID)
Create a new instance of a ValueCollector using an exisiting session's peer, community and version. |
|
ValueCollector(String host,
String community,
OID baseOID)
Create a new instance of a ValueCollector |
|
| Method Summary | |
boolean |
actionPerformed(int result,
NetSNMPSession session,
PDU pdu,
Object o)
Called when a session receives a pdu result |
int[] |
ints()
wait for the results, and convert them to integers |
boolean |
isReady()
|
static void |
main(String[] args)
|
protected void |
onComplete()
routine called when query has been completed. |
String[] |
strings()
|
String |
toString()
|
ASNValue[] |
values()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public ValueCollector(String host,
String community,
OID baseOID)
throws NetSNMPSendError
host - host to querycommunity - community to usebaseOID - OID to begin query
public ValueCollector(NetSNMPSession copySession,
OID baseOID)
throws NetSNMPSendError
| Method Detail |
public String[] strings()
throws RuntimeException,
Error
RuntimeException
Errorpublic ASNValue[] values()
public int[] ints()
throws RuntimeException,
Error
RuntimeException
Errorpublic String toString()
toString in class Objectpublic boolean isReady()
protected void onComplete()
Example:
class myValueCollector extends ValueCollector {
protected void onComplete() {
// completion action
}
public boolean actionPerformed(int result,
NetSNMPSession session,
PDU pdu,
Object o)
throws Throwable
NetSNMPAction
actionPerformed in interface NetSNMPActionresult - SNMP Supporting library specific codesession - Session PDU was received onpdu - The pdu receivedo - Object supplied by caller to send method
Throwable - Exception to be caught by the internal threadNetSNMPAction.actionPerformed(int, NetSNMPSession, PDU, Object)
public static void main(String[] args)
throws Throwable
Throwable
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||