|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.cloudera.sqoop.tool.SqoopTool
public abstract class SqoopTool
Base class for Sqoop subprograms (e.g., SqoopImport, SqoopExport, etc.) Allows subprograms to configure the arguments they accept and provides an entry-point to the subprogram.
Field Summary | |
---|---|
protected java.lang.String[] |
extraArguments
Arguments that remained unparsed after parseArguments. |
static org.apache.commons.logging.Log |
LOG
|
Constructor Summary | |
---|---|
SqoopTool()
|
|
SqoopTool(java.lang.String name)
|
Method Summary | |
---|---|
void |
appendArgs(java.lang.String[] extra)
Append 'extra' to extraArguments. |
void |
applyOptions(org.apache.commons.cli.CommandLine in,
SqoopOptions out)
Generate the SqoopOptions containing actual argument values from the extracted CommandLine arguments. |
void |
configureOptions(ToolOptions opts)
Configure the command-line arguments we expect to receive. |
static SqoopTool |
getTool(java.lang.String toolName)
|
static java.lang.String |
getToolDescription(java.lang.String toolName)
|
java.lang.String |
getToolName()
|
static java.util.Set<java.lang.String> |
getToolNames()
|
SqoopOptions |
parseArguments(java.lang.String[] args,
org.apache.hadoop.conf.Configuration conf,
SqoopOptions in,
boolean useGenericOptions)
Configures a SqoopOptions according to the specified arguments. |
void |
printHelp(ToolOptions opts)
Print the help message for this tool. |
abstract int |
run(SqoopOptions options)
Main body of code to run the tool. |
protected void |
setToolName(java.lang.String name)
|
java.lang.String |
toString()
|
void |
validateOptions(SqoopOptions options)
Validates options and ensures that any required options are present and that any mutually-exclusive options are not selected. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final org.apache.commons.logging.Log LOG
protected java.lang.String[] extraArguments
Constructor Detail |
---|
public SqoopTool()
public SqoopTool(java.lang.String name)
Method Detail |
---|
public static final java.util.Set<java.lang.String> getToolNames()
public static final SqoopTool getTool(java.lang.String toolName)
public static final java.lang.String getToolDescription(java.lang.String toolName)
public java.lang.String getToolName()
protected void setToolName(java.lang.String name)
public abstract int run(SqoopOptions options)
options
- the SqoopOptions configured via
configureOptions()/applyOptions().
public void configureOptions(ToolOptions opts)
opts
- a ToolOptions that should be populated with sets of
RelatedOptions for the tool.public void printHelp(ToolOptions opts)
opts
- the configured tool optionspublic void applyOptions(org.apache.commons.cli.CommandLine in, SqoopOptions out) throws SqoopOptions.InvalidOptionsException
in
- the CLI CommandLine that contain the user's set Options.out
- the SqoopOptions with all fields applied.
SqoopOptions.InvalidOptionsException
- if there's a problem.public void validateOptions(SqoopOptions options) throws SqoopOptions.InvalidOptionsException
SqoopOptions.InvalidOptionsException
- if there's a problem.public SqoopOptions parseArguments(java.lang.String[] args, org.apache.hadoop.conf.Configuration conf, SqoopOptions in, boolean useGenericOptions) throws org.apache.commons.cli.ParseException, SqoopOptions.InvalidOptionsException
args
- the arguments to parse.conf
- if non-null, set as the configuration for the returned
SqoopOptions.in
- a (perhaps partially-configured) SqoopOptions. If null,
then a new SqoopOptions will be used. If this has a null configuration
and conf is null, then a new Configuration will be inserted in this.useGenericOptions
- if true, will also parse generic Hadoop
options into the Configuration.
org.apache.commons.cli.ParseException
SqoopOptions.InvalidOptionsException
public void appendArgs(java.lang.String[] extra)
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |