Sysinfo reports values relevant to the current Derby configuration.
Sysinfo looks for properties files in org.apache.derby.info named after
the genus names in org.apache.derby.tools.sysinfo, and gets their location
using getResource. It also searches the classpath and attempts to load
the info properties files from the directory or jar locations on the
classpath, and eliminates any duplicated information. If no files
are found, or some other exception occurs, the
value returned will be "
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
Derby information; a Derby version string is returned by this Java code:
new Main().toString();
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static boolean | |
| private static final String | |
| private static final String | |
| private static final String[] | |
| private static final String[] | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final LocalizedResource | LOCALIZED_RESOURCE
Resource for localizing the sysinfo messages. |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | sep
for use by the main () method |
| private static boolean | |
| private static boolean | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static String | |
| private static boolean | |
| private static ZipInfoProperties | Returns: a ZipInfoProperties if a file is found, otherwise null.the directory to check as a String dirname)Check a given directory for the presence of an info properties file in org/apache/derby/info inside the directory. |
| private static ZipInfoProperties | |
| private static ZipInfoProperties | Returns: a ZipInfoProperties if an info properties file is found.the classpath element cpEntry)Given an individual element of the element of the classpath, call checkDirectory() if the element is a directory or checkFile() if the element is a file. |
| private static String | |
| private static String | |
| private static String | |
| public static ZipInfoProperties[] | Returns: an array of ZipInfoProperties with the locations of the located resourcesthe classpath, or null if not accessible classpath)Get all the info we can obtain from the local execution context as to the availability of the Derby classes by attempting to load the info files with loadZipFromResource() and checking classpath locations with checkForInfo if the classpath is accessible. |
| private static String | Returns: f.getCanonicalPathfile on which to call getCanonicalPath f)wrapper for getCanonicalPath for sysinfo. |
| private static void | |
| private static String | getFileWhichLoadedClass(final Class<T> cls)
Given a loaded class, this routine asks the class's class loader for information about where the class was loaded from. |
| private static String | Returns: getJavaProperty(whichProperty, false)This is the name of the property whichProperty)Return Java properties from java.lang.System. |
| private static String | Returns: the Java property value or a string capturing a security exception.This is the name of the property whichProperty, boolean return nothing if no such java property and nullUnavailable is true nullUnavailable)Return Java properties from java.lang.System. |
| public static void | |
| public static String | |
| private static ZipInfoProperties[] | Returns: An array of ZipInfoProperties with the locations from which the info properties files were loaded.Attempt to load the info properties files specified in infoNames[i] using getResourceAsStream(). |
| private static String | |
| public static void | |
| private static ZipInfoProperties[] | Returns: the merged arraythe first array from loadZipWithResource zip1, ZipInfoProperties[] the second array from analyzing the classpath zip2)Merge and flatten two arrays of ZipInfoProperties, removing any duplicates. |
| private static String | |
| private static void | |
| private static String[] | Returns: a String array with the individual classpath elements.the classpath, if accessible. cp)Split the classpath into separate elements. |
| private static void | |
| private static void | printPropertyIfNotNull(PrintWriter
This is PrintWriter to print to localAW, String This is system property string property)Print property only if not null |
| private static void | reportDerby(PrintWriter
the AppStreamWriter to use. If null, System.out is
used localAW)prints out the jbms info to the specified AppStreamWriter. |
| private static void | reportJavaInfo(PrintWriter
The AppStreamWriter to write info out to. If this is
null, the info is written to System.out localAW)Writes out the relevant info about the Java environment to the specified AppStreamWriter. |
| private static void | reportLocales(PrintWriter
the AppStreamWriter to which the info is written. If this
value is null, the info is written to System.out localAW)Writes out information about the locales with the product. |
| private static void | reportTesting(PrintWriter
the AppStreamWriter to which the info is written. If this
value is null, the info is written to System.out localAW)Writes out information about the derbyTesting classes with the product. |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| private static void | |
| pack-priv static void |
| CLIENT | back to summary |
|---|---|
| private static final String CLIENT | |
| cptester | back to summary |
|---|---|
| private static boolean cptester | |
| curLoc | back to summary |
|---|---|
| private static final String curLoc | |
| EMBEDDED | back to summary |
|---|---|
| private static final String EMBEDDED | |
| infoNames | back to summary |
|---|---|
| private static final String[] infoNames | |
| jarNames | back to summary |
|---|---|
| private static final String[] jarNames | |
| javaSep | back to summary |
|---|---|
| private static final String javaSep | |
| jbmsSep | back to summary |
|---|---|
| private static final String jbmsSep | |
| licSep | back to summary |
|---|---|
| private static final String licSep | |
| LOCALIZED_RESOURCE | back to summary |
|---|---|
| private static final LocalizedResource LOCALIZED_RESOURCE Resource for localizing the sysinfo messages.
The default LocalizedResource reads messages from the toolsmessages
bundle. Create this instance to read messages from sysinfoMessages. Use
the locale and codeset specified by derby.ui.locale and derby.ui.codeset
if they are set.
Note that this variable must be initialized when the class is loaded in
order to work correctly for the API methods that don't call
| |
| locSep | back to summary |
|---|---|
| private static final String locSep | |
| MAINUSAGESTRING | back to summary |
|---|---|
| private static final String MAINUSAGESTRING | |
| NET | back to summary |
|---|---|
| private static final String NET | |
| sep | back to summary |
|---|---|
| private static final String sep for use by the main () method | |
| setLicense | back to summary |
|---|---|
| private static boolean setLicense | |
| setPause | back to summary |
|---|---|
| private static boolean setPause | |
| TEST_CLASS_NAME | back to summary |
|---|---|
| private static final String TEST_CLASS_NAME | |
| TOOLS | back to summary |
|---|---|
| private static final String TOOLS | |
| USAGESTRINGPARTA | back to summary |
|---|---|
| private static final String USAGESTRINGPARTA | |
| USAGESTRINGPARTB | back to summary |
|---|---|
| private static final String USAGESTRINGPARTB | |
| Main | back to summary |
|---|---|
| public Main() | |
| argumentMatches | back to summary |
|---|---|
| private static String argumentMatches(String[] args, String ss) | |
| argumentsContain | back to summary |
|---|---|
| private static boolean argumentsContain(String[] args, String s) | |
| checkDirectory | back to summary |
|---|---|
| private static ZipInfoProperties checkDirectory(String dirname) Check a given directory for the presence of an info properties file in org/apache/derby/info inside the directory.
| |
| checkFile | back to summary |
|---|---|
| private static ZipInfoProperties checkFile(String filename) Check inside a jar file for the presence of a Derby info properties file.
| |
| checkForInfo | back to summary |
|---|---|
| private static ZipInfoProperties checkForInfo(final String cpEntry) Given an individual element of the element of the classpath, call checkDirectory() if the element is a directory or checkFile() if the element is a file.
| |
| crLf | back to summary |
|---|---|
| private static String crLf() | |
| formatURL | back to summary |
|---|---|
| private static String formatURL(URL loc) Strip a given URL down to the filename. The URL will be a jarfile or directory containing a Derby info properties file. Return the canonical path for the filename, with the path separators normalized. | |
| found | back to summary |
|---|---|
| private static String found(String cn, String library, String loc) | |
| getAllInfo | back to summary |
|---|---|
| public static ZipInfoProperties[] getAllInfo(String classpath) Get all the info we can obtain from the local execution context as to the availability of the Derby classes by attempting to load the info files with loadZipFromResource() and checking classpath locations with checkForInfo if the classpath is accessible.
| |
| getCanonicalPath | back to summary |
|---|---|
| private static String getCanonicalPath(final File f) throws IOException wrapper for getCanonicalPath for sysinfo. When we installed a SecurityManager (see DERBY-7138), we wanted to print the security exceptions for sysinfo, not throw them if we didn't have permmission | |
| getClasspathInfo | back to summary |
|---|---|
| private static void getClasspathInfo(String[] args, PrintWriter aw) | |
| getFileWhichLoadedClass | back to summary |
|---|---|
| private static String getFileWhichLoadedClass(final Class<T> cls) Given a loaded class, this routine asks the class's class loader for information about where the class was loaded from. Typically, this is a file, which might be either a class file or a jar file. The routine figures that out, and returns the name of the file. If it can't figure it out, it returns null | |
| getJavaProperty | back to summary |
|---|---|
| private static String getJavaProperty(final String whichProperty) Return Java properties from java.lang.System. | |
| getJavaProperty | back to summary |
|---|---|
| private static String getJavaProperty(final String whichProperty, boolean nullUnavailable) Return Java properties from java.lang.System. | |
| getMainInfo | back to summary |
|---|---|
| public static void getMainInfo(PrintWriter aw, boolean pause) | |
| getTextMessage | back to summary |
|---|---|
| public static String getTextMessage(String msgId, Object... arguments) | |
| loadZipFromResource | back to summary |
|---|---|
| private static ZipInfoProperties[] loadZipFromResource() Attempt to load the info properties files specified in infoNames[i] using getResourceAsStream(). If none are able to be loaded, return a null array.
| |
| lookForMainArg | back to summary |
|---|---|
| private static String lookForMainArg(String[] args, PrintWriter localPW) | |
| main | back to summary |
|---|---|
| public static void main(String[] args) Application entry point for SysInfo. This will print out the Derby product information as well as a snapshot of the System properties. | |
| mergeZips | back to summary |
|---|---|
| private static ZipInfoProperties[] mergeZips(ZipInfoProperties[] zip1, ZipInfoProperties[] zip2) Merge and flatten two arrays of ZipInfoProperties, removing any duplicates. There may be duplicates in the arrays because loadZipFromResource may find all the properties files in the same location, such as when loading from compiled source instead of packaged jars. Also, a poorly constructed classpath may contain duplicate entries that each contain the Derby classes, and we need only report the first of each such instances found. The second array may be null if the classpath was empty, in which case we still remove the duplicates from the first array and return the shortened array.
| |
| notFound | back to summary |
|---|---|
| private static String notFound(String cn, String library) | |
| parseArgs | back to summary |
|---|---|
| private static void parseArgs(String[] args) | |
| parseClasspath | back to summary |
|---|---|
| private static String[] parseClasspath(String cp) Split the classpath into separate elements. | |
| pause | back to summary |
|---|---|
| private static void pause() For the benefit of DOS box users, this method waits for input before returning | |
| printPropertyIfNotNull | back to summary |
|---|---|
| private static void printPropertyIfNotNull(PrintWriter localAW, String property) Print property only if not null
| |
| reportDerby | back to summary |
|---|---|
| private static void reportDerby(PrintWriter localAW) prints out the jbms info to the specified AppStreamWriter.
| |
| reportJavaInfo | back to summary |
|---|---|
| private static void reportJavaInfo(PrintWriter localAW) Writes out the relevant info about the Java environment to the specified AppStreamWriter.
| |
| reportLocales | back to summary |
|---|---|
| private static void reportLocales(PrintWriter localAW) Writes out information about the locales with the product.
| |
| reportTesting | back to summary |
|---|---|
| private static void reportTesting(PrintWriter localAW) Writes out information about the derbyTesting classes with the product.
| |
| tryAllClasspaths | back to summary |
|---|---|
| private static void tryAllClasspaths(PrintWriter localPW) throws Throwable | |
| tryAsResource | back to summary |
|---|---|
| private static void tryAsResource(String cn, String library, StringBuffer successes, StringBuffer failures) | |
| tryClientClasspath | back to summary |
|---|---|
| private static void tryClientClasspath(StringBuffer successes, StringBuffer failures) | |
| tryCoreClasspath | back to summary |
|---|---|
| private static void tryCoreClasspath(StringBuffer successes, StringBuffer failures) | |
| tryMyClasspath | back to summary |
|---|---|
| private static void tryMyClasspath(String cn, String library, StringBuffer successes, StringBuffer failures) | |
| tryNetClasspath | back to summary |
|---|---|
| private static void tryNetClasspath(StringBuffer successes, StringBuffer failures) | |
| trySomeClasspaths | back to summary |
|---|---|
| private static void trySomeClasspaths(String[] args, PrintWriter localPW) throws Throwable | |
| tryTstingClasspath | back to summary |
|---|---|
| private static void tryTstingClasspath(StringBuffer successes, StringBuffer failures) | |
| tryUtilsClasspath | back to summary |
|---|---|
| private static void tryUtilsClasspath(StringBuffer successes, StringBuffer failures) | |
| useMe | back to summary |
|---|---|
| pack-priv static void useMe(String[] args, PrintWriter pw) | |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public int | compare(Locale
the first object to be compared. left, Locale the second object to be compared. right)Implements java. |
| LocaleSorter | back to summary |
|---|---|
| public LocaleSorter() | |
| compare | back to summary |
|---|---|
| public int compare(Locale left, Locale right) Implements java. Doc from java. Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
The implementor must ensure that
The implementor must also ensure that the relation is transitive:
Finally, the implementor must ensure that | |