Java Doc for EnvironmentCheck.java in  » XML » xalan » org » apache » xalan » xslt » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » xalan » org.apache.xalan.xslt 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.xalan.xslt.EnvironmentCheck

EnvironmentCheck
public class EnvironmentCheck (Code)
Utility class to report simple information about the environment. Simplistic reporting about certain classes found in your JVM may help answer some FAQs for simple problems.

Usage-command line: java org.apache.xalan.xslt.EnvironmentCheck [-out outFile]

Usage-from program: boolean environmentOK = (new EnvironmentCheck()).checkEnvironment(yourPrintWriter);

Usage-from stylesheet:

 <?xml version="1.0"?>
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
 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>
 

Xalan users reporting problems are encouraged to use this class to see if there are potential problems with their actual Java environment before reporting a bug. Note that you should both check from the JVM/JRE's command line as well as temporarily calling checkEnvironment() directly from your code, since the classpath may differ (especially for servlets, etc).

Also see http://xml.apache.org/xalan-j/faq.html

Note: This class is pretty simplistic: results are not necessarily definitive nor will it find all problems related to environment setup. Also, you should avoid calling this in deployed production code, both because it is quite slow and because it forces classes to get loaded.

Note: This class explicitly has very limited compile-time dependencies to enable easy compilation and usage even when Xalan, DOM/SAX/JAXP, etc. are not present.

Note: for an improved version of this utility, please see the xml-commons' project Which utility which does the same kind of thing but in a much simpler manner.


author:
   Shane_Curcuru@us.ibm.com
version:
   $Id: EnvironmentCheck.java,v 1.29 2005/07/27 19:21:04 mcnamara Exp $


Field Summary
final public static  StringCLASS_NOTPRESENT
     Marker that a class or .jar was not found.
final public static  StringCLASS_PRESENT
     Marker that a class or .jar was found.
final public static  StringERROR
     Prefixed to hash keys that signify serious problems.
final public static  StringERROR_FOUND
     Value for any error found.
final public static  StringFOUNDCLASSES
     Prefixed to hash keys that signify .jars found in classpath.
final public static  StringVERSION
     Prefixed to hash keys that signify version numbers.
final public static  StringWARNING
     Added to descriptions that signify potential problems.
public  String[]jarNames
     Listing of common .jar files that include Xalan-related classes.
protected  PrintWriteroutWriter
     Simple PrintWriter we send output to; defaults to System.out.


Method Summary
public  voidappendEnvironmentReport(Node container, Document factory, Hashtable h)
     Stylesheet extension entrypoint: Dump a basic Xalan environment report from getEnvironmentHash() to a Node.
protected  booleanappendFoundJars(Node container, Document factory, Vector v, String desc)
     Print out report of .jars found in a classpath.
protected  voidcheckAntVersion(Hashtable h)
     Report product version information from Ant.
protected  voidcheckDOMVersion(Hashtable h)
     Report version info from DOM interfaces.
public  booleancheckEnvironment(PrintWriter pw)
     Programmatic entrypoint: Report on basic Java environment and CLASSPATH settings that affect Xalan.

Note that this class is not advanced enough to tell you everything about the environment that affects Xalan, and sometimes reports errors that will not actually affect Xalan's behavior.

protected  voidcheckJAXPVersion(Hashtable h)
     Report version information about JAXP interfaces.
protected  voidcheckParserVersion(Hashtable h)
     Report product version information from common parsers.
protected  VectorcheckPathForJars(String cp, String[] jars)
     Cheap-o listing of specified .jars found in the classpath.
protected  voidcheckProcessorVersion(Hashtable h)
     Report product version information from Xalan-J.
protected  voidcheckSAXVersion(Hashtable h)
     Report version info from SAX interfaces.
protected  voidcheckSystemProperties(Hashtable h)
     Fillin hash with info about SystemProperties.
protected  StringgetApparentVersion(String jarName, long jarSize)
     Cheap-o method to determine the product version of a .jar.
public  HashtablegetEnvironmentHash()
     Fill a hash with basic environment settings that affect Xalan.

Worker method called from various places.

Various system and CLASSPATH, etc.

protected  booleanlogFoundJars(Vector v, String desc)
     Print out report of .jars found in a classpath.
protected  voidlogMsg(String s)
     Bottleneck output: calls outWriter.println(s).
public static  voidmain(String[] args)
     Command line runnability: checks for [-out outFilename] arg.
protected  booleanwriteEnvironmentReport(Hashtable h)
     Dump a basic Xalan environment report to outWriter.

Field Detail
CLASS_NOTPRESENT
final public static String CLASS_NOTPRESENT(Code)
Marker that a class or .jar was not found.



CLASS_PRESENT
final public static String CLASS_PRESENT(Code)
Marker that a class or .jar was found.



ERROR
final public static String ERROR(Code)
Prefixed to hash keys that signify serious problems.



ERROR_FOUND
final public static String ERROR_FOUND(Code)
Value for any error found.



FOUNDCLASSES
final public static String FOUNDCLASSES(Code)
Prefixed to hash keys that signify .jars found in classpath.



VERSION
final public static String VERSION(Code)
Prefixed to hash keys that signify version numbers.



WARNING
final public static String WARNING(Code)
Added to descriptions that signify potential problems.



jarNames
public String[] jarNames(Code)
Listing of common .jar files that include Xalan-related classes.



outWriter
protected PrintWriter outWriter(Code)
Simple PrintWriter we send output to; defaults to System.out.





Method Detail
appendEnvironmentReport
public void appendEnvironmentReport(Node container, Document factory, Hashtable h)(Code)
Stylesheet extension entrypoint: Dump a basic Xalan environment report from getEnvironmentHash() to a Node.

Copy of writeEnvironmentReport that creates a Node suitable for other processing instead of a properties-like text output.


Parameters:
  container - Node to append our report to
Parameters:
  factory - Document providing createElement, etc. services
Parameters:
  h - Hash presumably from EnvironmentCheck.getEnvironmentHash()
See Also:   EnvironmentCheck.writeEnvironmentReport(Hashtable)
See Also:   for an equivalent that writes to a PrintWriter instead



appendFoundJars
protected boolean appendFoundJars(Node container, Document factory, Vector v, String desc)(Code)
Print out report of .jars found in a classpath. Takes the information encoded from a checkPathForJars() call and dumps it out to our PrintWriter.
Parameters:
  container - Node to append our report to
Parameters:
  factory - Document providing createElement, etc. services
Parameters:
  v - Vector of Hashtables of .jar file info
Parameters:
  desc - description to print out in header false if OK, true if any .jars were reported as having errors
See Also:   EnvironmentCheck.checkPathForJars(String,String[])



checkAntVersion
protected void checkAntVersion(Hashtable h)(Code)
Report product version information from Ant.
Parameters:
  h - Hashtable to put information in



checkDOMVersion
protected void checkDOMVersion(Hashtable h)(Code)
Report version info from DOM interfaces. Currently distinguishes between pre-DOM level 2, the DOM level 2 working draft, the DOM level 2 final draft, and not found.
Parameters:
  h - Hashtable to put information in



checkEnvironment
public boolean checkEnvironment(PrintWriter pw)(Code)
Programmatic entrypoint: Report on basic Java environment and CLASSPATH settings that affect Xalan.

Note that this class is not advanced enough to tell you everything about the environment that affects Xalan, and sometimes reports errors that will not actually affect Xalan's behavior. Currently, it very simplistically checks the JVM's environment for some basic properties and logs them out; it will report a problem if it finds a setting or .jar file that is likely to cause problems.

Advanced users can peruse the code herein to help them investigate potential environment problems found; other users may simply send the output from this tool along with any bugs they submit to help us in the debugging process.


Parameters:
  pw - PrintWriter to send output to; can be sent to a file that will look similar to a Properties file; defaults to System.out if null true if your environment appears to have no major problems; false if potential environment problems found
See Also:   EnvironmentCheck.getEnvironmentHash()



checkJAXPVersion
protected void checkJAXPVersion(Hashtable h)(Code)
Report version information about JAXP interfaces. Currently distinguishes between JAXP 1.0.1 and JAXP 1.1, and not found; only tests the interfaces, and does not check for reference implementation versions.
Parameters:
  h - Hashtable to put information in



checkParserVersion
protected void checkParserVersion(Hashtable h)(Code)
Report product version information from common parsers. Looks for version info in xerces.jar/xercesImpl.jar/crimson.jar. //@todo actually look up version info in crimson manifest
Parameters:
  h - Hashtable to put information in



checkPathForJars
protected Vector checkPathForJars(String cp, String[] jars)(Code)
Cheap-o listing of specified .jars found in the classpath. cp should be separated by the usual File.pathSeparator. We then do a simplistic search of the path for any requested .jar filenames, and return a listing of their names and where (apparently) they came from.
Parameters:
  cp - classpath to search
Parameters:
  jars - array of .jar base filenames to look for Vector of Hashtables filled with info about found .jars
See Also:   EnvironmentCheck.jarNames
See Also:   EnvironmentCheck.logFoundJars(Vector,String)
See Also:   EnvironmentCheck.appendFoundJars(Node,Document,Vector,String)
See Also:   EnvironmentCheck.getApparentVersion(String,long)



checkProcessorVersion
protected void checkProcessorVersion(Hashtable h)(Code)
Report product version information from Xalan-J. Looks for version info in xalan.jar from Xalan-J products.
Parameters:
  h - Hashtable to put information in



checkSAXVersion
protected void checkSAXVersion(Hashtable h)(Code)
Report version info from SAX interfaces. Currently distinguishes between SAX 2, SAX 2.0beta2, SAX1, and not found.
Parameters:
  h - Hashtable to put information in



checkSystemProperties
protected void checkSystemProperties(Hashtable h)(Code)
Fillin hash with info about SystemProperties. Logs java.class.path and other likely paths; then attempts to search those paths for .jar files with Xalan-related classes. //@todo NOTE: We don't actually search java.ext.dirs for // *.jar files therein! This should be updated
Parameters:
  h - Hashtable to put information in
See Also:   EnvironmentCheck.jarNames
See Also:   EnvironmentCheck.checkPathForJars(String,String[])



getApparentVersion
protected String getApparentVersion(String jarName, long jarSize)(Code)
Cheap-o method to determine the product version of a .jar. Currently does a lookup into a local table of some recent shipped Xalan builds to determine where the .jar probably came from. Note that if you recompile Xalan or Xerces yourself this will likely report a potential error, since we can't certify builds other than the ones we ship. Only reports against selected posted Xalan-J builds. //@todo actually look up version info in manifests
Parameters:
  jarName - base filename of the .jarfile
Parameters:
  jarSize - size of the .jarfile String describing where the .jar file probably came from



getEnvironmentHash
public Hashtable getEnvironmentHash()(Code)
Fill a hash with basic environment settings that affect Xalan.

Worker method called from various places.

Various system and CLASSPATH, etc. properties are put into the hash as keys with a brief description of the current state of that item as the value. Any serious problems will be put in with a key that is prefixed with #ERROR 'ERROR.' so it stands out in any resulting report; also a key with just that constant will be set as well for any error.

Note that some legitimate cases are flaged as potential errors - namely when a developer recompiles xalan.jar on their own - and even a non-error state doesn't guaruntee that everything in the environment is correct. But this will help point out the most common classpath and system property problems that we've seen.

Hashtable full of useful environment info about Xalan and related system properties, etc.



logFoundJars
protected boolean logFoundJars(Vector v, String desc)(Code)
Print out report of .jars found in a classpath. Takes the information encoded from a checkPathForJars() call and dumps it out to our PrintWriter.
Parameters:
  v - Vector of Hashtables of .jar file info
Parameters:
  desc - description to print out in header false if OK, true if any .jars were reported as having errors
See Also:   EnvironmentCheck.checkPathForJars(String,String[])



logMsg
protected void logMsg(String s)(Code)
Bottleneck output: calls outWriter.println(s).
Parameters:
  s - String to print



main
public static void main(String[] args)(Code)
Command line runnability: checks for [-out outFilename] arg.

Command line entrypoint; Sets output and calls EnvironmentCheck.checkEnvironment(PrintWriter) .


Parameters:
  args - command line args



writeEnvironmentReport
protected boolean writeEnvironmentReport(Hashtable h)(Code)
Dump a basic Xalan environment report to outWriter.

This dumps a simple header and then each of the entries in the Hashtable to our PrintWriter; it does special processing for entries that are .jars found in the classpath.


Parameters:
  h - Hashtable of items to report on; presumablyfilled in by our various check*() methods true if your environment appears to have no major problems; false if potential environment problems found
See Also:   EnvironmentCheck.appendEnvironmentReport(Node,Document,Hashtable)
See Also:   for an equivalent that appends to a Node instead



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.