public class SystemState extends 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 String |
escapeWhitespaceChars(CharSequence sequence) |
static Map<Integer,Rectangle> |
getDisplayBounds()
Returns a mapping of display number to a
Rectangle
that represents the "bounds" of the display. |
static String |
getIdvVersionString()
Gets a human-friendly representation of the information embedded within
IDV's
build.properties . |
static String |
getMcvVersionString()
Gets a human-friendly representation of the information embedded within
McIDAS-V's
build.properties . |
static String |
getNcidvVersionString()
Gets a human-friendly representation of the ncIdv.jar version
information.
|
private static InputStream |
getResourceAsStream(String name)
Open a file for reading.
|
static String |
getStateAsString(McIDASV mcv)
Builds a (filtered) subset of the McIDAS-V system properties and returns
the results as a
String . |
static String |
getStateAsString(McIDASV mcv,
boolean firehose)
Builds the McIDAS-V system properties and returns the results as a
String . |
static Rectangle |
getVirtualDisplayBounds() |
static String |
getVisadVersionString()
Gets a human-friendly representation of the version information embedded
within VisAD's "DATE" file.
|
private static <T> T |
hackyMethodCall(String methodName,
T defaultValue)
Attempt to invoke
OperatingSystemMXBean.methodName via
reflection. |
static Map<String,String> |
queryIdvBuildProperties()
Returns a
Map of the (currently) most useful contents of
ucar/unidata/idv/resources/build.properties . |
static Map<String,Object> |
queryJava3d()
Polls Java 3D for information about its environment.
|
static Map<Object,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 Map<String,String> |
queryMachine()
Polls Java for information about the user's machine.
|
static Map<String,String> |
queryMcvBuildProperties()
Returns a
Map of the (currently) most useful contents of
edu/wisc/ssec/mcidasv/resources/build.properties . |
static Map<String,Object> |
queryMcvState(McIDASV mcv)
Queries McIDAS-V for information about its state.
|
static Map<String,String> |
queryNcidvBuildProperties()
|
static Map<String,String> |
queryOpSysProps()
Attempts to call methods belonging to
com.sun.management.OperatingSystemMXBean . |
static Map<String,String> |
queryVisadBuildProperties()
Returns a
Map containing any relevant version information. |
private static final org.slf4j.Logger logger
private SystemState()
public static String escapeWhitespaceChars(CharSequence sequence)
private static <T> T hackyMethodCall(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 Map<Object,Object> queryJythonProps()
public static Map<String,String> queryOpSysProps()
com.sun.management.OperatingSystemMXBean
. If successful, we'll
have the following information:
public static Map<String,String> queryMachine()
Map
of properties that describes the user's machine.public static Map<Integer,Rectangle> getDisplayBounds()
Rectangle
that represents the "bounds" of the display.public static Rectangle getVirtualDisplayBounds()
public static Map<String,Object> queryJava3d()
VirtualUniverse.getProperties()
and
Canvas3D.queryProperties()
.public static 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 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 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 String getNcidvVersionString()
String
that looks like
"netCDF-Java version <b>revision</b> <b>built</b>".private static InputStream getResourceAsStream(String name)
name
- File to open.InputStream
used to read name
, or null
if name
could not be found.public static Map<String,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 Map<String,String> queryNcidvBuildProperties()
Map
containing netCDF-Java version and build date.public static Map<String,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 Map<String,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 Map<String,Object> queryMcvState(McIDASV mcv)
mcv
- The McIDASV "god" object.public static 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 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.