OpenNMS API 1.2.3

org.opennms.protocols.snmp
Class SnmpParameters

java.lang.Object
  extended byorg.opennms.protocols.snmp.SnmpParameters
All Implemented Interfaces:
java.lang.Cloneable

public class SnmpParameters
extends java.lang.Object
implements java.lang.Cloneable

The SnmpParameters class is used to define the parameters for an SnmpSession. The parameters include the read/write community strings. The protocol version and the ASN.1 encoder used to encode/decode transmissions.

Version:
1.1.1.1
Author:
Brian Weaver

Field Summary
static java.lang.String defaultCommunity
          The default read-only community string
static AsnEncoder defaultEncoder
          The AsnEncoder used by default.
static int defaultVersion
          The SNMP protocol version used by default.
private  AsnEncoder m_encoder
          The AsnEncoder object used by the session to encode and decode information.
private  java.lang.String m_readCommunity
          The read community string.
private  int m_version
          The SNMP protocol version used for communication.
private  java.lang.String m_writeCommunity
          The write community string
 
Constructor Summary
SnmpParameters()
          The default class constructor.
SnmpParameters(int version)
          Constructs a default object with the specified SNMP protocol version.
SnmpParameters(SnmpParameters second)
          Constructs a copy of the parameters defined in the object second.
SnmpParameters(java.lang.String read)
          Constructs a default object with the specified read-only community string.
SnmpParameters(java.lang.String read, java.lang.String write)
          Constructs an object with the specified read-only and write-only community strings.
 
Method Summary
 java.lang.Object clone()
          Used to get a newly created duplicate of the current object.
 AsnEncoder getEncoder()
          Retreives the current ASN.1 encoder object.
 java.lang.String getReadCommunity()
          Retreives the current read community string from the parameters.
 int getVersion()
          Returns the current SNMP version defined by the parameters.
 java.lang.String getWriteCommunity()
          Retreives the current write community string set in the parameters.
 void setEncoder(AsnEncoder encoder)
          Sets the ASN.1 encoder.
 void setReadCommunity(java.lang.String rd)
          Used to set the parameters read community string.
 void setVersion(int ver)
          Use to set the SNMP protocol version.
 void setWriteCommunity(java.lang.String wr)
          Used to set the parameters write community string.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_readCommunity

private java.lang.String m_readCommunity
The read community string.


m_writeCommunity

private java.lang.String m_writeCommunity
The write community string


m_version

private int m_version
The SNMP protocol version used for communication. The possible values are defined in the SnmpSMI

See Also:
SnmpSMI.SNMPV1, SnmpSMI.SNMPV2

m_encoder

private AsnEncoder m_encoder
The AsnEncoder object used by the session to encode and decode information.

See Also:
BerEncoder

defaultCommunity

public static final java.lang.String defaultCommunity
The default read-only community string

See Also:
Constant Field Values

defaultEncoder

public static final AsnEncoder defaultEncoder
The AsnEncoder used by default.


defaultVersion

public static final int defaultVersion
The SNMP protocol version used by default.

See Also:
Constant Field Values
Constructor Detail

SnmpParameters

public SnmpParameters()
The default class constructor. Constructs the object with the publicly available default values. By default the write community string is left null.

See Also:
defaultCommunity, defaultEncoder, defaultVersion

SnmpParameters

public SnmpParameters(SnmpParameters second)
Constructs a copy of the parameters defined in the object second.

Parameters:
second - The object to copy into self.

SnmpParameters

public SnmpParameters(int version)
Constructs a default object with the specified SNMP protocol version.

Parameters:
version - The SNMP protocol version.

SnmpParameters

public SnmpParameters(java.lang.String read)
Constructs a default object with the specified read-only community string.

Parameters:
read - The read-only community string.

SnmpParameters

public SnmpParameters(java.lang.String read,
                      java.lang.String write)
Constructs an object with the specified read-only and write-only community strings.

Parameters:
read - The read-only community string.
write - The write-only community string.
Method Detail

getReadCommunity

public java.lang.String getReadCommunity()
Retreives the current read community string from the parameters.

Returns:
The read community string.

setReadCommunity

public void setReadCommunity(java.lang.String rd)
Used to set the parameters read community string. NOTE: The community string is covnerted to a set of 8-bit characters by the String.getBytes() method.

Parameters:
rd - The new read community string.
See Also:
String.getBytes()

getWriteCommunity

public java.lang.String getWriteCommunity()
Retreives the current write community string set in the parameters.

Returns:
The write community string.

setWriteCommunity

public void setWriteCommunity(java.lang.String wr)
Used to set the parameters write community string. The write community string is only used by SNMP SET packet. NOTE: The community string is covnerted to a set of 8-bit characters by the String.getBytes() method.

Parameters:
wr - The new write community string.
See Also:
String.getBytes()

getVersion

public int getVersion()
Returns the current SNMP version defined by the parameters.

Returns:
The current protocol version.

setVersion

public void setVersion(int ver)
Use to set the SNMP protocol version. The version should be one of the constants within the SnmpSMI.

Parameters:
ver - The SNMP version protocol to use.
See Also:
SnmpSMI.SNMPV1, SnmpSMI.SNMPV2

getEncoder

public AsnEncoder getEncoder()
Retreives the current ASN.1 encoder object.

Returns:
The current AsnEncoder

setEncoder

public void setEncoder(AsnEncoder encoder)
Sets the ASN.1 encoder.

Parameters:
encoder - The new encoder to use.

clone

public java.lang.Object clone()
Used to get a newly created duplicate of the current object.

Returns:
A newly created duplicate

OpenNMS API 1.2.3

Generated by eevans on May 29 2005 2015.