@InterfaceAudience.Private @InterfaceStability.Evolving public class RegistryPathUtils extends Object
Constructor and Description |
---|
RegistryPathUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
createFullPath(String base,
String path)
Create a full path from the registry root and the supplied subdir
|
static String |
encodeForRegistry(String element)
Perform any formatting for the registry needed to convert
non-simple-DNS elements
|
static String |
encodeYarnID(String yarnId)
Perform whatever transforms are needed to get a YARN ID into
a DNS-compatible name
|
static String |
getUsername(String recPath)
Return the username found in the ZK path.
|
static String |
join(String base,
String path)
Join two paths, guaranteeing that there will not be exactly
one separator between the two, and exactly one at the front
of the path.
|
static String |
lastPathEntry(String path)
Get the last entry in a path; for an empty path
returns "".
|
static String |
parentOf(String path)
Get the parent of a path
|
static List<String> |
split(String path)
split a path into elements, stripping empty elements
|
static String |
validateElementsAsDNS(String path)
Validate ZK path as valid for a DNS hostname.
|
static String |
validateZKPath(String path)
Validate ZK path with the path itself included in
the exception text
|
public static String validateZKPath(String path) throws InvalidPathnameException
path
- path to validateInvalidPathnameException
- if the pathname is invalid.public static String validateElementsAsDNS(String path) throws InvalidPathnameException
path
- path to validateInvalidPathnameException
- if the pathname is invalid.public static String createFullPath(String base, String path) throws InvalidPathnameException
path
- path of operationInvalidPathnameException
- if the path is invalidpublic static String join(String base, String path)
base
- base pathpath
- second path to addpublic static List<String> split(String path)
path
- the pathpublic static String lastPathEntry(String path)
split(String)
path
- path of operationpublic static String parentOf(String path) throws org.apache.hadoop.fs.PathNotFoundException
path
- path to look atorg.apache.hadoop.fs.PathNotFoundException
- if the path was at root.public static String encodeForRegistry(String element)
element
- element to encodepublic static String encodeYarnID(String yarnId)
yarnId
- ID as string of YARN application, instance or containerCopyright © 2008–2019 Apache Software Foundation. All rights reserved.