public class Environment extends 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(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(ArrayList<MonitorJob> monitors)
Determines the minimum interval at which the executor thread
needs to wake upto execute jobs.
|
static ArrayList<MonitorJob> |
getJobs()
Scans the configuration file to determine which monitoring
utilities are available in the system.
|
static String |
getProperty(String key)
Fetches the value of a property from the configuration file.
|
static void |
logInfo(String str) |
static void |
prepare(String fname)
Initializes structures needed by other methods.
|
static StringBuffer |
runCommand(String cmd)
Runs a shell command in the system and provides a StringBuffer
with the output of the command.
|
static StringBuffer |
runCommand(String[] cmd)
Runs a shell command in the system and provides a StringBuffer
with the output of the command.
|
static void |
setProperty(String key,
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(String fname)
public static String getProperty(String key)
key
- the name of the propertypublic static void setProperty(String key, String value)
key
- the name of the propertyvalue
- the new value for the propertypublic static ArrayList<MonitorJob> getJobs()
public static int getInterval(ArrayList<MonitorJob> monitors)
monitors
- the list of scheduled jobspublic static boolean checkExistence(String cmd)
cmd
- the command to check againstpublic static StringBuffer runCommand(String[] cmd)
cmd
- an array of string that form the command to runpublic static StringBuffer runCommand(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(String str)
Copyright © 2010 The Apache Software Foundation