Package com.optum.sourcehawk.exec
Class ConfigurationReader
- java.lang.Object
-
- com.optum.sourcehawk.exec.ConfigurationReader
-
public final class ConfigurationReader extends Object
Utility class for reading and deserialization of configuration- Author:
- Brian Wyka
-
-
Field Summary
Fields Modifier and Type Field Description static com.fasterxml.jackson.databind.ObjectMapperMAPPERThe object mapper which is used to deserialize the configuration from file
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<FileResolver>convertFileEnforcerToFileResolver(Object fileEnforcerObject)Convert the file enforcer to a file resolverstatic SourcehawkConfigurationparseConfiguration(InputStream inputStream)Parse the configuration from the provided yaml stringstatic SourcehawkConfigurationparseConfiguration(Path configurationFilePath)Parse the configuration from the provided filestatic FileEnforcerparseFileEnforcer(Object fileEnforcerObject)Parse the file enforcerstatic Optional<SourcehawkConfiguration>readConfiguration(Path repositoryRoot, String configurationFileLocation)Read the configuration from the provided location
-
-
-
Method Detail
-
parseConfiguration
public static SourcehawkConfiguration parseConfiguration(InputStream inputStream) throws IOException
Parse the configuration from the provided yaml string- Parameters:
inputStream- the input stream- Returns:
- the configuration
- Throws:
IOException
-
parseConfiguration
public static SourcehawkConfiguration parseConfiguration(Path configurationFilePath) throws IOException
Parse the configuration from the provided file- Parameters:
configurationFilePath- the configuration file path- Returns:
- the configuration
- Throws:
IOException
-
readConfiguration
public static Optional<SourcehawkConfiguration> readConfiguration(Path repositoryRoot, String configurationFileLocation)
Read the configuration from the provided location- Parameters:
repositoryRoot- the repository rootconfigurationFileLocation- the config file location- Returns:
- the configuration
-
parseFileEnforcer
public static FileEnforcer parseFileEnforcer(Object fileEnforcerObject)
Parse the file enforcer- Parameters:
fileEnforcerObject- the file enforcer object- Returns:
- the file enforcer
-
convertFileEnforcerToFileResolver
public static Optional<FileResolver> convertFileEnforcerToFileResolver(Object fileEnforcerObject)
Convert the file enforcer to a file resolver- Parameters:
fileEnforcerObject- the file enforcer object- Returns:
- the file resolver if able to be converted, otherwise
Optional.empty()
-
-