use of com.amazon.dataprepper.parser.model.PipelineConfiguration in project data-prepper by opensearch-project.
the class PipelineParser method parseConfiguration.
/**
* Parses the configuration file into Pipeline
*/
public Map<String, Pipeline> parseConfiguration() {
try {
final Map<String, PipelineConfiguration> pipelineConfigurationMap = OBJECT_MAPPER.readValue(new File(pipelineConfigurationFileLocation), new TypeReference<Map<String, PipelineConfiguration>>() {
});
final List<String> allPipelineNames = PipelineConfigurationValidator.validateAndGetPipelineNames(pipelineConfigurationMap);
// LinkedHashMap to preserve insertion order
final Map<String, Pipeline> pipelineMap = new LinkedHashMap<>();
pipelineConfigurationMap.forEach((pipelineName, configuration) -> configuration.updateCommonPipelineConfiguration(pipelineName));
for (String pipelineName : allPipelineNames) {
if (!pipelineMap.containsKey(pipelineName) && pipelineConfigurationMap.containsKey(pipelineName)) {
buildPipelineFromConfiguration(pipelineName, pipelineConfigurationMap, pipelineMap);
}
}
return pipelineMap;
} catch (IOException e) {
throw new ParseException(format("Failed to parse the configuration file %s", pipelineConfigurationFileLocation), e);
}
}
Aggregations