org.apache.env
Class WhichJar

java.lang.Object
  |
  +--org.apache.env.WhichJar

public abstract class WhichJar
extends java.lang.Object

Static worker methods to find version info about jars and classpaths.

Version:
$Id: WhichJar.html,v 1.4 2003/12/30 03:55:19 crossley Exp $
Author:
shane_curcuru@us.ibm.com

Field Summary
protected static java.util.Properties jarSizeTable
          A Properties block of known officially shipped .jar names/sizes.
static java.lang.String SERVICE_NAME
          SERVICE_NAME.
 
Constructor Summary
WhichJar()
           
 
Method Summary
static void getClasspathInfo(java.util.Hashtable hash, java.lang.String options)
          Generic worker method to print out java.class.path, sun.boot.class.path, and java.ext.dirs.
static int getInfo(java.util.Hashtable hash, java.io.File jarFile, java.lang.String options)
          Get version information about a specific .jar file.
static java.lang.String getVersion()
          Get our file version info.
static int searchClasspaths(java.util.Hashtable hash, java.lang.String jarName, java.lang.String options)
          Search all applicable classpath-like items for the named jar.
static int searchDir(java.util.Hashtable hash, java.lang.String dir, java.lang.String jarName, java.lang.String options)
          Search a single directory for the named jar.
static int searchDirs(java.util.Hashtable hash, java.lang.String pathName, java.lang.String jarName, java.lang.String options)
          Search a list of paths for the named jar.
static int searchPath(java.util.Hashtable hash, java.lang.String pathName, java.lang.String jarName, java.lang.String options)
          Search a classpath path for the named jar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_NAME

public static final java.lang.String SERVICE_NAME
SERVICE_NAME.

See Also:
Constant Field Values

jarSizeTable

protected static java.util.Properties jarSizeTable
A Properties block of known officially shipped .jar names/sizes.

Constructor Detail

WhichJar

public WhichJar()
Method Detail

getClasspathInfo

public static void getClasspathInfo(java.util.Hashtable hash,
                                    java.lang.String options)
Generic worker method to print out java.class.path, sun.boot.class.path, and java.ext.dirs.

Parameters:
hash - to put information in
options - to apply like strict or verbose

searchClasspaths

public static int searchClasspaths(java.util.Hashtable hash,
                                   java.lang.String jarName,
                                   java.lang.String options)
Search all applicable classpath-like items for the named jar. Looks in each classpath (and bootclasspath, and ext dirs) for the jar and reports info about it.

Parameters:
hash - to put information in
jarName - to look for
options - to apply like strict or verbose
Returns:
status information from WhichConstant

searchPath

public static int searchPath(java.util.Hashtable hash,
                             java.lang.String pathName,
                             java.lang.String jarName,
                             java.lang.String options)
Search a classpath path for the named jar.

Parameters:
hash - to put information in
pathName - to get from System.getProperty()
jarName - to look for, case-insensitive
options - to apply like strict or verbose
Returns:
status information from WhichConstant

searchDirs

public static int searchDirs(java.util.Hashtable hash,
                             java.lang.String pathName,
                             java.lang.String jarName,
                             java.lang.String options)
Search a list of paths for the named jar.

Parameters:
hash - to put information in
pathName - to get from System.getProperty()
jarName - to look for, case-insensitive
options - to apply like strict or verbose
Returns:
status information from WhichConstant

searchDir

public static int searchDir(java.util.Hashtable hash,
                            java.lang.String dir,
                            java.lang.String jarName,
                            java.lang.String options)
Search a single directory for the named jar.

Parameters:
hash - to put information in
dir - name of directory
jarName - to look for, case-insensitive
options - to apply like strict or verbose
Returns:
status information from WhichConstant

getInfo

public static int getInfo(java.util.Hashtable hash,
                          java.io.File jarFile,
                          java.lang.String options)
Get version information about a specific .jar file. Current implementation simply checks the file size in bytes of the .jar file and does a lookup in WhichJar.properties to get a description of officially shipped .jars. //@todo future versions should also lookup manifest version info from .jar files (but remember to provide fallbacks since we must also run on JDK 1.1.8!).

Parameters:
hash - to put information in
options - to apply like strict or verbose
Returns:
status information from WhichConstant

getVersion

public static java.lang.String getVersion()
Get our file version info.

Returns:
String of our file version


Copyright 2001 Apache Software Foundation. All Rights Reserved.