@ThreadSafe @PublicApi 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_NO_ACL |
static String |
LS_FORMAT_PERMISSION |
static String |
LS_FORMAT_PERSISTENCE_STATE |
static String |
LS_FORMAT_TIMESTAMP |
static String |
LS_FORMAT_USER_NAME |
mFileSystem, mFsContext
Constructor and Description |
---|
LsCommand(FileSystemContext fsContext)
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 timestamp,
int inAlluxioPercentage,
String persistenceState,
String path,
String dateFormatPattern)
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)
Runs 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.
|
processHeader, runWildCardCmd
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSubCommands, hasSubCommand, 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_TIMESTAMP
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(FileSystemContext fsContext)
fsContext
- the filesystem of Alluxiopublic static String formatLsString(boolean hSize, boolean acl, boolean isFolder, String permission, String userName, String groupName, long size, long timestamp, int inAlluxioPercentage, String persistenceState, String path, String dateFormatPattern)
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 bytestimestamp
- the epoch time in msinAlluxioPercentage
- whether the file is in AlluxiopersistenceState
- the persistence state of the filepath
- path of the file or folderdateFormatPattern
- the format to follow when printing datespublic 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.