use of com.thinkbiganalytics.discovery.parser.SchemaParser in project kylo by Teradata.
the class FileParserFactory method listSchemaParsers.
/**
* Returns a list of available schema parsers. Parsers are guaranteed to be annotated with @SchemaParser and implement FileSchemaParser interface
*
* @return a list of file schema parsers
*/
public List<FileSchemaParser> listSchemaParsers() {
List<FileSchemaParser> supportedParsers = new ArrayList<>();
List<Class<SchemaParser>> supportedParsersClazzes = listSchemaParsersClasses();
for (Class<SchemaParser> clazz : supportedParsersClazzes) {
try {
FileSchemaParser newInstance = (FileSchemaParser) clazz.newInstance();
newInstance = (FileSchemaParser) SpringApplicationContext.autowire(newInstance);
supportedParsers.add(newInstance);
} catch (InstantiationException | IllegalAccessException e) {
log.warn("Failed to instantiate registered schema parser [?]. Missing default constructor?", clazz.getAnnotation(SchemaParser.class).name(), e);
}
}
return supportedParsers;
}
Aggregations