View Javadoc

1   package uk.ac.ebi.intenz.tools.sib;
2   
3   import uk.ac.ebi.intenz.tools.sib.comparator.FlatFileComparator;
4   import uk.ac.ebi.intenz.tools.sib.writer.EnzymeFlatFileWriter;
5   
6   import java.io.File;
7   import java.util.PropertyResourceBundle;
8   
9   import org.apache.log4j.Logger;
10  
11  /**
12   * This class provides methods for exporting enzyme data into the ENZYME flat file format.
13   *
14   * @author Michael Darsow
15   * @version $Revision: 1.2 $ $Date: 2008/01/28 11:43:22 $
16   */
17  public class EnzymeFlatFileComparatorApp {
18  
19    private static final Logger LOGGER =
20  	  Logger.getLogger(EnzymeFlatFileComparatorApp.class.getName());
21  
22    /**
23     * Compares the content of two ENZYME flat files.
24     *
25     * @param args Command line arguments (see {@link EnzymeFlatFileWriterApp#printHelp()} .
26     */
27    public static void main(String[] args) {
28  //    if (!argumentsOk(args)) {
29  //      printHelp();
30  //      System.exit(1);
31  //    }
32      LOGGER.debug("Running comparator");
33      File flatFile1 = new File(ApplicationResources.getInstance().getInputFlatFileName());
34      File flatFile2 = new File(ApplicationResources.getInstance().getExportFlatFileName());
35      LOGGER.debug("Enzyme.dat input file found at: "+ApplicationResources.getInstance().getInputFlatFileName());
36  
37      FlatFileComparator.compare(flatFile1, flatFile2);
38    }
39  
40  
41    // --------------------------- PRIVATE METHODS ------------------------------------------------
42  
43    /**
44     * Checks the arguments taken from the command line.
45     * <p/>
46     * For further info see {@link EnzymeFlatFileComparatorApp#main(String[])}.
47     *
48     * @param args The arguments to be checked.
49     * @return <code>true</code> if the arguments are ok.
50     */
51    private static boolean argumentsOk(String[] args) {
52      if (args.length != 2) {
53        System.err.println("Please provide the two file names (incl. abs. path info) of the flat files to be compared.");
54        return false;
55      }
56      return true;
57    }
58  
59    /**
60     * Prints usage information of this class to the console.
61     */
62    private static void printHelp() {
63      StringBuffer help = new StringBuffer();
64      help.append("Usage: java EnzymeFlatFileComparatorApp <flat file 1> <flat file 2>\n");
65      help.append("Examples: java EnzymeFlatFileComparatorApp -v 33.0\n");
66      help.append("          java EnzymeFlatFileComparatorApp -v 33.12\n");
67      System.out.println(help.toString());
68    }
69  
70  }