Return-Path: X-Original-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1F6EE966A for ; Thu, 9 Feb 2012 21:14:01 +0000 (UTC) Received: (qmail 38597 invoked by uid 500); 9 Feb 2012 21:14:01 -0000 Delivered-To: apmail-incubator-accumulo-commits-archive@incubator.apache.org Received: (qmail 38581 invoked by uid 500); 9 Feb 2012 21:14:00 -0000 Mailing-List: contact accumulo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: accumulo-dev@incubator.apache.org Delivered-To: mailing list accumulo-commits@incubator.apache.org Received: (qmail 38574 invoked by uid 99); 9 Feb 2012 21:14:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2012 21:14:00 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Feb 2012 21:13:59 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8577F23888D2; Thu, 9 Feb 2012 21:13:39 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1242528 - /incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/ShellOptions.java Date: Thu, 09 Feb 2012 21:13:39 -0000 To: accumulo-commits@incubator.apache.org From: kturner@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120209211339.8577F23888D2@eris.apache.org> Author: kturner Date: Thu Feb 9 21:13:39 2012 New Revision: 1242528 URL: http://svn.apache.org/viewvc?rev=1242528&view=rev Log: ACCUMULO-303 Applied rest of per table formatter patch. Added: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/ShellOptions.java Added: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/ShellOptions.java URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/ShellOptions.java?rev=1242528&view=auto ============================================================================== --- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/ShellOptions.java (added) +++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/util/shell/ShellOptions.java Thu Feb 9 21:13:39 2012 @@ -0,0 +1,96 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.accumulo.core.util.shell; + +import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionGroup; +import org.apache.commons.cli.Options; + +/** + * Abstract class to encompass the Options available on the Accumulo Shell + */ +public abstract class ShellOptions { + protected static final String DEFAULT_AUTH_TIMEOUT = "60"; // in minutes + + // Global options flags + public static final String userOption = "u"; + public static final String tableOption = "t"; + public static final String helpOption = "?"; + public static final String helpLongOption = "help"; + + final Options opts = new Options(); + final Option usernameOption = new Option("u", "user", true, "username (defaults to your OS user)"); + final Option passwOption = new Option("p", "password", true, "password (prompt for password if this option is missing)"); + final Option tabCompleteOption = new Option(null, "disable-tab-completion", false, "disables tab completion (for less overhead when scripting)"); + final Option debugOption = new Option(null, "debug", false, "enables client debugging"); + final Option fakeOption = new Option(null, "fake", false, "fake a connection to accumulo"); + final Option helpOpt = new Option(helpOption, helpLongOption, false, "display this help"); + final Option execCommandOpt = new Option("e", "execute-command", true, "executes a command, and then exits"); + final OptionGroup execFileGroup = new OptionGroup(); + final Option execfileOption = new Option("f", "execute-file", true, "executes commands from a file at startup"); + final Option execfileVerboseOption = new Option("fv", "execute-file-verbose", true, "executes commands from a file at startup, with commands shown"); + final OptionGroup instanceOptions = new OptionGroup(); + final Option hdfsZooInstance = new Option("h", "hdfsZooInstance", false, "use hdfs zoo instance"); + final Option zooKeeperInstance = new Option("z", "zooKeeperInstance", true, "use a zookeeper instance with the given instance name and list of zoo hosts"); + final OptionGroup authTimeoutOptions = new OptionGroup(); + final Option authTimeoutOpt = new Option(null, "auth-timeout", true, "minutes the shell can be idle without re-entering a password (default " + + DEFAULT_AUTH_TIMEOUT + " min)"); + final Option disableAuthTimeoutOpt = new Option(null, "disable-auth-timeout", false, "disables requiring the user to re-type a password after being idle"); + + public ShellOptions() { + usernameOption.setArgName("user"); + opts.addOption(usernameOption); + + passwOption.setArgName("pass"); + opts.addOption(passwOption); + + opts.addOption(tabCompleteOption); + + opts.addOption(debugOption); + + opts.addOption(fakeOption); + + opts.addOption(helpOpt); + + opts.addOption(execCommandOpt); + + + execfileOption.setArgName("file"); + execFileGroup.addOption(execfileOption); + + execfileVerboseOption.setArgName("file"); + execFileGroup.addOption(execfileVerboseOption); + + opts.addOptionGroup(execFileGroup); + + + instanceOptions.addOption(hdfsZooInstance); + + zooKeeperInstance.setArgName("name hosts"); + zooKeeperInstance.setArgs(2); + instanceOptions.addOption(zooKeeperInstance); + + opts.addOptionGroup(instanceOptions); + + authTimeoutOpt.setArgName("minutes"); + authTimeoutOptions.addOption(authTimeoutOpt); + + authTimeoutOptions.addOption(disableAuthTimeoutOpt); + + opts.addOptionGroup(authTimeoutOptions); + } +}