org.apache.derby.impl.tools.sysinfo
Class Main

java.lang.Object
  extended byorg.apache.derby.impl.tools.sysinfo.Main

public final class Main
extends java.lang.Object

Copyright © 1998, Cloudscape, Inc. All rights reserved.

SysInfo reports values relevant to the Cloudscape product found on the CLASSPATH. It looks for a file called sysinfo.properties in the CLASSPATH using getResourceAsStream. If the file is not found, or some other exception occurs, the value returned will be that set for the key SysInfo.failureTag, or be the value "".

This class can be used to print out system information at the command line by issuing the command:

    java org.apache.derby.tools.sysinfo
  
Alternatively, you can use SysInfo within your program to display Cloudscape information; a Cloudscape version string is returned by this Java code:
    new Main().toString();
  


Field Summary
private static java.lang.String CLIENT
           
private static boolean cptester
           
private static java.lang.String curLoc
           
private static java.lang.String EMBEDDED
           
private static java.lang.String failureTag
          The name of the failure tag in the information file.
private static java.lang.String[] infoNames
           
private static java.lang.String javaSep
           
private static java.lang.String jbmsSep
           
private static java.lang.String licSep
           
private static java.lang.String locSep
           
private static java.lang.String MAINUSAGESTRING
           
private static java.lang.String NET
           
private static java.lang.String sep
          for use by the main () method
private static boolean setLicense
           
private static boolean setPause
           
private static java.lang.String TOOLS
           
private static java.lang.String USAGESTRINGPARTA
           
private static java.lang.String USAGESTRINGPARTB
           
 
Constructor Summary
Main()
           
 
Method Summary
private static java.lang.String argumentMatches(java.lang.String[] args, java.lang.String ss)
           
private static boolean argumentsContain(java.lang.String[] args, java.lang.String s)
           
private static ZipInfoProperties checkDirectory(java.lang.String dirname)
           
private static ZipInfoProperties checkFile(java.lang.String filename)
           
private static ZipInfoProperties checkForInfo(java.lang.String cpEntry)
           
private static java.lang.String crLf()
           
private static java.lang.String found(java.lang.String cn, java.lang.String library)
           
static ZipInfoProperties[] getAllInfo(java.lang.String classpath)
           
private static java.util.ResourceBundle getBundle()
           
private static void getClasspathInfo(java.lang.String[] args, java.io.PrintWriter aw)
           
static java.lang.String getCompleteMessage(java.lang.String msgId, java.lang.Object[] arguments)
           
private static java.lang.String getJavaProperty(java.lang.String whichProperty)
          Return Java properties from java.lang.System.
static void getMainInfo(java.io.PrintWriter aw, boolean pause)
           
static java.lang.String getTextMessage(java.lang.String msgId)
           
static java.lang.String getTextMessage(java.lang.String msgId, java.lang.Object a1)
           
static java.lang.String getTextMessage(java.lang.String msgId, java.lang.Object a1, java.lang.Object a2)
           
static java.lang.String getTextMessage(java.lang.String msgId, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3)
           
static java.lang.String getTextMessage(java.lang.String msgId, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4)
           
private static ZipInfoProperties[] loadZipFromResource()
          This method returns exactly one ZipInfoProperty in the array.
private static java.lang.String lookForMainArg(java.lang.String[] args, java.io.PrintWriter localPW)
           
static void main(java.lang.String[] args)
          Application entry point for SysInfo.
private static java.lang.String notFound(java.lang.String cn, java.lang.String library)
           
private static void parseArgs(java.lang.String[] args)
           
private static java.lang.String[] parseClasspath(java.lang.String cp)
           
private static void pause()
          For the benefit of DOS box users, this method waits for input before returning
private static void reportCloudscape(java.io.PrintWriter localAW)
          prints out the jbms info to the specified AppStreamWriter.
private static void reportJavaInfo(java.io.PrintWriter localAW)
          Writes out the relevant info about the Java environment to the specified AppStreamWriter.
private static void reportLocales(java.io.PrintWriter localAW)
          Writes out information about the locales with the product.
private static void tryAllClasspaths(java.io.PrintWriter localPW)
           
private static void tryAsResource(java.lang.String cn, java.lang.String library, java.lang.StringBuffer successes, java.lang.StringBuffer failures)
           
private static void tryClientClasspath(java.lang.StringBuffer successes, java.lang.StringBuffer failures)
           
private static void tryCoreClasspath(java.lang.StringBuffer successes, java.lang.StringBuffer failures)
           
private static void tryMyClasspath(java.lang.String cn, java.lang.String library, java.lang.StringBuffer successes, java.lang.StringBuffer failures)
           
private static void tryNetClasspath(java.lang.StringBuffer successes, java.lang.StringBuffer failures)
           
private static void trySomeClasspaths(java.lang.String[] args, java.io.PrintWriter localPW)
           
private static void tryUtilsClasspath(java.lang.StringBuffer successes, java.lang.StringBuffer failures)
           
(package private) static void useMe(java.lang.String[] args, java.io.PrintWriter pw)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

setPause

private static boolean setPause

setLicense

private static boolean setLicense

cptester

private static boolean cptester

sep

private static final java.lang.String sep
for use by the main () method

See Also:
Constant Field Values

javaSep

private static final java.lang.String javaSep

jbmsSep

private static final java.lang.String jbmsSep

licSep

private static final java.lang.String licSep

locSep

private static final java.lang.String locSep

curLoc

private static final java.lang.String curLoc

failureTag

private static final java.lang.String failureTag
The name of the failure tag in the information file. The failure tag's value provides a default value if any other properties are missing.


EMBEDDED

private static final java.lang.String EMBEDDED
See Also:
Constant Field Values

TOOLS

private static final java.lang.String TOOLS
See Also:
Constant Field Values

NET

private static final java.lang.String NET
See Also:
Constant Field Values

CLIENT

private static final java.lang.String CLIENT
See Also:
Constant Field Values

MAINUSAGESTRING

private static final java.lang.String MAINUSAGESTRING
See Also:
Constant Field Values

USAGESTRINGPARTA

private static final java.lang.String USAGESTRINGPARTA
See Also:
Constant Field Values

USAGESTRINGPARTB

private static final java.lang.String USAGESTRINGPARTB
See Also:
Constant Field Values

infoNames

private static final java.lang.String[] infoNames
Constructor Detail

Main

public Main()
Method Detail

main

public static void main(java.lang.String[] args)
Application entry point for SysInfo. This will print out the Cloudscape product information as well as a snapshot of the System properties.


getMainInfo

public static void getMainInfo(java.io.PrintWriter aw,
                               boolean pause)

parseArgs

private static void parseArgs(java.lang.String[] args)

pause

private static void pause()
For the benefit of DOS box users, this method waits for input before returning


reportCloudscape

private static void reportCloudscape(java.io.PrintWriter localAW)
prints out the jbms info to the specified AppStreamWriter.


reportJavaInfo

private static void reportJavaInfo(java.io.PrintWriter localAW)
Writes out the relevant info about the Java environment to the specified AppStreamWriter.


getJavaProperty

private static java.lang.String getJavaProperty(java.lang.String whichProperty)
Return Java properties from java.lang.System. Will catch SecurityExceptions and note them for displaying information.

Returns:
the Java property value or a string capturing a security exception.

getClasspathInfo

private static void getClasspathInfo(java.lang.String[] args,
                                     java.io.PrintWriter aw)

reportLocales

private static void reportLocales(java.io.PrintWriter localAW)
Writes out information about the locales with the product.


useMe

static void useMe(java.lang.String[] args,
                  java.io.PrintWriter pw)

tryAllClasspaths

private static void tryAllClasspaths(java.io.PrintWriter localPW)
                              throws java.lang.Throwable
Throws:
java.lang.Throwable

trySomeClasspaths

private static void trySomeClasspaths(java.lang.String[] args,
                                      java.io.PrintWriter localPW)
                               throws java.lang.Throwable
Throws:
java.lang.Throwable

tryCoreClasspath

private static void tryCoreClasspath(java.lang.StringBuffer successes,
                                     java.lang.StringBuffer failures)

tryNetClasspath

private static void tryNetClasspath(java.lang.StringBuffer successes,
                                    java.lang.StringBuffer failures)

tryClientClasspath

private static void tryClientClasspath(java.lang.StringBuffer successes,
                                       java.lang.StringBuffer failures)

tryUtilsClasspath

private static void tryUtilsClasspath(java.lang.StringBuffer successes,
                                      java.lang.StringBuffer failures)

tryMyClasspath

private static void tryMyClasspath(java.lang.String cn,
                                   java.lang.String library,
                                   java.lang.StringBuffer successes,
                                   java.lang.StringBuffer failures)

tryAsResource

private static void tryAsResource(java.lang.String cn,
                                  java.lang.String library,
                                  java.lang.StringBuffer successes,
                                  java.lang.StringBuffer failures)

found

private static java.lang.String found(java.lang.String cn,
                                      java.lang.String library)

notFound

private static java.lang.String notFound(java.lang.String cn,
                                         java.lang.String library)

crLf

private static java.lang.String crLf()

lookForMainArg

private static java.lang.String lookForMainArg(java.lang.String[] args,
                                               java.io.PrintWriter localPW)

argumentsContain

private static boolean argumentsContain(java.lang.String[] args,
                                        java.lang.String s)

argumentMatches

private static java.lang.String argumentMatches(java.lang.String[] args,
                                                java.lang.String ss)

getAllInfo

public static ZipInfoProperties[] getAllInfo(java.lang.String classpath)

loadZipFromResource

private static ZipInfoProperties[] loadZipFromResource()
This method returns exactly one ZipInfoProperty in the array. If it is able to load the sysinfo file as a resource, it returns the ZipInfoProperty associated with that. Otherwise, the ZipInfoProperty will be empty.


parseClasspath

private static java.lang.String[] parseClasspath(java.lang.String cp)

checkForInfo

private static ZipInfoProperties checkForInfo(java.lang.String cpEntry)

checkDirectory

private static ZipInfoProperties checkDirectory(java.lang.String dirname)

checkFile

private static ZipInfoProperties checkFile(java.lang.String filename)

getBundle

private static java.util.ResourceBundle getBundle()

getTextMessage

public static java.lang.String getTextMessage(java.lang.String msgId)

getTextMessage

public static java.lang.String getTextMessage(java.lang.String msgId,
                                              java.lang.Object a1)

getTextMessage

public static java.lang.String getTextMessage(java.lang.String msgId,
                                              java.lang.Object a1,
                                              java.lang.Object a2)

getTextMessage

public static java.lang.String getTextMessage(java.lang.String msgId,
                                              java.lang.Object a1,
                                              java.lang.Object a2,
                                              java.lang.Object a3)

getTextMessage

public static java.lang.String getTextMessage(java.lang.String msgId,
                                              java.lang.Object a1,
                                              java.lang.Object a2,
                                              java.lang.Object a3,
                                              java.lang.Object a4)

getCompleteMessage

public static java.lang.String getCompleteMessage(java.lang.String msgId,
                                                  java.lang.Object[] arguments)


Apache Derby V10.0 Engine Documentation - Copyright © 1997,2004 The Apache Software Foundation or its licensors, as applicable.