Search in sources :

Example 1 with ElideNamespaceConfig

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

the class DynamicConfigHelpers method stringToElideNamespaceConfigPojo.

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