Package alluxio.cli.fs.command
Class LsCommand
- java.lang.Object
-
- alluxio.cli.fs.command.AbstractFileSystemCommand
-
- alluxio.cli.fs.command.LsCommand
-
- All Implemented Interfaces:
alluxio.cli.Command,java.io.Closeable,java.lang.AutoCloseable
@ThreadSafe @PublicApi public final class LsCommand extends AbstractFileSystemCommand
Displays information for the path specified in args. Depends on different options, this command can also display the information for all directly children under the path, or recursively.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringIN_ALLUXIO_STATE_DIRstatic java.lang.StringIN_ALLUXIO_STATE_FILE_FORMATstatic java.lang.StringLS_FORMATstatic java.lang.StringLS_FORMAT_ALLUXIO_STATEstatic java.lang.StringLS_FORMAT_FILE_PATHstatic java.lang.StringLS_FORMAT_FILE_SIZEstatic java.lang.StringLS_FORMAT_GROUP_NAMEstatic java.lang.StringLS_FORMAT_NO_ACLstatic java.lang.StringLS_FORMAT_PERMISSIONstatic java.lang.StringLS_FORMAT_PERSISTENCE_STATEstatic java.lang.StringLS_FORMAT_TIMESTAMPstatic java.lang.StringLS_FORMAT_USER_NAME-
Fields inherited from class alluxio.cli.fs.command.AbstractFileSystemCommand
mFileSystem, mFsContext
-
-
Constructor Summary
Constructors Constructor Description LsCommand(alluxio.client.file.FileSystemContext fsContext)Constructs a new instance to display information for all directories and files directly under the path specified in args.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringformatLsString(boolean hSize, boolean acl, boolean isFolder, java.lang.String permission, java.lang.String userName, java.lang.String groupName, long size, long timestamp, int inAlluxioPercentage, java.lang.String persistenceState, java.lang.String path, java.lang.String dateFormatPattern)Formats the ls result string.java.lang.StringgetCommandName()java.lang.StringgetDescription()org.apache.commons.cli.OptionsgetOptions()java.lang.StringgetUsage()intrun(org.apache.commons.cli.CommandLine cl)protected voidrunPlainPath(alluxio.AlluxioURI path, org.apache.commons.cli.CommandLine cl)Runs the command for a particular URI that does not contain wildcard in its path.voidvalidateArgs(org.apache.commons.cli.CommandLine cl)-
Methods inherited from class alluxio.cli.fs.command.AbstractFileSystemCommand
processHeader, runWildCardCmd
-
-
-
-
Field Detail
-
IN_ALLUXIO_STATE_DIR
public static final java.lang.String IN_ALLUXIO_STATE_DIR
- See Also:
- Constant Field Values
-
IN_ALLUXIO_STATE_FILE_FORMAT
public static final java.lang.String IN_ALLUXIO_STATE_FILE_FORMAT
- See Also:
- Constant Field Values
-
LS_FORMAT_PERMISSION
public static final java.lang.String LS_FORMAT_PERMISSION
- See Also:
- Constant Field Values
-
LS_FORMAT_FILE_SIZE
public static final java.lang.String LS_FORMAT_FILE_SIZE
- See Also:
- Constant Field Values
-
LS_FORMAT_TIMESTAMP
public static final java.lang.String LS_FORMAT_TIMESTAMP
- See Also:
- Constant Field Values
-
LS_FORMAT_ALLUXIO_STATE
public static final java.lang.String LS_FORMAT_ALLUXIO_STATE
- See Also:
- Constant Field Values
-
LS_FORMAT_PERSISTENCE_STATE
public static final java.lang.String LS_FORMAT_PERSISTENCE_STATE
- See Also:
- Constant Field Values
-
LS_FORMAT_USER_NAME
public static final java.lang.String LS_FORMAT_USER_NAME
- See Also:
- Constant Field Values
-
LS_FORMAT_GROUP_NAME
public static final java.lang.String LS_FORMAT_GROUP_NAME
- See Also:
- Constant Field Values
-
LS_FORMAT_FILE_PATH
public static final java.lang.String LS_FORMAT_FILE_PATH
- See Also:
- Constant Field Values
-
LS_FORMAT_NO_ACL
public static final java.lang.String LS_FORMAT_NO_ACL
- See Also:
- Constant Field Values
-
LS_FORMAT
public static final java.lang.String LS_FORMAT
- See Also:
- Constant Field Values
-
-
Method Detail
-
formatLsString
public static java.lang.String formatLsString(boolean hSize, boolean acl, boolean isFolder, java.lang.String permission, java.lang.String userName, java.lang.String groupName, long size, long timestamp, int inAlluxioPercentage, java.lang.String persistenceState, java.lang.String path, java.lang.String dateFormatPattern)Formats the ls result string.- Parameters:
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 dates- Returns:
- the formatted string according to acl and isFolder
-
getCommandName
public java.lang.String getCommandName()
-
getOptions
public org.apache.commons.cli.Options getOptions()
-
runPlainPath
protected void runPlainPath(alluxio.AlluxioURI path, org.apache.commons.cli.CommandLine cl) throws alluxio.exception.AlluxioException, java.io.IOExceptionDescription copied from class:AbstractFileSystemCommandRuns the command for a particular URI that does not contain wildcard in its path.- Overrides:
runPlainPathin classAbstractFileSystemCommand- Parameters:
path- an AlluxioURI that does not contain wildcardcl- object containing the original commandLine- Throws:
alluxio.exception.AlluxioExceptionjava.io.IOException
-
run
public int run(org.apache.commons.cli.CommandLine cl) throws alluxio.exception.AlluxioException, java.io.IOException- Throws:
alluxio.exception.AlluxioExceptionjava.io.IOException
-
getUsage
public java.lang.String getUsage()
-
getDescription
public java.lang.String getDescription()
-
validateArgs
public void validateArgs(org.apache.commons.cli.CommandLine cl) throws alluxio.exception.status.InvalidArgumentException- Throws:
alluxio.exception.status.InvalidArgumentException
-
-