@ThreadSafe public final class FileSystemShellUtils extends Object
FileSystemShell
.Modifier and Type | Method and Description |
---|---|
static List<AlluxioURI> |
getAlluxioURIs(FileSystem alluxioClient,
AlluxioURI inputURI)
Gets all the
AlluxioURI s that match inputURI. |
static String |
getFilePath(String path,
AlluxioConfiguration alluxioConf)
Removes
Constants.HEADER and hostname:port information
from a path, leaving only the local file path. |
static List<File> |
getFiles(String inputPath)
Gets the files (on the local filesystem) that match the given input path.
|
static int |
getIntArg(org.apache.commons.cli.CommandLine cl,
org.apache.commons.cli.Option option,
int defaultValue)
Gets the value of an option from the command line.
|
static long |
getMs(String time)
Converts the input time into millisecond unit.
|
static long |
getMsArg(org.apache.commons.cli.CommandLine cl,
org.apache.commons.cli.Option option,
long defaultValue)
Gets the value of an option from the command line.
|
static Map<String,Command> |
loadCommands(FileSystemContext fsContext)
Gets all
Command instances in the same package as FileSystemShell and load them
into a map. |
static boolean |
match(String filePath,
String patternPath)
Returns whether or not filePath matches patternPath.
|
static String |
validatePath(String path,
AlluxioConfiguration alluxioConf)
Validates the path, verifying that it contains the
Constants.HEADER and a
hostname:port specified. |
public static String getFilePath(String path, AlluxioConfiguration alluxioConf) throws IOException
Constants.HEADER
and hostname:port information
from a path, leaving only the local file path.path
- the path to obtain the local path fromalluxioConf
- Alluxio configurationIOException
public static String validatePath(String path, AlluxioConfiguration alluxioConf) throws IOException
Constants.HEADER
and a
hostname:port specified.path
- the path to be verifiedalluxioConf
- Alluxio configurationIOException
public static List<AlluxioURI> getAlluxioURIs(FileSystem alluxioClient, AlluxioURI inputURI) throws IOException
AlluxioURI
s that match inputURI. If the path is a regular path, the
returned list only contains the corresponding URI; Else if the path contains wildcards, the
returned list contains all the matched URIs It supports any number of wildcards in inputURIalluxioClient
- the client used to fetch information of Alluxio filesinputURI
- the input URI (could contain wildcards)AlluxioURI
s that matches the inputURIIOException
public static List<File> getFiles(String inputPath)
inputPath
- The input file path (could contain wildcards)public static int getIntArg(org.apache.commons.cli.CommandLine cl, org.apache.commons.cli.Option option, int defaultValue)
cl
- command line objectoption
- the option to check for in the command linedefaultValue
- default value for the optionpublic static long getMsArg(org.apache.commons.cli.CommandLine cl, org.apache.commons.cli.Option option, long defaultValue)
cl
- command line objectoption
- the option to check for in the command linedefaultValue
- default value for the optionpublic static Map<String,Command> loadCommands(FileSystemContext fsContext)
Command
instances in the same package as FileSystemShell
and load them
into a map. Provides a way to gain these commands information by their CommandName.fsContext
- the FileSystemContext
instance to construct the commandpublic static long getMs(String time)
time
- the time to be converted into millisecondsCopyright © 2023. All Rights Reserved.