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:is.landsbokasafn.deduplicator.indexer.CommandLineParser.java

/**
 * Constructor./*from  ww w  .  j  a v a 2 s.c o  m*/
 *
 * @param args Command-line arguments to process.
 * @param out PrintStream to write on.
 *
 * @throws ParseException Failed parse of command line.
 */
public CommandLineParser(String[] args, PrintWriter out) throws ParseException {
    super();

    this.out = out;

    this.options = new Options();
    this.options.addOption(new Option("h", "help", false, "Prints this message and exits."));

    Option opt = new Option("u", "no-url-index", false,
            "Do not index the URLs. Index will only be searchable by digest. "
                    + "Choosing this also sets --no-canonicalized.");
    this.options.addOption(opt);

    this.options.addOption(new Option("s", "no-canonicalized", false,
            "Do not add a canonicalized version of the URL to the index."));

    this.options.addOption(
            new Option("e", "etag", false, "Include etags in the index (if available in the source)."));

    opt = new Option("m", "mime", true,
            "A filter on what mime types are added into the index " + "(blacklist). Default: ^text/.*");
    opt.setArgName("reg.expr.");
    this.options.addOption(opt);

    this.options.addOption(
            new Option("w", "whitelist", false, "Make the --mime filter a whitelist instead of blacklist."));

    this.options.addOption(
            new Option("v", "verbose", false, "Make the program print progress info to standard out."));

    opt = new Option("i", "iterator", true,
            "An iterator suitable for the source data (default iterator " + "works WARC files).");
    opt.setArgName("classname");
    this.options.addOption(opt);

    this.options.addOption(new Option("a", "add", false, "Add source data to existing index."));

    PosixParser parser = new PosixParser();
    try {
        this.commandLine = parser.parse(this.options, args, false);
    } catch (UnrecognizedOptionException e) {
        usage(e.getMessage(), 1);
    }
}

From source file:com.netscape.admin.certsrv.Console.java

/**
  * main routine. It will pass the command line parameters then call the Console constructor
  * to create a console instance./*from  w  w w  .ja v  a  2  s .c om*/
  *
  * @param parameters list
  */

public static void mainImpl(String argv[]) throws Exception {

    Options options = new Options();

    Option option = new Option("f", true, "Capture stderr and stdout to file.");
    option.setArgName("file");
    options.addOption(option);

    option = new Option("D", true, "Debug options.");
    option.setArgName("options");
    options.addOption(option);

    option = new Option("x", true, "Extra options (javalaf, nowinpos, nologo).");
    option.setArgName("options");
    options.addOption(option);

    options.addOption("v", "verbose", false, "Run in verbose mode.");
    options.addOption("h", "help", false, "Show help message.");

    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, argv);

    String[] cmdArgs = cmd.getArgs();

    verbose = cmd.hasOption("verbose");

    String outFile = cmd.getOptionValue("f");
    if (outFile != null) {
        try {
            TeeStream.tee(outFile);
        } catch (Exception e) {
            System.err.println("Missing or invalid output file specification for the -f option: " + e);
            System.exit(1);
        }
    }

    if (cmd.hasOption("D")) {
        Debug.setApplicationStartTime(_t0);
        String extraParam = cmd.getOptionValue("D");
        if (!extraParam.isEmpty()) {
            if (extraParam.equals("?") || !Debug.setTraceMode(extraParam)) {
                System.out.println(Debug.getUsage());
                waitForKeyPress(); // allow the user to read the msg on Win NT
                System.exit(0);
            }
        } else {
            Debug.setTraceMode(null);
        }

        // Show all system proprties if debug level is 9
        if (Debug.getTraceLevel() == 9) {
            try {
                Properties props = System.getProperties();
                for (Enumeration<Object> e = props.keys(); e.hasMoreElements();) {
                    String key = (String) e.nextElement();
                    String val = (String) props.get(key);
                    Debug.println(9, key + "=" + val);
                }
            } catch (Exception e) {
            }
        }
    }

    if (cmdArgs.length != 1 || cmd.hasOption("help")) {
        printHelp();
        waitForKeyPress(); // allow the user to read the msg on Win NT
        return;
    }

    Debug.println(0, "Management-Console/" + _resource.getString("console", "displayVersion") + " B"
            + VersionInfo.getBuildNumber());

    if (cmd.hasOption("x")) {
        String extraParam = cmd.getOptionValue("x");
        boolean supportedOption = false;

        if (extraParam.indexOf(OPTION_NOLOGO) != -1) {
            _showSplashScreen = false;
            supportedOption = true;
        }
        if (extraParam.indexOf(OPTION_NOWINPOS) != -1) {
            Framework.setEnableWinPositioning(false);
            supportedOption = true;
        }
        if (extraParam.indexOf(OPTION_JAVALAF) != -1) {
            _useJavaLookAndFeel = true;
            supportedOption = true;
        }

        if (supportedOption == false) {
            printHelp();
            waitForKeyPress(); // allow the user to read the msg on Win NT
            System.exit(0);
        }
    }

    String sAdminURL = cmdArgs[0];

    ConsoleInfo cinfo = new ConsoleInfo();
    CMSAdmin admin = new CMSAdmin();
    URL url = null;
    try {
        url = new URL(sAdminURL);
    } catch (Exception e) {
        String es = e.toString();
        String ep = "java.net.MalformedURLException:";
        if (es != null && es.startsWith(ep)) {
            es = es.substring(ep.length());
        }
        System.err.println("\nURL error: " + es + "\n");
        waitForKeyPress(); // allow the user to read the msg on Win NT
        System.exit(1);
    }
    if (url == null) {
        System.err.println("\nIncorrect URL: " + sAdminURL + "\n");
        waitForKeyPress(); // allow the user to read the msg on Win NT
        System.exit(1);
    }
    cinfo.put("cmsServerInstance", "instanceID");

    String protocol = url.getProtocol();
    String hostName = url.getHost();
    String path = url.getPath();
    /* Protocol part of URL is required only by URL class. Console assumes URL protocol. */
    if (protocol == null || protocol.length() == 0
            || ((!protocol.equalsIgnoreCase("https")) && (!protocol.equalsIgnoreCase("http")))) {
        System.err.println(
                "\nIncorrect protocol" + ((protocol != null && protocol.length() > 0) ? ": " + protocol : ".")
                        + "\nDefault supported protocol is 'https'.\n");
        waitForKeyPress(); // allow the user to read the msg on Win NT
        System.exit(1);
    }

    if (hostName == null || hostName.length() == 0) {
        System.err.println("\nMissing hostName: " + sAdminURL + "\n");
        waitForKeyPress(); // allow the user to read the msg on Win NT
        System.exit(1);
    }
    if (path == null || path.length() < 2) {
        System.err.println("\nMissing URL path: " + sAdminURL
                + "\nDefault supported URL paths are 'ca', 'kra', 'ocsp', and 'tks'.\n");
        waitForKeyPress(); // allow the user to read the msg on Win NT
        System.exit(1);
    }
    path = path.substring(1);
    if ((!path.equals("ca")) && (!path.equals("kra")) && (!path.equals("ocsp")) && (!path.equals("tks"))) {
        System.err.println("\nWarning: Potentially incorrect URL path: " + path
                + "\n         Default supported URL paths are 'ca', 'kra', 'ocsp', and 'tks'.\n");
    }
    int portNumber = url.getPort();
    if (portNumber < 0) {
        System.err.println("\nWarning: Unspecified port number: " + sAdminURL + "\n");
        /* Add warning about using non default port numbers after port separation is done.
                       "\n         Default port number is 9443.\n");
        } else if (portNumber != 9443) {
            System.err.println("\nWarning: Attempt to connect to non default port number: "+sAdminURL+
                       "\n         Default port number is 9443.\n");
        */
    }

    UtilConsoleGlobals.initJSS();

    ClientConfig config = new ClientConfig();
    config.setServerURL(protocol, hostName, portNumber);

    PKIClient client = new PKIClient(config);

    InfoClient infoClient = new InfoClient(client);
    Info info = infoClient.getInfo();
    String banner = info.getBanner();

    if (banner != null) {

        System.out.println(banner);
        System.out.println();
        System.out.print("Do you want to proceed (y/N)? ");
        System.out.flush();

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String line = reader.readLine().trim();

        if (!line.equalsIgnoreCase("Y")) {
            return;
        }
    }

    cinfo.put("cmsHost", url.getHost());
    cinfo.put("cmsPort", Integer.toString(portNumber));
    cinfo.put("cmsPath", path);
    admin.initialize(cinfo);
    admin.run(null, null);
    /*
            _console = new Console(sAdminURL, localAdminURL, sLang, host, uid, password);
    */
}

From source file:edu.cornell.med.icb.geo.tools.MicroarrayTrainEvaluate.java

private void proccess(final String[] args) {
    // create the Options
    final Options options = new Options();

    // help/* w w w . ja v a  2s .c  om*/
    options.addOption("h", "help", false, "print this message. When -r is used with a non zero integer n, "
            + "a set of n random gene lists is evaluated for each line of the task list. The evaluation statistics "
            + "reported is the number of random gene lists that obtained the same or better leave-one-out performance than "
            + "the gene list from the task list. Accuracy is used to evaluate performance for random trials. ");

    // input file name
    final Option inputOption = new Option("i", "input", true,
            "specify a GEO or RES data set file (GDS file or whitehead RES format)");
    inputOption.setArgName("file");
    inputOption.setRequired(true);
    options.addOption(inputOption);

    // output file name
    final Option outputOption = new Option("o", "output", true,
            "specify the destination file where statistics will be written");
    outputOption.setArgName("file");
    outputOption.setRequired(true);
    options.addOption(outputOption);

    // task list file name
    final Option tasksFilenameOption = new Option("t", "task-list", true,
            "specify the file with the list of tasks to perform. This file is tab separated");
    tasksFilenameOption.setArgName("file");
    tasksFilenameOption.setRequired(true);
    options.addOption(tasksFilenameOption);

    // condition identifiers file name
    final Option conditionsIdsFilenameOption = new Option("c", "conditions", true,
            "specify the file with the mapping condition-name column-identifier (tab separated, on mapping per line).");
    conditionsIdsFilenameOption.setArgName("file");
    conditionsIdsFilenameOption.setRequired(true);
    options.addOption(conditionsIdsFilenameOption);

    // gene lists file name
    final Option geneListsFilenameOption = new Option("g", "gene-list", true,
            "specify the file with the gene lists (one per line).");
    geneListsFilenameOption.setArgName("file");
    geneListsFilenameOption.setRequired(true);
    options.addOption(geneListsFilenameOption);

    // Geo platform description file name
    final Option platformDescriptionFilenameOption = new Option("p", "platform", true,
            "specify the platform description file(s) (GEO GPL file format). Multiple platorm files may be provided "
                    + " if separated by coma (e.g., file1,file2). Each file is read in the order provided.");
    platformDescriptionFilenameOption.setArgName("file,file");
    platformDescriptionFilenameOption.setRequired(true);
    options.addOption(platformDescriptionFilenameOption);

    // Number of random runs  (picking probesets randomly that are not in the gene list)
    final Option randomRunCountOption = new Option("r", "random-run-count", true,
            "Number of random runs to execute for each random gene list.");
    randomRunCountOption.setArgName("number");
    randomRunCountOption.setRequired(false);
    options.addOption(randomRunCountOption);

    // Number of probeset to randomly select for each random run
    final Option batchSizeRandomRun = new Option("b", "batch-size-random-run", true,
            "Number of probeset to randomly select for each random run. Default is " + DEFAULT_RANDOM_BATCH_SIZE
                    + ".");
    batchSizeRandomRun.setArgName("number");
    batchSizeRandomRun.setRequired(false);
    options.addOption(batchSizeRandomRun);

    // Number of shuffle runs (shuffling the training label).
    final Option shuffleRunCountOption = new Option("u", "shuffle-run-count", true,
            "Number of shuffle runs (label permutations) to execute for each training set.");
    shuffleRunCountOption.setArgName("number");
    shuffleRunCountOption.setRequired(false);
    options.addOption(shuffleRunCountOption);

    // Minimal signal value for signal floor adjustment.
    final Option floorSignalValueOption = new Option("f", "floor", true,
            "Specify a floor value for the signal. If a signal is lower than the floor, it is set to the floor.");
    floorSignalValueOption.setArgName("number");
    floorSignalValueOption.setRequired(false);
    options.addOption(floorSignalValueOption);

    // distinguish between one channel array and two channel array
    final Option channelOption = new Option("a", "two-channel-array", false,
            "Indicate that the data is for a two channel array. This flag affects how the floor value is interpreted."
                    + "For two channel arrays, values on the array are set to 1.0 if (Math.abs(oldValue-1.0)+1)<=floorValue, "
                    + "whereas for one channel array the condition becomes: oldValue<=floorValue.");
    channelOption.setRequired(false);
    options.addOption(channelOption);

    // Minimal signal value for signal floor adjustment.
    final Option svmLightOption = new Option("l", "light", false, "Choose svmLight. (default libSVM).");
    svmLightOption.setRequired(false);
    options.addOption(svmLightOption);

    // Number of random runs
    final Option seedOption = new Option("s", "seed", true, "Seed for the number generator.");
    seedOption.setArgName("number");
    seedOption.setRequired(false);

    // Timeout for stopping svmlight in seconds if the process does not complete.
    final Option timeoutOption = new Option("x", "timeout", true,
            "Timeout for svmLight training, in seconds (default 3600 seconds/1h).");
    timeoutOption.setArgName("number");
    timeoutOption.setRequired(false);
    options.addOption(timeoutOption);

    final Option clusterFilename = new Option("e", "clusters", true,
            "Name of file that describes clusters of genes. ");
    clusterFilename.setArgName("filename");
    clusterFilename.setRequired(false);
    options.addOption(clusterFilename);

    // parse the command line arguments
    CommandLine line = null;
    final double defaultLabelValue = 0;
    try {
        // create the command line parser
        final CommandLineParser parser = new BasicParser();
        line = parser.parse(options, args, true);
    } catch (ParseException e) {
        System.err.println(e.getMessage());
        usage(options);
        System.exit(1);
    }

    // print help and exit
    if (line.hasOption("h")) {
        usage(options);
        System.exit(0);
    }
    try {
        int randomRunCount = 0;
        final String randomCount = line.getOptionValue("r");
        if (randomCount != null) {
            randomRunCount = Integer.parseInt(randomCount);
        }

        if (line.hasOption("l")) {
            this.svmLight = true;
        }
        System.out.println("Using " + (svmLight ? "svmLight" : "libSVM"));
        final String batchSize = line.getOptionValue("b");
        if (batchSize != null) {
            this.randomBatchSize = Integer.parseInt(batchSize);
        } else {
            this.randomBatchSize = DEFAULT_RANDOM_BATCH_SIZE;
        }
        System.out.println("Will do " + randomRunCount + " random runs with batch-size=" + randomBatchSize);

        if (line.hasOption("a")) {
            this.oneChannelArray = false;
        } else {
            this.oneChannelArray = true;
        }

        final String floorOptionValue = line.getOptionValue("f");
        if (floorOptionValue != null) {
            adjustSignalToFloorValue = true;
            if (oneChannelArray) {
                this.signalFloorValue = DEFAULT_SIGNAL_FLOOR_VALUE_SINGLE_CHANNEL;
                this.signalFloorValue = Integer.parseInt(floorOptionValue);
            } else {
                this.signalFloorValue = DEFAULT_SIGNAL_FLOOR_VALUE_TWO_CHANNELS;
                this.signalFloorValue = Float.parseFloat(floorOptionValue);
            }
            System.out.println("Clipping signal at floor value: " + signalFloorValue);
            System.out.println("This chip has " + (oneChannelArray ? " one channel." : "two channels."));
        }

        int seed = (int) new Date().getTime();
        if (line.getOptionValue("s") != null) {
            seed = Integer.parseInt(line.getOptionValue("s"));
        }
        randomGenerator = new MersenneTwister(seed);

        int timeout = 60 * 60; // in seconds. // 1 hour
        if (line.getOptionValue("x") != null) {
            if (!svmLight) {
                System.out.println("Error: --timeout option can only be used with --light option.");
                System.exit(1);
            }
            timeout = Integer.parseInt(line.getOptionValue("x"));
            System.out.println("Timeout set to " + timeout + " second(s).");
        }
        this.timeout = timeout * 1000;

        final ClassificationTask[] tasks = readTasksAndConditions(line.getOptionValue("t"),
                line.getOptionValue("c"));
        final GeneList[] geneList = readGeneList(line.getOptionValue("p"), line.getOptionValue("g"));
        formatter = new DecimalFormat();
        formatter.setMaximumFractionDigits(2);

        final String uOption = line.getOptionValue("u");
        if (uOption == null) {
            countShuffleLabelTests = 0;
        } else {
            countShuffleLabelTests = Integer.parseInt(uOption);
        }

        System.out.println("Will do " + countShuffleLabelTests + " shuffling runs");
        final File outputFile = new File(line.getOptionValue("o"));
        final boolean outputFilePreexist = outputFile.exists();
        final PrintWriter statWriter = new PrintWriter(new FileWriter(outputFile, true)); // append stats to output.
        if (!outputFilePreexist) {
            ClassificationResults.writeHeader(statWriter, shuffleLabelTest);
        }

        convert(line.getOptionValue("i"), statWriter, tasks, geneList, randomRunCount);
        statWriter.close();
        System.exit(0);
    } catch (Exception e) {
        System.out.println(e);
        e.printStackTrace();
        System.exit(10);
    }
}

From source file:net.sourceforge.jencrypt.CommandLineHelper.java

/**
 * Build the Apache CLI Options collection based on the given string of
 * short opts.//from   ww w .  j  av a  2 s . c o m
 * 
 * @param selectOptions
 *            String of first characters of commandline options.
 * @return
 */
private Options getOptions(String selectOptions) {

    Options options = new Options();

    Option newOption = null;

    // Walk through string of short opts and build CLI Options collection
    for (char s : selectOptions.toCharArray()) {
        switch (s) {
        case 'e':
            newOption = new Option("e", "enc", true, "[File or folder to encrypt] [Destination file]");
            newOption.setArgs(3);
            break;
        case 'd':
            newOption = new Option("d", "dec", true, "[File to decrypt] [Destination folder]");
            newOption.setArgs(3);
            break;
        case 'i':
            newOption = new Option("i", "ini", false, "[Configuration file]");
            newOption.setArgs(1);
            break;
        case 'p':
            newOption = new Option("p", "pwd", false, "[Password to use for en-/decryption]");
            newOption.setArgs(1);
            break;
        }
        if (newOption != null) {
            newOption.setArgName("");
            options.addOption(newOption);
        }
    }
    return options;
}

From source file:io.janusproject.Boot.java

/** Replies the command line options supported by this boot class.
 *
 * @return the command line options./*from  w w  w .j  a v a  2 s. c o  m*/
 */
public static Options getOptions() {
    Option opt;
    Options options = new Options();

    options.addOption("B", "bootid", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_B", //$NON-NLS-1$
                    JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));

    options.addOption("f", "file", true, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_F")); //$NON-NLS-1$

    options.addOption("h", "help", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_H")); //$NON-NLS-1$

    options.addOption("nologo", false, //$NON-NLS-1$
            Locale.getString("CLI_HELP_NOLOGO")); //$NON-NLS-1$

    options.addOption("o", "offline", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_O", JanusConfig.OFFLINE)); //$NON-NLS-1$

    options.addOption("q", "quiet", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_Q")); //$NON-NLS-1$

    options.addOption("R", "randomid", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_R", //$NON-NLS-1$
                    JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));

    options.addOption("s", "showdefaults", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_S")); //$NON-NLS-1$

    options.addOption("v", "verbose", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_V")); //$NON-NLS-1$

    options.addOption("W", "worldid", false, //$NON-NLS-1$//$NON-NLS-2$
            Locale.getString("CLI_HELP_W", //$NON-NLS-1$
                    JanusConfig.BOOT_DEFAULT_CONTEXT_ID_NAME, JanusConfig.RANDOM_DEFAULT_CONTEXT_ID_NAME));
    StringBuilder b = new StringBuilder();
    int l = 0;
    for (String logLevel : LoggerCreator.getLevelStrings()) {
        if (b.length() > 0) {
            b.append(", "); //$NON-NLS-1$
        }
        b.append(logLevel);
        b.append(" ("); //$NON-NLS-1$
        b.append(l);
        b.append(")"); //$NON-NLS-1$
        ++l;
    }
    opt = new Option("l", "log", true, Locale.getString("CLI_HELP_L", //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
            JanusConfig.VERBOSE_LEVEL_VALUE, b));
    opt.setArgs(1);
    options.addOption(opt);
    opt = new Option("D", true, Locale.getString("CLI_HELP_D")); //$NON-NLS-1$//$NON-NLS-2$
    opt.setArgs(2);
    opt.setValueSeparator('=');
    opt.setArgName(Locale.getString("CLI_HELP_D_ARGNAME")); //$NON-NLS-1$
    options.addOption(opt);
    return options;
}

From source file:com.trsst.Command.java

@SuppressWarnings("static-access")
private void buildOptions(String[] argv, PrintStream out, InputStream in) {

    // NOTE: OptionsBuilder is NOT thread-safe
    // which was causing us random failures.
    Option o;

    portOptions = new Options();

    o = new Option(null, "Specify port");
    o.setRequired(false);/* w  w w  .  j  a  v a  2s. c  o  m*/
    o.setArgs(1);
    o.setLongOpt("port");
    portOptions.addOption(o);

    o = new Option(null, "Expose client API");
    o.setRequired(false);
    o.setArgs(0);
    o.setLongOpt("api");
    portOptions.addOption(o);

    o = new Option(null, "Launch embedded GUI");
    o.setRequired(false);
    o.setArgs(0);
    o.setLongOpt("gui");
    portOptions.addOption(o);

    o = new Option(null, "Turn off SSL");
    o.setRequired(false);
    o.setArgs(0);
    o.setLongOpt("clear");
    portOptions.addOption(o);

    o = new Option(null, "Use TOR (experimental)");
    o.setRequired(false);
    o.setArgs(0);
    o.setLongOpt("tor");
    portOptions.addOption(o);

    pullOptions = new Options();

    o = new Option("h", "Set host server for this operation");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("url");
    o.setLongOpt("host");
    pullOptions.addOption(o);

    o = new Option("d", "Decrypt entries as specified recipient id");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("id");
    o.setLongOpt("decrypt");
    pullOptions.addOption(o);

    postOptions = new Options();

    o = new Option("a", "Attach the specified file, or - for std input");
    o.setRequired(false);
    o.setOptionalArg(true);
    o.setArgName("file");
    o.setLongOpt("attach");
    postOptions.addOption(o);

    o = new Option("b", "Set base URL for this feed");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("url");
    o.setLongOpt("base");
    postOptions.addOption(o);

    o = new Option("p", "Specify passphrase on the command line");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("pass");
    postOptions.addOption(o);

    o = new Option("s", "Specify status update on command line");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("status");
    postOptions.addOption(o);

    o = new Option("u", "Attach the specified url to the new entry");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("url");
    o.setLongOpt("url");
    postOptions.addOption(o);

    o = new Option("v", "Specify an activitystreams verb for this entry");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("verb");
    o.setLongOpt("verb");
    postOptions.addOption(o);

    o = new Option("r", "Add a mention");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("id");
    o.setLongOpt("mention");
    postOptions.addOption(o);

    o = new Option("g", "Add a tag");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("tag");
    postOptions.addOption(o);

    o = new Option("c", "Specify entry content on command line");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("content");
    postOptions.addOption(o);

    o = new Option("t", "Set this feed's title");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("title");
    postOptions.addOption(o);

    o = new Option(null, "Set this feed's subtitle");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("subtitle");
    postOptions.addOption(o);

    o = new Option("n", "Set this feed's author name");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("text");
    o.setLongOpt("name");
    postOptions.addOption(o);

    o = new Option(null, "Set this feed's author uri");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("uri");
    o.setLongOpt("uri");
    postOptions.addOption(o);

    o = new Option("e", "Encrypt entry for specified public key");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("pubkey");
    o.setLongOpt("encrypt");
    postOptions.addOption(o);

    o = new Option("m", "Set this feed's author email");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("email");
    o.setLongOpt("email");
    postOptions.addOption(o);

    o = new Option("i", "Set as this feed's icon or specify url");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("url");
    o.setLongOpt("icon");
    postOptions.addOption(o);

    o = new Option("l", "Set as this feed's logo or specify url");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("url");
    o.setLongOpt("logo");
    postOptions.addOption(o);

    o = new Option(null, "Generate feed id with specified prefix");
    o.setRequired(false);
    o.setArgs(1);
    o.setArgName("prefix");
    o.setLongOpt("vanity");
    postOptions.addOption(o);

    o = new Option(null, "Require SSL certs");
    o.setRequired(false);
    o.setArgs(0);
    o.setLongOpt("strict");
    postOptions.addOption(o);

    // merge options parameters
    mergedOptions = new Options();
    for (Object obj : pullOptions.getOptions()) {
        mergedOptions.addOption((Option) obj);
    }
    for (Object obj : postOptions.getOptions()) {
        mergedOptions.addOption((Option) obj);
    }
    for (Object obj : portOptions.getOptions()) {
        mergedOptions.addOption((Option) obj);
    }
    helpOption = OptionBuilder.isRequired(false).withLongOpt("help").withDescription("Display these options")
            .create('?');
    mergedOptions.addOption(helpOption);
}

From source file:de.uni_koblenz.jgralab.utilities.rsa2tg.Rsa2Tg.java

/**
 * Processes all command line parameters and returns a {@link CommandLine}
 * object, which holds all values included in the given {@link String}
 * array.//  w  w  w .j a v a2  s. co m
 * 
 * @param args
 *            {@link CommandLine} parameters.
 * @return {@link CommandLine} object, which holds all necessary values.
 */
public static CommandLine processCommandLineOptions(String[] args) {

    // Creates a OptionHandler.
    String toolString = "java " + Rsa2Tg.class.getName();
    String versionString = JGraLab.getInfo(false);

    // TODO Add an additional help string to the help page.
    // This String needs to be included into the OptionHandler, but
    // the functionality is not present.

    // String additional =
    // "If no optional output option is selected, a file with the name "
    // + "\"<InputFileName>.rsa.tg\" will be written."
    // + "\n\n"
    // + toolString;

    OptionHandler oh = new OptionHandler(toolString, versionString);

    // Several Options are declared.
    Option validate = new Option(OPTION_FILENAME_VALIDATION, "report", true,
            "(optional): writes a validation report to the given filename. "
                    + "Free naming, but should look like this: '<filename>.html'");
    validate.setRequired(false);
    validate.setArgName("filename");
    oh.addOption(validate);

    Option export = new Option(OPTION_FILENAME_DOT, "export", true,
            "(optional): writes a GraphViz DOT file to the given filename. "
                    + "Free naming, but should look like this: '<filename>.dot'");
    export.setRequired(false);
    export.setArgName("filename");
    oh.addOption(export);

    Option schemaGraph = new Option(OPTION_FILENAME_SCHEMA_GRAPH, "schemaGraph", true,
            "(optional): writes a TG-file of the Schema as graph instance to the given filename. "
                    + "Free naming, but should look like this:  '<filename>.tg'");
    schemaGraph.setRequired(false);
    schemaGraph.setArgName("filename");
    oh.addOption(schemaGraph);

    Option input = new Option("i", "input", true, "(required): UML 2.1-XMI exchange model file of the Schema.");
    input.setRequired(true);
    input.setArgName("filename");
    oh.addOption(input);

    Option output = new Option(OPTION_FILENAME_SCHEMA, "output", true,
            "(optional): writes a TG-file of the Schema to the given filename. "
                    + "Free naming, but should look like this: '<filename>.rsa.tg.'");
    output.setRequired(false);
    output.setArgName("filename");
    oh.addOption(output);

    Option fromRole = new Option(OPTION_USE_ROLE_NAME, "useFromRole", false,
            "(optional): if this flag is set, the name of from roles will be used for creating undefined EdgeClass names.");
    fromRole.setRequired(false);
    oh.addOption(fromRole);

    Option unusedDomains = new Option(OPTION_REMOVE_UNUSED_DOMAINS, "removeUnusedDomains", false,
            "(optional): if this flag is set, all unused domains be deleted.");
    unusedDomains.setRequired(false);
    oh.addOption(unusedDomains);

    Option removeComments = new Option(OPTION_REMOVE_COMMENTS, "removeComments", false,
            "(optional): if this flag is set, all comments are removed.");
    removeComments.setRequired(false);
    oh.addOption(removeComments);

    Option emptyPackages = new Option(OPTION_KEEP_EMPTY_PACKAGES, "keepEmptyPackages", false,
            "(optional): if this flag is set, empty packages will be retained.");
    emptyPackages.setRequired(false);
    oh.addOption(emptyPackages);

    Option navigability = new Option(OPTION_USE_NAVIGABILITY, "useNavigability", false,
            "(optional): if this flag is set, navigability information will be interpreted as reading direction.");
    navigability.setRequired(false);
    oh.addOption(navigability);

    Option ignoreStereotypes = new Option(OPTION_IGNORE_UNKNOWN_STEREOTYPES, "ignoreUnknownStereotypes", false,
            "(optional): if this flag is set, unknown stereotypes are ignored.");
    ignoreStereotypes.setRequired(false);
    oh.addOption(ignoreStereotypes);

    // Parses the given command line parameters with all created Option.
    return oh.parse(args);
}

From source file:de.uni_koblenz.jgralab.utilities.rsa.Rsa2Tg.java

/**
 * Processes all command line parameters and returns a {@link CommandLine}
 * object, which holds all values included in the given {@link String}
 * array.//w w w. j  a v  a  2s .com
 * 
 * @param args
 *            {@link CommandLine} parameters.
 * @return {@link CommandLine} object, which holds all necessary values.
 */
public static CommandLine processCommandLineOptions(String[] args) {

    // Creates a OptionHandler.
    String toolString = "java " + Rsa2Tg.class.getName();
    String versionString = JGraLab.getInfo(false);

    // TODO Add an additional help string to the help page.
    // This String needs to be included into the OptionHandler, but
    // the functionality is not present.

    // String additional =
    // "If no optional output option is selected, a file with the name "
    // + "\"<InputFileName>.rsa.tg\" will be written."
    // + "\n\n"
    // + toolString;

    OptionHandler oh = new OptionHandler(toolString, versionString);

    // Several Options are declared.
    Option validate = new Option(OPTION_FILENAME_VALIDATION, "report", true,
            "(optional): writes a validation report to the given filename. "
                    + "Free naming, but should look like this: '<filename>.html'");
    validate.setRequired(false);
    validate.setArgName("filename");
    oh.addOption(validate);

    Option export = new Option(OPTION_FILENAME_DOT, "export", true,
            "(optional): writes a GraphViz DOT file to the given filename. "
                    + "Free naming, but should look like this: '<filename>.dot'");
    export.setRequired(false);
    export.setArgName("filename");
    oh.addOption(export);

    Option schemaGraph = new Option(OPTION_FILENAME_SCHEMA_GRAPH, "schemaGraph", true,
            "(optional): writes a TG-file of the Schema as graph instance to the given filename. "
                    + "Free naming, but should look like this:  '<filename>.tg'");
    schemaGraph.setRequired(false);
    schemaGraph.setArgName("filename");
    oh.addOption(schemaGraph);

    Option input = new Option("i", "input", true, "(required): UML 2.1-XMI exchange model file of the Schema.");
    input.setRequired(true);
    input.setArgName("filename");
    oh.addOption(input);

    Option output = new Option(OPTION_FILENAME_SCHEMA, "output", true,
            "(optional): writes a TG-file of the Schema to the given filename. "
                    + "Free naming, but should look like this: '<filename>.rsa.tg.'");
    output.setRequired(false);
    output.setArgName("filename");
    oh.addOption(output);

    Option fromRole = new Option(OPTION_USE_ROLE_NAME, "useFromRole", false,
            "(optional): if this flag is set, the name of from roles will be used for creating undefined EdgeClass names.");
    fromRole.setRequired(false);
    oh.addOption(fromRole);

    Option unusedDomains = new Option(OPTION_REMOVE_UNUSED_DOMAINS, "removeUnusedDomains", false,
            "(optional): if this flag is set, all unused domains be deleted.");
    unusedDomains.setRequired(false);
    oh.addOption(unusedDomains);

    Option emptyPackages = new Option(OPTION_KEEP_EMPTY_PACKAGES, "keepEmptyPackages", false,
            "(optional): if this flag is set, empty packages will be retained.");
    unusedDomains.setRequired(false);
    oh.addOption(emptyPackages);

    Option navigability = new Option(OPTION_USE_NAVIGABILITY, "useNavigability", false,
            "(optional): if this flag is set, navigability information will be interpreted as reading direction.");
    navigability.setRequired(false);
    oh.addOption(navigability);

    // Parses the given command line parameters with all created Option.
    return oh.parse(args);
}

From source file:no.antares.clutil.hitman.CommandLineOptions.java

private Option addOption(String opt, String description, String argName) {
    Option option = new Option(opt, true, description);
    option.setArgName(argName);
    options.addOption(option);//from  ww  w. j a v a2  s  .  co m
    return option;
}

From source file:op.OPDE.java

/**
 * Hier ist die main Methode von OPDE. In dieser Methode wird auch festgestellt, wie OPDE gestartet wurde.
 * <ul>/*  w  w  w  . j ava 2s. c o m*/
 * <li>Im Standard Modus, das heisst mit graphischer Oberflche. Das drfte der hufigste Fall sein.</li>
 * <li>Im DFNImport Modus. Der wird meist auf dem Datenbankserver gebraucht um Nachts die Durchfhrungsnachweise anhand der
 * DFNImport Tabelle zu generieren. Das alles gehrt zu der Pflegeplanung.</li>
 * <li>Im BHPImport Modus. Auch dieser Modus wird auf dem DB-Server gebraucht um die Behandlungspflege Massnahmen
 * anhand der rztlichen Verordnungen zu generieren.</li>
 * </ul>
 *
 * @param args Hier stehen die Kommandozeilen Parameter. Diese werden mit
 */
public static void main(String[] args) throws Exception {
    /***
     *
     *              ____
     *            ,'  , `.
     *         ,-+-,.' _ |              ,--,
     *      ,-+-. ;   , ||            ,--.'|         ,---,
     *     ,--.'|'   |  ;|            |  |,      ,-+-. /  |
     *    |   |  ,', |  ':  ,--.--.   `--'_     ,--.'|'   |
     *    |   | /  | |  || /       \  ,' ,'|   |   |  ,"' |
     *    '   | :  | :  |,.--.  .-. | '  | |   |   | /  | |
     *    ;   . |  ; |--'  \__\/: . . |  | :   |   | |  | |
     *    |   : |  | ,     ," .--.; | '  : |__ |   | |  |/
     *    |   : '  |/     /  /  ,.  | |  | '.'||   | |--'
     *    ;   | |`-'     ;  :   .'   \;  :    ;|   |/
     *    |   ;/         |  ,     .-./|  ,   / '---'
     *    '---'           `--`---'     ---`-'
     *
     */
    uptime = SYSCalendar.now();

    //        arial14 = new Font("Arial", Font.PLAIN, 14);
    //        arial28 = new Font("Arial", Font.PLAIN, 28);

    /***
     *      _                                               ____                  _ _
     *     | |    __ _ _ __   __ _ _   _  __ _  __ _  ___  | __ ) _   _ _ __   __| | | ___
     *     | |   / _` | '_ \ / _` | | | |/ _` |/ _` |/ _ \ |  _ \| | | | '_ \ / _` | |/ _ \
     *     | |__| (_| | | | | (_| | |_| | (_| | (_| |  __/ | |_) | |_| | | | | (_| | |  __/
     *     |_____\__,_|_| |_|\__, |\__,_|\__,_|\__, |\___| |____/ \__,_|_| |_|\__,_|_|\___|
     *                       |___/             |___/
     */
    lang = ResourceBundle.getBundle("languageBundle", Locale.getDefault());

    validatorFactory = Validation.buildDefaultValidatorFactory();

    /***
     *       ____      _       _             _ _                                                        _   _
     *      / ___|__ _| |_ ___| |__     __ _| | |  _ __ ___   __ _ _   _  ___    _____  _____ ___ _ __ | |_(_) ___  _ __  ___
     *     | |   / _` | __/ __| '_ \   / _` | | | | '__/ _ \ / _` | | | |/ _ \  / _ \ \/ / __/ _ \ '_ \| __| |/ _ \| '_ \/ __|
     *     | |__| (_| | || (__| | | | | (_| | | | | | | (_) | (_| | |_| |  __/ |  __/>  < (_|  __/ |_) | |_| | (_) | | | \__ \
     *      \____\__,_|\__\___|_| |_|  \__,_|_|_| |_|  \___/ \__, |\__,_|\___|  \___/_/\_\___\___| .__/ \__|_|\___/|_| |_|___/
     *                                                       |___/                               |_|
     */
    Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
        @Override
        public void uncaughtException(Thread t, Throwable e) {
            OPDE.fatal(e);
        }
    });

    localProps = new SortedProperties();
    props = new Properties();

    /***
     *                         _      _               ___        __
     *      _ __ ___  __ _  __| |    / \   _ __  _ __|_ _|_ __  / _| ___
     *     | '__/ _ \/ _` |/ _` |   / _ \ | '_ \| '_ \| || '_ \| |_ / _ \
     *     | | |  __/ (_| | (_| |  / ___ \| |_) | |_) | || | | |  _| (_) |
     *     |_|  \___|\__,_|\__,_| /_/   \_\ .__/| .__/___|_| |_|_|  \___/
     *                                    |_|   |_|
     */
    appInfo = new AppInfo();

    /***
     *       ____                                          _   _     _               ___        _   _
     *      / ___|___  _ __ ___  _ __ ___   __ _ _ __   __| | | |   (_)_ __   ___   / _ \ _ __ | |_(_) ___  _ __  ___
     *     | |   / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` | | |   | | '_ \ / _ \ | | | | '_ \| __| |/ _ \| '_ \/ __|
     *     | |__| (_) | | | | | | | | | | | (_| | | | | (_| | | |___| | | | |  __/ | |_| | |_) | |_| | (_) | | | \__ \
     *      \____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_| |_____|_|_| |_|\___|  \___/| .__/ \__|_|\___/|_| |_|___/
     *                                                                                   |_|
     */
    Options opts = new Options();
    opts.addOption("h", "hilfe", false, "Gibt die Hilfeseite fr OPDE aus.");
    opts.addOption("v", "version", false, "Zeigt die Versionsinformationen an.");
    opts.addOption("x", "experimental", false,
            "Schaltet experimentelle Programm-Module fr User frei, die Admin Rechte haben. VORSICHT !!!!");
    opts.addOption("a", "anonym", false,
            "Blendet die Bewohnernamen in allen Ansichten aus. Spezieller Modus fr Schulungsmaterial zu erstellen.");
    opts.addOption("w", "workingdir", true,
            "Damit kannst Du ein anderes Arbeitsverzeichnis setzen. Wenn Du diese Option weglsst, dann ist das Dein Benutzerverzeichnis: "
                    + System.getProperty("user.home"));
    opts.addOption("l", "debug", false,
            "Schaltet alle Ausgaben ein auf der Konsole ein, auch die, die eigentlich nur whrend der Softwareentwicklung angezeigt werden.");
    opts.addOption("t", "training", false,
            "Wird fr Einarbeitungsversionen bentigt. Frbt die Oberflche anders ein und zeigt eine Warnmeldung nach jeder Anmeldung.");
    Option optFTPserver = OptionBuilder.withLongOpt("ftpserver").withArgName("ip or hostname").hasArgs(1)
            .withDescription(lang.getString("cmdline.ftpserver")).create("f");
    opts.addOption(optFTPserver);
    //        opts.addOption("p", "pidfile", false, "Path to the pidfile which needs to be deleted when this application ends properly.");

    Option notification = OptionBuilder.withLongOpt("notification").hasOptionalArg()
            .withDescription("Schickt allen festgelegten Empfngern die jeweilige Benachrichtungs-Mail.")
            .create("n");
    notification.setArgName(
            "Liste der Empfnger (durch Komma getrennt, ohne Leerzeichen. UID verwenden). Damit kannst Du die Benachrichtigungen einschrnken. Fehlt diese Liste, erhalten ALLE Empfnger eine Mail.");
    opts.addOption(notification);

    opts.addOption(OptionBuilder.withLongOpt("jdbc").hasArg().withDescription(lang.getString("cmdline.jdbc"))
            .create("j"));

    Option dfnimport = OptionBuilder //.withArgName("datum")
            .withLongOpt("dfnimport").hasOptionalArg()
            .withDescription("Startet OPDE im DFNImport Modus fr den aktuellen Tag.").create("d");
    dfnimport.setArgName(
            "Anzahl der Tage (+ oder -) abweichend vom aktuellen Tag fr den der Import durchgefhrt werden soll. Nur in Ausnahmefllen anzuwenden.");
    opts.addOption(dfnimport);

    Option bhpimport = OptionBuilder.withLongOpt("bhpimport").hasOptionalArg()
            .withDescription("Startet OPDE im BHPImport Modus fr den aktuellen Tag.").create("b");
    //        bhpimport.setOptionalArg(true);
    bhpimport.setArgName(
            "Anzahl der Tage (+ oder -) abweichend vom aktuellen Tag fr den der Import durchgefhrt werden soll. Nur in Ausnahmefllen anzuwenden.");
    opts.addOption(bhpimport);

    BasicParser parser = new BasicParser();
    CommandLine cl = null;
    String footer = "http://www.Offene-Pflege.de";

    /***
     *      _          _
     *     | |__   ___| |_ __    ___  ___ _ __ ___  ___ _ __
     *     | '_ \ / _ \ | '_ \  / __|/ __| '__/ _ \/ _ \ '_ \
     *     | | | |  __/ | |_) | \__ \ (__| | |  __/  __/ | | |
     *     |_| |_|\___|_| .__/  |___/\___|_|  \___|\___|_| |_|
     *                  |_|
     */
    try {
        cl = parser.parse(opts, args);
    } catch (ParseException ex) {
        HelpFormatter f = new HelpFormatter();
        f.printHelp("OffenePflege.jar [OPTION]",
                "Offene-Pflege.de, Version " + appInfo.getVersion() + " Build:" + appInfo.getBuildnum(), opts,
                footer);
        System.exit(0);
    }

    // Alternative FTP-Server
    if (cl.hasOption("f")) {
        UPDATE_FTPSERVER = cl.getOptionValue("f");
    }

    if (cl.hasOption("h")) {
        HelpFormatter f = new HelpFormatter();
        f.printHelp("OffenePflege.jar [OPTION]",
                "Offene-Pflege.de, Version " + appInfo.getVersion() + " Build:" + appInfo.getBuildnum(), opts,
                footer);
        System.exit(0);
    }

    String homedir = System.getProperty("user.home");
    // alternatice working dir
    if (cl.hasOption("w")) {
        File dir = new File(cl.getOptionValue("w"));
        if (dir.exists() && dir.isDirectory()) {
            homedir = dir.getAbsolutePath();
        }
    }
    opwd = homedir + sep + AppInfo.dirBase;

    /***
     *                                                                ___
     *       __ _ _ __   ___  _ __  _   _ _ __ ___   ___  _   _ ___  |__ \
     *      / _` | '_ \ / _ \| '_ \| | | | '_ ` _ \ / _ \| | | / __|   / /
     *     | (_| | | | | (_) | | | | |_| | | | | | | (_) | |_| \__ \  |_|
     *      \__,_|_| |_|\___/|_| |_|\__, |_| |_| |_|\___/ \__,_|___/  (_)
     *                              |___/
     */
    if (cl.hasOption("a")) { // anonym Modus
        //localProps.put("anonym", "true");
        anonym = true;
        anonymize = new HashMap[] { SYSConst.getNachnamenAnonym(), SYSConst.getVornamenFrauAnonym(),
                SYSConst.getVornamenMannAnonym() };
    } else {
        anonym = false;
    }

    /***
     *      _       _ _                _       _
     *     (_)_ __ (_) |_   _ __  _ __(_)_ __ | |_ ___ _ __ ___
     *     | | '_ \| | __| | '_ \| '__| | '_ \| __/ _ \ '__/ __|
     *     | | | | | | |_  | |_) | |  | | | | | ||  __/ |  \__ \
     *     |_|_| |_|_|\__| | .__/|_|  |_|_| |_|\__\___|_|  |___/
     *                     |_|
     */
    printers = new LogicalPrinters();

    /***
     *      _                 _   _                 _                                   _   _
     *     | | ___   __ _  __| | | | ___   ___ __ _| |  _ __  _ __ ___  _ __   ___ _ __| |_(_) ___  ___
     *     | |/ _ \ / _` |/ _` | | |/ _ \ / __/ _` | | | '_ \| '__/ _ \| '_ \ / _ \ '__| __| |/ _ \/ __|
     *     | | (_) | (_| | (_| | | | (_) | (_| (_| | | | |_) | | | (_) | |_) |  __/ |  | |_| |  __/\__ \
     *     |_|\___/ \__,_|\__,_| |_|\___/ \___\__,_|_| | .__/|_|  \___/| .__/ \___|_|   \__|_|\___||___/
     *                                                 |_|             |_|
     */
    if (loadLocalProperties()) {

        //            try {
        //                FileAppender fileAppender = new FileAppender(layout, , true);
        //                logger.addAppender(fileAppender);
        //            } catch (IOException ex) {
        //                fatal(ex);
        //            }

        animation = localProps.containsKey("animation") && localProps.getProperty("animation").equals("true");

        logger.info("######### START ###########  " + OPDE.getAppInfo().getProgname() + ", v"
                + OPDE.getAppInfo().getVersion() + "/" + OPDE.getAppInfo().getBuildnum());
        logger.info(System.getProperty("os.name").toLowerCase());

        /***
         *      _     ____       _                   ___ ___
         *     (_)___|  _ \  ___| |__  _   _  __ _  |__ \__ \
         *     | / __| | | |/ _ \ '_ \| | | |/ _` |   / / / /
         *     | \__ \ |_| |  __/ |_) | |_| | (_| |  |_| |_|
         *     |_|___/____/ \___|_.__/ \__,_|\__, |  (_) (_)
         *                                   |___/
         */
        if (cl.hasOption("l") || SYSTools.catchNull(localProps.getProperty("debug")).equalsIgnoreCase("true")) {
            debug = true;
            logger.setLevel(Level.DEBUG);
        } else {
            debug = false;
            logger.setLevel(Level.INFO);
        }

        Logger.getLogger("org.hibernate").setLevel(Level.OFF);

        if (cl.hasOption("x")
                || SYSTools.catchNull(localProps.getProperty("experimental")).equalsIgnoreCase("true")) {
            experimental = true;

        } else {
            experimental = false;
        }

        if (cl.hasOption("t")
                || SYSTools.catchNull(localProps.getProperty("training")).equalsIgnoreCase("true")) {
            training = true;
        } else {
            training = false;
        }

        /***
         *          _ _                       _                                               _   _ _     _        ___ 
         *       __| | |____   _____ _ __ ___(_) ___  _ __     ___ ___  _ __ ___  _ __   __ _| |_(_) |__ | | ___  |__ \
         *      / _` | '_ \ \ / / _ \ '__/ __| |/ _ \| '_ \   / __/ _ \| '_ ` _ \| '_ \ / _` | __| | '_ \| |/ _ \   / /
         *     | (_| | |_) \ V /  __/ |  \__ \ | (_) | | | | | (_| (_) | | | | | | |_) | (_| | |_| | |_) | |  __/  |_| 
         *      \__,_|_.__/ \_/ \___|_|  |___/_|\___/|_| |_|  \___\___/|_| |_| |_| .__/ \__,_|\__|_|_.__/|_|\___|  (_) 
         *                                                                       |_|                                   
         */
        url = cl.hasOption("j") ? cl.getOptionValue("j") : localProps.getProperty("javax.persistence.jdbc.url");
        String hostkey = OPDE.getLocalProps().getProperty("hostkey");
        String cryptpassword = localProps.getProperty("javax.persistence.jdbc.password");
        DesEncrypter desEncrypter = new DesEncrypter(hostkey);
        Connection jdbcConnection = DriverManager.getConnection(url,
                localProps.getProperty("javax.persistence.jdbc.user"), desEncrypter.decrypt(cryptpassword));
        if (appInfo.getDbversion() != getDBVersion(jdbcConnection)) {
            SYSFilesTools.print(lang.getString("cant.start.with.version.mismatch"), false);
            System.exit(1);
        }
        jdbcConnection.close();

        /***
         *          _ ____   _      ____        _        _
         *         | |  _ \ / \    |  _ \  __ _| |_ __ _| |__   __ _ ___  ___
         *      _  | | |_) / _ \   | | | |/ _` | __/ _` | '_ \ / _` / __|/ _ \
         *     | |_| |  __/ ___ \  | |_| | (_| | || (_| | |_) | (_| \__ \  __/
         *      \___/|_| /_/   \_\ |____/ \__,_|\__\__,_|_.__/ \__,_|___/\___|
         *
         */
        Properties jpaProps = new Properties();
        jpaProps.put("javax.persistence.jdbc.user", localProps.getProperty("javax.persistence.jdbc.user"));

        try {
            jpaProps.put("javax.persistence.jdbc.password", desEncrypter.decrypt(cryptpassword));
        } catch (Exception e) {
            if (Desktop.isDesktopSupported()) {
                JOptionPane.showMessageDialog(null, SYSTools.xx("misc.msg.decryption.failure"),
                        appInfo.getProgname(), JOptionPane.ERROR_MESSAGE);
            } else {
                OPDE.fatal(e);
            }
            System.exit(1);
        }

        jpaProps.put("javax.persistence.jdbc.driver", localProps.getProperty("javax.persistence.jdbc.driver"));
        jpaProps.put("javax.persistence.jdbc.url", url);

        //            if (cl.hasOption("d") || cl.hasOption("d")) {  // not for BHP or DFN
        //                jpaProps.put("eclipselink.cache.shared.default", "false");
        //            } else {
        //                jpaProps.put("eclipselink.cache.shared.default", "true");
        //            }

        jpaProps.put("eclipselink.cache.shared.default", "false");
        jpaProps.put("eclipselink.session.customizer", "entity.JPAEclipseLinkSessionCustomizer");
        emf = Persistence.createEntityManagerFactory("OPDEPU", jpaProps);

        /***
         *     __     __            _
         *     \ \   / /__ _ __ ___(_) ___  _ __
         *      \ \ / / _ \ '__/ __| |/ _ \| '_ \
         *       \ V /  __/ |  \__ \ | (_) | | | |
         *        \_/ \___|_|  |___/_|\___/|_| |_|
         *
         */
        String header = SYSTools.getWindowTitle("");
        if (cl.hasOption("v")) {
            System.out.println(header);
            System.out.println(footer);
            System.exit(0);
        }

        /***
         *       ____                           _         ____  _____ _   _
         *      / ___| ___ _ __   ___ _ __ __ _| |_ ___  |  _ \|  ___| \ | |___
         *     | |  _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \ | | | | |_  |  \| / __|
         *     | |_| |  __/ | | |  __/ | | (_| | ||  __/ | |_| |  _| | |\  \__ \
         *      \____|\___|_| |_|\___|_|  \__,_|\__\___| |____/|_|   |_| \_|___/
         *
         */
        if (cl.hasOption("d")) {
            EntityManager em = OPDE.createEM();

            try {
                em.getTransaction().begin();
                Users rootUser = em.find(Users.class, "admin");

                SYSLogin rootLogin = em.merge(new SYSLogin(rootUser));
                OPDE.setLogin(rootLogin);
                initProps();

                // create the new DFNs
                DFNTools.generate(em);
                // move over the floating ones that have not yet been clicked to the current day
                DFNTools.moveFloating(em);

                em.getTransaction().commit();
            } catch (Exception ex) {
                if (em.getTransaction().isActive()) {
                    em.getTransaction().rollback();
                }
                fatal(ex);
            } finally {
                em.close();
            }
            System.exit(0);
        }

        /***
         *       ____                           _         ____  _   _ ____
         *      / ___| ___ _ __   ___ _ __ __ _| |_ ___  | __ )| | | |  _ \ ___
         *     | |  _ / _ \ '_ \ / _ \ '__/ _` | __/ _ \ |  _ \| |_| | |_) / __|
         *     | |_| |  __/ | | |  __/ | | (_| | ||  __/ | |_) |  _  |  __/\__ \
         *      \____|\___|_| |_|\___|_|  \__,_|\__\___| |____/|_| |_|_|   |___/
         *
         */
        if (cl.hasOption("b")) {

            EntityManager em = OPDE.createEM();

            try {
                em.getTransaction().begin();
                Users rootUser = em.find(Users.class, "admin");

                SYSLogin rootLogin = em.merge(new SYSLogin(rootUser));
                OPDE.setLogin(rootLogin);
                initProps();

                BHPTools.generate(em);

                em.getTransaction().commit();
            } catch (Exception ex) {
                if (em.getTransaction().isActive()) {
                    em.getTransaction().rollback();
                }
                fatal(ex);
            } finally {
                em.close();
            }
            System.exit(0);
        }

        /***
         *      _   _       _   _  __ _           _   _
         *     | \ | | ___ | |_(_)/ _(_) ___ __ _| |_(_) ___  _ __
         *     |  \| |/ _ \| __| | |_| |/ __/ _` | __| |/ _ \| '_ \
         *     | |\  | (_) | |_| |  _| | (_| (_| | |_| | (_) | | | |
         *     |_| \_|\___/ \__|_|_| |_|\___\__,_|\__|_|\___/|_| |_|
         *
         */
        if (cl.hasOption("n")) {

            EntityManager em = OPDE.createEM();

            try {
                em.getTransaction().begin();
                Users rootUser = em.find(Users.class, "admin");

                SYSLogin rootLogin = em.merge(new SYSLogin(rootUser));
                OPDE.setLogin(rootLogin);
                initProps();

                EMailSystem.notify(cl.getOptionValue("n"));

                em.getTransaction().commit();
            } catch (Exception ex) {
                if (em.getTransaction().isActive()) {
                    em.getTransaction().rollback();
                }
                fatal(ex);
            } finally {
                em.close();
            }
            System.exit(0);
        }

        // to speed things later. The first connection loads the while JPA system.
        EntityManager em1 = createEM();
        em1.close();

        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
        setStandardFont();

        try {
            css = SYSTools.readFileAsString(opwd + sep + AppInfo.dirTemplates + sep + AppInfo.fileStandardCSS);
        } catch (IOException ie) {
            css = "";
        }

        // JideSoft
        Lm.verifyLicense("Torsten Loehr", "Open-Pflege.de", "G9F4JW:Bm44t62pqLzp5woAD4OCSUAr2");
        WizardStyle.setStyle(WizardStyle.JAVA_STYLE);
        // JideSoft

        /***
         *      _____               __  __       _        ____
         *     |  ___| __ _ __ ___ |  \/  | __ _(_)_ __  / /\ \
         *     | |_ | '__| '_ ` _ \| |\/| |/ _` | | '_ \| |  | |
         *     |  _|| |  | | | | | | |  | | (_| | | | | | |  | |
         *     |_|  |_|  |_| |_| |_|_|  |_|\__,_|_|_| |_| |  | |
         *                                               \_\/_/
         */

        //        JFrame frm = new JFrame();
        //            frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        //            frm.setLayout(new FlowLayout());
        //
        //                    frm.getContentPane().add(new PnlBodyScheme(new Properties()));
        //
        //                    frm.setVisible(true);

        SYSTools.checkForSoftwareupdates();

        mainframe = new FrmMain();

        mainframe.setVisible(true);

    }
}