Search in sources :

Example 1 with CustomSchemaStateExecutor

use of com.hortonworks.registries.schemaregistry.state.CustomSchemaStateExecutor in project registry by hortonworks.

the class SchemaVersionLifecycleManager method createSchemaReviewExecutor.

private CustomSchemaStateExecutor createSchemaReviewExecutor(Map<String, Object> props, SchemaVersionLifecycleStateMachine.Builder builder) {
    Map<String, Object> schemaReviewExecConfig = (Map<String, Object>) props.getOrDefault("customSchemaStateExecutor", Collections.emptyMap());
    String className = (String) schemaReviewExecConfig.getOrDefault("className", DEFAULT_SCHEMA_REVIEW_EXECUTOR_CLASS);
    Map<String, ?> executorProps = (Map<String, ?>) schemaReviewExecConfig.getOrDefault("props", Collections.emptyMap());
    CustomSchemaStateExecutor customSchemaStateExecutor;
    try {
        customSchemaStateExecutor = (CustomSchemaStateExecutor) Class.forName(className, true, Thread.currentThread().getContextClassLoader()).newInstance();
    } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) {
        LOG.error("Error encountered while loading class [{}]", className, e);
        throw new IllegalArgumentException(e);
    }
    customSchemaStateExecutor.init(builder, SchemaVersionLifecycleStates.REVIEWED.getId(), SchemaVersionLifecycleStates.CHANGES_REQUIRED.getId(), executorProps);
    return customSchemaStateExecutor;
}
Also used : CustomSchemaStateExecutor(com.hortonworks.registries.schemaregistry.state.CustomSchemaStateExecutor) Map(java.util.Map)

Aggregations

CustomSchemaStateExecutor (com.hortonworks.registries.schemaregistry.state.CustomSchemaStateExecutor)1 Map (java.util.Map)1