1 20 21 22 23 24 25 package org.snmp4j; 26 27 import org.snmp4j.smi.OctetString; 28 import org.snmp4j.smi.Address; 29 import org.snmp4j.mp.SnmpConstants; 30 31 37 public class CommunityTarget extends AbstractTarget { 38 39 static final long serialVersionUID = 147443821594052003L; 40 41 private org.snmp4j.smi.OctetString community = new OctetString(); 42 43 46 public CommunityTarget() { 47 setVersion(SnmpConstants.version1); 48 } 49 50 57 public CommunityTarget(Address address, OctetString community) { 58 super(address); 59 setVersion(SnmpConstants.version1); 60 setCommunity(community); 61 } 62 63 68 public OctetString getCommunity() { 69 return community; 70 } 71 72 78 public void setCommunity(OctetString community) { 79 if (community == null) { 80 throw new IllegalArgumentException ("Community must not be null"); 81 } 82 this.community = community; 83 } 84 85 public String toString() { 86 return "CommunityTarget["+toStringAbstractTarget()+ 87 ", community="+community+"]"; 88 } 89 90 } 91 | Popular Tags |