Return-Path: X-Original-To: apmail-devicemap-commits-archive@www.apache.org Delivered-To: apmail-devicemap-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6E13B1861B for ; Sun, 20 Dec 2015 21:57:59 +0000 (UTC) Received: (qmail 79400 invoked by uid 500); 20 Dec 2015 21:57:59 -0000 Delivered-To: apmail-devicemap-commits-archive@devicemap.apache.org Received: (qmail 79373 invoked by uid 500); 20 Dec 2015 21:57:59 -0000 Mailing-List: contact commits-help@devicemap.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@devicemap.apache.org Delivered-To: mailing list commits@devicemap.apache.org Received: (qmail 79363 invoked by uid 99); 20 Dec 2015 21:57:59 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Dec 2015 21:57:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id C4CE81804C0 for ; Sun, 20 Dec 2015 21:57:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.247 X-Spam-Level: * X-Spam-Status: No, score=1.247 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-0.554, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id iElktQks2Yey for ; Sun, 20 Dec 2015 21:57:56 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with ESMTP id 089B720C59 for ; Sun, 20 Dec 2015 21:57:56 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id F1C8EE0097 for ; Sun, 20 Dec 2015 21:57:54 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id D95BC3A023D for ; Sun, 20 Dec 2015 21:57:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1721073 - in /devicemap/trunk/clients/1.0/java: console/NOTICE console/pom.xml console/src/main/java/org/apache/devicemap/console/DeviceMapConsole.java pom.xml Date: Sun, 20 Dec 2015 21:57:54 -0000 To: commits@devicemap.apache.org From: wkeil@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20151220215754.D95BC3A023D@svn01-us-west.apache.org> Author: wkeil Date: Sun Dec 20 21:57:54 2015 New Revision: 1721073 URL: http://svn.apache.org/viewvc?rev=1721073&view=rev Log: DMAP-186: Some arguments like debug/log won't work in Java Console Task-Url: https://issues.apache.org/jira/browse/DMAP-186 Modified: devicemap/trunk/clients/1.0/java/console/NOTICE devicemap/trunk/clients/1.0/java/console/pom.xml devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/DeviceMapConsole.java devicemap/trunk/clients/1.0/java/pom.xml Modified: devicemap/trunk/clients/1.0/java/console/NOTICE URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/java/console/NOTICE?rev=1721073&r1=1721072&r2=1721073&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/java/console/NOTICE (original) +++ devicemap/trunk/clients/1.0/java/console/NOTICE Sun Dec 20 21:57:54 2015 @@ -1,8 +1,7 @@ ============= Bundled APIs: ============= -This module uses the Airlift Airline framework. -It is licensed under Apache 2 as well. +This module uses Apache Commons CLI. -The source code of Airline is available at -https://github.com/airlift/airline +The source code of Apache Commons CLI is available at +https://commons.apache.org/proper/commons-cli/source-repository.html \ No newline at end of file Modified: devicemap/trunk/clients/1.0/java/console/pom.xml URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/java/console/pom.xml?rev=1721073&r1=1721072&r2=1721073&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/java/console/pom.xml (original) +++ devicemap/trunk/clients/1.0/java/console/pom.xml Sun Dec 20 21:57:54 2015 @@ -41,8 +41,8 @@ devicemap-client - io.airlift - airline + commons-cli + commons-cli junit Modified: devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/DeviceMapConsole.java URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/DeviceMapConsole.java?rev=1721073&r1=1721072&r2=1721073&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/DeviceMapConsole.java (original) +++ devicemap/trunk/clients/1.0/java/console/src/main/java/org/apache/devicemap/console/DeviceMapConsole.java Sun Dec 20 21:57:54 2015 @@ -18,14 +18,6 @@ */ package org.apache.devicemap.console; -import io.airlift.airline.Arguments; -import io.airlift.airline.Cli; -import io.airlift.airline.Cli.CliBuilder; -import io.airlift.airline.Command; -import io.airlift.airline.Help; -import io.airlift.airline.Option; -import io.airlift.airline.OptionType; - import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -34,6 +26,14 @@ import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; +import org.apache.commons.cli.BasicParser; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionBuilder; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; import org.apache.devicemap.DeviceMapClient; import org.apache.devicemap.data.Device; import org.apache.devicemap.loader.LoaderOption; @@ -42,14 +42,16 @@ import org.apache.devicemap.loader.impl. /** * @author Reza Naghibi * @author Werner Keil - * @version 1.1.1 + * @version 1.1.2 */ public class DeviceMapConsole { private static final String APP_NAME = "DeviceMap Java Console"; - private final static Logger LOG = Logger.getLogger(DeviceMapConsole.class.getName()); + private static final String CLASS_NAME = DeviceMapConsole.class.getName(); + private final static Logger LOG = Logger.getLogger(CLASS_NAME); private static boolean isVerbose; + /* static class ToolCommand implements Runnable { @Option(type = OptionType.GLOBAL, name = "-v", description = "Verbose mode") public boolean verbose; @@ -92,25 +94,70 @@ public class DeviceMapConsole { } } } + + */ public static void main(String[] args) throws Exception { System.out.println(APP_NAME + " " + DeviceMapConsole.class.getPackage().getImplementationVersion()); + CommandLine lvCmd = null; + HelpFormatter lvFormater = new HelpFormatter(); + CommandLineParser lvParser = new BasicParser(); + Options lvOptions = new Options(); - try { - @SuppressWarnings("unchecked") - CliBuilder builder = Cli.builder(DeviceMapConsole.class.getSimpleName()) - .withDescription("Unicode CLDR Importer Tool") - .withDefaultCommand(Help.class) - .withCommands(Help.class, Classify.class) - //.withCommands(Help.class, Write.class) - ; - Cli toolParser = builder.build(); - toolParser.parse(args).run(); - } catch (Exception e) { - LOG.severe(e.getMessage()); - } + Option lvClassify = new Option("c", "classify", true, "User Agent String to test"); + Option lvHilfe = new Option("h", "help", false, "Show Help."); + Option lvName = new Option("u", true, "Load DeviceMap resouces from URL or \"default\""); + Option lvJar = new Option("j", true, "Load DeviceMap resouces from JAR file in classpath"); + Option lverbose = new Option("v", "verbose", false, "Verbose mode."); + + lvOptions.addOption(lvClassify); + lvOptions.addOption(lvHilfe); + lvOptions.addOption(lvName); + lvOptions.addOption(lvJar); + lvOptions.addOption(lverbose); + + /* lvOptions.addOption(OptionBuilder + .withLongOpt("url") + .withArgName("URL") + .withDescription("Load DeviceMap resouces from URL or \"default\"") + .hasArg() + .create("u")); + + lvOptions.addOption(OptionBuilder + .withLongOpt("classify") + .withArgName("userAgent") + .withDescription("User Agent String to test") + //.isRequired() + .create("c")); + */ + + try { + lvCmd = lvParser.parse(lvOptions, args); + + if (lvCmd.hasOption('h')) { + lvFormater.printHelp(CLASS_NAME, lvOptions); + return; + } + + if (lvCmd.hasOption('u')) { + System.out.println("URL: " + lvCmd.getOptionObject('u')); + } + + if (lvCmd.hasOption('j')) { + System.out.println("JAR: " + lvCmd.getOptionObject('j')); + } + + if (lvCmd.hasOption('c')) { + System.out.println("UA: " + lvCmd.getOptionObject("classify")); + } + + } catch (ParseException pvException) { + lvFormater.printHelp(CLASS_NAME, lvOptions); + System.out.println("Parse Error:" + pvException.getMessage()); + return; + } /* if (args.length == 0) { Modified: devicemap/trunk/clients/1.0/java/pom.xml URL: http://svn.apache.org/viewvc/devicemap/trunk/clients/1.0/java/pom.xml?rev=1721073&r1=1721072&r2=1721073&view=diff ============================================================================== --- devicemap/trunk/clients/1.0/java/pom.xml (original) +++ devicemap/trunk/clients/1.0/java/pom.xml Sun Dec 20 21:57:54 2015 @@ -52,6 +52,11 @@ ${project.version} + commons-cli + commons-cli + 1.3.1 + + io.airlift airline 0.7