1 /*
2 Copyright (c) 2005 The European Bioinformatics Institute, and others.
3 All rights reserved. Please see the file LICENSE
4 in the root directory of this distribution.
5 */
6 package uk.ac.ebi.intenz.tools.importer;
7
8 import java.util.Arrays;
9 import java.util.Date;
10
11 import org.apache.log4j.Logger;
12
13
14 /**
15 * ImportController used to run the importers.
16 *
17 * @author P.de Matos
18 * @version $id 01-Jun-2005 18:38:07
19 * <p/>
20 * History:
21 * Developer Date Description<br>
22 * P.de Matos 01-Jun-2005 Created class<br>
23 */
24 public class ImportController {
25
26 static Logger LOGGER = Logger.getLogger(ImportController.class);
27
28 /**
29 * Imports links from external databases.
30 * @param args A list of databases whose links should be imported.
31 * Allowed values are (letter casing doesn't matter):
32 * <ul>
33 * <li>UNIPROT</li>
34 * <li>GO</li>
35 * </ul>
36 * If no argument is passed, all of the links are imported.
37 * @throws Exception
38 * @throws InstantiationException
39 * @throws ClassNotFoundException
40 */
41 public static void main (String[] args) throws Exception, InstantiationException, ClassNotFoundException {
42
43 for (int i = 0; i < args.length; i++){
44 args[i] = args[i].toLowerCase();
45 }
46 Arrays.sort(args);
47
48 Importer imp = null;
49
50 LOGGER.info("Starting time: "+new Date(System.currentTimeMillis()));
51
52 if (args.length == 0 || Arrays.binarySearch(args, "uniprot") > -1){
53 LOGGER.info("Obtaining ProteinImporter...");
54 // imp = ImporterFactory.createImporter(ImporterFactory.PROTEIN_IMPORTER);
55 imp = ImporterFactory.createImporter(ImporterFactory.KRAKEN_IMPORTER);
56 LOGGER.info("Doing import");
57 imp.doImport();
58 }
59
60 if (args.length == 0 || Arrays.binarySearch(args, "go") > -1){
61 LOGGER.info("Obtaining GoImporter...");
62 imp = ImporterFactory.createImporter(ImporterFactory.GO_IMPORTER);
63 LOGGER.info("Doing import");
64 imp.doImport();
65 }
66
67 LOGGER.info("Ending time: "+new Date(System.currentTimeMillis()));
68
69 }
70 }