SNMP Stack 5_1

uk.co.westhawk.snmp.stack
Class SnmpContextv2cPool

java.lang.Object
  |
  +--uk.co.westhawk.snmp.stack.SnmpContextPool
        |
        +--uk.co.westhawk.snmp.stack.SnmpContextv2cPool
All Implemented Interfaces:
SnmpContextBasisFace, SnmpContextFace, SnmpContextv2cFace

public class SnmpContextv2cPool
extends SnmpContextPool
implements SnmpContextv2cFace

This class contains the pool of SNMP v2c contexts. It extends the SnmpContextPool and is similar in every way, except it uses a pool of SnmpContextv2c.

Thanks to Seon Lee (slee@virtc.com) for reporting thread safety problems.

Version:
$Revision: 3.13 $ $Date: 2006/02/09 14:16:36 $
Author:
Birgit Arkesteijn
See Also:
SnmpContextv2c, SnmpContextPool, SnmpContextv3Pool

Field Summary
 
Fields inherited from class uk.co.westhawk.snmp.stack.SnmpContextPool
bindAddr, community, context, contextPool, hostname, hostPort, socketType
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextv2cFace
version_id
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
DEFAULT_COMMUNITY
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
DEFAULT_PORT, KVM_SOCKET, MAXPDU, MSS, NETSCAPE_SOCKET, STANDARD_SOCKET, TCP_SOCKET
 
Constructor Summary
SnmpContextv2cPool(java.lang.String host, int port)
          Constructor.
SnmpContextv2cPool(java.lang.String host, int port, java.lang.String typeSocket)
          Constructor.
SnmpContextv2cPool(java.lang.String host, int port, java.lang.String comm, java.lang.String typeSocket)
          Constructor.
SnmpContextv2cPool(java.lang.String host, int port, java.lang.String comm, java.lang.String bindAddress, java.lang.String typeSocket)
          Constructor.
 
Method Summary
 java.lang.Object clone()
          This method is not supported.
protected  SnmpContext getMatchingContext()
          Returns a v2c context from the pool.
 int getVersion()
          Returns the SNMP version of the context.
 
Methods inherited from class uk.co.westhawk.snmp.stack.SnmpContextPool
addPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, destroyPool, dumpContexts, encodePacket, getBindAddress, getCommunity, getHashKey, getHost, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, processIncomingPdu, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, sendPacket, setCommunity, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextFace
getCommunity, setCommunity
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
addPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, destroy, encodePacket, getBindAddress, getHashKey, getHost, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, isDestroyed, processIncomingPdu, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, sendPacket
 

Constructor Detail

SnmpContextv2cPool

public SnmpContextv2cPool(java.lang.String host,
                          int port)
                   throws java.io.IOException
Constructor.

Parameters:
host - The host to which the PDU will be sent
port - The port where the SNMP server will be
See Also:
SnmpContextv2c.SnmpContextv2c(String, int)

SnmpContextv2cPool

public SnmpContextv2cPool(java.lang.String host,
                          int port,
                          java.lang.String typeSocket)
                   throws java.io.IOException
Constructor.

Parameters:
host - The host to which the PDU will be sent
port - The port where the SNMP server will be
typeSocket - The type of socket to use.
See Also:
SnmpContextv2c.SnmpContextv2c(String, int, String), SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.TCP_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET

SnmpContextv2cPool

public SnmpContextv2cPool(java.lang.String host,
                          int port,
                          java.lang.String comm,
                          java.lang.String typeSocket)
                   throws java.io.IOException
Constructor.

Parameters:
host - The host to which the PDU will be sent
port - The port where the SNMP server will be
comm - The community name.
typeSocket - The type of socket to use.
Since:
4_14
See Also:
SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.TCP_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET

SnmpContextv2cPool

public SnmpContextv2cPool(java.lang.String host,
                          int port,
                          java.lang.String comm,
                          java.lang.String bindAddress,
                          java.lang.String typeSocket)
                   throws java.io.IOException
Constructor.

Parameters:
host - The host to which the PDU will be sent
port - The port where the SNMP server will be
comm - The community name.
bindAddress - The local address the server will bind to
typeSocket - The type of socket to use.
Since:
4_14
See Also:
SnmpContextBasisFace.STANDARD_SOCKET, SnmpContextBasisFace.TCP_SOCKET, SnmpContextBasisFace.NETSCAPE_SOCKET, SnmpContextBasisFace.KVM_SOCKET
Method Detail

getVersion

public int getVersion()
Description copied from interface: SnmpContextBasisFace
Returns the SNMP version of the context.

Specified by:
getVersion in interface SnmpContextBasisFace
Overrides:
getVersion in class SnmpContextPool
Returns:
The version
See Also:
SnmpConstants.SNMP_VERSION_1, SnmpConstants.SNMP_VERSION_2c, SnmpConstants.SNMP_VERSION_3

getMatchingContext

protected SnmpContext getMatchingContext()
                                  throws java.io.IOException
Returns a v2c context from the pool. This methods checks for an existing context that matches all our properties. If such a context does not exist, a new one is created and added to the pool. This method actually returns a SnmpContextv2c, although it doesn't look like it.

Overrides:
getMatchingContext in class SnmpContextPool
Returns:
A context (v2c) from the pool
java.io.IOException
See Also:
SnmpContextPool.getHashKey(), SnmpContext, SnmpContextv2c

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
This method is not supported. It will throw a CloneNotSupportedException.

Specified by:
clone in interface SnmpContextBasisFace
Overrides:
clone in class SnmpContextPool
Throws:
java.lang.CloneNotSupportedException - Thrown when the constructor generates an IOException or when in one of the Pool classes.
Since:
4_14

SNMP Stack 5_1