public class IsHostReachableBean extends SNMPBean implements java.util.Observer
This bean will determine whether the host+port is up, by sending an UpSincePdu.
The properties in the parent classes should be set, before calling the action() method. Via a PropertyChangeEvent the application/applet will be notified.
SNMPBean.setHost(java.lang.String)
,
SNMPBean.setPort(int)
,
SNMPBean.setCommunityName(java.lang.String)
,
SNMPBean.addPropertyChangeListener(java.beans.PropertyChangeListener)
,
SNMPBean.action()
,
UpSincePdu
bindAddr, community, context, host, message, port, propertyChangeListener, socketType
Constructor and Description |
---|
IsHostReachableBean()
The default constructor.
|
IsHostReachableBean(java.lang.String h,
int p)
The constructor that will set the host and the port no.
|
IsHostReachableBean(java.lang.String h,
int p,
java.lang.String b)
The constructor that will set the host, the port no and the local
bind address.
|
Modifier and Type | Method and Description |
---|---|
void |
action()
This method actually performs the request.
|
protected void |
action(boolean wait) |
void |
freeResources()
Destroys the context.
|
java.util.Date |
getUpSinceDate()
Returns the date when the host went up.
|
boolean |
isReachable()
Indicates whether the host + port is reachable.
|
protected void |
setReachable(boolean b)
The reachable property is set according to the succes of making
a connection and the response of the SNMP request.
|
protected void |
setUpSinceDate(java.util.Date d)
Answer is set according to the received SNMP response.
|
void |
update(java.util.Observable obs,
java.lang.Object ov)
The update method according to the Observer interface, it will be
called when the Pdu response is received.
|
void |
waitForSelfAction()
This method performs the request and wait for it.
|
addPropertyChangeListener, firePropertyChange, getBindAddress, getCommunityName, getHost, getMessage, getPort, getSocketType, isHostPortReachable, removePropertyChangeListener, setBindAddress, setCommunityName, setHost, setMessage, setPort, setPort, setSocketType
public IsHostReachableBean()
public IsHostReachableBean(java.lang.String h, int p)
h
- the hostnamep
- the port noSNMPBean.setHost(java.lang.String)
,
SNMPBean.setPort(int)
public IsHostReachableBean(java.lang.String h, int p, java.lang.String b)
h
- the hostnamep
- the port nob
- the local bind addressSNMPBean.setHost(java.lang.String)
,
SNMPBean.setPort(int)
,
SNMPBean.setBindAddress(java.lang.String)
public java.util.Date getUpSinceDate()
SNMPBean.getMessage()
,
isReachable()
protected void setUpSinceDate(java.util.Date d)
getUpSinceDate()
public boolean isReachable()
SNMPBean.getMessage()
,
getUpSinceDate()
protected void setReachable(boolean b)
public void waitForSelfAction() throws PduException, java.io.IOException
PduException
java.io.IOException
SnmpContext
,
action()
,
Pdu.waitForSelf()
public void action() throws PduException, java.io.IOException
action
in class SNMPBean
PduException
java.io.IOException
SnmpContext
protected void action(boolean wait) throws PduException, java.io.IOException
PduException
java.io.IOException
public void update(java.util.Observable obs, java.lang.Object ov)
update
in interface java.util.Observer
public void freeResources()