Package gda.util.userOptions
Interface UserOptionsService
- All Superinterfaces:
Configurable,Findable
- All Known Implementing Classes:
UserOptionsManager
Service Interface for maintaining run-time options with a set of current values stored in the specified location,
typically the current visit. A set of default (template) values are maintained in the beamline configuration.
Each UserOption is referenced in the service-provided Map by a key.
Properties are used to specify the template folder location and the default options filename
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionCreate a UserOptionsMap from the configuration template, using default values in templategetOptions(String directory, String filename) Fetches UserOptionsMap from specified fileFetches UserOptionsMap from current visit folderIndicates that a template is availableresetOptions(String directory, String filename) Replaces UserOptionsMap from specified file with the default template valuessaveOptions(String directory, String filename, UserOptionsMap options) Saves the UserOptionsMap to the specified filesaveOptionsCurrent(UserOptionsMap options) Saves the UserOptionsMap to the current visit directoryMethods inherited from interface gda.factory.Configurable
configure, isConfigureAtStartup, isConfigured, reconfigure
-
Field Details
-
PROP_OPTIONS_FILENAME
- See Also:
-
PROP_TEMPLATE_DIRECTORY
- See Also:
-
-
Method Details
-
createOptionsMapFromTemplate
UserOptionsMap createOptionsMapFromTemplate() throws org.apache.commons.configuration.ConfigurationException, IOExceptionCreate a UserOptionsMap from the configuration template, using default values in template- Returns:
- UserOptionsMap using default template values
- Throws:
org.apache.commons.configuration.ConfigurationExceptionIOException
-
getOptionsCurrent
UserOptionsMap getOptionsCurrent() throws org.apache.commons.configuration.ConfigurationException, IOExceptionFetches UserOptionsMap from current visit folder- Returns:
- UserOptionsMap with values from options file in visit folder
- Throws:
org.apache.commons.configuration.ConfigurationExceptionIOException
-
getOptions
UserOptionsMap getOptions(String directory, String filename) throws org.apache.commons.configuration.ConfigurationException, IOException Fetches UserOptionsMap from specified file- Parameters:
directory- location of options file namefilename- for options file- Returns:
- UserOptionsMap with template defaults updated by specified file
- Throws:
org.apache.commons.configuration.ConfigurationExceptionIOException
-
hasTemplate
Boolean hasTemplate()Indicates that a template is available- Returns:
- true if service is configured and template exists
-
resetOptions
UserOptionsMap resetOptions(String directory, String filename) throws org.apache.commons.configuration.ConfigurationException, IOException Replaces UserOptionsMap from specified file with the default template values- Parameters:
directory- location of options file namefilename- for options file- Returns:
- UserOptionsMap using default template values
- Throws:
org.apache.commons.configuration.ConfigurationExceptionIOException
-
saveOptions
UserOptionsMap saveOptions(String directory, String filename, UserOptionsMap options) throws org.apache.commons.configuration.ConfigurationException, IOException Saves the UserOptionsMap to the specified file- Parameters:
directory- location of options file namefilename- for options fileoptions- map of options to save- Returns:
- UserOptionsMap
- Throws:
org.apache.commons.configuration.ConfigurationExceptionIOException
-
saveOptionsCurrent
UserOptionsMap saveOptionsCurrent(UserOptionsMap options) throws org.apache.commons.configuration.ConfigurationException, IOException Saves the UserOptionsMap to the current visit directory- Parameters:
options- map of options to save- Returns:
- UserOptionsMap
- Throws:
org.apache.commons.configuration.ConfigurationExceptionIOException
-