net.fenyo.gnetwatch
Class SNMPQuerier

java.lang.Object
  extended by net.fenyo.gnetwatch.SNMPQuerier

public class SNMPQuerier
extends java.lang.Object

An SNMP querier maintains SNMP parameters needed for the manager to talk to an agent.

Version:
$Id: SNMPQuerier.java,v 1.26 2008/04/24 19:28:13 fenyo Exp $
Author:
Alexandre Fenyo

Nested Class Summary
static interface SNMPQuerier.QuerierListener
          Interface used to manage asynchronous SNMP answers.
 
Field Summary
private  java.net.InetAddress address
           
private  java.lang.String community
           
private  java.lang.Long id
           
private  java.lang.String last_sysdescr
           
private static Log log
           
private  java.lang.String password_auth
           
private  java.lang.String password_priv
           
private  int pdu_max_size
           
private  int port
           
private  int retries
           
private  int sec
           
private  boolean snmp_capable
           
private  SNMPManager snmp_manager
           
private  Target snmp_target
           
private  int timeout
           
private  java.lang.String username
           
private  int version
           
 
Constructor Summary
protected SNMPQuerier()
          Default constructor.
protected SNMPQuerier(java.net.InetAddress address, SNMPManager snmp_manager)
          Constructor.
 
Method Summary
 java.lang.Object clone()
           
 java.net.InetAddress getAddress()
          Returns the target address.
 java.lang.String getCommunity()
          Returns the community string.
 java.lang.Long getId()
           
 java.util.List<TableEvent> getInterfaces()
          Gets some columns of the interface list table synchronously.
 java.lang.String getLastSysdescr()
          Returns the last sysdescr returned.
 java.lang.String getPasswordAuth()
          Returns the password authentication attribute.
 java.lang.String getPasswordPriv()
          Returns the password privacy attribute.
private  PDU getPDU()
          Creates a new empty PDU.
 int getPDUMaxSize()
          Returns the PDU maximum size attribute.
 int getPort()
          Returns the agent UDP port attribute.
 int getRetries()
          Returns the retries attribute.
 int getSec()
          Returns the security attribute.
private  Snmp getSNMP()
          Returns the SNMP4J Snmp instance used to perform further SNMP queries.
 SNMPManager getSNMPManager()
           
 Target getSNMPTarget()
           
 java.lang.String getSysDescr()
          Gets the system description OID content synchronously.
 void getSysDescr(SNMPQuerier.QuerierListener listener)
          Gets the system description OID content asynchronously.
 int getTimeout()
          Returns the timeout attribute.
 java.lang.String getUsername()
          Returns the username attribute.
 int getVersion()
          Returns the version attribute.
 boolean isSNMPCapable()
          Checks that the associated target has already answered a SNMP query.
 void parametersHaveChanged()
          Must be called after some setters have been called.
 void setAddress(java.net.InetAddress address)
           
 void setCommunity(java.lang.String community)
          Sets the community string attribute.
protected  void setId(java.lang.Long id)
           
 void setLastSysdescr(java.lang.String last_sysdescr)
           
 void setPasswordAuth(java.lang.String password_auth)
          Sets the password authentication attribute.
 void setPasswordPriv(java.lang.String password_priv)
          Sets the password privacy attribute.
 void setPDUMaxSize(int pdu_max_size)
          Sets the PDU maximum size attribute.
 void setPort(int port)
          Sets the agent UDP port attribute.
 void setRetries(int retries)
          Sets the retries attribute.
 void setSec(int sec)
          Sets the security attribute.
private  void setSNMP(SNMPManager snmp_manager)
           
 void setSNMPCapable(boolean snmp_capable)
           
 void setSNMPManager(SNMPManager snmp_manager)
           
 void setSNMPTarget(Target snmp_target)
           
 void setTimeout(int timeout)
          Sets the timeout attribute.
 void setUsername(java.lang.String username)
          Sets the username attribute.
 void setVersion(int version)
          Sets the version attribute.
 void update()
          Must be called after some setters have been called.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static Log log

id

private java.lang.Long id

address

private java.net.InetAddress address

version

private int version

sec

private int sec

retries

private int retries

timeout

private int timeout

port

private int port

community

private java.lang.String community

username

private java.lang.String username

password_auth

private java.lang.String password_auth

password_priv

private java.lang.String password_priv

pdu_max_size

private int pdu_max_size

snmp_capable

private boolean snmp_capable

last_sysdescr

private java.lang.String last_sysdescr

snmp_manager

private SNMPManager snmp_manager

snmp_target

private Target snmp_target
Constructor Detail

SNMPQuerier

protected SNMPQuerier(java.net.InetAddress address,
                      SNMPManager snmp_manager)
Constructor.

Parameters:
address - target address.
snmp_manager - SNMPManager instance.

SNMPQuerier

protected SNMPQuerier()
Default constructor.

Parameters:
none. -
Method Detail

getSNMPTarget

public Target getSNMPTarget()

setSNMPTarget

public void setSNMPTarget(Target snmp_target)

getSNMPManager

public SNMPManager getSNMPManager()

setSNMPManager

public void setSNMPManager(SNMPManager snmp_manager)

getId

public java.lang.Long getId()

setId

protected void setId(java.lang.Long id)

getAddress

public java.net.InetAddress getAddress()
Returns the target address.

Parameters:
none. -
Returns:
InetAddress target address.

setAddress

public void setAddress(java.net.InetAddress address)

isSNMPCapable

public boolean isSNMPCapable()
Checks that the associated target has already answered a SNMP query.

Parameters:
none. -
Returns:
boolean true if the target has already answered a SNMP query.

setSNMPCapable

public void setSNMPCapable(boolean snmp_capable)

getLastSysdescr

public java.lang.String getLastSysdescr()
Returns the last sysdescr returned.

Parameters:
none. -
Returns:
String system description.

setLastSysdescr

public void setLastSysdescr(java.lang.String last_sysdescr)

update

public void update()
Must be called after some setters have been called.

Parameters:
none. -

parametersHaveChanged

public final void parametersHaveChanged()
Must be called after some setters have been called.

Parameters:
none. -

getVersion

public int getVersion()
Returns the version attribute.

Parameters:
none. -
Returns:
int version attribute.

getSec

public int getSec()
Returns the security attribute.

Parameters:
none. -
Returns:
int security attribute.

getRetries

public int getRetries()
Returns the retries attribute.

Parameters:
none. -
Returns:
int retries attribute.

getTimeout

public int getTimeout()
Returns the timeout attribute.

Parameters:
none. -
Returns:
int timeout attribute.

getPort

public int getPort()
Returns the agent UDP port attribute.

Parameters:
none. -
Returns:
int agent UDP port.

getCommunity

public java.lang.String getCommunity()
Returns the community string.

Parameters:
none. -
Returns:
String community string.

getUsername

public java.lang.String getUsername()
Returns the username attribute.

Parameters:
none. -
Returns:
String username attribute.

getPasswordAuth

public java.lang.String getPasswordAuth()
Returns the password authentication attribute.

Parameters:
none. -
Returns:
String password authentication attribute.

getPasswordPriv

public java.lang.String getPasswordPriv()
Returns the password privacy attribute.

Parameters:
none. -
Returns:
String password privacy attribute.

getPDUMaxSize

public int getPDUMaxSize()
Returns the PDU maximum size attribute.

Parameters:
none. -
Returns:
int PDU maximum size attribute.

setVersion

public void setVersion(int version)
Sets the version attribute.

Parameters:
version - version.

setSec

public void setSec(int sec)
Sets the security attribute.

Parameters:
sec - security attribute.

setRetries

public void setRetries(int retries)
Sets the retries attribute.

Parameters:
retries - retries attribute.

setTimeout

public void setTimeout(int timeout)
Sets the timeout attribute.

Parameters:
timeout - timeout attribute.

setPort

public void setPort(int port)
Sets the agent UDP port attribute.

Parameters:
port - agent UDP port attribute.

setCommunity

public void setCommunity(java.lang.String community)
Sets the community string attribute.

Parameters:
community - community string attribute.

setUsername

public void setUsername(java.lang.String username)
Sets the username attribute.

Parameters:
username - username attribute.

setPasswordAuth

public void setPasswordAuth(java.lang.String password_auth)
Sets the password authentication attribute.

Parameters:
password_auth - password authentication attribute.

setPasswordPriv

public void setPasswordPriv(java.lang.String password_priv)
Sets the password privacy attribute.

Parameters:
password_priv - password_privacy attribute.

setPDUMaxSize

public void setPDUMaxSize(int pdu_max_size)
Sets the PDU maximum size attribute.

Parameters:
pdu_max_size - PDU maximum size attribute.

getSNMP

private Snmp getSNMP()
Returns the SNMP4J Snmp instance used to perform further SNMP queries.

Parameters:
none. -
Returns:
Snmp Snmp instance.

setSNMP

private void setSNMP(SNMPManager snmp_manager)

getPDU

private PDU getPDU()
Creates a new empty PDU.

Parameters:
none. -
Returns:
PDU new PDU.

getSysDescr

public java.lang.String getSysDescr()
Gets the system description OID content synchronously.

Parameters:
none. -
Returns:
String system description.

getSysDescr

public void getSysDescr(SNMPQuerier.QuerierListener listener)
Gets the system description OID content asynchronously.

Parameters:
listener - listener instance that will be called asynchronously.

getInterfaces

public java.util.List<TableEvent> getInterfaces()
Gets some columns of the interface list table synchronously.

Parameters:
none. -
Returns:
java.util.List list of rows.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object