@ThreadSafe
public final class FileSystemShellUtils
extends java.lang.Object
FileSystemShell.| Modifier and Type | Method and Description |
|---|---|
static java.util.List<AlluxioURI> |
getAlluxioURIs(FileSystem alluxioClient,
AlluxioURI inputURI)
Gets all the
AlluxioURIs that match inputURI. |
static boolean |
getBoolArg(org.apache.commons.cli.CommandLine cl,
org.apache.commons.cli.Option option,
boolean defaultValue)
Gets the value of an option from the command line.
|
static java.lang.String |
getFilePath(java.lang.String path,
AlluxioConfiguration alluxioConf)
Removes
Constants.HEADER and hostname:port information
from a path, leaving only the local file path. |
static java.util.List<java.io.File> |
getFiles(java.lang.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(java.lang.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 java.util.Map<java.lang.String,Command> |
loadCommands(FileSystemContext fsContext)
Gets all
Command instances in the same package as FileSystemShell and load them
into a map. |
static boolean |
match(java.lang.String filePath,
java.lang.String patternPath)
Returns whether or not filePath matches patternPath.
|
static java.lang.String |
validatePath(java.lang.String path,
AlluxioConfiguration alluxioConf)
Validates the path, verifying that it contains the
Constants.HEADER and a
hostname:port specified. |
public static java.lang.String getFilePath(java.lang.String path,
AlluxioConfiguration alluxioConf)
throws java.io.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 configurationjava.io.IOExceptionpublic static java.lang.String validatePath(java.lang.String path,
AlluxioConfiguration alluxioConf)
throws java.io.IOException
Constants.HEADER and a
hostname:port specified.path - the path to be verifiedalluxioConf - Alluxio configurationjava.io.IOExceptionpublic static java.util.List<AlluxioURI> getAlluxioURIs(FileSystem alluxioClient, AlluxioURI inputURI) throws java.io.IOException
AlluxioURIs 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)AlluxioURIs that matches the inputURIjava.io.IOExceptionpublic static java.util.List<java.io.File> getFiles(java.lang.String inputPath)
inputPath - The input file path (could contain wildcards)public static boolean getBoolArg(org.apache.commons.cli.CommandLine cl,
org.apache.commons.cli.Option option,
boolean defaultValue)
cl - command line objectoption - the option to check for in the command linedefaultValue - default value for the optionpublic 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 java.util.Map<java.lang.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(java.lang.String time)
time - the time to be converted into millisecondspublic static boolean match(java.lang.String filePath,
java.lang.String patternPath)
filePath - path of a given filepatternPath - path that can contain wildcardsCopyright © 2022. All Rights Reserved.