/**
 * Copyright (c) 2016, German Neuroinformatics Node (G-Node)
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted under the terms of the BSD License. See
 * LICENSE file in the root of the Project.
 */

package org.g_node;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.apache.log4j.Logger;
import org.g_node.micro.commons.AppUtils;
import org.g_node.micro.commons.CliToolController;
import org.g_node.reporter.LKTLogbook.CliLKTController;

/**
 * Main application class used to parse command line input and pass
 * information to the appropriate modules.
 *
 * @author Michael Sonntag (sonntag@bio.lmu.de)
 */
public class App {

    /**
     * Access to the main log4j LOGGER.
     */
    private static final Logger LOGGER = Logger.getLogger(App.class.getName());
    /**
     * Hash map of all implemented report tools mapping a string to the corresponding controller class.
     */
    private static final Map<String, CliToolController> REGISTRY = Collections.unmodifiableMap(
        new HashMap<String, CliToolController>() {
            {
                put("lkt", new CliLKTController());
            }
        }
    );

    /**
     * Main method of the CLI framework.
     * @param args Command line input arguments.
     */
    public static void main(final String[] args) {

        App.LOGGER.info("\n");
        App.LOGGER.info(String.join("", AppUtils.getTimeStamp("dd.MM.yyyy HH:mm"), ", Starting logfile."));
        App.LOGGER.info(String.join("", "Input arguments: '", String.join(" ", args), "'"));

        if (args.length > 0 && App.REGISTRY.containsKey(args[0])) {
            System.out.println("[DEBUG ] YAAAAY we have registered!");
        } else {
            App.LOGGER.error(
                    String.join("", "No existing report tool selected!",
                            "\n\t Please use syntax 'java -jar rdf-to-report.jar [reporter] [options]'",
                            "\n\t e.g. 'java -jar rdf-to-report.jar LKT -i RdfFile.ttl -o reportFile -f CVS'",
                            "\n\t Available reporter tools: '", App.REGISTRY.keySet().toString(), "'."
                    )
            );
        }
    }

}

@@ -378,16 +378,283 @@
 l.Map;%0A%0A
+import org.apache.commons.cli.CommandLine;%0Aimport org.apache.commons.cli.CommandLineParser;%0Aimport org.apache.commons.cli.DefaultParser;%0Aimport org.apache.commons.cli.HelpFormatter;%0Aimport org.apache.commons.cli.Options;%0Aimport org.apache.commons.cli.ParseException;%0A
 import o
@@ -1981,78 +1981,773 @@
 ) %7B%0A
-            System.out.println(%22%5BDEBUG %5D YAAAAY we have registered!%22);
+%0A            final HelpFormatter printHelp = new HelpFormatter();%0A            final CommandLineParser parser = new DefaultParser();%0A            final Options useOptions = App.REGISTRY.get(args%5B0%5D).options();%0A%0A            try %7B%0A                final CommandLine cmd = parser.parse(useOptions, args, false);%0A                if (cmd.hasOption(%22h%22)) %7B%0A                    printHelp.printHelp(%22Help%22, useOptions);%0A                    return;%0A                %7D%0A%0A                System.out.print(%22Implement run selected tool%22);%0A%0A            %7D catch (final ParseException exp) %7B%0A                printHelp.printHelp(%22Help%22, useOptions);%0A                App.LOGGER.error(%0A                        String.join(%22%22, %22%5Cn%22, exp.getMessage(), %22%5Cn%22)%0A                );%0A            %7D%0A
 %0A   

Add command line parser