voldemort.tools.admin
Class AdminParserUtils

java.lang.Object
  extended by voldemort.tools.admin.AdminParserUtils

public class AdminParserUtils
extends java.lang.Object

Parser utility class for AdminCommand


Field Summary
static java.lang.String ARG_FORMAT_HEX
           
static java.lang.String ARG_FORMAT_JSON
           
static java.lang.String OPT_ALL_NODES
           
static java.lang.String OPT_ALL_PARTITIONS
           
static java.lang.String OPT_ALL_STORES
           
static java.lang.String OPT_CONFIRM
           
static java.lang.String OPT_D
           
static java.lang.String OPT_DIR
           
static java.lang.String OPT_F
           
static java.lang.String OPT_FILE
           
static java.lang.String OPT_FORMAT
           
static java.lang.String OPT_H
           
static java.lang.String OPT_HELP
           
static java.lang.String OPT_HEX
           
static java.lang.String OPT_J
           
static java.lang.String OPT_JSON
           
static java.lang.String OPT_N
           
static java.lang.String OPT_NODE
           
static java.lang.String OPT_ORPHANED
           
static java.lang.String OPT_P
           
static java.lang.String OPT_PARTITION
           
static java.lang.String OPT_S
           
static java.lang.String OPT_STORE
           
static java.lang.String OPT_U
           
static java.lang.String OPT_URL
           
static java.lang.String OPT_X
           
static java.lang.String OPT_Z
           
static java.lang.String OPT_ZONE
           
 
Constructor Summary
AdminParserUtils()
           
 
Method Summary
static void acceptsAllNodes(joptsimple.OptionParser parser)
          Adds OPT_ALL_NODES option to OptionParser, without argument.
static void acceptsAllPartitions(joptsimple.OptionParser parser)
          Adds OPT_ALL_PARTITIONS option to OptionParser, without argument.
static void acceptsAllStores(joptsimple.OptionParser parser)
          Adds OPT_ALL_STORES option to OptionParser, without argument.
static void acceptsConfirm(joptsimple.OptionParser parser)
          Adds OPT_CONFIRM option to OptionParser, without argument.
static void acceptsDir(joptsimple.OptionParser parser)
          Adds OPT_D | OPT_DIR option to OptionParser, with one argument.
static void acceptsFile(joptsimple.OptionParser parser)
          Adds OPT_F | OPT_FILE option to OptionParser, with one argument.
static void acceptsFormat(joptsimple.OptionParser parser)
          Adds OPT_FORMAT option to OptionParser, with one argument.
static void acceptsHelp(joptsimple.OptionParser parser)
          Adds OPT_H | OPT_HELP option to OptionParser, without argument.
static void acceptsHex(joptsimple.OptionParser parser)
          Adds OPT_X | OPT_HEX option to OptionParser, with one argument.
static void acceptsJson(joptsimple.OptionParser parser)
          Adds OPT_J | OPT_JSON option to OptionParser, with one argument.
static void acceptsNodeMultiple(joptsimple.OptionParser parser)
          Adds OPT_N | OPT_NODE option to OptionParser, with one argument.
static void acceptsNodeSingle(joptsimple.OptionParser parser)
          Adds OPT_N | OPT_NODE option to OptionParser, with one argument.
static void acceptsOrphaned(joptsimple.OptionParser parser)
          Adds OPT_ORPHANED option to OptionParser, without argument.
static void acceptsPartition(joptsimple.OptionParser parser)
          Adds OPT_P | OPT_PARTITION option to OptionParser, with one argument.
static void acceptsStoreMultiple(joptsimple.OptionParser parser)
          Adds OPT_S | OPT_STORE option to OptionParser, with one argument.
static void acceptsStoreSingle(joptsimple.OptionParser parser)
          Adds OPT_S | OPT_STORE option to OptionParser, with one argument.
static void acceptsUrl(joptsimple.OptionParser parser)
          Adds OPT_U | OPT_URL option to OptionParser, with one argument.
static void acceptsZone(joptsimple.OptionParser parser)
          Adds OPT_Z | OPT_ZONE option to OptionParser, with one argument.
static void checkOptional(joptsimple.OptionSet options, java.util.List<java.lang.String> opts)
          Checks if there's at most one option that exists among all opts.
static void checkOptional(joptsimple.OptionSet options, java.lang.String opt1, java.lang.String opt2)
          Checks if there's at most one option that exists among all opts.
static void checkOptional(joptsimple.OptionSet options, java.lang.String opt1, java.lang.String opt2, java.lang.String opt3)
          Checks if there's at most one option that exists among all opts.
static void checkRequired(joptsimple.OptionSet options, java.util.List<java.lang.String> opts)
          Checks if there's exactly one option that exists among all opts.
static void checkRequired(joptsimple.OptionSet options, java.lang.String opt)
          Checks if the required option exists.
static void checkRequired(joptsimple.OptionSet options, java.lang.String opt1, java.lang.String opt2)
          Checks if there's exactly one option that exists among all possible opts.
static void checkRequired(joptsimple.OptionSet options, java.lang.String opt1, java.lang.String opt2, java.lang.String opt3)
          Checks if there's exactly one option that exists among all possible opts.
static void printArgs(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPT_ALL_NODES

public static final java.lang.String OPT_ALL_NODES
See Also:
Constant Field Values

OPT_ALL_PARTITIONS

public static final java.lang.String OPT_ALL_PARTITIONS
See Also:
Constant Field Values

OPT_ALL_STORES

public static final java.lang.String OPT_ALL_STORES
See Also:
Constant Field Values

OPT_CONFIRM

public static final java.lang.String OPT_CONFIRM
See Also:
Constant Field Values

OPT_H

public static final java.lang.String OPT_H
See Also:
Constant Field Values

OPT_HELP

public static final java.lang.String OPT_HELP
See Also:
Constant Field Values

OPT_ORPHANED

public static final java.lang.String OPT_ORPHANED
See Also:
Constant Field Values

OPT_D

public static final java.lang.String OPT_D
See Also:
Constant Field Values

OPT_DIR

public static final java.lang.String OPT_DIR
See Also:
Constant Field Values

OPT_F

public static final java.lang.String OPT_F
See Also:
Constant Field Values

OPT_FILE

public static final java.lang.String OPT_FILE
See Also:
Constant Field Values

OPT_FORMAT

public static final java.lang.String OPT_FORMAT
See Also:
Constant Field Values

OPT_U

public static final java.lang.String OPT_U
See Also:
Constant Field Values

OPT_URL

public static final java.lang.String OPT_URL
See Also:
Constant Field Values

OPT_Z

public static final java.lang.String OPT_Z
See Also:
Constant Field Values

OPT_ZONE

public static final java.lang.String OPT_ZONE
See Also:
Constant Field Values

OPT_X

public static final java.lang.String OPT_X
See Also:
Constant Field Values

OPT_HEX

public static final java.lang.String OPT_HEX
See Also:
Constant Field Values

OPT_J

public static final java.lang.String OPT_J
See Also:
Constant Field Values

OPT_JSON

public static final java.lang.String OPT_JSON
See Also:
Constant Field Values

OPT_P

public static final java.lang.String OPT_P
See Also:
Constant Field Values

OPT_PARTITION

public static final java.lang.String OPT_PARTITION
See Also:
Constant Field Values

OPT_N

public static final java.lang.String OPT_N
See Also:
Constant Field Values

OPT_NODE

public static final java.lang.String OPT_NODE
See Also:
Constant Field Values

OPT_S

public static final java.lang.String OPT_S
See Also:
Constant Field Values

OPT_STORE

public static final java.lang.String OPT_STORE
See Also:
Constant Field Values

ARG_FORMAT_HEX

public static final java.lang.String ARG_FORMAT_HEX
See Also:
Constant Field Values

ARG_FORMAT_JSON

public static final java.lang.String ARG_FORMAT_JSON
See Also:
Constant Field Values
Constructor Detail

AdminParserUtils

public AdminParserUtils()
Method Detail

printArgs

public static void printArgs(java.lang.String[] args)

acceptsAllNodes

public static void acceptsAllNodes(joptsimple.OptionParser parser)
Adds OPT_ALL_NODES option to OptionParser, without argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsAllPartitions

public static void acceptsAllPartitions(joptsimple.OptionParser parser)
Adds OPT_ALL_PARTITIONS option to OptionParser, without argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsAllStores

public static void acceptsAllStores(joptsimple.OptionParser parser)
Adds OPT_ALL_STORES option to OptionParser, without argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsConfirm

public static void acceptsConfirm(joptsimple.OptionParser parser)
Adds OPT_CONFIRM option to OptionParser, without argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsHelp

public static void acceptsHelp(joptsimple.OptionParser parser)
Adds OPT_H | OPT_HELP option to OptionParser, without argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsOrphaned

public static void acceptsOrphaned(joptsimple.OptionParser parser)
Adds OPT_ORPHANED option to OptionParser, without argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsDir

public static void acceptsDir(joptsimple.OptionParser parser)
Adds OPT_D | OPT_DIR option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsFile

public static void acceptsFile(joptsimple.OptionParser parser)
Adds OPT_F | OPT_FILE option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsFormat

public static void acceptsFormat(joptsimple.OptionParser parser)
Adds OPT_FORMAT option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsNodeSingle

public static void acceptsNodeSingle(joptsimple.OptionParser parser)
Adds OPT_N | OPT_NODE option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsStoreSingle

public static void acceptsStoreSingle(joptsimple.OptionParser parser)
Adds OPT_S | OPT_STORE option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsUrl

public static void acceptsUrl(joptsimple.OptionParser parser)
Adds OPT_U | OPT_URL option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsZone

public static void acceptsZone(joptsimple.OptionParser parser)
Adds OPT_Z | OPT_ZONE option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsHex

public static void acceptsHex(joptsimple.OptionParser parser)
Adds OPT_X | OPT_HEX option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsJson

public static void acceptsJson(joptsimple.OptionParser parser)
Adds OPT_J | OPT_JSON option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsNodeMultiple

public static void acceptsNodeMultiple(joptsimple.OptionParser parser)
Adds OPT_N | OPT_NODE option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsPartition

public static void acceptsPartition(joptsimple.OptionParser parser)
Adds OPT_P | OPT_PARTITION option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

acceptsStoreMultiple

public static void acceptsStoreMultiple(joptsimple.OptionParser parser)
Adds OPT_S | OPT_STORE option to OptionParser, with one argument.

Parameters:
parser - OptionParser to be modified
required - Tells if this option is required or optional

checkRequired

public static void checkRequired(joptsimple.OptionSet options,
                                 java.lang.String opt)
                          throws VoldemortException
Checks if the required option exists.

Parameters:
options - OptionSet to checked
opt - Required option to check
Throws:
VoldemortException

checkRequired

public static void checkRequired(joptsimple.OptionSet options,
                                 java.lang.String opt1,
                                 java.lang.String opt2)
                          throws VoldemortException
Checks if there's exactly one option that exists among all possible opts.

Parameters:
options - OptionSet to checked
opt1 - Possible required option to check
opt2 - Possible required option to check
Throws:
VoldemortException

checkRequired

public static void checkRequired(joptsimple.OptionSet options,
                                 java.lang.String opt1,
                                 java.lang.String opt2,
                                 java.lang.String opt3)
                          throws VoldemortException
Checks if there's exactly one option that exists among all possible opts.

Parameters:
options - OptionSet to checked
opt1 - Possible required option to check
opt2 - Possible required option to check
opt3 - Possible required option to check
Throws:
VoldemortException

checkRequired

public static void checkRequired(joptsimple.OptionSet options,
                                 java.util.List<java.lang.String> opts)
                          throws VoldemortException
Checks if there's exactly one option that exists among all opts.

Parameters:
options - OptionSet to checked
opts - List of options to be checked
Throws:
VoldemortException

checkOptional

public static void checkOptional(joptsimple.OptionSet options,
                                 java.lang.String opt1,
                                 java.lang.String opt2)
Checks if there's at most one option that exists among all opts.

Parameters:
parser - OptionParser to checked
opt1 - Optional option to check
opt2 - Optional option to check
Throws:
VoldemortException

checkOptional

public static void checkOptional(joptsimple.OptionSet options,
                                 java.lang.String opt1,
                                 java.lang.String opt2,
                                 java.lang.String opt3)
Checks if there's at most one option that exists among all opts.

Parameters:
parser - OptionParser to checked
opt1 - Optional option to check
opt2 - Optional option to check
opt3 - Optional option to check
Throws:
VoldemortException

checkOptional

public static void checkOptional(joptsimple.OptionSet options,
                                 java.util.List<java.lang.String> opts)
                          throws VoldemortException
Checks if there's at most one option that exists among all opts.

Parameters:
parser - OptionParser to checked
opts - List of options to be checked
Throws:
VoldemortException


Jay Kreps, Roshan Sumbaly, Alex Feinberg, Bhupesh Bansal, Lei Gao, Chinmay Soman, Vinoth Chandar, Zhongjie Wu