org.apache.env
public class Which extends Object
Which is the command line interface to the org.apache.env package. Simply put, it provides a simplistic check of a user's actual environment for debugging and product support purposes by detecting the specific versions of commonly installed classes in the environment.
Which and related service classes provide a framework for looking for version information and passing it around in hashtables. Users can plug in their own implementations of WhichProject classes to get custom version info about any product.
One important usage note: you must call Which (or subclasses) in the environment that you wish to check. I.e. if you have a problem with a command line tool, then call Which from the same command line environment. If you have a problem with a servlet, you must call Which.blah() from your servlet as it's installed in an actual container.
Usage-command line:
java org.apache.env.Which [project;WhichProject] [-options]
Usage-from program:
int status = org.apache.env.Which.which(hash, projects, options);
Original credit to org.apache.xalan.xslt.EnvironmentCheck
Version: $Id: Which.java 225940 2001-12-21 22:59:05Z curcuru $
Field Summary | |
---|---|
static String | DEFAULT_PROJECTS Default set of projects to use if none provided. |
protected StringBuffer | optionsBuf optionsBuf. |
protected PrintWriter | outWriter outWriter. |
protected StringBuffer | projectsBuf projectsBuf. |
static String | SEPARATOR Generic ';' separator for various items. |
Method Summary | |
---|---|
void | doMain(String[] args)
Instance worker method to handle main(). |
static void | getGeneralInfo(Hashtable hash, String options)
Grab a couple of generally useful items, like classpath,
java version, version of this file, etc..
|
static int | getProjectsInfo(Hashtable hash, String projects, String options)
Get information from various project's WhichProject impls.
|
static String | getVersion()
Get simple version info about org.apache.env.Which and
related classes. |
static void | main(String[] args)
Command line runnability. |
protected boolean | parseArgs(String[] args)
Parse commandline args, return false if help asked for.
|
protected void | reportHashtable(Hashtable hash, String name, PrintWriter out)
Print information from a hashtable into the PrintWriter.
|
void | reportProjectsInfo(Hashtable hash, String options, int status, PrintWriter out)
Print information from which() into the PrintWriter.
|
protected String | usage()
Return our usage statement. |
static int | which(Hashtable hash, String projects, String options)
Which - get all info.
|
Parameters: args command line args
Parameters: hash to put information in projects to get information about
Each project's info is put into a subhash. Note: if projects is null, we use DEFAULT_PROJECTS.
Parameters: hash to put information in projects to get information about options to apply like strict or verbose
Returns: status information from WhichConstant
Returns: String of our file version
Parameters: args command line args
Parameters: args array of commandline args
Returns: true if OK, false if error/usage/help needed
Provides a pre-order traversal where the parent hash has it's output dumped before recursing to any child sub hashes. Sorta looks like Properties.list() output.
Parameters: hash to get info from (may have subhashtables) name to print as header for this hash out PrintWriter to send Properties.list()-like output to
Simplistic implementation to report to a writer.
Parameters: hash to get info from (may have subhashtables) options to apply like strict or verbose status from finding version info out PrintWriter to send Properties.list()-like output to
Returns: String of our usage
Parameters: hash to put information in projects to get information about options to apply like strict or verbose
Returns: status information from WhichConstant