Example usage for org.apache.commons.cli Option setArgName

List of usage examples for org.apache.commons.cli Option setArgName

Introduction

In this page you can find the example usage for org.apache.commons.cli Option setArgName.

Prototype

public void setArgName(String argName) 

Source Link

Document

Sets the display name for the argument value.

Usage

From source file:net.sf.jsignpdf.verify.Verifier.java

/**
 * @param args//from   ww  w . j  av a2  s  . c om
 */
public static void main(String[] args) {

    // create the Options
    Option optHelp = new Option("h", "help", false, "print this message");
    // Option optVersion = new Option("v", "version", false,
    // "print version info");
    Option optCerts = new Option("c", "cert", true, "use external semicolon separated X.509 certificate files");
    optCerts.setArgName("certificates");
    Option optPasswd = new Option("p", "password", true, "set password for opening PDF");
    optPasswd.setArgName("password");
    Option optExtract = new Option("e", "extract", true, "extract signed PDF revisions to given folder");
    optExtract.setArgName("folder");
    Option optListKs = new Option("lk", "list-keystore-types", false, "list keystore types provided by java");
    Option optListCert = new Option("lc", "list-certificates", false, "list certificate aliases in a KeyStore");
    Option optKsType = new Option("kt", "keystore-type", true, "use keystore type with given name");
    optKsType.setArgName("keystore_type");
    Option optKsFile = new Option("kf", "keystore-file", true, "use given keystore file");
    optKsFile.setArgName("file");
    Option optKsPass = new Option("kp", "keystore-password", true,
            "password for keystore file (look on -kf option)");
    optKsPass.setArgName("password");
    Option optFailFast = new Option("ff", "fail-fast", false,
            "flag which sets the Verifier to exit with error code on the first validation failure");

    final Options options = new Options();
    options.addOption(optHelp);
    // options.addOption(optVersion);
    options.addOption(optCerts);
    options.addOption(optPasswd);
    options.addOption(optExtract);
    options.addOption(optListKs);
    options.addOption(optListCert);
    options.addOption(optKsType);
    options.addOption(optKsFile);
    options.addOption(optKsPass);
    options.addOption(optFailFast);

    CommandLine line = null;
    try {
        // create the command line parser
        CommandLineParser parser = new PosixParser();
        // parse the command line arguments
        line = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Illegal command used: " + exp.getMessage());
        System.exit(SignatureVerification.SIG_STAT_CODE_ERROR_UNEXPECTED_PROBLEM);
    }

    final boolean failFast = line.hasOption("ff");
    final String[] tmpArgs = line.getArgs();
    if (line.hasOption("h") || args == null || args.length == 0) {
        // automatically generate the help statement
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(70, "java -jar Verifier.jar [file1.pdf [file2.pdf ...]]",
                "JSignPdf Verifier is a command line tool for verifying signed PDF documents.", options, null,
                true);
    } else if (line.hasOption("lk")) {
        // list keystores
        for (String tmpKsType : KeyStoreUtils.getKeyStores()) {
            System.out.println(tmpKsType);
        }
    } else if (line.hasOption("lc")) {
        // list certificate aliases in the keystore
        for (String tmpCert : KeyStoreUtils.getCertAliases(line.getOptionValue("kt"), line.getOptionValue("kf"),
                line.getOptionValue("kp"))) {
            System.out.println(tmpCert);
        }
    } else {
        final VerifierLogic tmpLogic = new VerifierLogic(line.getOptionValue("kt"), line.getOptionValue("kf"),
                line.getOptionValue("kp"));
        tmpLogic.setFailFast(failFast);

        if (line.hasOption("c")) {
            String tmpCertFiles = line.getOptionValue("c");
            for (String tmpCFile : tmpCertFiles.split(";")) {
                tmpLogic.addX509CertFile(tmpCFile);
            }
        }
        byte[] tmpPasswd = null;
        if (line.hasOption("p")) {
            tmpPasswd = line.getOptionValue("p").getBytes();
        }
        String tmpExtractDir = null;
        if (line.hasOption("e")) {
            tmpExtractDir = new File(line.getOptionValue("e")).getPath();
        }

        int exitCode = 0;

        for (String tmpFilePath : tmpArgs) {
            int exitCodeForFile = 0;
            System.out.println("Verifying " + tmpFilePath);
            final File tmpFile = new File(tmpFilePath);
            if (!tmpFile.canRead()) {
                exitCodeForFile = SignatureVerification.SIG_STAT_CODE_ERROR_FILE_NOT_READABLE;
                System.err.println("Couln't read the file. Check the path and permissions.");
                if (failFast) {
                    System.exit(exitCodeForFile);
                }
                exitCode = Math.max(exitCode, exitCodeForFile);
                continue;
            }
            final VerificationResult tmpResult = tmpLogic.verify(tmpFilePath, tmpPasswd);
            if (tmpResult.getException() != null) {
                tmpResult.getException().printStackTrace();
                exitCodeForFile = SignatureVerification.SIG_STAT_CODE_ERROR_UNEXPECTED_PROBLEM;
                if (failFast) {
                    System.exit(exitCodeForFile);
                }
                exitCode = Math.max(exitCode, exitCodeForFile);
                continue;
            } else {
                System.out.println("Total revisions: " + tmpResult.getTotalRevisions());
                for (SignatureVerification tmpSigVer : tmpResult.getVerifications()) {
                    System.out.println(tmpSigVer.toString());
                    if (tmpExtractDir != null) {
                        try {
                            File tmpExFile = new File(tmpExtractDir + "/" + tmpFile.getName() + "_"
                                    + tmpSigVer.getRevision() + ".pdf");
                            System.out.println("Extracting to " + tmpExFile.getCanonicalPath());
                            FileOutputStream tmpFOS = new FileOutputStream(tmpExFile.getCanonicalPath());

                            InputStream tmpIS = tmpLogic.extractRevision(tmpFilePath, tmpPasswd,
                                    tmpSigVer.getName());
                            IOUtils.copy(tmpIS, tmpFOS);
                            tmpIS.close();
                            tmpFOS.close();
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                        }
                    }
                }
                exitCodeForFile = tmpResult.getVerificationResultCode();
                if (failFast && SignatureVerification.isError(exitCodeForFile)) {
                    System.exit(exitCodeForFile);
                }
            }
            exitCode = Math.max(exitCode, exitCodeForFile);
        }
        if (exitCode != 0 && tmpArgs.length > 1) {
            System.exit(SignatureVerification.isError(exitCode)
                    ? SignatureVerification.SIG_STAT_CODE_ERROR_ANY_ERROR
                    : SignatureVerification.SIG_STAT_CODE_WARNING_ANY_WARNING);
        } else {
            System.exit(exitCode);
        }
    }
}

From source file:de.topobyte.livecg.CreateImage.java

public static void main(String[] args) {
    EnumNameLookup<ExportFormat> exportSwitch = new EnumNameLookup<ExportFormat>(ExportFormat.class, true);

    EnumNameLookup<Visualization> visualizationSwitch = new EnumNameLookup<Visualization>(Visualization.class,
            true);/*from  w  w w.  j a v a2  s.co  m*/

    // @formatter:off
    Options options = new Options();
    OptionHelper.add(options, OPTION_CONFIG, true, false, "path", "config file");
    OptionHelper.add(options, OPTION_INPUT, true, true, "file", "input geometry file");
    OptionHelper.add(options, OPTION_OUTPUT, true, true, "file", "output file");
    OptionHelper.add(options, OPTION_OUTPUT_FORMAT, true, true, "type",
            "type of output. one of <png,svg,tikz,ipe>");
    OptionHelper.add(options, OPTION_VISUALIZATION, true, true, "type",
            "type of visualization. one of <" + VisualizationUtil.getListOfAvailableVisualizations() + ">");
    OptionHelper.add(options, OPTION_STATUS, true, false,
            "status to " + "set the algorithm to. The format depends on the algorithm");
    // @formatter:on

    Option propertyOption = new Option(OPTION_PROPERTIES, "set a special property");
    propertyOption.setArgName("property=value");
    propertyOption.setArgs(2);
    propertyOption.setValueSeparator('=');
    options.addOption(propertyOption);

    CommandLineParser clp = new GnuParser();

    CommandLine line = null;
    try {
        line = clp.parse(options, args);
    } catch (ParseException e) {
        System.err.println("Parsing command line failed: " + e.getMessage());
        new HelpFormatter().printHelp(HELP_MESSAGE, options);
        System.exit(1);
    }

    StringOption argConfig = ArgumentHelper.getString(line, OPTION_CONFIG);
    if (argConfig.hasValue()) {
        String configPath = argConfig.getValue();
        LiveConfig.setPath(configPath);
    }

    StringOption argInput = ArgumentHelper.getString(line, OPTION_INPUT);
    StringOption argOutput = ArgumentHelper.getString(line, OPTION_OUTPUT);
    StringOption argOutputFormat = ArgumentHelper.getString(line, OPTION_OUTPUT_FORMAT);
    StringOption argVisualization = ArgumentHelper.getString(line, OPTION_VISUALIZATION);
    StringOption argStatus = ArgumentHelper.getString(line, OPTION_STATUS);

    ExportFormat exportFormat = exportSwitch.find(argOutputFormat.getValue());
    if (exportFormat == null) {
        System.err.println("Unsupported output format '" + argOutputFormat.getValue() + "'");
        System.exit(1);
    }

    Visualization visualization = visualizationSwitch.find(argVisualization.getValue());
    if (visualization == null) {
        System.err.println("Unsupported visualization '" + argVisualization.getValue() + "'");
        System.exit(1);
    }

    System.out.println("Visualization: " + visualization);
    System.out.println("Output format: " + exportFormat);

    ContentReader contentReader = new ContentReader();
    Content content = null;
    try {
        content = contentReader.read(new File(argInput.getValue()));
    } catch (Exception e) {
        System.out.println("Error while reading input file '" + argInput.getValue() + "'. Exception type: "
                + e.getClass().getSimpleName() + ", message: " + e.getMessage());
        System.exit(1);
    }

    Properties properties = line.getOptionProperties(OPTION_PROPERTIES);

    double zoom = 1;

    String statusArgument = null;
    if (argStatus.hasValue()) {
        statusArgument = argStatus.getValue();
    }

    VisualizationSetup setup = null;

    switch (visualization) {
    case GEOMETRY: {
        setup = new ContentVisualizationSetup();
        break;
    }
    case DCEL: {
        setup = new DcelVisualizationSetup();
        break;
    }
    case FREESPACE: {
        setup = new FreeSpaceVisualizationSetup();
        break;
    }
    case DISTANCETERRAIN: {
        setup = new DistanceTerrainVisualizationSetup();
        break;
    }
    case CHAN: {
        setup = new ChanVisualizationSetup();
        break;
    }
    case MONOTONE_PIECES: {
        setup = new MonotonePiecesVisualizationSetup();
        break;
    }
    case MONOTONE_TRIANGULATION: {
        setup = new MonotoneTriangulationVisualizationSetup();
        break;
    }
    case TRIANGULATION: {
        setup = new MonotonePiecesTriangulationVisualizationSetup();
        break;
    }
    case BUFFER: {
        setup = new BufferVisualizationSetup();
        break;
    }
    case FORTUNE: {
        setup = new FortunesSweepVisualizationSetup();
        break;
    }
    case SPIP: {
        setup = new ShortestPathVisualizationSetup();
        break;
    }
    }

    if (setup == null) {
        System.err.println("Not yet implemented");
        System.exit(1);
    }

    SetupResult setupResult = setup.setup(content, statusArgument, properties, zoom);

    int width = setupResult.getWidth();
    int height = setupResult.getHeight();

    VisualizationPainter visualizationPainter = setupResult.getVisualizationPainter();

    File output = new File(argOutput.getValue());

    visualizationPainter.setZoom(zoom);

    switch (exportFormat) {
    case IPE: {
        try {
            IpeExporter.exportIpe(output, visualizationPainter, width, height);
        } catch (Exception e) {
            System.err.println("Error while exporting. Exception type: " + e.getClass().getSimpleName()
                    + ", message: " + e.getMessage());
            System.exit(1);
        }
        break;
    }
    case PNG: {
        try {
            GraphicsExporter.exportPNG(output, visualizationPainter, width, height);
        } catch (IOException e) {
            System.err.println("Error while exporting. Exception type: " + e.getClass().getSimpleName()
                    + ", message: " + e.getMessage());
            System.exit(1);
        }
        break;
    }
    case SVG: {
        try {
            SvgExporter.exportSVG(output, visualizationPainter, width, height);
        } catch (Exception e) {
            System.err.println("Error while exporting. Exception type: " + e.getClass().getSimpleName()
                    + ", message: " + e.getMessage());
            System.exit(1);
        }
        break;
    }
    case TIKZ: {
        try {
            TikzExporter.exportTikz(output, visualizationPainter, width, height);
        } catch (Exception e) {
            System.err.println("Error while exporting. Exception type: " + e.getClass().getSimpleName()
                    + ", message: " + e.getMessage());
            System.exit(1);
        }
        break;
    }
    }
}

From source file:com.netscape.cmstools.CMCResponse.java

public static void main(String args[]) throws Exception {

    Option option = new Option("d", true, "NSS database location");
    option.setArgName("path");
    options.addOption(option);//w  w  w . j  a  v a2 s .c om

    option = new Option("i", true, "Input file containing CMC response in binary format");
    option.setArgName("path");
    options.addOption(option);

    option = new Option("o", true,
            "Output file to store certificate chain in PKCS #7 PEM format; also prints out cert base 64 encoding individually");
    option.setArgName("path");
    options.addOption(option);

    options.addOption("v", "verbose", false,
            "Run in verbose mode. Base64 encoding of certs in response will be printed individually");

    options.addOption(null, "help", false, "Show help message.");

    CommandLine cmd = parser.parse(options, args, true);

    @SuppressWarnings("unused")
    String database = cmd.getOptionValue("d");

    String input = cmd.getOptionValue("i");
    String output = cmd.getOptionValue("o");
    boolean printCerts = cmd.hasOption("v");

    if (cmd.hasOption("help")) {
        printUsage();
        System.exit(1);
    }

    if (input == null) {
        System.err.println("ERROR: Missing input CMC response");
        System.err.println("Try 'CMCResponse --help' for more information.");
        System.exit(1);
    }

    // load CMC response
    byte[] data = Files.readAllBytes(Paths.get(input));

    // display CMC response
    CMCResponse response = new CMCResponse(data);
    response.printContent(printCerts);

    // terminate if any of the statuses is not a SUCCESS
    Collection<CMCStatusInfoV2> statusInfos = response.getStatusInfos();
    if (statusInfos != null) { // full response
        for (CMCStatusInfoV2 statusInfo : statusInfos) {

            int status = statusInfo.getStatus();
            if (status == CMCStatusInfoV2.SUCCESS) {
                continue;
            }

            SEQUENCE bodyList = statusInfo.getBodyList();

            Collection<INTEGER> list = new ArrayList<>();
            for (int i = 0; i < bodyList.size(); i++) {
                INTEGER n = (INTEGER) bodyList.elementAt(i);
                list.add(n);
            }

            System.err.println("ERROR: CMC status for " + list + ": " + CMCStatusInfoV2.STATUS[status]);
            System.exit(1);
        }
    }

    // export PKCS #7 if requested
    if (output != null) {
        PKCS7 pkcs7 = new PKCS7(data);

        try (FileWriter fw = new FileWriter(output)) {
            fw.write(pkcs7.toPEMString());
        }
        System.out.println("\nPKCS#7 now stored in file: " + output);
    }
}

From source file:edu.ksu.cis.indus.staticanalyses.concurrency.DeadlockAnalysisCLI.java

/**
 * The entry point to this class.// w w  w  .j  a  v a  2 s. com
 * 
 * @param args command line arguments.
 * @throws RuntimeException when escape information and side-effect information calculation fails.
 */
public static void main(final String[] args) {
    final Options _options = new Options();
    Option _option = new Option("h", "help", false, "Display message.");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path.");
    _option.setArgs(1);
    _option.setArgName("classpath");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("S", "scope", true, "The scope that should be analyzed.");
    _option.setArgs(1);
    _option.setArgName("scope");
    _option.setRequired(false);
    _options.addOption(_option);

    final CommandLineParser _parser = new GnuParser();

    try {
        final CommandLine _cl = _parser.parse(_options, args);

        if (_cl.hasOption("h")) {
            final String _cmdLineSyn = "java " + DeadlockAnalysisCLI.class.getName()
                    + " <options> <classnames>";
            (new HelpFormatter()).printHelp(_cmdLineSyn, _options);
            System.exit(1);
        }

        if (_cl.getArgList().isEmpty()) {
            throw new MissingArgumentException("Please specify atleast one class.");
        }

        final DeadlockAnalysisCLI _cli = new DeadlockAnalysisCLI();

        if (_cl.hasOption('p')) {
            _cli.addToSootClassPath(_cl.getOptionValue('p'));
        }

        if (_cl.hasOption('S')) {
            _cli.setScopeSpecFile(_cl.getOptionValue('S'));
        }
        _cli.setClassNames(_cl.getArgList());
        _cli.<ITokens>execute();
    } catch (final ParseException _e) {
        LOGGER.error("Error while parsing command line.", _e);
        System.out.println("Error while parsing command line." + _e);
        final String _cmdLineSyn = "java " + DeadlockAnalysisCLI.class.getName() + " <options> <classnames>";
        (new HelpFormatter()).printHelp(_cmdLineSyn, "Options are:", _options, "");
    } catch (final Throwable _e) {
        LOGGER.error("Beyond our control. May day! May day!", _e);
        throw new RuntimeException(_e);
    }
}

From source file:edu.ksu.cis.indus.staticanalyses.concurrency.independence.IndependenceDetectionCLI.java

/**
 * The entry point to the program via command line.
 * /*  ww  w .j  a va2 s. co  m*/
 * @param args is the command line arguments.
 * @throws RuntimeException when CLI fails.
 */
public static void main(final String[] args) {
    final Options _options = new Options();
    Option _option = new Option("o", "output", true,
            "Directory into which jimple files will be written into. [required]");
    _option.setArgs(1);
    _option.setArgName("ouput-directory");
    _option.setRequired(true);
    _options.addOption(_option);
    _option = new Option("h", "help", false, "Display message.");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path.");
    _option.setArgs(1);
    _option.setArgName("classpath");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("useV2", false, "Use version 2 of the atomicity detection algorithm.");
    _options.addOption(_option);
    _option = new Option("scheme", false,
            "Scheme to indicate atomicity. Valid values are 'tag-stmt' and 'tag-region'.  By default, 'tag-stmt' "
                    + "scheme is used. ");
    _option.setArgs(1);
    _option.setArgName("scheme-name");
    _options.addOption(_option);
    _option = new Option("S", "scope", true, "The scope that should be analyzed.");
    _option.setArgs(1);
    _option.setArgName("scope");
    _option.setRequired(false);
    _options.addOption(_option);

    final CommandLineParser _parser = new GnuParser();

    try {
        final CommandLine _cl = _parser.parse(_options, args);

        if (_cl.hasOption("h")) {
            final String _cmdLineSyn = "java " + IndependenceDetectionCLI.class.getName()
                    + " <options> <classnames>";
            (new HelpFormatter()).printHelp(_cmdLineSyn, _options);
            System.exit(1);
        }

        if (_cl.getArgList().isEmpty()) {
            throw new MissingArgumentException("Please specify atleast one class.");
        }

        final IndependenceDetectionCLI _cli;

        if (_cl.hasOption("useV2")) {
            _cli = new IndependenceDetectionCLI(new IndependentStmtDetectorv2());
        } else {
            _cli = new IndependenceDetectionCLI(new IndependentStmtDetector());
        }

        if (_cl.hasOption('p')) {
            _cli.addToSootClassPath(_cl.getOptionValue('p'));
        }

        if (_cl.hasOption('S')) {
            _cli.setScopeSpecFile(_cl.getOptionValue('S'));
        }

        _cli.setClassNames(_cl.getArgList());
        _cli.setOutputDir(_cl.getOptionValue('o'));
        _cli.<ITokens>execute(_cl);
    } catch (final ParseException _e) {
        LOGGER.error("Error while parsing command line.", _e);
        System.out.println("Error while parsing command line." + _e);
        final String _cmdLineSyn = "java " + IndependenceDetectionCLI.class.getName()
                + " <options> <classnames>";
        (new HelpFormatter()).printHelp(_cmdLineSyn, "Options are:", _options, "");
    } catch (final Throwable _e) {
        LOGGER.error("Beyond our control. May day! May day!", _e);
        throw new RuntimeException(_e);
    }
}

From source file:edu.ksu.cis.indus.staticanalyses.concurrency.escape.EscapeAndReadWriteCLI.java

/**
 * The entry point to this class./*from www  .j av a2 s.  c o m*/
 * 
 * @param args command line arguments.
 * @throws RuntimeException when escape information and side-effect information calculation fails.
 */
public static void main(final String[] args) {
    final Options _options = new Options();
    Option _option = new Option("h", "help", false, "Display message.");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path.");
    _option.setArgs(1);
    _option.setArgName("classpath");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("S", "scope", true, "The scope that should be analyzed.");
    _option.setArgs(1);
    _option.setArgName("scope");
    _option.setRequired(false);
    _options.addOption(_option);

    final CommandLineParser _parser = new GnuParser();

    try {
        final CommandLine _cl = _parser.parse(_options, args);

        if (_cl.hasOption("h")) {
            final String _cmdLineSyn = "java " + EscapeAndReadWriteCLI.class.getName()
                    + " <options> <classnames>";
            (new HelpFormatter()).printHelp(_cmdLineSyn, _options);
            System.exit(1);
        }

        if (_cl.getArgList().isEmpty()) {
            throw new MissingArgumentException("Please specify atleast one class.");
        }

        final EscapeAndReadWriteCLI _cli = new EscapeAndReadWriteCLI();

        if (_cl.hasOption('p')) {
            _cli.addToSootClassPath(_cl.getOptionValue('p'));
        }

        if (_cl.hasOption('S')) {
            _cli.setScopeSpecFile(_cl.getOptionValue('S'));
        }
        _cli.setClassNames(_cl.getArgList());
        _cli.<ITokens>execute();
    } catch (final ParseException _e) {
        LOGGER.error("Error while parsing command line.", _e);
        System.out.println("Error while parsing command line." + _e);
        final String _cmdLineSyn = "java " + EscapeAndReadWriteCLI.class.getName() + " <options> <classnames>";
        (new HelpFormatter()).printHelp(_cmdLineSyn, "Options are:", _options, "");
    } catch (final Throwable _e) {
        LOGGER.error("Beyond our control. May day! May day!", _e);
        throw new RuntimeException(_e);
    }
}

From source file:edu.cornell.med.icb.R.RUtils.java

public static void main(final String[] args) throws ParseException, ConfigurationException {
    final Options options = new Options();

    final Option helpOption = new Option("h", "help", false, "Print this message");
    options.addOption(helpOption);/*from w w  w.  ja v  a 2 s.co  m*/

    final Option startupOption = new Option(Mode.startup.name(), Mode.startup.name(), false,
            "Start Rserve process");
    final Option shutdownOption = new Option(Mode.shutdown.name(), Mode.shutdown.name(), false,
            "Shutdown Rserve process");
    final Option validateOption = new Option(Mode.validate.name(), Mode.validate.name(), false,
            "Validate that Rserve processes are running");

    final OptionGroup optionGroup = new OptionGroup();
    optionGroup.addOption(startupOption);
    optionGroup.addOption(shutdownOption);
    optionGroup.addOption(validateOption);
    optionGroup.setRequired(true);
    options.addOptionGroup(optionGroup);

    final Option portOption = new Option("port", "port", true,
            "Use specified port to communicate with the Rserve process");
    portOption.setArgName("port");
    portOption.setType(int.class);
    options.addOption(portOption);

    final Option hostOption = new Option("host", "host", true,
            "Communicate with the Rserve process on the given host");
    hostOption.setArgName("hostname");
    hostOption.setType(String.class);
    options.addOption(hostOption);

    final Option userOption = new Option("u", "username", true, "Username to send to the Rserve process");
    userOption.setArgName("username");
    userOption.setType(String.class);
    options.addOption(userOption);

    final Option passwordOption = new Option("p", "password", true, "Password to send to the Rserve process");
    passwordOption.setArgName("password");
    passwordOption.setType(String.class);
    options.addOption(passwordOption);

    final Option configurationOption = new Option("c", "configuration", true,
            "Configuration file or url to read from");
    configurationOption.setArgName("configuration");
    configurationOption.setType(String.class);
    options.addOption(configurationOption);

    final Parser parser = new BasicParser();
    final CommandLine commandLine;
    try {
        commandLine = parser.parse(options, args);
    } catch (ParseException e) {
        usage(options);
        throw e;
    }

    int exitStatus = 0;
    if (commandLine.hasOption("h")) {
        usage(options);
    } else {
        Mode mode = null;
        for (final Mode potentialMode : Mode.values()) {
            if (commandLine.hasOption(potentialMode.name())) {
                mode = potentialMode;
                break;
            }
        }

        final ExecutorService threadPool = Executors.newCachedThreadPool();

        if (commandLine.hasOption("configuration")) {
            final String configurationFile = commandLine.getOptionValue("configuration");
            LOG.info("Reading configuration from " + configurationFile);
            XMLConfiguration configuration;
            try {
                final URL configurationURL = new URL(configurationFile);
                configuration = new XMLConfiguration(configurationURL);
            } catch (MalformedURLException e) {
                // resource is not a URL: attempt to get the resource from a file
                LOG.debug("Configuration is not a valid url");
                configuration = new XMLConfiguration(configurationFile);
            }

            configuration.setValidating(true);
            final int numberOfRServers = configuration.getMaxIndex("RConfiguration.RServer") + 1;
            boolean failed = false;
            for (int i = 0; i < numberOfRServers; i++) {
                final String server = "RConfiguration.RServer(" + i + ")";
                final String host = configuration.getString(server + "[@host]");
                final int port = configuration.getInt(server + "[@port]",
                        RConfigurationUtils.DEFAULT_RSERVE_PORT);
                final String username = configuration.getString(server + "[@username]");
                final String password = configuration.getString(server + "[@password]");
                final String command = configuration.getString(server + "[@command]", DEFAULT_RSERVE_COMMAND);

                if (executeMode(mode, threadPool, host, port, username, password, command) != 0) {
                    failed = true; // we have other hosts to check so keep a failed state
                }
            }
            if (failed) {
                exitStatus = 3;
            }
        } else {
            final String host = commandLine.getOptionValue("host", "localhost");
            final int port = Integer.valueOf(commandLine.getOptionValue("port", "6311"));
            final String username = commandLine.getOptionValue("username");
            final String password = commandLine.getOptionValue("password");

            exitStatus = executeMode(mode, threadPool, host, port, username, password, null);
        }
        threadPool.shutdown();
    }

    System.exit(exitStatus);
}

From source file:edu.nyu.vida.data_polygamy.pre_processing.PreProcessing.java

/**
 * @param args/*from  w w w  . jav a2s.  co  m*/
 * @throws IOException 
 * @throws ClassNotFoundException 
 * @throws InterruptedException 
 */
@SuppressWarnings("deprecation")
public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {

    Options options = new Options();

    Option nameOption = new Option("dn", "name", true, "the name of the dataset");
    nameOption.setRequired(true);
    nameOption.setArgName("DATASET NAME");
    options.addOption(nameOption);

    Option headerOption = new Option("dh", "header", true, "the file that contains the header of the dataset");
    headerOption.setRequired(true);
    headerOption.setArgName("DATASET HEADER FILE");
    options.addOption(headerOption);

    Option deafultsOption = new Option("dd", "defaults", true,
            "the file that contains the default values of the dataset");
    deafultsOption.setRequired(true);
    deafultsOption.setArgName("DATASET DEFAULTS FILE");
    options.addOption(deafultsOption);

    Option tempResOption = new Option("t", "temporal", true,
            "desired temporal resolution (hour, day, week, or month)");
    tempResOption.setRequired(true);
    tempResOption.setArgName("TEMPORAL RESOLUTION");
    options.addOption(tempResOption);

    Option spatialResOption = new Option("s", "spatial", true,
            "desired spatial resolution (points, nbhd, zip, grid, or city)");
    spatialResOption.setRequired(true);
    spatialResOption.setArgName("SPATIAL RESOLUTION");
    options.addOption(spatialResOption);

    Option currentSpatialResOption = new Option("cs", "current-spatial", true,
            "current spatial resolution (points, nbhd, zip, grid, or city)");
    currentSpatialResOption.setRequired(true);
    currentSpatialResOption.setArgName("CURRENT SPATIAL RESOLUTION");
    options.addOption(currentSpatialResOption);

    Option indexResOption = new Option("i", "index", true, "indexes of the temporal and spatial attributes");
    indexResOption.setRequired(true);
    indexResOption.setArgName("INDEX OF SPATIO-TEMPORAL RESOLUTIONS");
    indexResOption.setArgs(Option.UNLIMITED_VALUES);
    options.addOption(indexResOption);

    Option machineOption = new Option("m", "machine", true, "machine identifier");
    machineOption.setRequired(true);
    machineOption.setArgName("MACHINE");
    machineOption.setArgs(1);
    options.addOption(machineOption);

    Option nodesOption = new Option("n", "nodes", true, "number of nodes");
    nodesOption.setRequired(true);
    nodesOption.setArgName("NODES");
    nodesOption.setArgs(1);
    options.addOption(nodesOption);

    Option s3Option = new Option("s3", "s3", false, "data on Amazon S3");
    s3Option.setRequired(false);
    options.addOption(s3Option);

    Option awsAccessKeyIdOption = new Option("aws_id", "aws-id", true,
            "aws access key id; " + "this is required if the execution is on aws");
    awsAccessKeyIdOption.setRequired(false);
    awsAccessKeyIdOption.setArgName("AWS-ACCESS-KEY-ID");
    awsAccessKeyIdOption.setArgs(1);
    options.addOption(awsAccessKeyIdOption);

    Option awsSecretAccessKeyOption = new Option("aws_key", "aws-id", true,
            "aws secrect access key; " + "this is required if the execution is on aws");
    awsSecretAccessKeyOption.setRequired(false);
    awsSecretAccessKeyOption.setArgName("AWS-SECRET-ACCESS-KEY");
    awsSecretAccessKeyOption.setArgs(1);
    options.addOption(awsSecretAccessKeyOption);

    Option bucketOption = new Option("b", "s3-bucket", true,
            "bucket on s3; " + "this is required if the execution is on aws");
    bucketOption.setRequired(false);
    bucketOption.setArgName("S3-BUCKET");
    bucketOption.setArgs(1);
    options.addOption(bucketOption);

    Option helpOption = new Option("h", "help", false, "display this message");
    helpOption.setRequired(false);
    options.addOption(helpOption);

    HelpFormatter formatter = new HelpFormatter();
    CommandLineParser parser = new PosixParser();
    CommandLine cmd = null;

    try {
        cmd = parser.parse(options, args);
    } catch (ParseException e) {
        formatter.printHelp(
                "hadoop jar data-polygamy.jar " + "edu.nyu.vida.data_polygamy.pre_processing.PreProcessing",
                options, true);
        System.exit(0);
    }

    if (cmd.hasOption("h")) {
        formatter.printHelp(
                "hadoop jar data-polygamy.jar " + "edu.nyu.vida.data_polygamy.pre_processing.PreProcessing",
                options, true);
        System.exit(0);
    }

    boolean s3 = cmd.hasOption("s3");
    String s3bucket = "";
    String awsAccessKeyId = "";
    String awsSecretAccessKey = "";

    if (s3) {
        if ((!cmd.hasOption("aws_id")) || (!cmd.hasOption("aws_key")) || (!cmd.hasOption("b"))) {
            System.out.println(
                    "Arguments 'aws_id', 'aws_key', and 'b'" + " are mandatory if execution is on AWS.");
            formatter.printHelp(
                    "hadoop jar data-polygamy.jar " + "edu.nyu.vida.data_polygamy.pre_processing.PreProcessing",
                    options, true);
            System.exit(0);
        }
        s3bucket = cmd.getOptionValue("b");
        awsAccessKeyId = cmd.getOptionValue("aws_id");
        awsSecretAccessKey = cmd.getOptionValue("aws_key");
    }

    boolean snappyCompression = false;
    boolean bzip2Compression = false;
    String machine = cmd.getOptionValue("m");
    int nbNodes = Integer.parseInt(cmd.getOptionValue("n"));

    Configuration s3conf = new Configuration();
    if (s3) {
        s3conf.set("fs.s3.awsAccessKeyId", awsAccessKeyId);
        s3conf.set("fs.s3.awsSecretAccessKey", awsSecretAccessKey);
        s3conf.set("bucket", s3bucket);
    }

    Configuration conf = new Configuration();
    Machine machineConf = new Machine(machine, nbNodes);
    String dataset = cmd.getOptionValue("dn");
    String header = cmd.getOptionValue("dh");
    String defaults = cmd.getOptionValue("dd");
    String temporalResolution = cmd.getOptionValue("t");
    String spatialResolution = cmd.getOptionValue("s");
    String gridResolution = "";
    String currentSpatialResolution = cmd.getOptionValue("cs");

    if (spatialResolution.contains("grid")) {
        String[] res = spatialResolution.split("-");
        spatialResolution = res[0];
        gridResolution = res[1];
    }

    conf.set("header", s3bucket + FrameworkUtils.dataDir + "/" + header);
    conf.set("defaults", s3bucket + FrameworkUtils.dataDir + "/" + defaults);
    conf.set("temporal-resolution", temporalResolution);
    conf.set("spatial-resolution", spatialResolution);
    conf.set("grid-resolution", gridResolution);
    conf.set("current-spatial-resolution", currentSpatialResolution);

    String[] indexes = cmd.getOptionValues("i");
    String temporalPos = "";
    Integer sizeSpatioTemp = 0;
    if (!(currentSpatialResolution.equals("points"))) {
        String spatialPos = "";
        for (int i = 0; i < indexes.length; i++) {
            temporalPos += indexes[i] + ",";
            spatialPos += indexes[++i] + ",";
            sizeSpatioTemp++;
        }
        conf.set("spatial-pos", spatialPos);
    } else {
        String xPositions = "", yPositions = "";
        for (int i = 0; i < indexes.length; i++) {
            temporalPos += indexes[i] + ",";
            xPositions += indexes[++i] + ",";
            yPositions += indexes[++i] + ",";
            sizeSpatioTemp++;
        }
        conf.set("xPositions", xPositions);
        conf.set("yPositions", yPositions);
    }
    conf.set("temporal-pos", temporalPos);

    conf.set("size-spatio-temporal", sizeSpatioTemp.toString());

    // checking resolutions

    if (utils.spatialResolution(spatialResolution) < 0) {
        System.out.println("Invalid spatial resolution: " + spatialResolution);
        System.exit(-1);
    }

    if (utils.spatialResolution(spatialResolution) == FrameworkUtils.POINTS) {
        System.out.println("The data needs to be reduced at least to neighborhoods or grid.");
        System.exit(-1);
    }

    if (utils.spatialResolution(currentSpatialResolution) < 0) {
        System.out.println("Invalid spatial resolution: " + currentSpatialResolution);
        System.exit(-1);
    }

    if (utils.spatialResolution(currentSpatialResolution) > utils.spatialResolution(spatialResolution)) {
        System.out.println("The current spatial resolution is coarser than "
                + "the desired one. You can only navigate from a fine resolution" + " to a coarser one.");
        System.exit(-1);
    }

    if (utils.temporalResolution(temporalResolution) < 0) {
        System.out.println("Invalid temporal resolution: " + temporalResolution);
        System.exit(-1);
    }

    String fileName = s3bucket + FrameworkUtils.preProcessingDir + "/" + dataset + "-" + temporalResolution
            + "-" + spatialResolution + gridResolution;
    conf.set("aggregates", fileName + ".aggregates");

    // making sure both files are removed, if they exist
    FrameworkUtils.removeFile(fileName, s3conf, s3);
    FrameworkUtils.removeFile(fileName + ".aggregates", s3conf, s3);

    /**
     * Hadoop Parameters
     * sources: http://www.slideshare.net/ImpetusInfo/ppt-on-advanced-hadoop-tuning-n-optimisation
     *          https://cloudcelebrity.wordpress.com/2013/08/14/12-key-steps-to-keep-your-hadoop-cluster-running-strong-and-performing-optimum/
     */

    conf.set("mapreduce.tasktracker.map.tasks.maximum", String.valueOf(machineConf.getMaximumTasks()));
    conf.set("mapreduce.tasktracker.reduce.tasks.maximum", String.valueOf(machineConf.getMaximumTasks()));
    conf.set("mapreduce.jobtracker.maxtasks.perjob", "-1");
    conf.set("mapreduce.reduce.shuffle.parallelcopies", "20");
    conf.set("mapreduce.input.fileinputformat.split.minsize", "0");
    conf.set("mapreduce.task.io.sort.mb", "200");
    conf.set("mapreduce.task.io.sort.factor", "100");

    // using SnappyCodec for intermediate and output data ?
    // TODO: for now, using SnappyCodec -- what about LZO + Protocol Buffer serialization?
    //   LZO - http://www.oberhumer.com/opensource/lzo/#download
    //   Hadoop-LZO - https://github.com/twitter/hadoop-lzo
    //   Protocol Buffer - https://github.com/twitter/elephant-bird
    //   General Info - http://www.devx.com/Java/Article/47913
    //   Compression - http://comphadoop.weebly.com/index.html
    if (snappyCompression) {
        conf.set("mapreduce.map.output.compress", "true");
        conf.set("mapreduce.map.output.compress.codec", "org.apache.hadoop.io.compress.SnappyCodec");
        conf.set("mapreduce.output.fileoutputformat.compress.codec",
                "org.apache.hadoop.io.compress.SnappyCodec");
    }
    if (bzip2Compression) {
        conf.set("mapreduce.map.output.compress", "true");
        conf.set("mapreduce.map.output.compress.codec", "org.apache.hadoop.io.compress.BZip2Codec");
        conf.set("mapreduce.output.fileoutputformat.compress.codec",
                "org.apache.hadoop.io.compress.BZip2Codec");
    }

    // TODO: this is dangerous!
    if (s3) {
        conf.set("fs.s3.awsAccessKeyId", awsAccessKeyId);
        conf.set("fs.s3.awsSecretAccessKey", awsSecretAccessKey);
    }

    Job job = new Job(conf);
    job.setJobName(dataset + "-" + temporalResolution + "-" + spatialResolution);

    job.setMapOutputKeyClass(MultipleSpatioTemporalWritable.class);
    job.setMapOutputValueClass(AggregationArrayWritable.class);

    job.setOutputKeyClass(MultipleSpatioTemporalWritable.class);
    job.setOutputValueClass(AggregationArrayWritable.class);

    job.setMapperClass(PreProcessingMapper.class);
    job.setCombinerClass(PreProcessingCombiner.class);
    job.setReducerClass(PreProcessingReducer.class);
    job.setNumReduceTasks(machineConf.getNumberReduces());
    //job.setNumReduceTasks(1);

    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(SequenceFileOutputFormat.class);
    SequenceFileOutputFormat.setCompressOutput(job, true);
    SequenceFileOutputFormat.setOutputCompressionType(job, CompressionType.BLOCK);

    FileInputFormat.setInputPaths(job, new Path(s3bucket + FrameworkUtils.dataDir + "/" + dataset));
    FileOutputFormat.setOutputPath(job, new Path(fileName));

    job.setJarByClass(PreProcessing.class);

    long start = System.currentTimeMillis();
    job.submit();
    job.waitForCompletion(true);
    System.out.println(fileName + "\t" + (System.currentTimeMillis() - start));

}

From source file:edu.ksu.cis.indus.staticanalyses.callgraphs.CallGraphXMLizerCLI.java

/**
 * The entry point to the program via command line.
 * /*from  ww w . ja  v a 2  s  .c  o m*/
 * @param args is the command line arguments.
 * @throws RuntimeException when the analyses fail.
 */
public static void main(final String[] args) {
    final Options _options = new Options();
    Option _option = new Option("c", "cumulative", false,
            "Builds one call graph that includes all root methods.");
    _options.addOption(_option);
    _option = new Option("o", "output", true,
            "Directory into which xml files will be written into.  Defaults to current directory if omitted");
    _option.setArgs(1);
    _option.setArgName("output-dir");
    _options.addOption(_option);
    _option = new Option("j", "jimple", false, "Dump xmlized jimple.");
    _option.setArgName("dump-jimple");
    _options.addOption(_option);
    _option = new Option("p", "soot-classpath", true, "Prepend this to soot class path.");
    _option.setArgs(1);
    _option.setArgName("classpath");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("h", "help", false, "Display message.");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("t", "call-graph-type", true,
            "Call graph type.  This has to be one of {cha, rta, ofa-oi, " + "ofa-oirt, ofa-os}.");
    _option.setArgs(1);
    _option.setArgName("type");
    _option.setRequired(true);
    _options.addOption(_option);
    _option = new Option("S", "scope", true, "The scope that should be analyzed.");
    _option.setArgs(1);
    _option.setArgName("scope");
    _option.setRequired(false);
    _options.addOption(_option);

    final PosixParser _parser = new PosixParser();

    try {
        final CommandLine _cl = _parser.parse(_options, args);

        if (_cl.hasOption('h')) {
            printUsage(_options);
            System.exit(1);
        }

        String _outputDir = _cl.getOptionValue('o');

        if (_outputDir == null) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("Defaulting to current directory for output.");
            }
            _outputDir = ".";
        }

        if (_cl.getArgList().isEmpty()) {
            throw new MissingArgumentException("Please specify atleast one class.");
        }

        final CallGraphXMLizerCLI _cli = new CallGraphXMLizerCLI();

        _cli.xmlizer.setXmlOutputDir(_outputDir);
        _cli.xmlizer.setGenerator(new UniqueJimpleIDGenerator());
        _cli.setCumulative(_cl.hasOption('c'));
        _cli.setClassNames(_cl.getArgList());
        _cli.addToSootClassPath(_cl.getOptionValue('p'));

        if (_cl.hasOption('S')) {
            _cli.setScopeSpecFile(_cl.getOptionValue('S'));
        }

        _cli.initialize();

        _cli.execute(_cl.hasOption('j'), _cl.getOptionValue('t'));
    } catch (final ParseException _e) {
        LOGGER.error("Error while parsing command line.", _e);
        System.out.println("Error while parsing command line." + _e);
        printUsage(_options);
    } catch (final Throwable _e) {
        LOGGER.error("Beyond our control. May day! May day!", _e);
        throw new RuntimeException(_e);
    }
}

From source file:edu.ksu.cis.indus.staticanalyses.dependency.DependencyXMLizerCLI.java

/**
 * This is the entry point via command-line.
 * //  w  w w  . ja  v  a  2s .  co  m
 * @param args is the command line arguments.
 * @throws RuntimeException when an Throwable exception beyond our control occurs.
 * @pre args != null
 */
public static void main(final String[] args) {
    final Options _options = new Options();
    Option _option = new Option("o", "output", true,
            "Directory into which xml files will be written into.  Defaults to current directory if omitted");
    _option.setArgs(1);
    _option.setArgName("output-directory");
    _options.addOption(_option);
    _option = new Option("j", "jimple", false, "Dump xmlized jimple.");
    _options.addOption(_option);

    final DivergenceDA _fidda = DivergenceDA.getDivergenceDA(IDependencyAnalysis.Direction.FORWARD_DIRECTION);
    _fidda.setConsiderCallSites(true);

    final DivergenceDA _bidda = DivergenceDA.getDivergenceDA(IDependencyAnalysis.Direction.BACKWARD_DIRECTION);
    _bidda.setConsiderCallSites(true);

    final NonTerminationSensitiveEntryControlDA _ncda = new NonTerminationSensitiveEntryControlDA();
    final Object[][] _dasOptions = {
            { "ibdda1", "Identifier based data dependence (Soot)", new IdentifierBasedDataDA() },
            { "ibdda2", "Identifier based data dependence (Indus)", new IdentifierBasedDataDAv2() },
            { "ibdda3", "Identifier based data dependence (Indus Optimized)", new IdentifierBasedDataDAv3() },
            { "rbdda", "Reference based data dependence", new ReferenceBasedDataDA() },
            { "nscda", "Non-termination sensitive Entry control dependence", _ncda },
            { "nicda", "Non-termination insensitive Entry control dependence",
                    new NonTerminationInsensitiveEntryControlDA(), },
            { "xcda", "Exit control dependence", new ExitControlDA() },
            { "sda", "Synchronization dependence", new SynchronizationDA() },
            { "frda1", "Forward Ready dependence v1", ReadyDAv1.getForwardReadyDA() },
            { "brda1", "Backward Ready dependence v1", ReadyDAv1.getBackwardReadyDA() },
            { "frda2", "Forward Ready dependence v2", ReadyDAv2.getForwardReadyDA() },
            { "brda2", "Backward Ready dependence v2", ReadyDAv2.getBackwardReadyDA() },
            { "frda3", "Forward Ready dependence v3", ReadyDAv3.getForwardReadyDA() },
            { "brda3", "Backward Ready dependence v3", ReadyDAv3.getBackwardReadyDA() },
            { "ida1", "Interference dependence v1", new InterferenceDAv1() },
            { "ida2", "Interference dependence v2", new InterferenceDAv2() },
            { "ida3", "Interference dependence v3", new InterferenceDAv3() },
            { "fdda", "Forward Intraprocedural Divergence dependence",
                    DivergenceDA.getDivergenceDA(IDependencyAnalysis.Direction.FORWARD_DIRECTION), },
            { "bdda", "Backward Intraprocedural Divergence dependence",
                    DivergenceDA.getDivergenceDA(IDependencyAnalysis.Direction.BACKWARD_DIRECTION), },
            { "fidda", "Forward Intra+Interprocedural Divergence dependence", _fidda },
            { "bidda", "Backward Intra+Interprocedural Divergence dependence", _bidda },
            { "fpidda", "Forward Interprocedural Divergence dependence",
                    InterProceduralDivergenceDA
                            .getDivergenceDA(IDependencyAnalysis.Direction.FORWARD_DIRECTION), },
            { "bpidda", "Backward Interprocedural Divergence dependence", InterProceduralDivergenceDA
                    .getDivergenceDA(IDependencyAnalysis.Direction.BACKWARD_DIRECTION), }, };
    _option = new Option("h", "help", false, "Display message.");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("p", "soot-classpath", false, "Prepend this to soot class path.");
    _option.setArgs(1);
    _option.setArgName("classpath");
    _option.setOptionalArg(false);
    _options.addOption(_option);
    _option = new Option("aliasedusedefv1", false, "Use version 1 of aliased use-def info.");
    _options.addOption(_option);
    _option = new Option("safelockanalysis", false, "Use safe-lock-analysis for ready dependence.");
    _options.addOption(_option);
    _option = new Option("ofaforinterference", false, "Use OFA for interference dependence.");
    _options.addOption(_option);
    _option = new Option("ofaforready", false, "Use OFA for ready dependence.");
    _options.addOption(_option);
    _option = new Option("exceptionalexits", false, "Consider exceptional exits for control dependence.");
    _options.addOption(_option);
    _option = new Option("commonuncheckedexceptions", false, "Consider common unchecked exceptions.");
    _options.addOption(_option);
    _option = new Option("S", "scope", true, "The scope that should be analyzed.");
    _option.setArgs(1);
    _option.setArgName("scope");
    _option.setRequired(false);
    _options.addOption(_option);

    for (int _i = 0; _i < _dasOptions.length; _i++) {
        final String _shortOption = _dasOptions[_i][0].toString();
        final String _description = _dasOptions[_i][1].toString();
        _option = new Option(_shortOption, false, _description);
        _options.addOption(_option);
    }

    final CommandLineParser _parser = new GnuParser();

    try {
        final CommandLine _cl = _parser.parse(_options, args);

        if (_cl.hasOption("h")) {
            printUsage(_options);
            System.exit(1);
        }

        final DependencyXMLizerCLI _xmlizerCLI = new DependencyXMLizerCLI();
        String _outputDir = _cl.getOptionValue('o');

        if (_outputDir == null) {
            if (LOGGER.isWarnEnabled()) {
                LOGGER.warn("Defaulting to current directory for output.");
            }
            _outputDir = ".";
        }

        _xmlizerCLI.xmlizer.setXmlOutputDir(_outputDir);

        if (_cl.hasOption('p')) {
            _xmlizerCLI.addToSootClassPath(_cl.getOptionValue('p'));
        }

        if (_cl.hasOption('S')) {
            _xmlizerCLI.setScopeSpecFile(_cl.getOptionValue('S'));
        }

        _xmlizerCLI.dumpJimple = _cl.hasOption('j');
        _xmlizerCLI.useAliasedUseDefv1 = _cl.hasOption("aliasedusedefv1");
        _xmlizerCLI.useSafeLockAnalysis = _cl.hasOption("safelockanalysis");
        _xmlizerCLI.exceptionalExits = _cl.hasOption("exceptionalexits");
        _xmlizerCLI.commonUncheckedException = _cl.hasOption("commonuncheckedexceptions");

        final List<String> _classNames = _cl.getArgList();

        if (_classNames.isEmpty()) {
            throw new MissingArgumentException("Please specify atleast one class.");
        }
        _xmlizerCLI.setClassNames(_classNames);

        final int _exitControlDAIndex = 6;

        if (_cl.hasOption(_dasOptions[_exitControlDAIndex][0].toString())) {
            _xmlizerCLI.das.add(_ncda);

            for (final Iterator<DependenceSort> _i = _ncda.getIds().iterator(); _i.hasNext();) {
                final DependenceSort _id = _i.next();
                MapUtils.putIntoCollectionInMapUsingFactory(_xmlizerCLI.info, _id, _ncda,
                        SetUtils.getFactory());
            }
        }

        if (!parseForDependenceOptions(_dasOptions, _cl, _xmlizerCLI)) {
            throw new ParseException("Atleast one dependence analysis must be requested.");
        }

        _xmlizerCLI.<ITokens>execute();
    } catch (final ParseException _e) {
        LOGGER.error("Error while parsing command line.", _e);
        System.out.println("Error while parsing command line." + _e);
        printUsage(_options);
    } catch (final Throwable _e) {
        LOGGER.error("Beyond our control. May day! May day!", _e);
        throw new RuntimeException(_e);
    }
}