Package com.chillycheesy.modulo.config
Class FileConfigurationFactory
java.lang.Object
com.chillycheesy.modulo.config.FileConfigurationFactory
- All Implemented Interfaces:
ConfigurationFactory
Create a
Configuration
from a Module and a source file.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected File
The destination config file.protected Module
Source module.protected InputStream
The source file input stream. -
Constructor Summary
ConstructorsConstructorDescriptionFileConfigurationFactory(Module module, File configFile, InputStream sourceInputStream)
Create a new FileConfigurationFactory.FileConfigurationFactory(Module module, File configFile, String internalSourcePath)
Create a new FileConfigurationFactory.FileConfigurationFactory(Module module, String configPath)
Create a new FileConfigurationFactory.FileConfigurationFactory(Module module, String configPath, InputStream sourceInputStream)
Create a new FileConfigurationFactory.FileConfigurationFactory(Module module, String configPath, String internalSourcePath)
Create a new FileConfigurationFactory. -
Method Summary
Modifier and TypeMethodDescriptioncreateConfiguration(ConfigurationLoaderStrategy loaderStrategy)
Create a new Configuration.Get the config file.Get the config file.Get the source input stream.void
saveConfiguration(Configuration configuration, ConfigurationLoaderStrategy loaderStrategy)
Save a configuration as a file.void
setConfigFile(File configFile)
Set the config file.void
Get the config file.void
setSourceInputStream(InputStream sourceInputStream)
Set the source input stream.
-
Field Details
-
module
Source module. -
configFile
The destination config file. -
sourceInputStream
The source file input stream.
-
-
Constructor Details
-
FileConfigurationFactory
Create a new FileConfigurationFactory.- Parameters:
module
- The source module.configFile
- The destination config file.sourceInputStream
- The source file input stream.
-
FileConfigurationFactory
Create a new FileConfigurationFactory.- Parameters:
module
- The source module.configPath
- The destination config file path. The path is relative to "./configs/<module-name>/".sourceInputStream
- The source file input stream.
-
FileConfigurationFactory
Create a new FileConfigurationFactory.- Parameters:
module
- The source module.configPath
- The destination config file path. The path is relative to "./configs/<module-name>/".internalSourcePath
- The source file path in the module jar file.
-
FileConfigurationFactory
Create a new FileConfigurationFactory.- Parameters:
module
- The source module.configFile
- The destination config file.internalSourcePath
- The source file path in the module jar file.
-
FileConfigurationFactory
Create a new FileConfigurationFactory. The config file will be created in "./configs/<module-name>/". The source file will be read from the module jar file at the same path as the configPath.- Parameters:
module
- The source module.configPath
- The destination config file path. The path is relative to "./configs/<module-name>/".
-
-
Method Details
-
createConfiguration
Create a new Configuration.- Specified by:
createConfiguration
in interfaceConfigurationFactory
- Parameters:
loaderStrategy
- The loader strategy.- Returns:
- The new Configuration.
-
saveConfiguration
public void saveConfiguration(Configuration configuration, ConfigurationLoaderStrategy loaderStrategy)Save a configuration as a file.- Specified by:
saveConfiguration
in interfaceConfigurationFactory
- Parameters:
configuration
- The configuration to save.loaderStrategy
- The loader strategy.
-
getModule
Get the config file.- Returns:
- The config file.
-
setModule
Get the config file.- Parameters:
module
- The module.
-
getConfigFile
Get the config file.- Returns:
- The config file.
-
setConfigFile
Set the config file.- Parameters:
configFile
- The config file.
-
getSourceInputStream
Get the source input stream.- Returns:
- The source input stream.
-
setSourceInputStream
Set the source input stream.- Parameters:
sourceInputStream
- The source input stream.
-