Search in sources :

Example 1 with ElideDBConfig

use of com.yahoo.elide.modelconfig.model.ElideDBConfig in project elide by yahoo.

the class DynamicConfigHelpers method stringToElideDBConfigPojo.

/**
 * Generates ElideDBConfig Pojo from input String.
 * @param content : input string
 * @param variables : variables to resolve.
 * @param schemaValidator JSON schema validator.
 * @return ElideDBConfig Pojo
 * @throws IOException If an I/O error or a processing error occurs.
 */
public static ElideDBConfig stringToElideDBConfigPojo(String fileName, String content, Map<String, Object> variables, DynamicConfigSchemaValidator schemaValidator) throws IOException {
    ElideDBConfig dbconfig = new ElideDBConfig();
    String jsonConfig = hjsonToJson(resolveVariables(content, variables));
    try {
        if (schemaValidator.verifySchema(Config.SQLDBConfig, jsonConfig, fileName)) {
            dbconfig = getModelPojo(jsonConfig, ElideDBConfig.class);
        }
    } catch (ProcessingException e) {
        log.error("Error Validating DB config : " + e.getMessage());
        throw new IOException(e);
    }
    return dbconfig;
}
Also used : IOException(java.io.IOException) ElideDBConfig(com.yahoo.elide.modelconfig.model.ElideDBConfig) ProcessingException(com.github.fge.jsonschema.core.exceptions.ProcessingException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ProcessingException (com.github.fge.jsonschema.core.exceptions.ProcessingException)1 ElideDBConfig (com.yahoo.elide.modelconfig.model.ElideDBConfig)1 IOException (java.io.IOException)1