public class SiteMonitor
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
(package private) class |
SiteMonitor.SiteChecker
A thread used to handle individual site accessibility checking.
|
(package private) class |
SiteMonitor.SiteMonLogWriter
A class to handle logging duties for site monitor.
|
Modifier and Type | Field and Description |
---|---|
private static java.util.ResourceBundle |
cvSM
A reference to the "sitemonitor" resource properties.
|
private long |
ivCheckInterval
The amount of time to wait between web site checks.
|
protected SiteMonitor.SiteMonLogWriter |
ivLogWriter
The active
LogWriter . |
protected int |
ivRetryAttempts
The number of retry attempts.
|
protected long |
ivRetryInterval
The amount of time to wait between retry attempts.
|
protected java.util.ArrayList<java.lang.String> |
ivSiteDescs
A collection of web site descriptions.
|
protected java.util.ArrayList<java.lang.String> |
ivSiteToAddrs
A collection of web site email to addresses.
|
protected java.util.ArrayList<java.lang.String> |
ivSiteToNames
A collection of web site email to names.
|
protected java.util.ArrayList<java.lang.String> |
ivSiteURLs
A collection of web site urls.
|
private long |
ivStartDelay
The amount of time to wait before performing initial web site checks.
|
private static int |
MAX_SITES
The maximum number of the sites that can be monitored.
|
private static long |
serialVersionUID
The class' serialization version id.
|
Constructor and Description |
---|
SiteMonitor()
Creates and initializes an instance of
SiteMonitor . |
Modifier and Type | Method and Description |
---|---|
private int |
getParamAsNumber(java.lang.String key)
Returns the configuration parameter numeric value for the given key in
the sitemonitor.properties file.
|
private java.lang.String |
getParamAsString(java.lang.String key)
Returns the configuration parameter string value for the given key in the
sitemonitor.properties file.
|
private java.lang.String |
getProperty(java.lang.String key,
boolean logerror)
Returns the value for the given key in the sitemonitor.properties file.
|
private boolean |
initIntervals()
Initializes the monitor timing interval values.
|
private boolean |
initLogFile()
Initializes the monitor log file value.
|
private boolean |
initWebSites()
Initializes the monitor web site values.
|
private boolean |
isKnownHost(java.lang.String hostname)
Determines if a host name can be resolved to its IP address.
|
static void |
main(java.lang.String[] args)
Main entry point for when the class is started from a command line.
|
private void |
monitor()
Handles the monitor's main timing interval.
|
private static final long serialVersionUID
private static final java.util.ResourceBundle cvSM
private static final int MAX_SITES
protected SiteMonitor.SiteMonLogWriter ivLogWriter
LogWriter
.private long ivStartDelay
private long ivCheckInterval
protected int ivRetryAttempts
protected long ivRetryInterval
protected java.util.ArrayList<java.lang.String> ivSiteURLs
protected java.util.ArrayList<java.lang.String> ivSiteDescs
protected java.util.ArrayList<java.lang.String> ivSiteToAddrs
protected java.util.ArrayList<java.lang.String> ivSiteToNames
public SiteMonitor()
SiteMonitor
.private boolean initIntervals()
true
if the initialization is successful,
otherwise false
.private boolean initLogFile()
true
if the initialization is successful,
otherwise false
.private boolean initWebSites()
true
if the initialization is successful,
otherwise false
.private int getParamAsNumber(java.lang.String key)
key
- (String) The key associcated with the desired value.private java.lang.String getParamAsString(java.lang.String key)
key
- (String) The key associcated with the desired value.private java.lang.String getProperty(java.lang.String key, boolean logerror)
key
- (String) The key associated with the desired value.logerror
- (boolean) true
if missing resource error
messages are to be logged, otherwise false
.private boolean isKnownHost(java.lang.String hostname)
hostname
- (String) The host name to be resolved (xyz.company.com)
or a web site url (http://www.company.com/stuff).true
if the host name is successfully
resolved, otherwise false
.private void monitor()
SiteChecker
thread.public static void main(java.lang.String[] args)
args
- (String[]) A String
array of startup
parameters for the class.