Class HardwareInfo
java.lang.Object
com.iizix.os.HardwareInfo
Hardware information class using "OSHI".
- Author:
- Christopher Mindus
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe prefix of an environment variable's entry in the hardware map.static final Stringstatic final StringThe key of the hardware map that names the platform itsEnv-andSysProp-entries were chosen by: one ofPLATFORM_WINDOWS,PLATFORM_LINUX,PLATFORM_MACOS,PLATFORM_AIX,PLATFORM_OTHERandPLATFORM_UNKNOWN.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringThe platforms: the four with a list of their own,PLATFORM_OTHERfor every other operating system Java names, andPLATFORM_UNKNOWNwhen it names none - its lists are empty, so a map of an unknown platform holds no environment at all.static final StringThe prefix of a Java system property's entry in the hardware map.Method Summary
Modifier and TypeMethodDescriptionallowedEnvironmentNames(String platform) Gets the environment variables allowed into the hardware map on a platform.get(HardwareIdentication info, boolean fresh, boolean update, String... ipAddresses) Gets the information as specified by the hardware information.static HardwareInfoGets the instance.Gets the map of all hardware properties.static booleanisAllowedEntry(String platform, String name) Tells whether an entry of the hardware map is allowed on a platform: anEnv-entry whose variable is on the platform's list, aSysProp-entry whose property is shared, and every other entry (the hardware itself).static booleanisAllowedEnvironmentName(String platform, String name) Tells whether an environment variable is allowed into the hardware map on a platform.static booleanisAllowedSystemPropertyName(String platform, String name) Tells whether a Java system property is allowed into the hardware map on a platform: on a known platform the shared ones, which describe the Java runtime, the operating system, the encodings and the locale (StringMapProp.isSharedSystemProperty(String)); none on an unknown platform.static StringplatformOf(String osName) Classifies the name of an operating system, as the Java system propertyos.namegives it, as a platform.static StringplatformOf(Map<String, String> hardwareMap) Gets the platform a hardware map names in itsPLATFORM_KEYentry.static intretainAllowedEntries(Map<String, String> hardwareMap) Removes from a hardware map everyEnv-andSysProp-entry that the platform the map names does not allow: what the License Server does with a map it receives, so that a client built before the lists, or a modified one, cannot fill its table.toString()Outputs the info as a string.
Field Details
PLATFORM_KEY
The key of the hardware map that names the platform itsEnv-andSysProp-entries were chosen by: one ofPLATFORM_WINDOWS,PLATFORM_LINUX,PLATFORM_MACOS,PLATFORM_AIX,PLATFORM_OTHERandPLATFORM_UNKNOWN. The License Server reads it to apply the same lists on receipt (retainAllowedEntries(Map)).- See Also:
ENV_PREFIX
The prefix of an environment variable's entry in the hardware map.- See Also:
SYSPROP_PREFIX
The prefix of a Java system property's entry in the hardware map.- See Also:
PLATFORM_WINDOWS
The platforms: the four with a list of their own,PLATFORM_OTHERfor every other operating system Java names, andPLATFORM_UNKNOWNwhen it names none - its lists are empty, so a map of an unknown platform holds no environment at all.- See Also:
PLATFORM_LINUX
- See Also:
PLATFORM_MACOS
- See Also:
PLATFORM_AIX
- See Also:
PLATFORM_OTHER
- See Also:
PLATFORM_UNKNOWN
- See Also:
Method Details
getInstance
Gets the instance.platformOf
platformOf
Gets the platform a hardware map names in itsPLATFORM_KEYentry.- Parameters:
hardwareMap- The map, null for none.- Returns:
- The platform;
PLATFORM_UNKNOWNwhen the map names none or one that is not aPLATFORM_constant (a client built before the lists, or a modified one).
allowedEnvironmentNames
isAllowedEnvironmentName
isAllowedSystemPropertyName
Tells whether a Java system property is allowed into the hardware map on a platform: on a known platform the shared ones, which describe the Java runtime, the operating system, the encodings and the locale (StringMapProp.isSharedSystemProperty(String)); none on an unknown platform.- Parameters:
platform- The platform.name- The property's name, null for none.- Returns:
- true when it is allowed.
isAllowedEntry
Tells whether an entry of the hardware map is allowed on a platform: anEnv-entry whose variable is on the platform's list, aSysProp-entry whose property is shared, and every other entry (the hardware itself).- Parameters:
platform- The platform.name- The entry's name, null for none.- Returns:
- true when it is allowed.
retainAllowedEntries
Removes from a hardware map everyEnv-andSysProp-entry that the platform the map names does not allow: what the License Server does with a map it receives, so that a client built before the lists, or a modified one, cannot fill its table. A map that names no platform keeps none of them.- Parameters:
hardwareMap- The map, null for none.- Returns:
- The number of entries removed.
getProperties
Gets the map of all hardware properties.- Returns:
- The linked hash map.
toString
get
Gets the information as specified by the hardware information.- Parameters:
info- The hardware information to return.fresh- Flag indicating the information must be fresh (in case hardware has changed).update- Flag to update refreshed information.ipAddresses- Only these addresses will be included. If the list is empty, all are included.This list of addresses is only used for for:
- HardwareIdentication.HostAddressesIPv4,
- HardwareIdentication.HostNamesWithDomain, and
- HardwareIdentication.HostNames.Note: the flags "fresh" and "update" are not used if you specify a specific list of IP addresses.
- Returns:
- The string formatted according to specification of the "info".