View Javadoc

1   package uk.ac.ebi.intenz.tools.importer;
2   
3   import org.apache.log4j.Logger;
4   
5   /**
6    * This class, is used to create instances of the importers.
7    *
8    * @author pmatos
9    * @version $id 31-May-2005 13:43:45
10   *          History:
11   *          Developer       Date        Description
12   *          pmatos      31-May-2005 Created class
13   *          rafalcan    06-Jan-2006 Added GoLinkImporter
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  }