Package de.qytera.qtaf.core.config
Class ConfigurationFactory
java.lang.Object
de.qytera.qtaf.core.config.ConfigurationFactory
Factory class for generating a configuration object from a JSON configuration file.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanCreate configuration file if it does not exist.static booleancreateConfigurationFileIfNotExists(String qtafConfigResourcesBaseDir, String filePath) Create configuration file if it does not exist.static ConfigMapCreate default configuration object.static ConfigMapgetInstance(String fileName) Create a new configuration object.static StringReads the default configuration file that is shipped with the QTAF JAR file.
-
Field Details
-
FILE_PATH
Default configuration path which is used if no custom path is provided.- See Also:
-
CONFIGURATION_RESOURCE_URL
Default configuration resource location.- See Also:
-
QTAF_CONFIG_RESOURCES_BASE_DIR
Base resource directory.- See Also:
-
-
Method Details
-
getInstance
Create default configuration object.- Returns:
- Configuration
-
readDefaultConfigurationFileContent
Reads the default configuration file that is shipped with the QTAF JAR file.- Returns:
- Configuration file JSON content
- Throws:
IOException- File not found
-
createConfigurationFileIfNotExists
Create configuration file if it does not exist.- Returns:
- true on success, false otherwise
- Throws:
IOException- Error during file creation
-
createConfigurationFileIfNotExists
public static boolean createConfigurationFileIfNotExists(String qtafConfigResourcesBaseDir, String filePath) throws IOException Create configuration file if it does not exist.- Parameters:
qtafConfigResourcesBaseDir- Directory where QTAF configuration files are storedfilePath- relative path of the configuration file (relative to qtafConfigResourcesBaseDir)- Returns:
- true on success, false otherwise
- Throws:
IOException- Error during file creation
-
getInstance
Create a new configuration object.- Parameters:
fileName- Name of the file- Returns:
- Configuration
-