@Component public class FsShellCommands extends ConfigurationAware implements org.springframework.shell.core.ExecutionProcessor
LOG| Constructor and Description |
|---|
FsShellCommands() |
| Modifier and Type | Method and Description |
|---|---|
org.springframework.shell.event.ParseResult |
beforeInvocation(org.springframework.shell.event.ParseResult invocationContext) |
void |
cat(java.lang.String path) |
void |
chgrp(boolean recursive,
java.lang.String group,
java.lang.String path) |
void |
chmod(boolean recursive,
java.lang.String mode,
java.lang.String path) |
void |
chown(boolean recursive,
java.lang.String owner,
java.lang.String path) |
protected boolean |
configurationChanged()
Called before invoking a command in case the configuration changed.
|
void |
copyFromLocal(java.lang.String source,
java.lang.String dest) |
void |
copyMergeToLocal(java.lang.String source,
java.lang.String dest,
boolean endline) |
void |
copyToLocal(java.lang.String source,
java.lang.String dest,
boolean ignoreCrc,
boolean crc) |
void |
count(boolean quota,
java.lang.String path) |
void |
cp(java.lang.String source,
java.lang.String dest) |
void |
du(java.lang.String path,
boolean summary) |
void |
expunge() |
protected java.lang.String |
failedComponentName() |
void |
get(java.lang.String source,
java.lang.String dest,
boolean ignoreCrc,
boolean crc) |
void |
init() |
void |
ls(java.lang.String path,
boolean recursive) |
void |
mkdir(java.lang.String dir) |
void |
moveFromLocal(java.lang.String source,
java.lang.String dest) |
void |
mv(java.lang.String source,
java.lang.String dest) |
void |
put(java.lang.String source,
java.lang.String dest) |
void |
rm(java.lang.String path,
boolean skipTrash,
boolean recursive) |
void |
setrep(java.lang.String path,
int replica,
boolean recursive,
boolean waiting) |
void |
tail(java.lang.String path,
boolean file) |
void |
text(java.lang.String path) |
void |
touchz(java.lang.String path) |
afterReturningInvocation, afterThrowingInvocation, getHadoopConfiguration, logUpdateError, onApplicationEvent@PostConstruct public void init()
protected java.lang.String failedComponentName()
failedComponentName in class ConfigurationAwareprotected boolean configurationChanged()
ConfigurationAwareConfigurationAware.failedComponentName() to provide
proper error messages.configurationChanged in class ConfigurationAwareConfigurationAware.failedComponentName(),
ConfigurationAware.logUpdateError(Exception)public org.springframework.shell.event.ParseResult beforeInvocation(org.springframework.shell.event.ParseResult invocationContext)
beforeInvocation in interface org.springframework.shell.core.ExecutionProcessorbeforeInvocation in class ConfigurationAware@CliCommand(value="hadoop fs ls",
help="List files in the directory")
public void ls(@CliOption(key={"","dir"},mandatory=false,unspecifiedDefaultValue=".",help="directory to be listed")
java.lang.String path,
@CliOption(key="recursive",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with recursion")
boolean recursive)
@CliCommand(value="hadoop fs cat",
help="Copy source paths to stdout")
public void cat(@CliOption(key={"","path"},mandatory=true,unspecifiedDefaultValue=".",help="file name to be shown")
java.lang.String path)
@CliCommand(value="hadoop fs chgrp",
help="Change group association of files")
public void chgrp(@CliOption(key="recursive",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with recursion")
boolean recursive,
@CliOption(key="group",mandatory=true,help="group name")
java.lang.String group,
@CliOption(key={"","path"},mandatory=true,help="path of the file whose group will be changed")
java.lang.String path)
@CliCommand(value="hadoop fs chown",
help="Change the owner of files")
public void chown(@CliOption(key="recursive",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with recursion")
boolean recursive,
@CliOption(key="owner",mandatory=true,help="owner name")
java.lang.String owner,
@CliOption(key={"","path"},mandatory=true,help="path of the file whose ownership will be changed")
java.lang.String path)
@CliCommand(value="hadoop fs chmod",
help="Change the permissions of files")
public void chmod(@CliOption(key="recursive",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with recursion")
boolean recursive,
@CliOption(key="mode",mandatory=true,help="permission mode")
java.lang.String mode,
@CliOption(key={"","path"},mandatory=true,help="path of the file whose permissions will be changed")
java.lang.String path)
@CliCommand(value="hadoop fs copyFromLocal",
help="Copy single src, or multiple srcs from local file system to the destination file system. Same as put")
public void copyFromLocal(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest)
@CliCommand(value="hadoop fs put",
help="Copy single src, or multiple srcs from local file system to the destination file system")
public void put(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest)
@CliCommand(value="hadoop fs moveFromLocal",
help="Similar to put command, except that the source localsrc is deleted after it\'s copied")
public void moveFromLocal(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest)
@CliCommand(value="hadoop fs copyToLocal",
help="Copy files to the local file system. Same as get")
public void copyToLocal(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest,
@CliOption(key="ignoreCrc",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether ignore CRC")
boolean ignoreCrc,
@CliOption(key="crc",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether copy CRC")
boolean crc)
@CliCommand(value="hadoop fs copyMergeToLocal",
help="Takes a source directory and a destination file as input and concatenates files in src into the destination local file")
public void copyMergeToLocal(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest,
@CliOption(key="endline",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether add a newline character at the end of each file")
boolean endline)
@CliCommand(value="hadoop fs get",
help="Copy files to the local file system")
public void get(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest,
@CliOption(key="ignoreCrc",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether ignore CRC")
boolean ignoreCrc,
@CliOption(key="crc",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether copy CRC")
boolean crc)
@CliCommand(value="hadoop fs count",
help="Count the number of directories, files, bytes, quota, and remaining quota")
public void count(@CliOption(key="quota",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with quta information")
boolean quota,
@CliOption(key="path",mandatory=true,help="path name")
java.lang.String path)
@CliCommand(value="hadoop fs cp",
help="Copy files from source to destination. This command allows multiple sources as well in which case the destination must be a directory")
public void cp(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest)
@CliCommand(value="hadoop fs mv",
help="Move source files to destination in the HDFS")
public void mv(@CliOption(key="from",mandatory=true,help="source file names")
java.lang.String source,
@CliOption(key="to",mandatory=true,help="destination path name")
java.lang.String dest)
@CliCommand(value="hadoop fs du",
help="Displays sizes of files and directories contained in the given directory or the length of a file in case its just a file")
public void du(@CliOption(key={"","dir"},mandatory=false,unspecifiedDefaultValue=".",help="directory to be listed")
java.lang.String path,
@CliOption(key="summary",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with summary")
boolean summary)
@CliCommand(value="hadoop fs expunge",
help="Empty the trash")
public void expunge()
@CliCommand(value="hadoop fs mkdir",
help="Create a new directory")
public void mkdir(@CliOption(key={"","dir"},mandatory=true,help="directory name")
java.lang.String dir)
@CliCommand(value="hadoop fs rm",
help="Remove files in the HDFS")
public void rm(@CliOption(key={"","path"},mandatory=false,unspecifiedDefaultValue=".",help="path to be deleted")
java.lang.String path,
@CliOption(key="skipTrash",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether to skip trash")
boolean skipTrash,
@CliOption(key="recursive",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether to recurse")
boolean recursive)
@CliCommand(value="hadoop fs setrep",
help="Change the replication factor of a file")
public void setrep(@CliOption(key="path",mandatory=true,help="path name")
java.lang.String path,
@CliOption(key="replica",mandatory=true,help="source file names")
int replica,
@CliOption(key="recursive",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether with recursion")
boolean recursive,
@CliOption(key="waiting",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether wait for the replic number is eqal to the number")
boolean waiting)
@CliCommand(value="hadoop fs tail",
help="Display last kilobyte of the file to stdout")
public void tail(@CliOption(key={"","file"},mandatory=true,help="file to be tailed")
java.lang.String path,
@CliOption(key="follow",mandatory=false,specifiedDefaultValue="true",unspecifiedDefaultValue="false",help="whether show content while file grow")
boolean file)
@CliCommand(value="hadoop fs text",
help="Take a source file and output the file in text format")
public void text(@CliOption(key={"","file"},mandatory=true,help="file to be shown")
java.lang.String path)
@CliCommand(value="hadoop fs touchz",
help="Create a file of zero length")
public void touchz(@CliOption(key={"","file"},mandatory=true,help="file to be touched")
java.lang.String path)