All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.duracloud.syncui.SyncSelector Maven / Gradle / Ivy

There is a newer version: 8.1.0
Show newest version
/*
 * The contents of this file are subject to the license and copyright
 * detailed in the LICENSE and NOTICE files at the root of the source
 * tree and available online at
 *
 *     http://duracloud.org/license/
 */
package org.duracloud.syncui;

import org.duracloud.sync.SyncToolInitializer;
import org.duracloud.syncui.config.SyncUIConfig;

import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;

/**
 * Runs the sync application in either the command line mode or GUI mode. If
 * command line parameters are present, command line mode is selected, otherwise
 * GUI mode is run.
 *
 * @author: Bill Branan
 * Date: 2/18/13
 */
public class SyncSelector {

    public static void main(String[] args) throws Exception {
        // Ensure that work dir is initialized
        SyncUIConfig.getWorkDir();

        // Determine which tool to execute
        if(args.length > 0) {
            SyncToolInitializer.main(args);
        } else {
            disableStdErr();
            SyncUIDriver.main(args);
        }
    }

    /*
     * Ensures that nothing is written to system.err.
     */
    private static void disableStdErr() {
        System.setErr(new PrintStream(new OutputStream() {
            @Override
            public void write(int arg0) throws IOException {
                // this method intentionally left blank
            }
        }));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy