org.opennms.netmgt.snmp.snmp4j
Class Snmp4JStrategy

java.lang.Object
  extended by org.opennms.netmgt.snmp.snmp4j.Snmp4JStrategy
All Implemented Interfaces:
SnmpStrategy

public class Snmp4JStrategy
extends Object
implements SnmpStrategy


Nested Class Summary
static class Snmp4JStrategy.RegistrationInfo
           
 
Constructor Summary
Snmp4JStrategy()
           
 
Method Summary
protected  SnmpAgentConfig buildAgentConfig(String address, int port, String community, org.snmp4j.PDU pdu)
           
protected  org.snmp4j.PDU buildPdu(Snmp4JAgentConfig agentConfig, int pduType, SnmpObjId[] oids, SnmpValue[] values)
           
 SnmpWalker createWalker(SnmpAgentConfig snmpAgentConfig, String name, CollectionTracker tracker)
          SNMP4J createWalker implemenetation.
 SnmpValue get(SnmpAgentConfig agentConfig, SnmpObjId oid)
          SNMP4J get helper that takes a single SnmpObjId and calls get with an array.lenght =1 and returns the first element of the returned array of SnmpValue.
 SnmpValue[] get(SnmpAgentConfig agentConfig, SnmpObjId[] oids)
          SnmpGet implementation.
 SnmpValue[] getBulk(SnmpAgentConfig agentConfig, SnmpObjId[] oid)
          Not yet implemented.
 SnmpValue getNext(SnmpAgentConfig agentConfig, SnmpObjId oid)
          SNMP4J getNext implementation
 SnmpValue[] getNext(SnmpAgentConfig agentConfig, SnmpObjId[] oids)
          SNMP GetNext implementation.
 SnmpV1TrapBuilder getV1TrapBuilder()
           
 SnmpTrapBuilder getV2TrapBuilder()
           
 SnmpValueFactory getValueFactory()
           
 void registerForTraps(TrapNotificationListener listener, TrapProcessorFactory processorFactory, int snmpTrapPort)
           
protected  SnmpValue[] send(Snmp4JAgentConfig agentConfig, org.snmp4j.PDU pdu, boolean expectResponse)
          Sends and SNMP4J request pdu.
 void sendTest(String agentAddress, int port, String community, org.snmp4j.PDU pdu)
           
 SnmpValue[] set(SnmpAgentConfig agentConfig, SnmpObjId[] oids, SnmpValue[] values)
           
 SnmpValue set(SnmpAgentConfig agentConfig, SnmpObjId oid, SnmpValue value)
           
 void unregisterForTraps(TrapNotificationListener listener, int snmpTrapPort)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Snmp4JStrategy

public Snmp4JStrategy()
Method Detail

createWalker

public SnmpWalker createWalker(SnmpAgentConfig snmpAgentConfig,
                               String name,
                               CollectionTracker tracker)
SNMP4J createWalker implemenetation.

Specified by:
createWalker in interface SnmpStrategy
Parameters:
snmpAgentConfig -
name -
tracker -

getBulk

public SnmpValue[] getBulk(SnmpAgentConfig agentConfig,
                           SnmpObjId[] oid)
Not yet implemented. Use a walker.

Specified by:
getBulk in interface SnmpStrategy

set

public SnmpValue set(SnmpAgentConfig agentConfig,
                     SnmpObjId oid,
                     SnmpValue value)
Specified by:
set in interface SnmpStrategy

set

public SnmpValue[] set(SnmpAgentConfig agentConfig,
                       SnmpObjId[] oids,
                       SnmpValue[] values)
Specified by:
set in interface SnmpStrategy

get

public SnmpValue get(SnmpAgentConfig agentConfig,
                     SnmpObjId oid)
SNMP4J get helper that takes a single SnmpObjId and calls get with an array.lenght =1 and returns the first element of the returned array of SnmpValue.

Specified by:
get in interface SnmpStrategy
Parameters:
agentConfig -
oid -

get

public SnmpValue[] get(SnmpAgentConfig agentConfig,
                       SnmpObjId[] oids)
SnmpGet implementation.

Specified by:
get in interface SnmpStrategy
Parameters:
agentConfig -
oids -
Returns:
Returns an array of Snmp4JValues. If the get was unsuccessful, then the first elment of the array will be null and lenth of 1.

getNext

public SnmpValue getNext(SnmpAgentConfig agentConfig,
                         SnmpObjId oid)
SNMP4J getNext implementation

Specified by:
getNext in interface SnmpStrategy
Parameters:
agentConfig -
oid -

getNext

public SnmpValue[] getNext(SnmpAgentConfig agentConfig,
                           SnmpObjId[] oids)
SNMP GetNext implementation.

Specified by:
getNext in interface SnmpStrategy
Parameters:
agentConfig -
oids -
Returns:
Returns an array of Snmp4JValues. If the getNext was unsuccessful, then the first element of the array will be null and length of 1.

send

protected SnmpValue[] send(Snmp4JAgentConfig agentConfig,
                           org.snmp4j.PDU pdu,
                           boolean expectResponse)
Sends and SNMP4J request pdu. The attributes in SnmpAgentConfig should have been adapted from default SnmpAgentConfig values to those compatible with the SNMP4J library.

Parameters:
agentConfig -
pduType - TODO
oids -
values - can be null
Returns:

buildPdu

protected org.snmp4j.PDU buildPdu(Snmp4JAgentConfig agentConfig,
                                  int pduType,
                                  SnmpObjId[] oids,
                                  SnmpValue[] values)

getValueFactory

public SnmpValueFactory getValueFactory()
Specified by:
getValueFactory in interface SnmpStrategy

registerForTraps

public void registerForTraps(TrapNotificationListener listener,
                             TrapProcessorFactory processorFactory,
                             int snmpTrapPort)
                      throws IOException
Specified by:
registerForTraps in interface SnmpStrategy
Throws:
IOException

unregisterForTraps

public void unregisterForTraps(TrapNotificationListener listener,
                               int snmpTrapPort)
                        throws IOException
Specified by:
unregisterForTraps in interface SnmpStrategy
Throws:
IOException

getV1TrapBuilder

public SnmpV1TrapBuilder getV1TrapBuilder()
Specified by:
getV1TrapBuilder in interface SnmpStrategy

getV2TrapBuilder

public SnmpTrapBuilder getV2TrapBuilder()
Specified by:
getV2TrapBuilder in interface SnmpStrategy

buildAgentConfig

protected SnmpAgentConfig buildAgentConfig(String address,
                                           int port,
                                           String community,
                                           org.snmp4j.PDU pdu)
                                    throws UnknownHostException
Throws:
UnknownHostException

sendTest

public void sendTest(String agentAddress,
                     int port,
                     String community,
                     org.snmp4j.PDU pdu)


Copyright © 2009. All Rights Reserved.