diff --git a/java/src/org/apache/env/Which.java b/java/src/org/apache/env/Which.java index 7ef3d27..06e7781 100644 --- a/java/src/org/apache/env/Which.java +++ b/java/src/org/apache/env/Which.java @@ -2,8 +2,8 @@ * The Apache Software License, Version 1.1 * * - * Copyright (c) 2001 The Apache Software Foundation. All rights - * reserved. + * Copyright (c) 2001-2002 The Apache Software Foundation. + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -64,7 +64,8 @@ import java.util.StringTokenizer; import java.util.Vector; /** - * General environment checking and version finding service. + * General environment checking and version finding service; + * main external entrypoints and command line interface. * *

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:
* * java org.apache.env.Which [project;WhichProject] [-options] *

* - *

Usage-from program: + *

Usage - from program:
* * int status = org.apache.env.Which.which(hash, projects, options); *

* + *

Usage - from XSLT stylesheet in Xalan-J:
+ * (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 environment checking utility + +

Which is a simple utility that inspects your JVM's environment and reports simple info about versions of classes found.

+
+
Author:
Shane_Curcuru@us.ibm.com
+
See: (overview)
xml-commons project for an overview.
+
Usage: (common)
+ set CLASSPATH=%CLASSPATH%;\xml-commons\java\build\which.jar
+ java org.apache.env.Which [project;WhichProject] [-options]
+
Usage: (more examples)
{@link org.apache.env.Which}
+
+

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.

+ + + +