Class FileConfigurationFactory

java.lang.Object
com.chillycheesy.modulo.config.FileConfigurationFactory
All Implemented Interfaces:
ConfigurationFactory

public class FileConfigurationFactory extends Object implements ConfigurationFactory
Create a Configuration from a Module and a source file.
  • Field Details

    • module

      protected Module module
      Source module.
    • configFile

      protected File configFile
      The destination config file.
    • sourceInputStream

      protected InputStream sourceInputStream
      The source file input stream.
  • Constructor Details

    • FileConfigurationFactory

      public FileConfigurationFactory(Module module, File configFile, InputStream sourceInputStream)
      Create a new FileConfigurationFactory.
      Parameters:
      module - The source module.
      configFile - The destination config file.
      sourceInputStream - The source file input stream.
    • FileConfigurationFactory

      public FileConfigurationFactory(Module module, String configPath, InputStream sourceInputStream)
      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

      public FileConfigurationFactory(Module module, String configPath, String internalSourcePath)
      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

      public FileConfigurationFactory(Module module, File configFile, String internalSourcePath)
      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

      public FileConfigurationFactory(Module module, String configPath)
      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

      public Configuration createConfiguration(ConfigurationLoaderStrategy loaderStrategy)
      Create a new Configuration.
      Specified by:
      createConfiguration in interface ConfigurationFactory
      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 interface ConfigurationFactory
      Parameters:
      configuration - The configuration to save.
      loaderStrategy - The loader strategy.
    • getModule

      public Module getModule()
      Get the config file.
      Returns:
      The config file.
    • setModule

      public void setModule(Module module)
      Get the config file.
      Parameters:
      module - The module.
    • getConfigFile

      public File getConfigFile()
      Get the config file.
      Returns:
      The config file.
    • setConfigFile

      public void setConfigFile(File configFile)
      Set the config file.
      Parameters:
      configFile - The config file.
    • getSourceInputStream

      public InputStream getSourceInputStream()
      Get the source input stream.
      Returns:
      The source input stream.
    • setSourceInputStream

      public void setSourceInputStream(InputStream sourceInputStream)
      Set the source input stream.
      Parameters:
      sourceInputStream - The source input stream.