public class Environment
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOG_INTERVAL |
static int |
DEFAULT_POLL_INTERVAL |
static org.apache.commons.logging.Log |
LOG |
static int |
MAX_OUTPUT_LENGTH |
static int |
MIN_INTERVAL |
Constructor and Description |
---|
Environment() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkExistence(java.lang.String cmd)
Checks whether a specific shell command is available
in the system.
|
static int |
gcd(int[] numbers)
Determines the greatest common divisor (GCD) of a list
of integers.
|
static int |
gcd(int m,
int n)
Determines the greatest common divisor (GCD) of two integers.
|
static int |
getInterval(java.util.ArrayList<MonitorJob> monitors)
Determines the minimum interval at which the executor thread
needs to wake upto execute jobs.
|
static java.util.ArrayList<MonitorJob> |
getJobs()
Scans the configuration file to determine which monitoring
utilities are available in the system.
|
static java.lang.String |
getProperty(java.lang.String key)
Fetches the value of a property from the configuration file.
|
static void |
logInfo(java.lang.String str) |
static void |
prepare(java.lang.String fname)
Initializes structures needed by other methods.
|
static java.lang.StringBuffer |
runCommand(java.lang.String cmd)
Runs a shell command in the system and provides a StringBuffer
with the output of the command.
|
static java.lang.StringBuffer |
runCommand(java.lang.String[] cmd)
Runs a shell command in the system and provides a StringBuffer
with the output of the command.
|
static void |
setProperty(java.lang.String key,
java.lang.String value)
Sets the value of a property inthe configuration file.
|
public static final int DEFAULT_LOG_INTERVAL
public static final int DEFAULT_POLL_INTERVAL
public static int MIN_INTERVAL
public static final int MAX_OUTPUT_LENGTH
public static org.apache.commons.logging.Log LOG
public static void prepare(java.lang.String fname)
public static java.lang.String getProperty(java.lang.String key)
key
- the name of the propertypublic static void setProperty(java.lang.String key, java.lang.String value)
key
- the name of the propertyvalue
- the new value for the propertypublic static java.util.ArrayList<MonitorJob> getJobs()
public static int getInterval(java.util.ArrayList<MonitorJob> monitors)
monitors
- the list of scheduled jobspublic static boolean checkExistence(java.lang.String cmd)
cmd
- the command to check againstpublic static java.lang.StringBuffer runCommand(java.lang.String[] cmd)
cmd
- an array of string that form the command to runpublic static java.lang.StringBuffer runCommand(java.lang.String cmd)
cmd
- the command to runpublic static int gcd(int m, int n)
m
- the first integern
- the second integerpublic static int gcd(int[] numbers)
numbers
- the list of integers to processpublic static void logInfo(java.lang.String str)
Copyright © 2009 The Apache Software Foundation