edu.wisc.ssec.mcidasv.startupmanager.options
Class OptionMaster

java.lang.Object
  extended by edu.wisc.ssec.mcidasv.startupmanager.options.OptionMaster

public class OptionMaster
extends Object


Nested Class Summary
static class OptionMaster.OptionPlatform
          Options can be either platform-specific or applicable to all platforms.
static class OptionMaster.Type
          The different types of Options.
static class OptionMaster.Visibility
          Different ways that an Option might be displayed.
 
Field Summary
 Object[][] blahblah
           
private static OptionMaster instance
           
private  Map<String,? extends Option> optionMap
          Maps an option ID to the corresponding object.
 
Constructor Summary
OptionMaster()
           
 
Method Summary
private  Map<String,Option> buildOptions(Object[][] options)
          Creates the specified options and returns a mapping of the option ID to the actual Option object.
protected  OptionMaster.OptionPlatform convertToOptionPlatform()
          Converts a OptionMaster.OptionPlatform to its corresponding OptionMaster.OptionPlatform type.
 Collection<Option> getAllOptions()
          Returns all the available startup manager options.
 BooleanOption getBooleanOption(String id)
          Searches optionMap for the BooleanOption that corresponds with the given id.
 DirectoryOption getDirectoryOption(String id)
          Searches optionMap for the DirectoryOption that corresponds with the given id.
static OptionMaster getInstance()
           
 LoggerLevelOption getLoggerLevelOption(String id)
          Searches optionMap for the LoggerLevelOption that corresponds with the given id.
 MemoryOption getMemoryOption(String id)
          Searches optionMap for the MemoryOption that corresponds with the given id.
private  Option getOption(String id)
          Returns the Option mapped to id.
 SliderOption getSliderOption(String id)
          Searches optionMap for the SliderOption that corresponds with the given id.
 TextOption getTextOption(String id)
          Searches optionMap for the TextOption that corresponds with the given id.
private  void normalizeUserDirectory()
           
 List<Option> optionsByPlatform(Collection<OptionMaster.OptionPlatform> platforms)
          Returns the Options applicable to the given OptionPlatforms.
 List<Option> optionsByType(Collection<OptionMaster.Type> types)
          Returns the Options that match the given Types.
 List<Option> optionsByVisibility(Collection<OptionMaster.Visibility> visibilities)
          Returns the Options that match the given levels of visibility.
 void readStartup()
           
 void writeStartup()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

blahblah

public final Object[][] blahblah

optionMap

private Map<String,? extends Option> optionMap
Maps an option ID to the corresponding object.


instance

private static OptionMaster instance
Constructor Detail

OptionMaster

public OptionMaster()
Method Detail

getInstance

public static OptionMaster getInstance()

buildOptions

private Map<String,Option> buildOptions(Object[][] options)
Creates the specified options and returns a mapping of the option ID to the actual Option object.

Parameters:
options - An array specifying the Options to be built.
Returns:
Mapping of ID to Option.
Throws:
AssertionError - if the option array contained an entry that this method cannot build.

convertToOptionPlatform

protected OptionMaster.OptionPlatform convertToOptionPlatform()
Converts a OptionMaster.OptionPlatform to its corresponding OptionMaster.OptionPlatform type.

Returns:
The current platform as a OptionPlatform type.
Throws:
AssertionError - if StartupManager.getPlatform() returned something that this method cannot convert.

getOption

private Option getOption(String id)
Returns the Option mapped to id.

Parameters:
id - The ID whose associated Option is to be returned.
Returns:
Either the Option associated with id, or null if there was no association.
See Also:
getMemoryOption(java.lang.String), getBooleanOption(java.lang.String), getDirectoryOption(java.lang.String), getSliderOption(java.lang.String), getTextOption(java.lang.String), getLoggerLevelOption(java.lang.String)

getMemoryOption

public MemoryOption getMemoryOption(String id)
Searches optionMap for the MemoryOption that corresponds with the given id.

Parameters:
id - Identifier for the desired MemoryOption. Should not be null.
Returns:
Either the MemoryOption that corresponds to id or null.

getBooleanOption

public BooleanOption getBooleanOption(String id)
Searches optionMap for the BooleanOption that corresponds with the given id.

Parameters:
id - Identifier for the desired BooleanOption. Should not be null.
Returns:
Either the BooleanOption that corresponds to id or null.

getDirectoryOption

public DirectoryOption getDirectoryOption(String id)
Searches optionMap for the DirectoryOption that corresponds with the given id.

Parameters:
id - Identifier for the desired DirectoryOption. Should not be null.
Returns:
Either the DirectoryOption that corresponds to id or null.

getSliderOption

public SliderOption getSliderOption(String id)
Searches optionMap for the SliderOption that corresponds with the given id.

Parameters:
id - Identifier for the desired SliderOption. Should not be null.
Returns:
Either the SliderOption that corresponds to id or null.

getTextOption

public TextOption getTextOption(String id)
Searches optionMap for the TextOption that corresponds with the given id.

Parameters:
id - Identifier for the desired TextOption. Should not be null.
Returns:
Either the TextOption that corresponds to id or null.

getLoggerLevelOption

public LoggerLevelOption getLoggerLevelOption(String id)
Searches optionMap for the LoggerLevelOption that corresponds with the given id.

Parameters:
id - Identifier for the desired LoggerLevelOption. Should not be null.
Returns:
Either the LoggerLevelOption that corresponds to id or null.

getAllOptions

public Collection<Option> getAllOptions()
Returns all the available startup manager options.

Returns:
Either all available startup manager options or an empty Collection.

optionsByPlatform

public List<Option> optionsByPlatform(Collection<OptionMaster.OptionPlatform> platforms)
Returns the Options applicable to the given OptionPlatforms.

Parameters:
platforms - Desired platforms. Cannot be null.
Returns:
Either a List of {code Option}-s applicable to platforms or an empty List.

optionsByType

public List<Option> optionsByType(Collection<OptionMaster.Type> types)
Returns the Options that match the given Types.

Parameters:
types - Desired Option types. Cannot be null.
Returns:
Either the List of Option-s that match the given types or an empty List.

optionsByVisibility

public List<Option> optionsByVisibility(Collection<OptionMaster.Visibility> visibilities)
Returns the Options that match the given levels of visibility.

Parameters:
visibilities - Desired visibility levels. Cannot be null.
Returns:
Either the List of Option-s that match the given visibility levels or an empty List.

normalizeUserDirectory

private void normalizeUserDirectory()

readStartup

public void readStartup()

writeStartup

public void writeStartup()