## org.opennms.netmgt.snmp.snmp4j
Class Snmp4JStrategy

    java.lang.Object
      org.opennms.netmgt.snmp.snmp4j.Snmp4JStrategy

All Implemented Interfaces:
  org.opennms.netmgt.snmp.SnmpStrategy

    public class Snmp4JStrategy

extends java.lang.Object
implements org.opennms.netmgt.snmp.SnmpStrategy

Nested Class Summary
`static class` `Snmp4JStrategy.RegistrationInfo`

Constructor Summary
`Snmp4JStrategy()`

Method Summary
`protected org.opennms.netmgt.snmp.SnmpAgentConfig` `buildAgentConfig(java.lang.String address, int port, java.lang.String community, org.snmp4j.PDU pdu)`
`protected org.snmp4j.PDU` `buildPdu(Snmp4JAgentConfig agentConfig, int pduType, org.opennms.netmgt.snmp.SnmpObjId[] oids, org.opennms.netmgt.snmp.SnmpValue[] values)`
`org.opennms.netmgt.snmp.SnmpWalker` `createWalker(org.opennms.netmgt.snmp.SnmpAgentConfig snmpAgentConfig, java.lang.String name, org.opennms.netmgt.snmp.CollectionTracker tracker)` SNMP4J createWalker implemenetation.
`org.opennms.netmgt.snmp.SnmpValue` `get(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.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.
`org.opennms.netmgt.snmp.SnmpValue[]` `get(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.SnmpObjId[] oids)` SnmpGet implementation.
`org.opennms.netmgt.snmp.SnmpValue[]` `getBulk(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.SnmpObjId[] oid)` Not yet implemented.
`org.opennms.netmgt.snmp.SnmpValue` `getNext(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.SnmpObjId oid)` SNMP4J getNext implementation
`org.opennms.netmgt.snmp.SnmpValue[]` `getNext(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.SnmpObjId[] oids)` SNMP GetNext implementation.
`org.opennms.netmgt.snmp.SnmpV1TrapBuilder` `getV1TrapBuilder()`
`org.opennms.netmgt.snmp.SnmpTrapBuilder` `getV2TrapBuilder()`
`org.opennms.netmgt.snmp.SnmpValueFactory` `getValueFactory()`
`void` `registerForTraps(org.opennms.netmgt.snmp.TrapNotificationListener listener, org.opennms.netmgt.snmp.TrapProcessorFactory processorFactory, int snmpTrapPort)`
`protected org.opennms.netmgt.snmp.SnmpValue[]` `send(Snmp4JAgentConfig agentConfig, org.snmp4j.PDU pdu, boolean expectResponse)` Sends and SNMP4J request pdu.
`void` `sendTest(java.lang.String agentAddress, int port, java.lang.String community, org.snmp4j.PDU pdu)`
`org.opennms.netmgt.snmp.SnmpValue[]` `set(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.SnmpObjId[] oids, org.opennms.netmgt.snmp.SnmpValue[] values)`
`org.opennms.netmgt.snmp.SnmpValue` `set(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig, org.opennms.netmgt.snmp.SnmpObjId oid, org.opennms.netmgt.snmp.SnmpValue value)`
`void` `unregisterForTraps(org.opennms.netmgt.snmp.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 org.opennms.netmgt.snmp.SnmpWalker createWalker(org.opennms.netmgt.snmp.SnmpAgentConfig snmpAgentConfig,
                                                           java.lang.String name,
                                                           org.opennms.netmgt.snmp.CollectionTracker tracker)

  SNMP4J createWalker implemenetation.

  Specified by:
    `createWalker` in interface `org.opennms.netmgt.snmp.SnmpStrategy`
  Parameters:
    `snmpAgentConfig` -
    `name` -
    `tracker` -

### getBulk

    public org.opennms.netmgt.snmp.SnmpValue[] getBulk(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                       org.opennms.netmgt.snmp.SnmpObjId[] oid)

  Not yet implemented. Use a walker.

  Specified by:
    `getBulk` in interface `org.opennms.netmgt.snmp.SnmpStrategy`

### set

    public org.opennms.netmgt.snmp.SnmpValue set(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                 org.opennms.netmgt.snmp.SnmpObjId oid,
                                                 org.opennms.netmgt.snmp.SnmpValue value)

  Specified by:
    `set` in interface `org.opennms.netmgt.snmp.SnmpStrategy`

### set

    public org.opennms.netmgt.snmp.SnmpValue[] set(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                   org.opennms.netmgt.snmp.SnmpObjId[] oids,
                                                   org.opennms.netmgt.snmp.SnmpValue[] values)

  Specified by:
    `set` in interface `org.opennms.netmgt.snmp.SnmpStrategy`

### get

    public org.opennms.netmgt.snmp.SnmpValue get(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                 org.opennms.netmgt.snmp.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 `org.opennms.netmgt.snmp.SnmpStrategy`
  Parameters:
    `agentConfig` -
    `oid` -

### get

    public org.opennms.netmgt.snmp.SnmpValue[] get(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                   org.opennms.netmgt.snmp.SnmpObjId[] oids)

  SnmpGet implementation.

  Specified by:
    `get` in interface `org.opennms.netmgt.snmp.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 org.opennms.netmgt.snmp.SnmpValue getNext(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                     org.opennms.netmgt.snmp.SnmpObjId oid)

  SNMP4J getNext implementation

  Specified by:
    `getNext` in interface `org.opennms.netmgt.snmp.SnmpStrategy`
  Parameters:
    `agentConfig` -
    `oid` -

### getNext

    public org.opennms.netmgt.snmp.SnmpValue[] getNext(org.opennms.netmgt.snmp.SnmpAgentConfig agentConfig,
                                                       org.opennms.netmgt.snmp.SnmpObjId[] oids)

  SNMP GetNext implementation.

  Specified by:
    `getNext` in interface `org.opennms.netmgt.snmp.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 org.opennms.netmgt.snmp.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,
                                      org.opennms.netmgt.snmp.SnmpObjId[] oids,
                                      org.opennms.netmgt.snmp.SnmpValue[] values)

### getValueFactory

    public org.opennms.netmgt.snmp.SnmpValueFactory getValueFactory()

  Specified by:
    `getValueFactory` in interface `org.opennms.netmgt.snmp.SnmpStrategy`

### registerForTraps

    public void registerForTraps(org.opennms.netmgt.snmp.TrapNotificationListener listener,
                                 org.opennms.netmgt.snmp.TrapProcessorFactory processorFactory,
                                 int snmpTrapPort)
                          throws java.io.IOException

  Specified by:
    `registerForTraps` in interface `org.opennms.netmgt.snmp.SnmpStrategy`
  Throws:
    `java.io.IOException`

### unregisterForTraps

    public void unregisterForTraps(org.opennms.netmgt.snmp.TrapNotificationListener listener,
                                   int snmpTrapPort)
                            throws java.io.IOException

  Specified by:
    `unregisterForTraps` in interface `org.opennms.netmgt.snmp.SnmpStrategy`
  Throws:
    `java.io.IOException`

### getV1TrapBuilder

    public org.opennms.netmgt.snmp.SnmpV1TrapBuilder getV1TrapBuilder()

  Specified by:
    `getV1TrapBuilder` in interface `org.opennms.netmgt.snmp.SnmpStrategy`

### getV2TrapBuilder

    public org.opennms.netmgt.snmp.SnmpTrapBuilder getV2TrapBuilder()

  Specified by:
    `getV2TrapBuilder` in interface `org.opennms.netmgt.snmp.SnmpStrategy`

### buildAgentConfig

    protected org.opennms.netmgt.snmp.SnmpAgentConfig buildAgentConfig(java.lang.String address,
                                                                       int port,
                                                                       java.lang.String community,
                                                                       org.snmp4j.PDU pdu)
                                                                throws java.net.UnknownHostException

  Throws:
    `java.net.UnknownHostException`

### sendTest

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

Copyright © 2010. All Rights Reserved.