AConfigService¶
-
public abstract class
AConfigService
<TSubject, TConfig>¶ Stores and retrieves configurations using the
Configuration
class.
Fields¶
configReaderWriter¶
-
protected final AConfigurationReaderWriter
configReaderWriter
¶
Constructors¶
AConfigService¶
-
protected
AConfigService
(AConfigurationReaderWriter configReaderWriter)¶ Initializes a new instance of the
AConfigService
class.Parameters: - configReaderWriter – The configuration reader/writer.
Methods¶
available¶
-
public boolean
available
(FileObject rootDirectory)¶ Checks if a configuration exists for a subject.
Parameters: - rootDirectory – The root directory of the subject to get the configuration for.
Returns: True if a configuration exists, false otherwise.
fromConfig¶
-
protected abstract HierarchicalConfiguration<ImmutableNode>
fromConfig
(TConfig config)¶ Creates a new hierarchical configuration for the specified config object.
Parameters: - config – The config object.
Returns: The configuration.
get¶
-
public ConfigRequest<TConfig>
get
(FileObject rootDirectory)¶ Gets the configuration for the a subject.
Parameters: - rootDirectory – The root directory of the subject to get the configuration for.
Returns: The configuration, or
null
when no configuration could be retrieved.
getConfigFile¶
-
protected FileObject
getConfigFile
(TSubject subject)¶ Gets the configuration file for the specified subject.
Parameters: - subject – The subject.
Throws: - FileSystemException –
Returns: The configuration file.
getConfigFile¶
-
protected abstract FileObject
getConfigFile
(FileObject rootFolder)¶ Gets the configuration file for the specified subject.
Parameters: - rootFolder – The root folder.
Throws: - FileSystemException –
Returns: The configuration file.
getFromConfigFile¶
-
public ConfigRequest<TConfig>
getFromConfigFile
(FileObject configFile, FileObject rootFolder)¶ Gets the configuration from the given file.
Parameters: - configFile – The configuration file with the configuration.
Returns: The configuration, or
null
when no configuration could be retrieved.
getRootDirectory¶
-
protected abstract FileObject
getRootDirectory
(TSubject subject)¶ Gets the configuration file for the specified subject.
Parameters: - subject – The subject.
Throws: - FileSystemException –
Returns: The configuration file.
readConfig¶
-
protected HierarchicalConfiguration<ImmutableNode>
readConfig
(FileObject configFile, FileObject rootDirectory)¶ Reads a configuration from a file.
Parameters: - configFile – The configuration file to read.
Throws: - IOException –
- ConfigurationException –
Returns: The read configuration, or
null
when the configuration could not be read.
toConfig¶
-
protected abstract ConfigRequest<TConfig>
toConfig
(HierarchicalConfiguration<ImmutableNode> config, FileObject configFile)¶ Creates a new instance of the config type for the specified configuration.
Parameters: - configuration – The configuration.
write¶
-
public void
write
(TSubject subject, TConfig config, IFileAccess access)¶ Writes the configuration for the given subject.
Parameters: - subject – The subject to set the configuration for.
- config – The configuration, or
null
to remove an existing configuration. - access –
write¶
-
public void
write
(FileObject rootDirectory, TConfig config, IFileAccess access)¶ Writes the configuration for the given subject.
Parameters: - rootDirectory – The root directory of the subject to set the configuration for.
- config – The configuration, or
null
to remove an existing configuration. - access –
writeConfig¶
-
protected void
writeConfig
(FileObject configFile, HierarchicalConfiguration<ImmutableNode> config, FileObject rootDirectory)¶ Writes a configuration to a file.
Parameters: - configFile – The configuration file to write to.
- config – The configuration to write, or
null
to delete the configuration file. - rootDirectory – The root folder.
Throws: - IOException –
- ConfigurationException –