edu.wisc.ssec.mcidasv.startupmanager
Enum Platform

java.lang.Object
  extended by java.lang.Enum<Platform>
      extended by edu.wisc.ssec.mcidasv.startupmanager.Platform
All Implemented Interfaces:
Serializable, Comparable<Platform>

public enum Platform
extends Enum<Platform>


Enum Constant Summary
UNIXLIKE
          Instance of unix-specific platform information.
WINDOWS
          Instance of windows-specific platform information.
 
Field Summary
private  int availableMemory
          Total amount of memory avilable in megabytes
private  String defaultPrefs
          Path to the preference file that ships with McIDAS-V.
private  String newLine
          Holds the platform's representation of a new line.
private  String pathSeparator
          Directory delimiter for the current platform.
private  String userDirectory
          Path to the user's "userpath" directory.
private  String userPrefs
          The path to the user's copy of the startup preferences.
 
Method Summary
 int getAvailableMemory()
          Returns the amount of available memory in megabytes
 String getDefaultPrefs()
          Returns the path of the startup preferences included in the McIDAS-V distribution.
 String getNewLine()
          Returns the platform's notion of a new line.
 String getUserBundles()
           
 String getUserDirectory()
          Returns the path to the user's "userpath" directory.
 String getUserFile(String filename)
          Returns the path to a file in the user's "userpath" directory.
 String getUserPrefs()
          Returns the path of user's copy of the startup preferences.
 void setAvailableMemory(String megabytes)
          Sets the amount of available memory.
 void setUserDirectory(String path)
          Sets the path to the user's userpath directory explicitly.
 String toString()
          Returns a brief summary of the platform specific file locations.
static Platform valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Platform[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

UNIXLIKE

public static final Platform UNIXLIKE
Instance of unix-specific platform information.


WINDOWS

public static final Platform WINDOWS
Instance of windows-specific platform information.

Field Detail

userDirectory

private String userDirectory
Path to the user's "userpath" directory.


userPrefs

private String userPrefs
The path to the user's copy of the startup preferences.


defaultPrefs

private final String defaultPrefs
Path to the preference file that ships with McIDAS-V.


newLine

private final String newLine
Holds the platform's representation of a new line.


pathSeparator

private final String pathSeparator
Directory delimiter for the current platform.


availableMemory

private int availableMemory
Total amount of memory avilable in megabytes

Method Detail

values

public static Platform[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (Platform c : Platform.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static Platform valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
NullPointerException - if the argument is null

setUserDirectory

public void setUserDirectory(String path)
Sets the path to the user's userpath directory explicitly.

Parameters:
path - New path. Cannot be null.

setAvailableMemory

public void setAvailableMemory(String megabytes)
Sets the amount of available memory. megabytes must be greater than or equal to zero.

Parameters:
megabytes - Memory in megabytes
Throws:
NullPointerException - if megabytes is null.
IllegalArgumentException - if megabytes is less than zero or does not represent an integer.
See Also:
StartupManager.getArgs(boolean, boolean, java.lang.String[], java.util.Properties)

getUserDirectory

public String getUserDirectory()
Returns the path to the user's "userpath" directory.

Returns:
Path to the user's directory.

getUserFile

public String getUserFile(String filename)
Returns the path to a file in the user's "userpath" directory.

Parameters:
filename - Filename within the userpath. Cannot be null, but does not need to be a filename that already exists within the userpath.
Returns:
Path to a file in the user's directory. Note: the file may not yet exist.

getUserBundles

public String getUserBundles()

getAvailableMemory

public int getAvailableMemory()
Returns the amount of available memory in megabytes

Returns:
Available memory in megabytes

getUserPrefs

public String getUserPrefs()
Returns the path of user's copy of the startup preferences.

Returns:
Path to the user's startup preferences file.

getDefaultPrefs

public String 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:
OptionMaster.normalizeUserDirectory()

getNewLine

public String getNewLine()
Returns the platform's notion of a new line.

Returns:
Unix-like: \n; Windows: \r\n.

toString

public String toString()
Returns a brief summary of the platform specific file locations. Please note that the format and contents are subject to change.

Overrides:
toString in class Enum<Platform>
Returns:
String that looks like [Platform@HASHCODE: defaultPrefs=..., userDirectory=..., userPrefs=...]