com.h3c.util.snmp.command

## Class SnmpCommandProcessor

- java.lang.Object
- - com.h3c.util.snmp.command.SnmpCommandProcessor

- All Implemented Interfaces:
    CommandProcessor<Oid,SnmpErrorDescriptor>

      public class SnmpCommandProcessor
      extends Object
      implements CommandProcessor<Oid,SnmpErrorDescriptor>

  SNMP Command Processor.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SnmpCommandProcessor(IpAddress ipAddress, SnmpCredentials credentials, SnmpConnectionConfiguration connectionConfiguration, ExecutorService taskExecutor)` Creates a SNMP Command Processor.
    `SnmpCommandProcessor(IpAddress ipAddress, SnmpCredentials credentials, SnmpConnectionConfiguration connectionConfiguration, SnmpClient snmpClient)` Creates a SNMP Command Processor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endSession()` Terminates the session.
    `void` | `executeAsynchronously(List<Command<Oid>> commands, CommandExecutionListener<Oid,SnmpErrorDescriptor> commandExecutionListener)` Asynchronously executes commands.
    `Result<Void,SnmpErrorDescriptor,Void>` | `executeSynchronously(List<Command<Oid>> commands, Long timeout)` Synchronously executes commands.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SnmpCommandProcessor

          public SnmpCommandProcessor(IpAddress ipAddress,
                              SnmpCredentials credentials,
                              SnmpConnectionConfiguration connectionConfiguration,
                              ExecutorService taskExecutor)
                               throws NullPointerException,
                                      IOException

      Creates a SNMP Command Processor.
      Parameters:
        `ipAddress` - Target device IP Address.
        `credentials` - Device SNMP credentials.
        `connectionConfiguration` - SNMP connection configuration.
        `taskExecutor` - Executor used for asynchronously command execution (to decouple execution of task i.e. to have a task executed in the context of a worker thread instead of in the context of the calling thread).
      Throws:
        `NullPointerException` - If any of the arguments is null.
        `IOException` - If an error occurs.

    - #### SnmpCommandProcessor

          public SnmpCommandProcessor(IpAddress ipAddress,
                              SnmpCredentials credentials,
                              SnmpConnectionConfiguration connectionConfiguration,
                              SnmpClient snmpClient)
                               throws NullPointerException,
                                      IOException

      Creates a SNMP Command Processor.
      Parameters:
        `ipAddress` - Target device IP Address.
        `credentials` - Device SNMP credentials.
        `connectionConfiguration` - SNMP connection configuration.
        `snmpClient` - The SNMP client interface.
      Throws:
        `NullPointerException` - If any of the arguments is null.
        `IOException` - If an error occurs.

  - ### Method Detail

    - #### executeSynchronously

          public Result<Void,SnmpErrorDescriptor,Void> executeSynchronously(List<Command<Oid>> commands,
                                                                   Long timeout)

      Description copied from interface: `CommandProcessor`
      Synchronously executes commands.
      Specified by:
        `executeSynchronously` in interface `CommandProcessor<Oid,SnmpErrorDescriptor>`
      Parameters:
        `commands` - Commands to execute.
        `timeout` - Timeout, null to wait until the response is received.
      Returns:
        Execution result.

    - #### executeAsynchronously

          public void executeAsynchronously(List<Command<Oid>> commands,
                                   CommandExecutionListener<Oid,SnmpErrorDescriptor> commandExecutionListener)

      Description copied from interface: `CommandProcessor`
      Asynchronously executes commands.
      Specified by:
        `executeAsynchronously` in interface `CommandProcessor<Oid,SnmpErrorDescriptor>`
      Parameters:
        `commands` - Commands to execute.
        `commandExecutionListener` - Entity to notify execution state.

    - #### endSession

          public void endSession()

      Description copied from interface: `CommandProcessor`
      Terminates the session.
      Specified by:
        `endSession` in interface `CommandProcessor<Oid,SnmpErrorDescriptor>`

Copyright © 2014. All Rights Reserved.