Package org.snmp4j
Class CommunityTarget
java.lang.Object
org.snmp4j.AbstractTarget
org.snmp4j.CommunityTarget
- All Implemented Interfaces:
 Serializable,Cloneable,Target
A 
CommunityTarget represents SNMP target properties for
 community based message processing models (SNMPv1 and SNMPv2c).- Version:
 - 1.1
 - Author:
 - Frank Fock
 - See Also:
 
- 
Field Summary
Fields inherited from class org.snmp4j.AbstractTarget
securityLevel, securityModel, securityName - 
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.CommunityTarget(Address address, OctetString community) Creates a fully specified community target. - 
Method Summary
Modifier and TypeMethodDescriptionCreates a new copy of this target with the same address type.Gets the community octet string (which is the same as the security name).intGets the security model associated with this target.voidsetCommunity(OctetString community) Sets the community octet sting.voidsetSecurityLevel(int securityLevel) Sets the security level for this target.voidsetSecurityModel(int securityModel) Sets the security model for this target.toString()Methods inherited from class org.snmp4j.AbstractTarget
clone, equals, getAddress, getMaxSizeRequestPDU, getPreferredTransports, getRetries, getSecurityLevel, getSecurityName, getTimeout, getVersion, hashCode, setAddress, setMaxSizeRequestPDU, setPreferredTransports, setRetries, setSecurityName, setTimeout, setVersion, toStringAbstractTarget 
- 
Constructor Details
- 
CommunityTarget
public CommunityTarget()Default constructor. - 
CommunityTarget
Creates a fully specified community target.- Parameters:
 address- the transportAddressof the target.community- the community to be used for the target.
 
 - 
 - 
Method Details
- 
duplicate
Description copied from interface:TargetCreates a new copy of this target with the same address type.- Returns:
 - a copy of this target with the same address type.
 
 - 
getCommunity
Gets the community octet string (which is the same as the security name). Thus, you can (and should) useAbstractTarget.getSecurityName()directly.- Returns:
 - an 
OctetStringinstance, should be nevernullwhen using this target to send messages over community based SNMP (v1 and v2c). 
 - 
setCommunity
Sets the community octet sting. This is a convenience method to set the security name for community based SNMP (v1 and v2c). It basically checks that the community is notnulland then callsAbstractTarget.setSecurityName(org.snmp4j.smi.OctetString)with the supplied parameter.- Parameters:
 community- anOctetStringinstance which must not benull.
 - 
getSecurityModel
public int getSecurityModel()Description copied from interface:TargetGets the security model associated with this target.- Specified by:
 getSecurityModelin interfaceTarget- Overrides:
 getSecurityModelin classAbstractTarget- Returns:
 - an 
intvalue as defined in theSecurityModelinterface or any third party subclass thereof. 
 - 
setSecurityLevel
public void setSecurityLevel(int securityLevel) Description copied from class:AbstractTargetSets the security level for this target. The supplied security level must be supported by the security model dependent information associated with the security name set for this target.- Specified by:
 setSecurityLevelin interfaceTarget- Overrides:
 setSecurityLevelin classAbstractTarget- Parameters:
 securityLevel- one of
 - 
setSecurityModel
public void setSecurityModel(int securityModel) Description copied from class:AbstractTargetSets the security model for this target.- Specified by:
 setSecurityModelin interfaceTarget- Overrides:
 setSecurityModelin classAbstractTarget- Parameters:
 securityModel- anintvalue as defined in theSecurityModelinterface or any third party subclass thereof.
 - 
toString
- Overrides:
 toStringin classAbstractTarget
 
 -