Main.java

48 lines | 1.516 kB Blame History Raw Download
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufrgs.inf.prosoft.trace.tools;

import java.util.logging.Logger;

/**
 *
 * @author romulo
 */
public class Main {

    private static final Logger logger = Logger.getLogger(Main.class.getName());

    public static void main(String[] args) {
        System.setProperty("java.util.logging.SimpleFormatter.format", "[%1$tF %1$tT+%1$tL] [%4$-7s] [Trace] %5$s %n");
        String tool = null;
        String firstPath = null;
        String secondPath = null;
        if (args.length < 2) {
            System.err.println("check <TracePath>");
            System.err.println("diff <FirstTracePath> <SecondTracePath>");
            System.err.println("hash <InputTracePath> <OutputTracePath>");
            System.exit(1);
        }
        tool = args[0];
        firstPath = args[1];
        if (tool.equals("check")) {
            CheckTraces.check(firstPath);
        } else {
            if (args.length < 3) {
                System.err.println("diff <FirstTracePath> <SecondTracePath>");
                System.err.println("hash <InputTracePath> <OutputTracePath>");
                System.exit(1);
            }
            secondPath = args[2];
            if (tool.equals("diff")) {
                DiffTraces.diff(firstPath, secondPath);
            } else {
                HashFile.convert(firstPath, secondPath);
            }
        }
    }
}