org.opennms.netmgt.config.snmp
Class SnmpConfig

java.lang.Object
  extended by org.opennms.netmgt.config.snmp.SnmpConfig
All Implemented Interfaces:
Serializable

public class SnmpConfig
extends Object
implements Serializable

Top-level element for the snmp-config.xml configuration file.

Version:
$Revision$ $Date$
See Also:
Serialized Form

Constructor Summary
SnmpConfig()
           
 
Method Summary
 void addDefinition(Definition vDefinition)
           
 void addDefinition(int index, Definition vDefinition)
           
 void deleteMaxRepetitions()
           
 void deleteMaxRequestSize()
           
 void deleteMaxVarsPerPdu()
           
 void deletePort()
           
 void deleteRetry()
           
 void deleteTimeout()
           
 Enumeration<Definition> enumerateDefinition()
          Method enumerateDefinition.
 String getAuthPassphrase()
          Returns the value of field 'authPassphrase'.
 String getAuthProtocol()
          Returns the value of field 'authProtocol'.
 String getContextEngineId()
          Returns the value of field 'contextEngineId'.
 String getContextName()
          Returns the value of field 'contextName'.
 Definition[] getDefinition()
          Method getDefinition.Returns the contents of the collection in an Array.
 Definition getDefinition(int index)
          Method getDefinition.
 List<Definition> getDefinitionCollection()
          Method getDefinitionCollection.Returns a reference to '_definitionList'.
 int getDefinitionCount()
          Method getDefinitionCount.
 String getEngineId()
          Returns the value of field 'engineId'.
 String getEnterpriseId()
          Returns the value of field 'enterpriseId'.
 int getMaxRepetitions()
          Returns the value of field 'maxRepetitions'.
 int getMaxRequestSize()
          Returns the value of field 'maxRequestSize'.
 int getMaxVarsPerPdu()
          Returns the value of field 'maxVarsPerPdu'.
 int getPort()
          Returns the value of field 'port'.
 String getPrivacyPassphrase()
          Returns the value of field 'privacyPassphrase'.
 String getPrivacyProtocol()
          Returns the value of field 'privacyProtocol'.
 String getProxyHost()
          Returns the value of field 'proxyHost'.
 String getReadCommunity()
          Returns the value of field 'readCommunity'.
 int getRetry()
          Returns the value of field 'retry'.
 String getSecurityName()
          Returns the value of field 'securityName'.
 int getTimeout()
          Returns the value of field 'timeout'.
 String getVersion()
          Returns the value of field 'version'.
 String getWriteCommunity()
          Returns the value of field 'writeCommunity'.
 boolean hasMaxRepetitions()
          Method hasMaxRepetitions.
 boolean hasMaxRequestSize()
          Method hasMaxRequestSize.
 boolean hasMaxVarsPerPdu()
          Method hasMaxVarsPerPdu.
 boolean hasPort()
          Method hasPort.
 boolean hasRetry()
          Method hasRetry.
 boolean hasTimeout()
          Method hasTimeout.
 boolean isValid()
          Method isValid.
 Iterator<Definition> iterateDefinition()
          Method iterateDefinition.
 void marshal(ContentHandler handler)
           
 void marshal(Writer out)
           
 void removeAllDefinition()
           
 boolean removeDefinition(Definition vDefinition)
          Method removeDefinition.
 Definition removeDefinitionAt(int index)
          Method removeDefinitionAt.
 void setAuthPassphrase(String authPassphrase)
          Sets the value of field 'authPassphrase'.
 void setAuthProtocol(String authProtocol)
          Sets the value of field 'authProtocol'.
 void setContextEngineId(String contextEngineId)
          Sets the value of field 'contextEngineId'.
 void setContextName(String contextName)
          Sets the value of field 'contextName'.
 void setDefinition(Definition[] vDefinitionArray)
           
 void setDefinition(int index, Definition vDefinition)
           
 void setDefinition(List<Definition> vDefinitionList)
          Sets the value of '_definitionList' by copying the given Vector.
 void setDefinitionCollection(List<Definition> definitionList)
          Deprecated.  
 void setEngineId(String engineId)
          Sets the value of field 'engineId'.
 void setEnterpriseId(String enterpriseId)
          Sets the value of field 'enterpriseId'.
 void setMaxRepetitions(int maxRepetitions)
          Sets the value of field 'maxRepetitions'.
 void setMaxRequestSize(int maxRequestSize)
          Sets the value of field 'maxRequestSize'.
 void setMaxVarsPerPdu(int maxVarsPerPdu)
          Sets the value of field 'maxVarsPerPdu'.
 void setPort(int port)
          Sets the value of field 'port'.
 void setPrivacyPassphrase(String privacyPassphrase)
          Sets the value of field 'privacyPassphrase'.
 void setPrivacyProtocol(String privacyProtocol)
          Sets the value of field 'privacyProtocol'.
 void setProxyHost(String proxyHost)
          Sets the value of field 'proxyHost'.
 void setReadCommunity(String readCommunity)
          Sets the value of field 'readCommunity'.
 void setRetry(int retry)
          Sets the value of field 'retry'.
 void setSecurityName(String securityName)
          Sets the value of field 'securityName'.
 void setTimeout(int timeout)
          Sets the value of field 'timeout'.
 void setVersion(String version)
          Sets the value of field 'version'.
 void setWriteCommunity(String writeCommunity)
          Sets the value of field 'writeCommunity'.
static SnmpConfig unmarshal(Reader reader)
          Method unmarshal.
 void validate()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SnmpConfig

public SnmpConfig()
Method Detail

addDefinition

public void addDefinition(Definition vDefinition)
                   throws IndexOutOfBoundsException
Parameters:
vDefinition -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

addDefinition

public void addDefinition(int index,
                          Definition vDefinition)
                   throws IndexOutOfBoundsException
Parameters:
index -
vDefinition -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

deleteMaxRepetitions

public void deleteMaxRepetitions()

deleteMaxRequestSize

public void deleteMaxRequestSize()

deleteMaxVarsPerPdu

public void deleteMaxVarsPerPdu()

deletePort

public void deletePort()

deleteRetry

public void deleteRetry()

deleteTimeout

public void deleteTimeout()

enumerateDefinition

public Enumeration<Definition> enumerateDefinition()
Method enumerateDefinition.

Returns:
an Enumeration over all possible elements of this collection

getAuthPassphrase

public String getAuthPassphrase()
Returns the value of field 'authPassphrase'. The field 'authPassphrase' has the following description: SNMPv3

Returns:
the value of field 'AuthPassphrase'.

getAuthProtocol

public String getAuthProtocol()
Returns the value of field 'authProtocol'. The field 'authProtocol' has the following description: SNMPv3

Returns:
the value of field 'AuthProtocol'.

getContextEngineId

public String getContextEngineId()
Returns the value of field 'contextEngineId'. The field 'contextEngineId' has the following description: SNMPv3

Returns:
the value of field 'ContextEngineId'.

getContextName

public String getContextName()
Returns the value of field 'contextName'. The field 'contextName' has the following description: SNMPv3

Returns:
the value of field 'ContextName'.

getDefinition

public Definition getDefinition(int index)
                         throws IndexOutOfBoundsException
Method getDefinition.

Parameters:
index -
Returns:
the value of the org.opennms.netmgt.config.snmp.Definition at the given index
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

getDefinition

public Definition[] getDefinition()
Method getDefinition.Returns the contents of the collection in an Array.

Note: Just in case the collection contents are changing in another thread, we pass a 0-length Array of the correct type into the API call. This way we know that the Array returned is of exactly the correct length.

Returns:
this collection as an Array

getDefinitionCollection

public List<Definition> getDefinitionCollection()
Method getDefinitionCollection.Returns a reference to '_definitionList'. No type checking is performed on any modifications to the Vector.

Returns:
a reference to the Vector backing this class

getDefinitionCount

public int getDefinitionCount()
Method getDefinitionCount.

Returns:
the size of this collection

getEngineId

public String getEngineId()
Returns the value of field 'engineId'. The field 'engineId' has the following description: SNMPv3

Returns:
the value of field 'EngineId'.

getEnterpriseId

public String getEnterpriseId()
Returns the value of field 'enterpriseId'. The field 'enterpriseId' has the following description: SNMPv3

Returns:
the value of field 'EnterpriseId'.

getMaxRepetitions

public int getMaxRepetitions()
Returns the value of field 'maxRepetitions'. The field 'maxRepetitions' has the following description: Number of repetitions to send per get-bulk request.

Returns:
the value of field 'MaxRepetitions'.

getMaxRequestSize

public int getMaxRequestSize()
Returns the value of field 'maxRequestSize'. The field 'maxRequestSize' has the following description: (SNMP4J specific) Specifies the maximum number of bytes that may be encoded into an individual SNMP PDU request by Collectd. Provides a means to limit the size of outgoing PDU requests. Default is 65535, must be at least 484.

Returns:
the value of field 'MaxRequestSize'.

getMaxVarsPerPdu

public int getMaxVarsPerPdu()
Returns the value of field 'maxVarsPerPdu'. The field 'maxVarsPerPdu' has the following description: Number of variables to send per SNMP request.

Returns:
the value of field 'MaxVarsPerPdu'.

getPort

public int getPort()
Returns the value of field 'port'. The field 'port' has the following description: If set, overrides UDP port 161 as the port where SNMP GET/GETNEXT/GETBULK requests are sent.

Returns:
the value of field 'Port'.

getPrivacyPassphrase

public String getPrivacyPassphrase()
Returns the value of field 'privacyPassphrase'. The field 'privacyPassphrase' has the following description: SNMPv3

Returns:
the value of field 'PrivacyPassphrase'.

getPrivacyProtocol

public String getPrivacyProtocol()
Returns the value of field 'privacyProtocol'. The field 'privacyProtocol' has the following description: SNMPv3

Returns:
the value of field 'PrivacyProtocol'.

getProxyHost

public String getProxyHost()
Returns the value of field 'proxyHost'. The field 'proxyHost' has the following description: The proxy host to use when communiciating with this agent

Returns:
the value of field 'ProxyHost'.

getReadCommunity

public String getReadCommunity()
Returns the value of field 'readCommunity'. The field 'readCommunity' has the following description: Default read community string

Returns:
the value of field 'ReadCommunity'.

getRetry

public int getRetry()
Returns the value of field 'retry'. The field 'retry' has the following description: Default number of retries

Returns:
the value of field 'Retry'.

getSecurityName

public String getSecurityName()
Returns the value of field 'securityName'. The field 'securityName' has the following description: SNMPv3

Returns:
the value of field 'SecurityName'.

getTimeout

public int getTimeout()
Returns the value of field 'timeout'. The field 'timeout' has the following description: Default timeout (in milliseconds)

Returns:
the value of field 'Timeout'.

getVersion

public String getVersion()
Returns the value of field 'version'. The field 'version' has the following description: If set, forces SNMP data collection to the specified version.

Returns:
the value of field 'Version'.

getWriteCommunity

public String getWriteCommunity()
Returns the value of field 'writeCommunity'. The field 'writeCommunity' has the following description: Default write community string

Returns:
the value of field 'WriteCommunity'.

hasMaxRepetitions

public boolean hasMaxRepetitions()
Method hasMaxRepetitions.

Returns:
true if at least one MaxRepetitions has been added

hasMaxRequestSize

public boolean hasMaxRequestSize()
Method hasMaxRequestSize.

Returns:
true if at least one MaxRequestSize has been added

hasMaxVarsPerPdu

public boolean hasMaxVarsPerPdu()
Method hasMaxVarsPerPdu.

Returns:
true if at least one MaxVarsPerPdu has been added

hasPort

public boolean hasPort()
Method hasPort.

Returns:
true if at least one Port has been added

hasRetry

public boolean hasRetry()
Method hasRetry.

Returns:
true if at least one Retry has been added

hasTimeout

public boolean hasTimeout()
Method hasTimeout.

Returns:
true if at least one Timeout has been added

isValid

public boolean isValid()
Method isValid.

Returns:
true if this object is valid according to the schema

iterateDefinition

public Iterator<Definition> iterateDefinition()
Method iterateDefinition.

Returns:
an Iterator over all possible elements in this collection

marshal

public void marshal(Writer out)
             throws org.exolab.castor.xml.MarshalException,
                    org.exolab.castor.xml.ValidationException
Parameters:
out -
Throws:
org.exolab.castor.xml.MarshalException - if object is null or if any SAXException is thrown during marshaling
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema

marshal

public void marshal(ContentHandler handler)
             throws IOException,
                    org.exolab.castor.xml.MarshalException,
                    org.exolab.castor.xml.ValidationException
Parameters:
handler -
Throws:
IOException - if an IOException occurs during marshaling
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema
org.exolab.castor.xml.MarshalException - if object is null or if any SAXException is thrown during marshaling

removeAllDefinition

public void removeAllDefinition()

removeDefinition

public boolean removeDefinition(Definition vDefinition)
Method removeDefinition.

Parameters:
vDefinition -
Returns:
true if the object was removed from the collection.

removeDefinitionAt

public Definition removeDefinitionAt(int index)
Method removeDefinitionAt.

Parameters:
index -
Returns:
the element removed from the collection

setAuthPassphrase

public void setAuthPassphrase(String authPassphrase)
Sets the value of field 'authPassphrase'. The field 'authPassphrase' has the following description: SNMPv3

Parameters:
authPassphrase - the value of field 'authPassphrase'.

setAuthProtocol

public void setAuthProtocol(String authProtocol)
Sets the value of field 'authProtocol'. The field 'authProtocol' has the following description: SNMPv3

Parameters:
authProtocol - the value of field 'authProtocol'.

setContextEngineId

public void setContextEngineId(String contextEngineId)
Sets the value of field 'contextEngineId'. The field 'contextEngineId' has the following description: SNMPv3

Parameters:
contextEngineId - the value of field 'contextEngineId'.

setContextName

public void setContextName(String contextName)
Sets the value of field 'contextName'. The field 'contextName' has the following description: SNMPv3

Parameters:
contextName - the value of field 'contextName'.

setDefinition

public void setDefinition(int index,
                          Definition vDefinition)
                   throws IndexOutOfBoundsException
Parameters:
index -
vDefinition -
Throws:
IndexOutOfBoundsException - if the index given is outside the bounds of the collection

setDefinition

public void setDefinition(Definition[] vDefinitionArray)
Parameters:
vDefinitionArray -

setDefinition

public void setDefinition(List<Definition> vDefinitionList)
Sets the value of '_definitionList' by copying the given Vector. All elements will be checked for type safety.

Parameters:
vDefinitionList - the Vector to copy.

setDefinitionCollection

public void setDefinitionCollection(List<Definition> definitionList)
Deprecated. 

Sets the value of '_definitionList' by setting it to the given Vector. No type checking is performed.

Parameters:
definitionList - the Vector to set.

setEngineId

public void setEngineId(String engineId)
Sets the value of field 'engineId'. The field 'engineId' has the following description: SNMPv3

Parameters:
engineId - the value of field 'engineId'.

setEnterpriseId

public void setEnterpriseId(String enterpriseId)
Sets the value of field 'enterpriseId'. The field 'enterpriseId' has the following description: SNMPv3

Parameters:
enterpriseId - the value of field 'enterpriseId'.

setMaxRepetitions

public void setMaxRepetitions(int maxRepetitions)
Sets the value of field 'maxRepetitions'. The field 'maxRepetitions' has the following description: Number of repetitions to send per get-bulk request.

Parameters:
maxRepetitions - the value of field 'maxRepetitions'.

setMaxRequestSize

public void setMaxRequestSize(int maxRequestSize)
Sets the value of field 'maxRequestSize'. The field 'maxRequestSize' has the following description: (SNMP4J specific) Specifies the maximum number of bytes that may be encoded into an individual SNMP PDU request by Collectd. Provides a means to limit the size of outgoing PDU requests. Default is 65535, must be at least 484.

Parameters:
maxRequestSize - the value of field 'maxRequestSize'.

setMaxVarsPerPdu

public void setMaxVarsPerPdu(int maxVarsPerPdu)
Sets the value of field 'maxVarsPerPdu'. The field 'maxVarsPerPdu' has the following description: Number of variables to send per SNMP request.

Parameters:
maxVarsPerPdu - the value of field 'maxVarsPerPdu'.

setPort

public void setPort(int port)
Sets the value of field 'port'. The field 'port' has the following description: If set, overrides UDP port 161 as the port where SNMP GET/GETNEXT/GETBULK requests are sent.

Parameters:
port - the value of field 'port'.

setPrivacyPassphrase

public void setPrivacyPassphrase(String privacyPassphrase)
Sets the value of field 'privacyPassphrase'. The field 'privacyPassphrase' has the following description: SNMPv3

Parameters:
privacyPassphrase - the value of field 'privacyPassphrase'.

setPrivacyProtocol

public void setPrivacyProtocol(String privacyProtocol)
Sets the value of field 'privacyProtocol'. The field 'privacyProtocol' has the following description: SNMPv3

Parameters:
privacyProtocol - the value of field 'privacyProtocol'.

setProxyHost

public void setProxyHost(String proxyHost)
Sets the value of field 'proxyHost'. The field 'proxyHost' has the following description: The proxy host to use when communiciating with this agent

Parameters:
proxyHost - the value of field 'proxyHost'.

setReadCommunity

public void setReadCommunity(String readCommunity)
Sets the value of field 'readCommunity'. The field 'readCommunity' has the following description: Default read community string

Parameters:
readCommunity - the value of field 'readCommunity'.

setRetry

public void setRetry(int retry)
Sets the value of field 'retry'. The field 'retry' has the following description: Default number of retries

Parameters:
retry - the value of field 'retry'.

setSecurityName

public void setSecurityName(String securityName)
Sets the value of field 'securityName'. The field 'securityName' has the following description: SNMPv3

Parameters:
securityName - the value of field 'securityName'.

setTimeout

public void setTimeout(int timeout)
Sets the value of field 'timeout'. The field 'timeout' has the following description: Default timeout (in milliseconds)

Parameters:
timeout - the value of field 'timeout'.

setVersion

public void setVersion(String version)
Sets the value of field 'version'. The field 'version' has the following description: If set, forces SNMP data collection to the specified version.

Parameters:
version - the value of field 'version'.

setWriteCommunity

public void setWriteCommunity(String writeCommunity)
Sets the value of field 'writeCommunity'. The field 'writeCommunity' has the following description: Default write community string

Parameters:
writeCommunity - the value of field 'writeCommunity'.

unmarshal

public static SnmpConfig unmarshal(Reader reader)
                            throws org.exolab.castor.xml.MarshalException,
                                   org.exolab.castor.xml.ValidationException
Method unmarshal.

Parameters:
reader -
Returns:
the unmarshaled org.opennms.netmgt.config.snmp.SnmpConfig
Throws:
org.exolab.castor.xml.MarshalException - if object is null or if any SAXException is thrown during marshaling
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema

validate

public void validate()
              throws org.exolab.castor.xml.ValidationException
Throws:
org.exolab.castor.xml.ValidationException - if this object is an invalid instance according to the schema


Copyright © 2008. All Rights Reserved.