From ae09b42018402540956e80ff12a65e4fb6882329 Mon Sep 17 00:00:00 2001
From: curcuru Which is the command line interface to the org.apache.env
* package. Simply put, it provides a simplistic
@@ -85,16 +86,30 @@ import java.util.Vector;
* servlet, you must call Which.blah() from your servlet as
* it's installed in an actual container. Usage-command line:
+ * Usage - command line: Usage-from program:
+ * Usage - from program: Usage - from XSLT stylesheet in Xalan-J:
*
* java org.apache.env.Which [project;WhichProject] [-options]
*
*
* int status = org.apache.env.Which.which(hash, projects, options);
*
+ * (add which.jar to your classpath and run the following stylesheet)
+ *
+ * <?xml version="1.0"?>
+ * <xsl:stylesheet version="1.0"
+ * xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ * xmlns:xalan="http://xml.apache.org/xalan"
+ * exclude-result-prefixes="xalan">
+ * <xsl:output indent="yes"/>
+ * <xsl:template match="/">
+ * <xsl:copy-of select="xalan:checkEnvironment()"/>
+ * </xsl:template>
+ * </xsl:stylesheet>
+ *
Original credit to org.apache.xalan.xslt.EnvironmentCheck
* @author shane_curcuru@us.ibm.com * @version $Id$ diff --git a/java/src/org/apache/env/WhichClass.java b/java/src/org/apache/env/WhichClass.java index 0e0087a..2a9cf2e 100644 --- a/java/src/org/apache/env/WhichClass.java +++ b/java/src/org/apache/env/WhichClass.java @@ -62,10 +62,19 @@ import org.apache.env.WhichConstant; /** * Class finding service. - * This effectively replaces Class.forName() calls in this package. - * Similar to code in javax.xml.*.FactoryFinder. Options included - * for future use; they could specify something like - * LOCAL_CLASSLOADER_ONLY for servlet environments, etc. + * + *This effectively replaces all Class.forName() calls in this + * package. Similar to code in javax.xml.*.FactoryFinder. + * Options included for future use; they could specify something + * like LOCAL_CLASSLOADER_ONLY for servlet environments, etc.
+ * + *This class detects JDKs 1.1.x versus 1.2+ and may attempt to + * either use the current classLoader or may use a contextClassLoader. + * Note that in some servlet environments or in IDE environments + * like Eclipse that the + * difference between classloaders is very important! Changes in + * the JAXP FactoryFinder classes should be actively evaluated for + * inclusion/copying here.
* * @author shane_curcuru@us.ibm.com * @version $Id$ @@ -126,6 +135,9 @@ public abstract class WhichClass // Prevent instantiation; only provide static { // Assume that we are running JDK 1.1, use the current ClassLoader + // Note that this will be the classloader from + // which.jar's loading, not necessarily the one from + // an external caller's perspective (I think) return WhichClass.class.getClassLoader(); } diff --git a/java/src/org/apache/env/package.html b/java/src/org/apache/env/package.html new file mode 100644 index 0000000..f69411c --- /dev/null +++ b/java/src/org/apache/env/package.html @@ -0,0 +1,21 @@ + +Which is a simple utility that inspects your JVM's environment and reports simple info about versions of classes found.
+set CLASSPATH=%CLASSPATH%;\xml-commons\java\build\which.jar
+ java org.apache.env.Which [project;WhichProject] [-options]This package is a somewhat simplistic environment checking + utility. It allows users in various environments to self-test + their specific deployed environment to ensure that they have the + correct classes present. Which is currently focused on various + XML issues but is architected to be generic and easily extensible.
+ + + +