Package com.devonfw.cobigen.cli.utils
Class ConfigurationUtils
- java.lang.Object
-
- com.devonfw.cobigen.cli.utils.ConfigurationUtils
-
public class ConfigurationUtils extends Object
Utilities class for CobiGen related operations. Handles everything related to custom templates folder destination and configuration file management
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOBIGEN_TEMPLATESName of templates folderstatic StringCOBIGEN_UTILITY_CLASSES_FOLDERFolder to store template utility classes in
-
Constructor Summary
Constructors Constructor Description ConfigurationUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcreateConfigFile(Path customTemplatesLocation)Creates a configuration file next to the CLI executable and stores the location of the custom templates folder in itstatic booleancustomTemplatesLocationExists()static PathgetCobigenCliRootPath()static PathgetCobigenTemplatesFolderPath()Checks if custom templates location path exists and either returns the path of the default location next to the CLI or the custom templates location defined in the configurationstatic PathgetCustomTemplatesLocation()Checks if the configuration file exists and returns the path of the custom templates location keystatic FilepreprocessInputFile(File inputFile)Processes the input file's path.static PropertiesreadConfigFileProperties()Reads the configuration file and returns all of its properties
-
-
-
Field Detail
-
COBIGEN_TEMPLATES
public static final String COBIGEN_TEMPLATES
Name of templates folder- See Also:
- Constant Field Values
-
COBIGEN_UTILITY_CLASSES_FOLDER
public static final String COBIGEN_UTILITY_CLASSES_FOLDER
Folder to store template utility classes in- See Also:
- Constant Field Values
-
-
Method Detail
-
getCustomTemplatesLocation
public static Path getCustomTemplatesLocation()
Checks if the configuration file exists and returns the path of the custom templates location key- Returns:
- Path of custom templates location or null
-
getCobigenCliRootPath
public static Path getCobigenCliRootPath()
- Returns:
- Path of Cobigen CLI root
-
getCobigenTemplatesFolderPath
public static Path getCobigenTemplatesFolderPath()
Checks if custom templates location path exists and either returns the path of the default location next to the CLI or the custom templates location defined in the configuration- Returns:
- Path of Cobigen templates folder, null if the folder does not exist
-
customTemplatesLocationExists
public static boolean customTemplatesLocationExists()
- Returns:
- boolean true if the folder specified in configuration file exists, false if not
-
createConfigFile
public static void createConfigFile(Path customTemplatesLocation) throws IOException
Creates a configuration file next to the CLI executable and stores the location of the custom templates folder in it- Parameters:
customTemplatesLocation- File location to store in configuration file- Throws:
IOException- if the configuration file could not created
-
readConfigFileProperties
public static Properties readConfigFileProperties()
Reads the configuration file and returns all of its properties- Returns:
- Properties
-
-