Search in sources :

Example 1 with ConfigDTO

use of com.wso2telco.core.pcrservice.model.ConfigDTO in project core-util by WSO2Telco.

the class YamlReader method getConfiguration.

/**
 * Gets the configuration.
 *
 * @return the configuration
 */
public static ConfigDTO getConfiguration() {
    File file = new File(DEVICE_MGT_CONFIG_PATH);
    ConfigDTO configPojo = new ConfigDTO();
    // jackson databind
    final ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    try {
        configPojo = mapper.readValue(file, ConfigDTO.class);
    } catch (JsonParseException e) {
        log.error("Yaml Parsing Error", e);
    } catch (JsonMappingException e) {
        log.error("Yaml Mapping Error", e);
    } catch (IOException e) {
        log.error("Yaml File Error", e);
    }
    return configPojo;
}
Also used : ConfigDTO(com.wso2telco.core.pcrservice.model.ConfigDTO) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) YAMLFactory(com.fasterxml.jackson.dataformat.yaml.YAMLFactory) IOException(java.io.IOException) JsonParseException(com.fasterxml.jackson.core.JsonParseException) File(java.io.File) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

JsonParseException (com.fasterxml.jackson.core.JsonParseException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 YAMLFactory (com.fasterxml.jackson.dataformat.yaml.YAMLFactory)1 ConfigDTO (com.wso2telco.core.pcrservice.model.ConfigDTO)1 File (java.io.File)1 IOException (java.io.IOException)1