1 package uk.ac.ebi.intenz.tools.importer;
2
3 import org.apache.log4j.Logger;
4
5
6
7
8
9
10
11
12
13
14
15 public class ImporterFactory {
16
17 static Logger LOGGER = Logger.getLogger(ImporterFactory.class);
18
19 public static final String GO_IMPORTER = GoLinkImporter.class.getName();
20
21 public static final String KRAKEN_IMPORTER = KrakenLinkImporter.class.getName();
22
23 public static Importer createImporter(String importer)
24 throws ClassNotFoundException, IllegalAccessException, InstantiationException {
25 try {
26 Class clazz = Class.forName(importer);
27 return (Importer) clazz.newInstance();
28 } catch (ClassNotFoundException e) {
29 LOGGER.error(e);
30 throw e;
31 } catch (IllegalAccessException e) {
32 LOGGER.error(e);
33 throw e;
34 } catch (InstantiationException e) {
35 LOGGER.error(e);
36 throw e;
37 }
38 }
39
40 }