Example usage for org.apache.commons.cli HelpFormatter printHelp

List of usage examples for org.apache.commons.cli HelpFormatter printHelp

Introduction

In this page you can find the example usage for org.apache.commons.cli HelpFormatter printHelp.

Prototype

public void printHelp(String cmdLineSyntax, Options options) 

Source Link

Document

Print the help for options with the specified command line syntax.

Usage

From source file:com.khubla.antlr4formatter.Antlr4Formatter.java

public static void main(String[] args) {
    try {//w ww  .ja v  a 2s  .co  m
        System.out.println("khubla.com Antlr4 Formatter");
        /*
         * options
         */
        final Options options = new Options();
        final Option o1 = Option.builder().argName(INPUT_OPTION).longOpt(INPUT_OPTION).type(String.class)
                .hasArg().required(false).desc("input file").build();
        options.addOption(o1);
        final Option o2 = Option.builder().argName(OUTPUT_OPTION).longOpt(OUTPUT_OPTION).type(String.class)
                .hasArg().required(false).desc("output file").build();
        options.addOption(o2);
        final Option o3 = Option.builder().argName(DIR_OPTION).longOpt(DIR_OPTION).type(String.class).hasArg()
                .required(false).desc("input dir").build();
        options.addOption(o3);
        /*
         * parse
         */
        final CommandLineParser parser = new DefaultParser();
        CommandLine cmd = null;
        try {
            cmd = parser.parse(options, args);
        } catch (final Exception e) {
            e.printStackTrace();
            final HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("posix", options);
            System.exit(0);
        }
        /*
         * get the file
         */
        final String inputFilename = cmd.getOptionValue(INPUT_OPTION);
        final String outputFilename = cmd.getOptionValue(OUTPUT_OPTION);
        final String inputDirOption = cmd.getOptionValue(DIR_OPTION);
        if (null == inputDirOption) {
            formatSingleFile(inputFilename, outputFilename);
        } else {
            formatDirectory(inputDirOption);
        }
    } catch (final Exception e) {
        e.printStackTrace();
    }
}

From source file:com.picdrop.security.SecureStoreMain.java

static public void main(String[] args)
        throws ParseException, IOException, FileNotFoundException, NoSuchAlgorithmException,
        CertificateException, KeyStoreException, KeyStoreException, InterruptedException {

    CommandLineParser cliP = new DefaultParser();

    Options ops = generateBasicOptions();
    CommandLine cli = cliP.parse(ops, args);
    HelpFormatter hlp = new HelpFormatter();

    SecureStore ss;/*from  w  ww  .j  a va2s  .c o  m*/
    String path = ".";

    try {
        if (cli.hasOption("help")) {
            hlp.printHelp("SecureStore", ops);
            System.exit(0);
        }

        if (cli.hasOption("keystore")) {
            path = cli.getOptionValue("keystore", ".");
        }

        if (cli.hasOption("create")) {
            ss = new SecureStore(path, false);
            ss.createKeyStore();
            System.exit(0);
        } else {
            ss = new SecureStore(path, true);
        }

        if (cli.hasOption("list")) {
            Enumeration<String> en = ss.listAlias();
            while (en.hasMoreElements()) {
                System.out.println(en.nextElement());
            }
            System.exit(0);
        }

        if (cli.hasOption("store")) {
            ss.storeValue(cli.getOptionValues("store")[0], cli.getOptionValues("store")[1]);
            ss.writeStore();
            System.exit(0);
        }

        if (cli.hasOption("clear")) {
            ss.deleteValue(cli.getOptionValue("clear"));
            ss.writeStore();
            System.exit(0);
        }
    } finally {
        hlp.printHelp("SecureStore", ops);
        System.exit(0);
    }
}

From source file:PlyBounder.java

public static void main(String[] args) {

    // Get the commandline arguments
    Options options = new Options();
    // Available options
    Option plyPath = OptionBuilder.withArgName("dir").hasArg()
            .withDescription("directory containing input .ply files").create("plyPath");
    Option boundingbox = OptionBuilder.withArgName("string").hasArg()
            .withDescription("bounding box in WKT notation").create("boundingbox");
    Option outputPlyFile = OptionBuilder.withArgName("file").hasArg().withDescription("output PLY file name")
            .create("outputPlyFile");
    options.addOption(plyPath);/*from   www .  ja  va 2  s.com*/
    options.addOption(boundingbox);
    options.addOption(outputPlyFile);

    String plydir = ".";
    String boundingboxstr = "";
    String outputfilename = "";

    CommandLineParser parser = new DefaultParser();
    try {
        // parse the command line arguments
        CommandLine line = parser.parse(options, args);

        boundingboxstr = line.getOptionValue("boundingbox");
        outputfilename = line.getOptionValue("outputPlyFile");

        if (line.hasOption("plyPath")) {
            // print the value of block-size
            plydir = line.getOptionValue("plyPath");
            System.out.println("Using plyPath=" + plydir);
        } else {
            HelpFormatter formatter = new HelpFormatter();
            formatter.printHelp("PlyBounder", options);
        }
        //System.out.println( "plyPath=" + line.getOptionValue( "plyPath" ) );
    } catch (ParseException exp) {
        System.err.println("Error getting arguments: " + exp.getMessage());
    }

    // input directory
    // Get list of files
    File dir = new File(plydir);

    //System.out.println("Getting all files in " + dir.getCanonicalPath());
    List<File> files = (List<File>) FileUtils.listFiles(dir, new String[] { "ply", "PLY" }, false);
    for (File file : files) {
        try {
            System.out.println("file=" + file.getCanonicalPath());
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    String sometempfile = "magweg.wkt";
    String s = null;

    // Loop through .ply files in directory
    for (File file : files) {
        try {
            String cmdl[] = { "./ply-tool.py", "intersection", file.getCanonicalPath(), boundingboxstr,
                    sometempfile };
            //System.out.println("Running: " + Arrays.toString(cmdl));
            Process p = Runtime.getRuntime().exec(cmdl);

            BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));

            BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));

            // read the output from the command
            System.out.println("cmdout:\n");
            while ((s = stdInput.readLine()) != null) {
                System.out.println(s);
            }

            // read any errors from the attempted command
            System.out.println("cmderr:\n");
            while ((s = stdError.readLine()) != null) {
                System.out.println(s);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    // Write new .ply file
    //ply-tool write setfile outputPlyFile
    try {
        String cmdl = "./ply-tool.py write " + sometempfile + " " + outputfilename;
        System.out.println("Running: " + cmdl);
        Process p = Runtime.getRuntime().exec(cmdl);

        BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));

        BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));

        // read the output from the command
        System.out.println("cmdout:\n");
        while ((s = stdInput.readLine()) != null) {
            System.out.println(s);
        }

        // read any errors from the attempted command
        System.out.println("cmderr:\n");
        while ((s = stdError.readLine()) != null) {
            System.out.println(s);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    // Done
    System.out.println("Done");
}

From source file:com.crushpaper.Main.java

public static void main(String[] args) throws IOException {
    Options options = new Options();
    options.addOption("help", false, "print this message");
    options.addOption("properties", true, "file system path to the crushpaper properties file");

    // Parse the command line.
    CommandLineParser parser = new BasicParser();
    CommandLine commandLine = null;/*from  w w w .j  a v a  2s. c o m*/

    try {
        commandLine = parser.parse(options, args);
    } catch (ParseException e) {
        System.err.println("crushpaper: Sorry, could not parse command line because `" + e.getMessage() + "`.");
        System.exit(1);
    }

    if (commandLine == null || commandLine.hasOption("help")) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("crushpaper", options);
        return;
    }

    // Get the properties path.
    String properties = null;
    if (commandLine.hasOption("properties")) {
        properties = commandLine.getOptionValue("properties");
    }

    if (properties == null || properties.isEmpty()) {
        System.err.println("crushpaper: Sorry, the `properties` command argument must be specified.");
        System.exit(1);
    }

    Configuration configuration = new Configuration();
    if (!configuration.load(new File(properties))) {
        System.exit(1);
    }

    // Get values.
    File databaseDirectory = configuration.getDatabaseDirectory();
    File keyStorePath = configuration.getKeyStoreFile();
    Integer httpPort = configuration.getHttpPort();
    Integer httpsPort = configuration.getHttpsPort();
    Integer httpsProxiedPort = configuration.getHttpsProxiedPort();
    String keyStorePassword = configuration.getKeyStorePassword();
    String keyManagerPassword = configuration.getKeyManagerPassword();
    File temporaryDirectory = configuration.getTemporaryDirectory();
    String singleUserName = configuration.getSingleUserName();
    Boolean allowSelfSignUp = configuration.getAllowSelfSignUp();
    Boolean allowSaveIfNotSignedIn = configuration.getAllowSaveIfNotSignedIn();
    File logDirectory = configuration.getLogDirectory();
    Boolean loopbackIsAdmin = configuration.getLoopbackIsAdmin();
    File sessionStoreDirectory = configuration.getSessionStoreDirectory();
    Boolean isOfficialSite = configuration.getIsOfficialSite();
    File extraHeaderFile = configuration.getExtraHeaderFile();

    // Validate the values.
    if (httpPort != null && httpsPort != null && httpPort.equals(httpsPort)) {
        System.err.println("crushpaper: Sorry, `" + configuration.getHttpPortKey() + "` and `"
                + configuration.getHttpsPortKey() + "` must not be set to the same value.");
        System.exit(1);
    }

    if ((httpsPort == null) != (keyStorePath == null)) {
        System.err.println("crushpaper: Sorry, `" + configuration.getHttpsPortKey() + "` and `"
                + configuration.getKeyStoreKey() + "` must either both be set or not set.");
        System.exit(1);
    }

    if (httpsProxiedPort != null && httpsPort == null) {
        System.err.println("crushpaper: Sorry, `" + configuration.getHttpsProxiedPortKey()
                + "` can only be set if `" + configuration.getHttpsPortKey() + "` is set.");
        System.exit(1);
    }

    if (databaseDirectory == null) {
        System.err.println("crushpaper: Sorry, `" + configuration.getDatabaseDirectoryKey() + "` must be set.");
        System.exit(1);
    }

    if (singleUserName != null && !AccountAttributeValidator.isUserNameValid(singleUserName)) {
        System.err.println(
                "crushpaper: Sorry, the username in `" + configuration.getSingleUserKey() + "` is not valid.");
        return;
    }

    if (allowSelfSignUp == null || allowSaveIfNotSignedIn == null || loopbackIsAdmin == null) {
        System.exit(1);
    }

    String extraHeader = null;
    if (extraHeaderFile != null) {
        extraHeader = readFile(extraHeaderFile);
        if (extraHeader == null) {
            System.err.println("crushpaper: Sorry, the file `" + extraHeaderFile.getPath() + "` set in `"
                    + configuration.getExtraHeaderKey() + "` could not be read.");
            System.exit(1);
        }
    }

    final DbLogic dbLogic = new DbLogic(databaseDirectory);
    dbLogic.createDb();
    final Servlet servlet = new Servlet(dbLogic, singleUserName, allowSelfSignUp, allowSaveIfNotSignedIn,
            loopbackIsAdmin, httpPort, httpsPort, httpsProxiedPort, keyStorePath, keyStorePassword,
            keyManagerPassword, temporaryDirectory, logDirectory, sessionStoreDirectory, isOfficialSite,
            extraHeader);
    servlet.run();
}

From source file:com.linkedin.helix.tools.ZKDumper.java

public static void main(String[] args) throws Exception {
    if (args == null || args.length == 0) {
        HelpFormatter helpFormatter = new HelpFormatter();
        helpFormatter.printHelp("java " + ZKDumper.class.getName(), options);
        System.exit(1);//w w  w. ja va  2 s .  co  m
    }
    CommandLineParser parser = new PosixParser();
    CommandLine cmd = parser.parse(options, args);
    cmd.hasOption("zkSvr");
    boolean download = cmd.hasOption("download");
    boolean upload = cmd.hasOption("upload");
    boolean del = cmd.hasOption("delete");
    String zkAddress = cmd.getOptionValue("zkSvr");
    String zkPath = cmd.getOptionValue("zkpath");
    String fsPath = cmd.getOptionValue("fspath");

    ZKDumper zkDump = new ZKDumper(zkAddress);
    if (download) {
        if (cmd.hasOption("addSuffix")) {
            zkDump.suffix = cmd.getOptionValue("addSuffix");
        }
        zkDump.download(zkPath, fsPath + zkPath);
    }
    if (upload) {
        if (cmd.hasOption("removeSuffix")) {
            zkDump.removeSuffix = true;
        }
        zkDump.upload(zkPath, fsPath);
    }
    if (del) {
        zkDump.delete(zkPath);
    }
}

From source file:DokeosConverter.java

public static void main(String[] arguments) throws Exception {
    CommandLineParser commandLineParser = new PosixParser();
    CommandLine commandLine = commandLineParser.parse(OPTIONS, arguments);

    int port = SocketOpenOfficeConnection.DEFAULT_PORT;
    if (commandLine.hasOption(OPTION_PORT.getOpt())) {
        port = Integer.parseInt(commandLine.getOptionValue(OPTION_PORT.getOpt()));
    }//from w ww. ja v  a  2s.  co  m

    String outputFormat = null;
    if (commandLine.hasOption(OPTION_OUTPUT_FORMAT.getOpt())) {
        outputFormat = commandLine.getOptionValue(OPTION_OUTPUT_FORMAT.getOpt());
    }

    boolean verbose = false;
    if (commandLine.hasOption(OPTION_VERBOSE.getOpt())) {
        verbose = true;
    }

    String dokeosMode = "woogie";
    if (commandLine.hasOption(OPTION_DOKEOS_MODE.getOpt())) {
        dokeosMode = commandLine.getOptionValue(OPTION_DOKEOS_MODE.getOpt());
    }
    int width = 800;
    if (commandLine.hasOption(OPTION_WIDTH.getOpt())) {
        width = Integer.parseInt(commandLine.getOptionValue(OPTION_WIDTH.getOpt()));
    }

    int height = 600;
    if (commandLine.hasOption(OPTION_HEIGHT.getOpt())) {
        height = Integer.parseInt(commandLine.getOptionValue(OPTION_HEIGHT.getOpt()));
    }

    String[] fileNames = commandLine.getArgs();
    if ((outputFormat == null && fileNames.length != 2 && dokeosMode != null) || fileNames.length < 1) {
        String syntax = "convert [options] input-file output-file; or\n"
                + "[options] -f output-format input-file [input-file...]";
        HelpFormatter helpFormatter = new HelpFormatter();
        helpFormatter.printHelp(syntax, OPTIONS);
        System.exit(EXIT_CODE_TOO_FEW_ARGS);
    }

    OpenOfficeConnection connection = new DokeosSocketOfficeConnection(port);
    try {
        if (verbose) {
            System.out.println("-- connecting to OpenOffice.org on port " + port);
        }
        connection.connect();
    } catch (ConnectException officeNotRunning) {
        System.err.println(
                "ERROR: connection failed. Please make sure OpenOffice.org is running and listening on port "
                        + port + ".");
        System.exit(EXIT_CODE_CONNECTION_FAILED);
    }
    try {

        // choose the good constructor to deal with the conversion
        DocumentConverter converter;
        if (dokeosMode.equals("oogie")) {
            converter = new OogieDocumentConverter(connection, new DokeosDocumentFormatRegistry(), width,
                    height);
        } else if (dokeosMode.equals("woogie")) {
            converter = new WoogieDocumentConverter(connection, new DokeosDocumentFormatRegistry(), width,
                    height);
        } else {
            converter = new OpenOfficeDocumentConverter(connection);
        }

        if (outputFormat == null) {
            File inputFile = new File(fileNames[0]);
            File outputFile = new File(fileNames[1]);
            convertOne(converter, inputFile, outputFile, verbose);
        } else {
            for (int i = 0; i < fileNames.length; i++) {
                File inputFile = new File(fileNames[i]);
                File outputFile = new File(FilenameUtils.getFullPath(fileNames[i])
                        + FilenameUtils.getBaseName(fileNames[i]) + "." + outputFormat);
                convertOne(converter, inputFile, outputFile, verbose);
            }
        }
    } catch (com.artofsolving.jodconverter.openoffice.connection.OpenOfficeException e) {
        connection.disconnect();
        System.err.println("ERROR: conversion failed.");
        System.exit(EXIT_CODE_CONVERSION_FAILED);
    } finally {
        if (verbose) {
            System.out.println("-- disconnecting");
        }
        connection.disconnect();
    }
}

From source file:ca.uhn.hunit.example.MllpHl7v2MessageSwapper.java

public static void main(String[] theArgs) {
    Options options = new Options();

    Option option = new Option("R", true, "Text to substiture in the message");
    option.setArgs(2);/*w w  w.  ja va2s.  c  om*/
    option.setArgName("text=substitution");
    option.setValueSeparator('=');
    option.setRequired(true);
    options.addOption(option);

    option = new Option("p", true, "Number of passes");
    option.setValueSeparator('=');
    option.setRequired(false);
    options.addOption(option);

    CommandLine commandLine;
    int passes;

    try {
        commandLine = new PosixParser().parse(options, theArgs);
        passes = Integer.parseInt(commandLine.getOptionValue("p", "1"));
    } catch (ParseException e) {
        HelpFormatter hf = new HelpFormatter();
        hf.printHelp(
                "java -cp hunit-[version]-jar-with-dependencies.jar ca.uhn.hunit.example.MllpHl7v2MessageSwapper {-Rtext=substitution}... [options]",
                options);

        return;
    }

    Properties substitutions = commandLine.getOptionProperties("R");

    new MllpHl7v2MessageSwapper(true, substitutions, passes).run();
}

From source file:cc.twittertools.search.api.TrecSearchThriftLoadGenerator.java

@SuppressWarnings("static-access")
public static void main(String[] args) throws Exception {
    Options options = new Options();

    options.addOption(new Option(HELP_OPTION, "show help"));
    options.addOption(OptionBuilder.withArgName("port").hasArg().withDescription("port").create(PORT_OPTION));
    options.addOption(OptionBuilder.withArgName("index").hasArg().withDescription("host").create(HOST_OPTION));
    options.addOption(/* w  ww .  j av  a  2  s . com*/
            OptionBuilder.withArgName("num").hasArg().withDescription("threads").create(THREADS_OPTION));
    options.addOption(OptionBuilder.withArgName("num").hasArg().withDescription("number of queries to process")
            .create(LIMIT_OPTION));
    options.addOption(
            OptionBuilder.withArgName("string").hasArg().withDescription("group id").create(GROUP_OPTION));
    options.addOption(
            OptionBuilder.withArgName("string").hasArg().withDescription("access token").create(TOKEN_OPTION));

    CommandLine cmdline = null;
    CommandLineParser parser = new GnuParser();
    try {
        cmdline = parser.parse(options, args);
    } catch (ParseException exp) {
        System.err.println("Error parsing command line: " + exp.getMessage());
        System.exit(-1);
    }

    if (cmdline.hasOption(HELP_OPTION) || !cmdline.hasOption(HOST_OPTION)) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(TrecSearchThriftServer.class.getName(), options);
        System.exit(-1);
    }

    String host = cmdline.getOptionValue(HOST_OPTION);
    int port = cmdline.hasOption(PORT_OPTION) ? Integer.parseInt(cmdline.getOptionValue(PORT_OPTION))
            : DEFAULT_PORT;
    int numThreads = cmdline.hasOption(THREADS_OPTION)
            ? Integer.parseInt(cmdline.getOptionValue(THREADS_OPTION))
            : DEFAULT_THREADS;
    int limit = cmdline.hasOption(LIMIT_OPTION) ? Integer.parseInt(cmdline.getOptionValue(LIMIT_OPTION))
            : Integer.MAX_VALUE;

    String group = cmdline.hasOption(GROUP_OPTION) ? cmdline.getOptionValue(GROUP_OPTION) : null;
    String token = cmdline.hasOption(TOKEN_OPTION) ? cmdline.getOptionValue(TOKEN_OPTION) : null;

    String queryFile = "data/queries.trec2005efficiency.txt";
    new TrecSearchThriftLoadGenerator(new File(queryFile), limit).withThreads(numThreads)
            .withCredentials(group, token).run(host, port);
}

From source file:com.arainfor.thermostat.daemon.HvacMonitor.java

/**
 * @param args The Program Arguments/*from   www .j a va  2s. c  o m*/
 */
public static void main(String[] args) throws IOException {

    Logger log = LoggerFactory.getLogger(HvacMonitor.class);

    //System.err.println(APPLICATION_NAME + " v" + APPLICATION_VERSION_MAJOR + "." + APPLICATION_VERSION_MINOR + "." + APPLICATION_VERSION_BUILD);
    Options options = new Options();
    options.addOption("help", false, "This message isn't very helpful");
    options.addOption("version", false, "Print the version number");
    options.addOption("monitor", false, "Start GUI Monitor");
    options.addOption("config", true, "The configuration file");

    CommandLineParser parser = new GnuParser();
    CommandLine cmd;

    try {
        cmd = parser.parse(options, args);
        if (cmd.hasOption("help")) {
            HelpFormatter hf = new HelpFormatter();
            hf.printHelp(APPLICATION_NAME, options);
            return;
        }
        if (cmd.hasOption("version")) {
            System.out.println("The " + APPLICATION_NAME + " v" + APPLICATION_VERSION_MAJOR + "."
                    + APPLICATION_VERSION_MINOR + "." + APPLICATION_VERSION_BUILD);
        }
    } catch (ParseException e) {
        e.printStackTrace();
        return;
    }

    String propFileName = "thermostat.properties";
    if (cmd.getOptionValue("config") != null)
        propFileName = cmd.getOptionValue("config");

    log.info("loading...{}", propFileName);

    try {
        Properties props = new PropertiesLoader(propFileName).getProps();

        // Append the system properties with our application properties
        props.putAll(System.getProperties());
        System.setProperties(props);
    } catch (FileNotFoundException fnfe) {
        log.warn("Cannot load file:", fnfe);
    }

    new HvacMonitor().start();

}

From source file:de.tudarmstadt.ukp.teaching.uima.nounDecompounding.evaluation.CouchDbExport.java

@SuppressWarnings("static-access")
public static void main(String[] args) {
    Options options = new Options();
    options.addOption(OptionBuilder.withLongOpt("host")
            .withDescription("(optional) The couchdb host. default: 127.0.0.1").hasArg().create());
    options.addOption(OptionBuilder.withLongOpt("port")
            .withDescription("(optional) The couchdb port. default: 5984").hasArg().create());
    options.addOption(OptionBuilder.withLongOpt("username")
            .withDescription("(optional) The couchdb username. default: <empty>").hasArg().create());
    options.addOption(OptionBuilder.withLongOpt("password")
            .withDescription("(optional) The couchdb password. default: <empty>").hasArg().create());
    options.addOption(OptionBuilder.withLongOpt("dbname")
            .withDescription("(optional) The couchdb database name. default: noun_decompounding").hasArg()
            .create());/*from  w  ww  . j a  v a  2s .co m*/
    options.addOption(OptionBuilder.withLongOpt("limit")
            .withDescription("(optional) The amount of documents you want to export. default: all").hasArg()
            .create());

    CommandLineParser parser = new PosixParser();
    CommandLine cmd;
    try {
        cmd = parser.parse(options, args);
    } catch (ParseException e) {
        System.err.println("Error: " + e.getMessage());

        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("countTotalFreq", options);
        return;
    }
    String host = (cmd.hasOption("host")) ? cmd.getOptionValue("host") : "127.0.0.1";
    int port = Integer.parseInt((cmd.hasOption("port")) ? cmd.getOptionValue("port") : "5984");
    String username = (cmd.hasOption("username")) ? cmd.getOptionValue("username") : "";
    String password = (cmd.hasOption("password")) ? cmd.getOptionValue("password") : "";
    String dbName = (cmd.hasOption("dbname")) ? cmd.getOptionValue("dbname") : "";
    int limit = (cmd.hasOption("limit")) ? Integer.parseInt(cmd.getOptionValue("limit")) : Integer.MAX_VALUE;

    IDictionary dict = new IGerman98Dictionary(new File("src/main/resources/de_DE.dic"),
            new File("src/main/resources/de_DE.aff"));
    LinkingMorphemes morphemes = new LinkingMorphemes(new File("src/main/resources/linkingMorphemes.txt"));
    LeftToRightSplitAlgorithm algo = new LeftToRightSplitAlgorithm(dict, morphemes);

    HttpClient httpClient = new StdHttpClient.Builder().host(host).port(port).username(username)
            .password(password).build();
    CouchDbInstance dbInstance = new StdCouchDbInstance(httpClient);
    CouchDbConnector db = new StdCouchDbConnector(dbName, dbInstance);

    try {
        CouchDbExport exporter = new CouchDbExport(
                new CcorpusReader(new File("src/main/resources/evaluation/ccorpus.txt")), db);
        exporter.export(algo, limit);
    } catch (FileNotFoundException e1) {
        // TODO Auto-generated catch block
        e1.printStackTrace();
    }
}