public class IsReachable extends ProjectComponent implements Condition
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TIMEOUT
The default timeout.
|
static java.lang.String |
ERROR_BAD_TIMEOUT
Error when invalid timeout value is defined
|
static java.lang.String |
ERROR_BAD_URL
Error message when an invalid url is used.
|
static java.lang.String |
ERROR_BOTH_TARGETS
Error message when url and host are specified.
|
static java.lang.String |
ERROR_NO_HOST_IN_URL
Error message when no hostname in url.
|
static java.lang.String |
ERROR_NO_HOSTNAME
Error when no hostname is defined
|
static java.lang.String |
ERROR_ON_NETWORK
Network error message is seen.
|
static java.lang.String |
METHOD_NAME
The method name to look for in InetAddress
|
static java.lang.String |
MSG_NO_REACHABLE_TEST
Error message when no reachably test avail.
|
description, location, project
Constructor and Description |
---|
IsReachable() |
Modifier and Type | Method and Description |
---|---|
boolean |
eval()
Evaluate the condition.
|
void |
setHost(java.lang.String host)
Set the host to ping.
|
void |
setTimeout(int timeout)
Set the timeout for the reachability test in seconds.
|
void |
setUrl(java.lang.String url)
Set the URL from which to extract the hostname.
|
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
public static final int DEFAULT_TIMEOUT
public static final java.lang.String ERROR_NO_HOSTNAME
public static final java.lang.String ERROR_BAD_TIMEOUT
public static final java.lang.String ERROR_ON_NETWORK
public static final java.lang.String ERROR_BOTH_TARGETS
public static final java.lang.String MSG_NO_REACHABLE_TEST
public static final java.lang.String ERROR_BAD_URL
public static final java.lang.String ERROR_NO_HOST_IN_URL
public static final java.lang.String METHOD_NAME
public void setHost(java.lang.String host)
host
- the host to ping.public void setUrl(java.lang.String url)
url
- a URL object.public void setTimeout(int timeout)
timeout
- the timeout in seconds.public boolean eval() throws BuildException
eval
in interface Condition
BuildException
- if an error occurs