Search in sources :

Example 1 with ElideTableConfig

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

the class DynamicConfigHelpers method stringToElideTablePojo.

/**
 * Generates ElideTableConfig Pojo from input String.
 * @param content : input string
 * @param variables : variables to resolve.
 * @param schemaValidator JSON schema validator.
 * @return ElideTableConfig Pojo
 * @throws IOException If an I/O error or a processing error occurs.
 */
public static ElideTableConfig stringToElideTablePojo(String fileName, String content, Map<String, Object> variables, DynamicConfigSchemaValidator schemaValidator) throws IOException {
    ElideTableConfig table = new ElideTableConfig();
    String jsonConfig = hjsonToJson(resolveVariables(content, variables));
    try {
        if (schemaValidator.verifySchema(Config.TABLE, jsonConfig, fileName)) {
            table = getModelPojo(jsonConfig, ElideTableConfig.class);
        }
    } catch (ProcessingException e) {
        log.error("Error Validating Table config : " + e.getMessage());
        throw new IOException(e);
    }
    return table;
}
Also used : ElideTableConfig(com.yahoo.elide.modelconfig.model.ElideTableConfig) IOException(java.io.IOException) 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 ElideTableConfig (com.yahoo.elide.modelconfig.model.ElideTableConfig)1 IOException (java.io.IOException)1