public abstract class S3GuardTool
extends org.apache.hadoop.conf.Configured
implements org.apache.hadoop.util.Tool
Modifier and Type | Field and Description |
---|---|
static String |
DAYS_FLAG |
static String |
HOURS_FLAG |
static String |
META_FLAG |
static String |
MINUTES_FLAG |
static String |
READ_FLAG |
static String |
REGION_FLAG |
static String |
SECONDS_FLAG |
static String |
WRITE_FLAG |
Modifier | Constructor and Description |
---|---|
protected |
S3GuardTool(org.apache.hadoop.conf.Configuration conf,
String... opts)
Constructor a S3Guard tool with HDFS configuration.
|
Modifier and Type | Method and Description |
---|---|
protected static org.apache.hadoop.util.ExitUtil.ExitException |
badState(String format,
Object... args)
Build the exception to raise on a bad store/bucket state.
|
protected static void |
exit(int status,
String text) |
protected org.apache.hadoop.fs.shell.CommandFormat |
getCommandFormat() |
protected S3AFileSystem |
getFilesystem() |
MetadataStore |
getStore() |
abstract String |
getUsage() |
protected static org.apache.hadoop.util.ExitUtil.ExitException |
invalidArgs(String format,
Object... args)
Build the exception to raise on invalid arguments.
|
static void |
main(String[] args)
Main entry point.
|
protected static void |
printStoreDiagnostics(PrintStream out,
MetadataStore store)
Retrieve and Print store diagnostics.
|
static int |
run(org.apache.hadoop.conf.Configuration conf,
String... args)
Execute the command with the given arguments.
|
int |
run(String[] args) |
abstract int |
run(String[] args,
PrintStream out)
Run the tool, capturing the output (if the tool supports that).
|
protected void |
setFilesystem(S3AFileSystem filesystem) |
protected void |
setStore(MetadataStore store) |
protected static org.apache.hadoop.util.ExitUtil.ExitException |
storeNotFound(FileNotFoundException e)
Handle store not found by converting to an exit exception
with specific error code.
|
protected static URI |
toUri(String s3Path)
Convert a path to a URI, catching any
URISyntaxException
and converting to an invalid args exception. |
public static final String META_FLAG
public static final String DAYS_FLAG
public static final String HOURS_FLAG
public static final String MINUTES_FLAG
public static final String SECONDS_FLAG
public static final String REGION_FLAG
public static final String READ_FLAG
public static final String WRITE_FLAG
protected S3GuardTool(org.apache.hadoop.conf.Configuration conf, String... opts)
conf
- Configuration.opts
- any boolean options to supportpublic abstract String getUsage()
protected S3AFileSystem getFilesystem()
protected void setFilesystem(S3AFileSystem filesystem)
public MetadataStore getStore()
protected void setStore(MetadataStore store)
protected org.apache.hadoop.fs.shell.CommandFormat getCommandFormat()
public final int run(String[] args) throws Exception
run
in interface org.apache.hadoop.util.Tool
Exception
public abstract int run(String[] args, PrintStream out) throws Exception
ExitUtil.ExitException
with their exit
code set to the desired exit value. The exit code of auch an exception
is used for the tool's exit code, and the stack trace only logged at
debug.args
- argument listout
- output streamException
- on any failureExitUtil.ExitException
- for an alternative clean exitprotected static URI toUri(String s3Path)
URISyntaxException
and converting to an invalid args exception.s3Path
- path to convert to a URIExitUtil.ExitException
- INVALID_ARGUMENT if the URI is invalidprotected static void printStoreDiagnostics(PrintStream out, MetadataStore store) throws IOException
out
- output streamstore
- storeIOException
- Failure to retrieve the data.protected static org.apache.hadoop.util.ExitUtil.ExitException storeNotFound(FileNotFoundException e)
e
- exceptionprotected static org.apache.hadoop.util.ExitUtil.ExitException invalidArgs(String format, Object... args)
format
- string formatargs
- optional arguments for the stringprotected static org.apache.hadoop.util.ExitUtil.ExitException badState(String format, Object... args)
format
- string formatargs
- optional arguments for the stringpublic static int run(org.apache.hadoop.conf.Configuration conf, String... args) throws Exception
conf
- Hadoop configuration.args
- command specific arguments.Exception
- on I/O errors.public static void main(String[] args)
System.exit()
on all execution paths.args
- argument listprotected static void exit(int status, String text)
Copyright © 2018 Apache Software Foundation. All Rights Reserved.