gov.nih.nlm.mms
Class UserConfiguration

java.lang.Object
  extended bygov.nih.nlm.mms.UserConfiguration
Direct Known Subclasses:
ApplicationConfiguration

public class UserConfiguration
extends Object

Represents a set of user configurations, including all of the relevant filter configuration data.

Author:
Deborah Shapiro, Brian Carlsen

Field Summary
protected  List default_subsets
           
protected  DefaultSubset selected_default_subset
           
 
Constructor Summary
UserConfiguration(File config_file)
          Instantiates a UserConfiguration from the specified properties File.
UserConfiguration(Properties p)
          Instantiates a UserConfiguration from the specified Properties.
 
Method Summary
 void addProperty(String key, String value)
          Adds a property.
 void addSourcePath(String ip)
          Adds a path to the list of installation sources.
 void clearFilters()
          Clears the active filter list.
 void clearProperties(Configurable f)
          Clears the properties associated with a particular Configurable.
 void clearSourcePaths()
          Clears the list of installation sources.
 boolean didLoadCauseWarnings()
          Indicates if there were warnings while loading the user configuration file.
 void enableFilter(Filter f)
          Enables the specified valid filter.
 List getActiveFilters()
          Returns the List of active Filters.
 boolean getAutomaticSelection()
          Returns a flag indicating whether or not "auto selection mode" is on.
 List getConceptContentSelectors()
          Returns the List of active ConceptContentSelectors.
 List getConceptManipulators()
          Returns the List of active ConceptManipulators.
 List getConceptSelectors()
          Returns the List of active ConceptSelectors.
 String getCurrentConfigurationFilename()
          Returns the path to the current configuration file.
 DefaultSubset[] getDefaultSubsets()
          Returns all available DefaultSubsets.
 List getDefaultSubsetsAsList()
          Returns all available DefaultSubsets as a List.
 MetamorphoSysInputStream getInputStream()
          Returns the ConceptInputStream selected by the user.
 String getLoadWarningsReport()
          Returns a report indicating all warnings that occurred while loading the user configuration file.
 List getOldStyleFilters()
          Returns the List of old style filters.
 MetamorphoSysOutputStream getOutputStream()
          Returns the ConceptOutputStream selected by the user.
 Properties getProperties(Configurable f)
          Return the Properties corresponding to the specified Configurable.
 String getProperty(GUIConfigurable f, String key)
          Returns the GUIConfigurable-specific property value.
 String getReleaseDate()
          Returns a String indicating the release date corresponding to the configuration file being used.
 String getReleaseDescription()
          Returns a String indicating the release description corresponding to the configuration file being used.
 String getReleaseVersion()
          Returns a String indicating the release version corresponding to the configuration file being used.
 DefaultSubset getSelectedDefaultSubset()
          Returns the selected DefaultSubset.
 String[] getSourcePaths()
          Returns paths to the the installation sources.
 String getSubsetDirectory()
          Returns path to the the subset folder.
 List getValidFilters()
          Returns the List of valid Filters.
 boolean hasDataChanged()
          Returns a flag indicating whether or not the user has changed the underlying configuration since it was last loaded or saved.
 void importFilter(Filter f)
          Imports and enables the specified filter.
 boolean isOutputVersioned()
          Returns true if output stream should write versioned format.
protected  Properties load(String file)
          Loads Properties from the specified file.
protected  Properties loadProperties(Properties props)
          Configures the class based on the Properties.
 void removeProperty(GUIConfigurable f, String key)
          Removes the GUIConfigurable-specific property value.
 void removeSourcePath(String ip)
          Removes a path from the list of installation sources.
 void reorderActiveFilters(int initial_index, int final_index)
          Moves the active filter at initial_index to insert it before final_index.
 void resetDataChanged()
          Resets the "has data changed" flag to false.
 void saveState(File file_path)
          Saves the configuration properties to the specified File.
 void setAutomaticSelection(boolean b)
          Sets the "automatic selection mode" flag.
 void setCurrentConfigFile(String file)
          Sets the path to the current configuration file.
 void setInputStream(MetamorphoSysInputStream input_stream)
          Sets the class name of the ConceptInputStream to be used during subsetting and instantiates it.
 void setOutputStream(MetamorphoSysOutputStream output_stream)
          Sets the ConceptOutputStream to be used during subsetting and instantiates it.
 void setProperties(Configurable f)
          Set the Properties corresponding to the specified Configurable.
 void setPropertiesChanged()
          Sets the flag indicating that the non-filter properties have changed.
 void setSelectedDefaultSubset(DefaultSubset ds)
          Sets the selected DefaultSubset.
 void setSourcePaths(String[] ip)
          Sets the paths to the installation sources.
 void setSubsetDirectory(String sd)
          Sets the path to the subset folder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

default_subsets

protected List default_subsets

selected_default_subset

protected DefaultSubset selected_default_subset
Constructor Detail

UserConfiguration

public UserConfiguration(File config_file)
                  throws LocalException
Instantiates a UserConfiguration from the specified properties File.

Parameters:
config_file - a valid Java properties File
Throws:
LocalException - if there is a problem loading the properties file.

UserConfiguration

public UserConfiguration(Properties p)
                  throws LocalException
Instantiates a UserConfiguration from the specified Properties.

Parameters:
p - Properties
Throws:
LocalException - if there is a problem loading the properties.
Method Detail

getSourcePaths

public String[] getSourcePaths()
Returns paths to the the installation sources.

Returns:
paths to the the installation sources.

setSourcePaths

public void setSourcePaths(String[] ip)
Sets the paths to the installation sources.

Parameters:
ip - the paths to the installation sources

addSourcePath

public void addSourcePath(String ip)
Adds a path to the list of installation sources.

Parameters:
ip - source path to be added

removeSourcePath

public void removeSourcePath(String ip)
Removes a path from the list of installation sources.

Parameters:
ip - source path to be removed

clearSourcePaths

public void clearSourcePaths()
Clears the list of installation sources.


getSubsetDirectory

public String getSubsetDirectory()
Returns path to the the subset folder.

Returns:
path to the the subset folder.

setSubsetDirectory

public void setSubsetDirectory(String sd)
Sets the path to the subset folder.

Parameters:
sd - the path to the subset folder

getInputStream

public MetamorphoSysInputStream getInputStream()
Returns the ConceptInputStream selected by the user.

Returns:
the ConceptInputStream selected by the user

setInputStream

public void setInputStream(MetamorphoSysInputStream input_stream)
Sets the class name of the ConceptInputStream to be used during subsetting and instantiates it.

Parameters:
input_stream - input stream

getOutputStream

public MetamorphoSysOutputStream getOutputStream()
Returns the ConceptOutputStream selected by the user.

Returns:
the ConceptOutputStream selected by the user

setOutputStream

public void setOutputStream(MetamorphoSysOutputStream output_stream)
Sets the ConceptOutputStream to be used during subsetting and instantiates it.

Parameters:
output_stream - output stream

getCurrentConfigurationFilename

public String getCurrentConfigurationFilename()
Returns the path to the current configuration file.

Returns:
the path to the current configuration file.

setCurrentConfigFile

public void setCurrentConfigFile(String file)
Sets the path to the current configuration file.

Parameters:
file - the String path to the current configuration file

getAutomaticSelection

public boolean getAutomaticSelection()
Returns a flag indicating whether or not "auto selection mode" is on.

Returns:
true if automatic selection mode is enabled, false otherwise.

setAutomaticSelection

public void setAutomaticSelection(boolean b)
Sets the "automatic selection mode" flag.

Parameters:
b - the "automatic selection mode" flag

getConceptSelectors

public List getConceptSelectors()
Returns the List of active ConceptSelectors. These are ConceptSelectors that have been loaded or imported and enabled.

Returns:
the List of active ConceptSelectors

getConceptContentSelectors

public List getConceptContentSelectors()
Returns the List of active ConceptContentSelectors. These are ConceptContentSelectors that have been loaded or imported and enabled.

Returns:
the List of active ConceptContentSelectors

getConceptManipulators

public List getConceptManipulators()
Returns the List of active ConceptManipulators. These are ConceptManipulators that have been loaded or imported and enabled.

Returns:
the List of active ConceptManipulators

getOldStyleFilters

public List getOldStyleFilters()
Returns the List of old style filters. These are not instances of ConceptSelector, ConceptManipulator, or ConceptContentSelector.

Returns:
the List of active old style filters

getActiveFilters

public List getActiveFilters()
Returns the List of active Filters. These are filters that have been loaded or imported and enabled.

Returns:
the List of active Filters

reorderActiveFilters

public void reorderActiveFilters(int initial_index,
                                 int final_index)
Moves the active filter at initial_index to insert it before final_index.

Parameters:
initial_index - position of filter initially
final_index - position of filter after reorder

getValidFilters

public List getValidFilters()
Returns the List of valid Filters. These are filters that have been loaded but not enabled.

Returns:
the List of valid Filters

isOutputVersioned

public boolean isOutputVersioned()
Returns true if output stream should write versioned format. false if output stream should write versionless format.

Returns:
true if output stream should write versioned format false if output stream should write versionless format

getProperties

public Properties getProperties(Configurable f)
Return the Properties corresponding to the specified Configurable.

Parameters:
f - the Configurable
Returns:
the Properties corresponding to the specified Configurable

setProperties

public void setProperties(Configurable f)
Set the Properties corresponding to the specified Configurable.

Parameters:
f - Configurable

getProperty

public String getProperty(GUIConfigurable f,
                          String key)
Returns the GUIConfigurable-specific property value.

Parameters:
f - a GUIConfigurable
key - a property name specific to the specified GUIConfigurable
Returns:
the GUIConfigurable-specific property value

removeProperty

public void removeProperty(GUIConfigurable f,
                           String key)
Removes the GUIConfigurable-specific property value.

Parameters:
f - a GUIConfigurable
key - a property name specific to the specified GUIConfigurable

clearProperties

public void clearProperties(Configurable f)
Clears the properties associated with a particular Configurable.

Parameters:
f - the Configurable

enableFilter

public void enableFilter(Filter f)
Enables the specified valid filter. This involves adding it to the active filter list.

Parameters:
f - the Filter to enable

importFilter

public void importFilter(Filter f)
Imports and enables the specified filter. This involves adding it to the valid filter list.

Parameters:
f - the Filter to import

clearFilters

public void clearFilters()
Clears the active filter list.


hasDataChanged

public boolean hasDataChanged()
Returns a flag indicating whether or not the user has changed the underlying configuration since it was last loaded or saved.

Returns:
true if changed have been made, false otherwise

resetDataChanged

public void resetDataChanged()
Resets the "has data changed" flag to false.


setPropertiesChanged

public void setPropertiesChanged()
Sets the flag indicating that the non-filter properties have changed.


getReleaseVersion

public String getReleaseVersion()
Returns a String indicating the release version corresponding to the configuration file being used.

Returns:
a String indicating the release version corresponding to the configuration file being used.

getReleaseDate

public String getReleaseDate()
Returns a String indicating the release date corresponding to the configuration file being used.

Returns:
a String indicating the release date corresponding to the configuration file being used.

getReleaseDescription

public String getReleaseDescription()
Returns a String indicating the release description corresponding to the configuration file being used.

Returns:
a String indicating the release description corresponding to the configuration file being used.

getLoadWarningsReport

public String getLoadWarningsReport()
Returns a report indicating all warnings that occurred while loading the user configuration file.

Returns:
String report of warnings

didLoadCauseWarnings

public boolean didLoadCauseWarnings()
Indicates if there were warnings while loading the user configuration file.

Returns:
boolean true if warnings occurred false otherwise

load

protected Properties load(String file)
                   throws LocalException
Loads Properties from the specified file. This method should be overridden by subclasses. It opens the named properties file, configures the class and returns the Properties object intact.

Parameters:
file - a String filename
Returns:
Properties
Throws:
LocalException - if there is a problem loading the properties

loadProperties

protected Properties loadProperties(Properties props)
                             throws LocalException
Configures the class based on the Properties.

Parameters:
props - user-level Properties
Returns:
Properties
Throws:
LocalException - if there is a problem loading the properties

saveState

public void saveState(File file_path)
               throws LocalException
Saves the configuration properties to the specified File.

Parameters:
file_path - the File
Throws:
LocalException - if there is an error while saving the configuration

setSelectedDefaultSubset

public void setSelectedDefaultSubset(DefaultSubset ds)
Sets the selected DefaultSubset.

Parameters:
ds - the selected DefaultSubset

getSelectedDefaultSubset

public DefaultSubset getSelectedDefaultSubset()
Returns the selected DefaultSubset.

Returns:
the selected DefaultSubset

getDefaultSubsets

public DefaultSubset[] getDefaultSubsets()
Returns all available DefaultSubsets.

Returns:
all available DefaultSubsets

getDefaultSubsetsAsList

public List getDefaultSubsetsAsList()
Returns all available DefaultSubsets as a List.

Returns:
all available DefaultSubsets as a List

addProperty

public void addProperty(String key,
                        String value)
Adds a property. This is used to set filter properties.

Parameters:
key - the String key
value - the String value


Copyright ©2005