@ThreadSafe public final class LsCommand extends AbstractFileSystemCommand
Modifier and Type | Field and Description |
---|---|
static String |
IN_ALLUXIO_STATE_DIR |
static String |
IN_ALLUXIO_STATE_FILE_FORMAT |
static String |
LS_FORMAT |
static String |
LS_FORMAT_ALLUXIO_STATE |
static String |
LS_FORMAT_FILE_PATH |
static String |
LS_FORMAT_FILE_SIZE |
static String |
LS_FORMAT_GROUP_NAME |
static String |
LS_FORMAT_LAST_MODIFIED_TIME |
static String |
LS_FORMAT_NO_ACL |
static String |
LS_FORMAT_PERMISSION |
static String |
LS_FORMAT_PERSISTENCE_STATE |
static String |
LS_FORMAT_USER_NAME |
mFileSystem
Constructor and Description |
---|
LsCommand(FileSystem fs)
Constructs a new instance to display information for all directories and files directly under
the path specified in args.
|
Modifier and Type | Method and Description |
---|---|
static String |
formatLsString(boolean hSize,
boolean acl,
boolean isFolder,
String permission,
String userName,
String groupName,
long size,
long lastModifiedTime,
int inAlluxioPercentage,
String persistenceState,
String path)
Formats the ls result string.
|
String |
getCommandName()
Gets the command name as input from the shell.
|
String |
getDescription() |
org.apache.commons.cli.Options |
getOptions() |
String |
getUsage() |
int |
run(org.apache.commons.cli.CommandLine cl)
Runs the command.
|
protected void |
runPlainPath(AlluxioURI path,
org.apache.commons.cli.CommandLine cl)
Run the command for a particular URI that does not contain wildcard in its path.
|
void |
validateArgs(org.apache.commons.cli.CommandLine cl)
Checks if the arguments are valid or throw InvalidArgumentException.
|
runWildCardCmd
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
parseAndValidateArgs
public static final String IN_ALLUXIO_STATE_DIR
public static final String IN_ALLUXIO_STATE_FILE_FORMAT
public static final String LS_FORMAT_PERMISSION
public static final String LS_FORMAT_FILE_SIZE
public static final String LS_FORMAT_LAST_MODIFIED_TIME
public static final String LS_FORMAT_ALLUXIO_STATE
public static final String LS_FORMAT_PERSISTENCE_STATE
public static final String LS_FORMAT_USER_NAME
public static final String LS_FORMAT_GROUP_NAME
public static final String LS_FORMAT_FILE_PATH
public static final String LS_FORMAT_NO_ACL
public static final String LS_FORMAT
public LsCommand(FileSystem fs)
fs
- the filesystem of Alluxiopublic static String formatLsString(boolean hSize, boolean acl, boolean isFolder, String permission, String userName, String groupName, long size, long lastModifiedTime, int inAlluxioPercentage, String persistenceState, String path)
hSize
- print human-readable format sizesacl
- whether security is enabledisFolder
- whether this path is a file or a folderpermission
- permission stringuserName
- user namegroupName
- group namesize
- size of the file in byteslastModifiedTime
- the epoch time in ms when the path is last modifiedinAlluxioPercentage
- whether the file is in AlluxiopersistenceState
- the persistence state of the filepath
- path of the file or folderpublic String getCommandName()
Command
public org.apache.commons.cli.Options getOptions()
Options
of the commandprotected void runPlainPath(AlluxioURI path, org.apache.commons.cli.CommandLine cl) throws AlluxioException, IOException
AbstractFileSystemCommand
runPlainPath
in class AbstractFileSystemCommand
path
- an AlluxioURI that does not contain wildcardcl
- object containing the original commandLineAlluxioException
IOException
public int run(org.apache.commons.cli.CommandLine cl) throws AlluxioException, IOException
Command
cl
- the parsed command line for the argumentsAlluxioException
IOException
public String getUsage()
public String getDescription()
public void validateArgs(org.apache.commons.cli.CommandLine cl) throws InvalidArgumentException
Command
cl
- the parsed command line for the argumentsInvalidArgumentException
- when arguments are not validCopyright © 2023. All Rights Reserved.