public abstract class SNMPBean
extends java.lang.Object
This bean forms the base of the SNMP beans.
The bean will only come into action when the method action() is called. This should be done after the properties have been set.
This bean also provide the methods for adding and removing property change listeners and firing property change events.
SNMPRunBean
,
IsHostReachableBean
,
OneInterfaceBean
,
InterfaceIndexesBean
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
bindAddr |
protected java.lang.String |
community |
protected SnmpContext |
context |
protected java.lang.String |
host |
protected java.lang.String |
message |
protected int |
port |
protected java.util.Vector |
propertyChangeListener |
protected java.lang.String |
socketType |
Constructor and Description |
---|
SNMPBean()
The default constructor.
|
SNMPBean(java.lang.String h,
int p)
The constructor that will set the host and the port no.
|
SNMPBean(java.lang.String h,
int p,
java.lang.String b,
java.lang.String t)
The constructor that will set the host, the port no and the local
bind address.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
action()
This method should send the SNMP request.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener l)
Add a property change listener.
|
protected void |
firePropertyChange(java.lang.String property,
java.lang.Object old_v,
java.lang.Object new_v)
Fire the property event.
|
java.lang.String |
getBindAddress()
Returns the local bind address.
|
java.lang.String |
getCommunityName()
Returns the community name that is used to send the SNMP request.
|
java.lang.String |
getHost()
Returns the host (name or ipadress) which is addressed.
|
java.lang.String |
getMessage()
Returns the message (if any).
|
int |
getPort()
Returns the port no which is used.
|
java.lang.String |
getSocketType()
Returns the socket type.
|
protected boolean |
isHostPortReachable()
Indicates whether the host is reachable.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener l)
Remove a property change listener.
|
void |
setBindAddress(java.lang.String b)
Sets the local bind address.
|
void |
setCommunityName(java.lang.String c)
Sets the community name that is used to send the SNMP request.
|
void |
setHost(java.lang.String h)
Sets the host (name or ipadress) which will be asked for the SNMP request.
|
protected void |
setMessage(java.lang.String st)
Returns the message (if any).
|
void |
setPort(int p)
Sets the port no which is used.
|
void |
setPort(java.lang.String p)
Sets the port no which is used as a String.
|
void |
setSocketType(java.lang.String t)
Sets socket type.
|
protected SnmpContext context
protected java.lang.String host
protected java.lang.String bindAddr
protected int port
protected java.lang.String community
protected java.lang.String socketType
protected java.lang.String message
protected java.util.Vector propertyChangeListener
public SNMPBean()
public SNMPBean(java.lang.String h, int p)
h
- the hostnamep
- the port nosetHost(java.lang.String)
,
setPort(int)
public SNMPBean(java.lang.String h, int p, java.lang.String b, java.lang.String t)
h
- the hostnamep
- the port nob
- the local bind addresst
- the socket typesetHost(java.lang.String)
,
setPort(int)
,
setBindAddress(java.lang.String)
,
setSocketType(java.lang.String)
public abstract void action() throws PduException, java.io.IOException
PduException
java.io.IOException
public java.lang.String getHost()
setHost(java.lang.String)
public void setHost(java.lang.String h)
getHost()
public int getPort()
setPort(int)
,
setPort(String)
public void setPort(int p)
p
- The number of the portgetPort()
,
setPort(String)
public void setPort(java.lang.String p)
p
- The number of the port as a StringgetPort()
,
setPort(int)
public java.lang.String getCommunityName()
setCommunityName(java.lang.String)
public void setCommunityName(java.lang.String c)
getCommunityName()
public java.lang.String getBindAddress()
setBindAddress(java.lang.String)
public void setBindAddress(java.lang.String b)
getBindAddress()
public java.lang.String getSocketType()
setSocketType(java.lang.String)
public void setSocketType(java.lang.String t)
getSocketType()
,
SnmpContextBasisFace.STANDARD_SOCKET
protected boolean isHostPortReachable()
SnmpContext
public java.lang.String getMessage()
protected void setMessage(java.lang.String st)
st
- the message stringgetMessage()
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
protected void firePropertyChange(java.lang.String property, java.lang.Object old_v, java.lang.Object new_v)
removePropertyChangeListener(java.beans.PropertyChangeListener)
,
addPropertyChangeListener(java.beans.PropertyChangeListener)
,
PropertyChangeEvent
,
PropertyChangeListener