public class SystemState extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
logger
Handy logging object.
|
Modifier | Constructor and Description |
---|---|
private |
SystemState() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
escapeWhitespaceChars(java.lang.CharSequence sequence) |
static java.util.Map<java.lang.Integer,java.awt.Rectangle> |
getDisplayBounds()
Returns a mapping of display number to a
Rectangle
that represents the "bounds" of the display. |
static java.lang.String |
getIdvVersionString()
Gets a human-friendly representation of the information embedded within
IDV's
build.properties . |
static java.lang.String |
getMcvVersionString()
Gets a human-friendly representation of the information embedded within
McIDAS-V's
build.properties . |
static java.lang.String |
getNcidvVersionString()
Gets a human-friendly representation of the ncIdv.jar version
information.
|
private static java.io.InputStream |
getResourceAsStream(java.lang.String name)
Open a file for reading.
|
static java.lang.String |
getStateAsString(McIDASV mcv)
Builds a (filtered) subset of the McIDAS-V system properties and returns
the results as a
String . |
static java.lang.String |
getStateAsString(McIDASV mcv,
boolean firehose)
Builds the McIDAS-V system properties and returns the results as a
String . |
static java.awt.Rectangle |
getVirtualDisplayBounds() |
static java.lang.String |
getVisadVersionString()
Gets a human-friendly representation of the version information embedded
within VisAD's "DATE" file.
|
private static <T> T |
hackyMethodCall(java.lang.String methodName,
T defaultValue)
Attempt to invoke
OperatingSystemMXBean.methodName via
reflection. |
static java.util.Map<java.lang.String,java.lang.String> |
queryIdvBuildProperties()
Returns a
Map of the (currently) most useful contents of
ucar/unidata/idv/resources/build.properties . |
static java.util.Map<java.lang.String,java.lang.Object> |
queryJava3d()
Polls Java 3D for information about its environment.
|
static java.util.Map<java.lang.Object,java.lang.Object> |
queryJythonProps()
Returns the contents of Jython's registry (basically just Jython-specific
properties) as well as some of the information from Python's
"sys" module.
|
static java.util.Map<java.lang.String,java.lang.String> |
queryMachine()
Polls Java for information about the user's machine.
|
static java.util.Map<java.lang.String,java.lang.String> |
queryMcvBuildProperties()
Returns a
Map of the (currently) most useful contents of
edu/wisc/ssec/mcidasv/resources/build.properties . |
static java.util.Map<java.lang.String,java.lang.Object> |
queryMcvState(McIDASV mcv)
Queries McIDAS-V for information about its state.
|
static java.util.Map<java.lang.String,java.lang.String> |
queryNcidvBuildProperties()
Returns a
Map containing version and buildDate
keys. |
static java.util.Map<java.lang.String,java.lang.String> |
queryOpSysProps()
Attempts to call methods belonging to
com.sun.management.OperatingSystemMXBean . |
static java.util.Map<java.lang.String,java.lang.String> |
queryVisadBuildProperties()
Returns a
Map containing any relevant version information. |
private static final org.slf4j.Logger logger
private SystemState()
public static java.lang.String escapeWhitespaceChars(java.lang.CharSequence sequence)
private static <T> T hackyMethodCall(java.lang.String methodName, T defaultValue)
OperatingSystemMXBean.methodName
via
reflection.T
- Either Long
or Double
.methodName
- The method to invoke. Must belong to
com.sun.management.OperatingSystemMXBean
.defaultValue
- Default value to return, must be in
"boxed" form.methodName
call or
defaultValue
.public static java.util.Map<java.lang.Object,java.lang.Object> queryJythonProps()
public static java.util.Map<java.lang.String,java.lang.String> queryOpSysProps()
com.sun.management.OperatingSystemMXBean
. If successful, we'll
have the following information:
public static java.util.Map<java.lang.String,java.lang.String> queryMachine()
Map
of properties that describes the user's machine.public static java.util.Map<java.lang.Integer,java.awt.Rectangle> getDisplayBounds()
Rectangle
that represents the "bounds" of the display.public static java.awt.Rectangle getVirtualDisplayBounds()
public static java.util.Map<java.lang.String,java.lang.Object> queryJava3d()
VirtualUniverse.getProperties()
and
Canvas3D.queryProperties()
.public static java.lang.String getIdvVersionString()
build.properties
.String
that looks like "IDV version major.minor<b>revision</b> built <b>date</b>".
For example: IDV version 2.9u4 built 2011-04-13 14:01 UTC
.public static java.lang.String getMcvVersionString()
build.properties
.String
that looks like "McIDAS-V version major.minor<b>release</b> built <b>date</b>".
For example: McIDAS-V version 1.02beta1 built 2011-04-14 17:36
.public static java.lang.String getVisadVersionString()
String
that looks
"VisAD version <b>revision</b> built <b>date</b>".
For example: VisAD version 5952 built Thu Mar 22 13:01:31 CDT 2012
.public static java.lang.String getNcidvVersionString()
String
that looks like
"netCDF-Java version <b>revision</b> <b>built</b>".private static java.io.InputStream getResourceAsStream(java.lang.String name)
name
- File to open.InputStream
used to read name
, or null
if name
could not be found.public static java.util.Map<java.lang.String,java.lang.String> queryVisadBuildProperties()
Map
containing any relevant version information.
Currently this information consists of the date visad.jar was built, as well as the (then-current) Subversion revision number.
Map
of the contents of VisAD's DATE file.public static java.util.Map<java.lang.String,java.lang.String> queryNcidvBuildProperties()
Map
containing version
and buildDate
keys.Map
containing netCDF-Java version and build date.public static java.util.Map<java.lang.String,java.lang.String> queryIdvBuildProperties()
Map
of the (currently) most useful contents of
ucar/unidata/idv/resources/build.properties
.
Consider the output of getIdvVersionString()
; it's built
with the the following:
idv.version.major
: currently "3"idv.version.minor
: currently "0"idv.version.revision
: currently "u2"}idv.build.date
: varies pretty frequently,
as it's the build timestamp for idv.jarMap
of at least the useful parts of build.properties.public static java.util.Map<java.lang.String,java.lang.String> queryMcvBuildProperties()
Map
of the (currently) most useful contents of
edu/wisc/ssec/mcidasv/resources/build.properties
.
Consider the output of getMcvVersionString()
; it's built
with the the following:
mcidasv.version.major
:
currently "1"mcidasv.version.minor
:
currently "02"mcidasv.version.release
: currently
"beta1"mcidasv.build.date
: varies pretty frequently, as
it's the build timestamp for mcidasv.jar.Map
of at least the useful parts of build.properties.public static java.util.Map<java.lang.String,java.lang.Object> queryMcvState(McIDASV mcv)
mcv
- The McIDASV "god" object.public static java.lang.String getStateAsString(McIDASV mcv)
String
.mcv
- The McIDASV "god" object.KEY=VALUE\n
. This is so we kinda-sorta conform to the standard
Properties
file format.getStateAsString(edu.wisc.ssec.mcidasv.McIDASV, boolean)
public static java.lang.String getStateAsString(McIDASV mcv, boolean firehose)
String
.mcv
- The McIDASV "god" object.firehose
- If true
, enables "unfiltered" output.KEY=VALUE\n
. This is so we kinda-sorta conform to the standard
Properties
file format.