Enum Class Platform
- All Implemented Interfaces:
Serializable
,Comparable<Platform>
,Constable
Represents platform specific details used by McIDAS-V. In particular, there
are useful methods related to the McIDAS-V "userpath".
Currently McIDAS-V distinguishes between "Unix-like", macOS,
and "Windows"; these can be accessed using
Platform.UNIXLIKE
, Platform.WINDOWS
,
or Platform.MAC
.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
Total amount of memory avilable in megabytesprivate final String
Path to the preference file that ships with McIDAS-V.private final String
Holds the platform's representation of a new line.private final String
Path to the bundles subdirectory withinuserDirectory
.private String
Path to the user's "userpath" directory.private String
The path to the user's copy of the startup preferences. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the amount of available memory in megabytes.Returns the path of the startup preferences included in the McIDAS-V distribution.Returns the platform's notion of a new line.Returns the path to the user's bundles directory.Returns the path to the user's "userpath" directory.getUserFile
(String filename) Returns the path to a file in the user's "userpath" directory.Returns the path of user's copy of the startup preferences.void
setAvailableMemory
(String megabytes) Deprecated.There's not really a need for this method; the JVM can tell us the amount of memory.void
setUserDirectory
(String path) Sets the path to the user's "userpath" directory explicitly.toString()
Returns a brief summary of the platform specific file locations.static Platform
Returns the enum constant of this class with the specified name.static Platform[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
UNIXLIKE
Instance of unix-specific platform information. -
MAC
macOS-specicfic platform information. -
WINDOWS
Instance of windows-specific platform information.
-
-
Field Details
-
userDirectory
Path to the user's "userpath" directory. -
userPrefs
The path to the user's copy of the startup preferences. -
defaultPrefs
Path to the preference file that ships with McIDAS-V. -
newLine
Holds the platform's representation of a new line. -
userBundles
Path to the bundles subdirectory withinuserDirectory
. -
availableMemory
Total amount of memory avilable in megabytes
-
-
Constructor Details
-
Platform
Initializes the platform-specific paths to the different files required by the startup manager.- Parameters:
defaultPrefs
- Path to the preferences file that ships with McIDAS-V. Cannot benull
or empty.newLine
- Character(s!) that represent a new line for this platform. Cannot benull
or empty.- Throws:
NullPointerException
- if eitherdefaultPrefs
ornewLine
arenull
.IllegalArgumentException
- if eitherdefaultPrefs
ornewLine
are an empty string.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
setUserDirectory
Sets the path to the user's "userpath" directory explicitly. If the specified path does not yet exist, this method will first attempt to create it. The method will then attempt to verify whether or not McIDAS-V can use the path.- Parameters:
path
- New path. Cannot benull
, but does not have to exist prior to running this method. Be aware that this method will attempt to createpath
if it does not already exist.- Throws:
IllegalArgumentException
- ifpath
is not a directory, or if it not both readable and writable.
-
setAvailableMemory
Deprecated.There's not really a need for this method; the JVM can tell us the amount of memory.Sets the amount of available memory.megabytes
must be greater than or equal to zero.- Parameters:
megabytes
- Memory in megabytes.- Throws:
NullPointerException
- ifmegabytes
isnull
.IllegalArgumentException
- ifmegabytes
is less than zero or does not represent an integer.- See Also:
-
getUserDirectory
Returns the path to the user's "userpath" directory.- Returns:
- Path to the user's directory.
-
getUserFile
Returns the path to a file in the user's "userpath" directory.- Parameters:
filename
- Filename within theuserpath
. Cannot benull
, but does not need to be a filename that already exists within theuserpath
.- Returns:
- Path to a file in the user's directory. Note: the file may not yet exist.
-
getUserBundles
Returns the path to the user's bundles directory. Note: this should be a directory withingetUserDirectory()
.- Returns:
- Path to the user's bundles directory.
-
getAvailableMemory
Returns the amount of available memory in megabytes.- Returns:
- Available memory in megabytes.
-
getUserPrefs
Returns the path of user's copy of the startup preferences.- Returns:
- Path to the user's startup preferences file.
-
getDefaultPrefs
Returns the path of the startup preferences included in the McIDAS-V distribution. Mostly useful for normalizing the user directory.- Returns:
- Path to the default startup preferences.
- See Also:
-
getNewLine
Returns the platform's notion of a new line.- Returns:
- Unix-like: \n; Windows: \r\n.
-
toString
Returns a brief summary of the platform specific file locations. Please note that the format and contents are subject to change.
-