org.snmp4j
Class AbstractTarget

java.lang.Object
  extended by org.snmp4j.AbstractTarget
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Target
Direct Known Subclasses:
CommunityTarget, SecureTarget

public abstract class AbstractTarget
extends java.lang.Object
implements Target

A AbstratTarget class is an abstract representation of a remote SNMP entity. It represents a target with an Address object, as well protocol parameters such as retransmission and timeout policy. Implementors of the Target interface can subclass AbstratTarget to take advantage of the implementation of common Target properties.

Since:
1.2
Version:
1.6
Author:
Frank Fock
See Also:
Serialized Form

Constructor Summary
protected AbstractTarget()
          Default constructor
protected AbstractTarget(Address address)
          Creates a SNMPv3 target with no retries and a timeout of one second.
 
Method Summary
 java.lang.Object clone()
           
 Address getAddress()
          Gets the address of this target.
 int getMaxSizeRequestPDU()
          Gets the maxmim size of request PDUs that this target is able to respond to.
 int getRetries()
          Gets the number of retries.
 long getTimeout()
          Gets the timeout for a target.
 int getVersion()
          Gets the SNMP version (NMP messagen processing model) of the target.
 void setAddress(Address address)
          Sets the address of the target.
 void setMaxSizeRequestPDU(int maxSizeRequestPDU)
          Sets the maximum size of request PDUs that this target is able to receive.
 void setRetries(int retries)
          Sets the number of retries to be performed before a request is timed out.
 void setTimeout(long timeout)
          Sets the timeout for a target.
 void setVersion(int version)
          Sets the SNMP version (thus the SNMP messagen processing model) of the target.
 java.lang.String toString()
           
protected  java.lang.String toStringAbstractTarget()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractTarget

protected AbstractTarget()
Default constructor


AbstractTarget

protected AbstractTarget(Address address)
Creates a SNMPv3 target with no retries and a timeout of one second.

Parameters:
address - an Address instance.
Method Detail

getAddress

public Address getAddress()
Gets the address of this target.

Specified by:
getAddress in interface Target
Returns:
an Address instance.

setAddress

public void setAddress(Address address)
Sets the address of the target.

Specified by:
setAddress in interface Target
Parameters:
address - an Address instance.

setVersion

public void setVersion(int version)
Sets the SNMP version (thus the SNMP messagen processing model) of the target.

Specified by:
setVersion in interface Target
Parameters:
version - the message processing model ID.
See Also:
SnmpConstants.version1, SnmpConstants.version2c, SnmpConstants.version3

getVersion

public int getVersion()
Gets the SNMP version (NMP messagen processing model) of the target.

Specified by:
getVersion in interface Target
Returns:
the message processing model ID.
See Also:
SnmpConstants.version1, SnmpConstants.version2c, SnmpConstants.version3

setRetries

public void setRetries(int retries)
Sets the number of retries to be performed before a request is timed out.

Specified by:
setRetries in interface Target
Parameters:
retries - the number of retries. Note: If the number of retries is set to 0, then the request will be sent out exactly once.

getRetries

public int getRetries()
Gets the number of retries.

Specified by:
getRetries in interface Target
Returns:
an integer >= 0.

setTimeout

public void setTimeout(long timeout)
Sets the timeout for a target.

Specified by:
setTimeout in interface Target
Parameters:
timeout - timeout in milliseconds before a confirmed request is resent or timed out.

getTimeout

public long getTimeout()
Gets the timeout for a target.

Specified by:
getTimeout in interface Target
Returns:
the timeout in milliseconds.

getMaxSizeRequestPDU

public int getMaxSizeRequestPDU()
Gets the maxmim size of request PDUs that this target is able to respond to. The default is 65535.

Specified by:
getMaxSizeRequestPDU in interface Target
Returns:
the maximum PDU size of request PDUs for this target. Which is always greater than 484.

setMaxSizeRequestPDU

public void setMaxSizeRequestPDU(int maxSizeRequestPDU)
Sets the maximum size of request PDUs that this target is able to receive.

Specified by:
setMaxSizeRequestPDU in interface Target
Parameters:
maxSizeRequestPDU - the maximum PDU (SNMP message) size this session will be able to process.

toStringAbstractTarget

protected java.lang.String toStringAbstractTarget()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone()
Specified by:
clone in interface Target
Overrides:
clone in class java.lang.Object

Copyright 2005-2010 Frank Fock (SNMP4J.org)

Copyright © 2011 SNMP4J.org. All Rights Reserved.