org.hackystat.sensorshell.command
Class PingCommand

java.lang.Object
  extended by org.hackystat.sensorshell.command.Command
      extended by org.hackystat.sensorshell.command.PingCommand

public class PingCommand
extends Command

Implements the Ping command, which ensures that the SensorBase is reachable.

Author:
Philip Johnson

Field Summary
 
Fields inherited from class org.hackystat.sensorshell.command.Command
cr, email, host, password, properties, shell
 
Constructor Summary
PingCommand(SingleSensorShell shell, SensorShellProperties properties)
          Creates the PingCommand.
 
Method Summary
 boolean isPingable()
          Does a ping on the hackystat server and returns true if the server was accessible.
 boolean isPingable(int timeout)
          Does a ping on the hackystat server and returns true if the server was accessible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PingCommand

public PingCommand(SingleSensorShell shell,
                   SensorShellProperties properties)
Creates the PingCommand.

Parameters:
shell - The sensorshell.
properties - The sensorproperties.
Method Detail

isPingable

public boolean isPingable()
Does a ping on the hackystat server and returns true if the server was accessible. A ping-able server indicates the data will be sent to it, while a non-pingable server indicates that data will be stored offline.

Returns:
True if the server could be pinged.

isPingable

public boolean isPingable(int timeout)
Does a ping on the hackystat server and returns true if the server was accessible. A ping-able server indicates the data will be sent to it, while a non-pingable server indicates that data will be stored offline. If the server is not reachable, or does not respond with given time frame, false will be returned.

Parameters:
timeout - Maximum seconds to wait for server response. A 0 value or negative value is equivalent to set time out to infinity.
Returns:
True if the server could be pinged.