Search in sources :

Example 1 with ParserFactoryForDataset

use of org.eol.globi.data.ParserFactoryForDataset in project eol-globi-data by jhpoelen.

the class GitHubImporterFactory method createImporter.

public StudyImporter createImporter(Dataset dataset, final NodeFactory nodeFactory) throws StudyImporterException {
    Class<? extends StudyImporter> anImporter = findImporterFor(dataset);
    try {
        Constructor<? extends StudyImporter> constructor = anImporter.getConstructor(ParserFactory.class, NodeFactory.class);
        ParserFactoryForDataset parserFactory = new ParserFactoryForDataset(dataset);
        StudyImporter studyImporter = constructor.newInstance(parserFactory, new NodeFactoryWithDatasetContext(nodeFactory, dataset));
        studyImporter.setDataset(dataset);
        return studyImporter;
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
        throw new StudyImporterException("failed to instantiate importer for [" + dataset.getNamespace() + "]", e);
    }
}
Also used : StudyImporterException(org.eol.globi.data.StudyImporterException) ParserFactoryForDataset(org.eol.globi.data.ParserFactoryForDataset) NodeFactoryWithDatasetContext(org.eol.globi.data.NodeFactoryWithDatasetContext) StudyImporter(org.eol.globi.data.StudyImporter) InvocationTargetException(java.lang.reflect.InvocationTargetException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 NodeFactoryWithDatasetContext (org.eol.globi.data.NodeFactoryWithDatasetContext)1 ParserFactoryForDataset (org.eol.globi.data.ParserFactoryForDataset)1 StudyImporter (org.eol.globi.data.StudyImporter)1 StudyImporterException (org.eol.globi.data.StudyImporterException)1