|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.hadoop.registry.client.binding.RegistryUtils
@InterfaceAudience.Public @InterfaceStability.Evolving public class RegistryUtils
Utility methods for working with a registry.
| Constructor Summary | |
|---|---|
RegistryUtils()
|
|
| Method Summary | |
|---|---|
static String |
componentListPath(String user,
String serviceClass,
String serviceName)
Create a path for listing components under a service |
static String |
componentPath(String user,
String serviceClass,
String serviceName,
String componentName)
Create the path to a service record for a component |
static String |
convertUsername(String username)
Convert the username to that which can be used for registry entries. |
static String |
currentUser()
Get the current user path formatted for the registry |
static Map<String,ServiceRecord> |
extractServiceRecords(RegistryOperations operations,
String parentpath)
Extract all service records under a list of stat operations...this non-atomic action skips entries that are too short or simply not matching. |
static Map<String,ServiceRecord> |
extractServiceRecords(RegistryOperations operations,
String parentpath,
Collection<RegistryPathStatus> stats)
Extract all service records under a list of stat operations...this skips entries that are too short or simply not matching |
static Map<String,ServiceRecord> |
extractServiceRecords(RegistryOperations operations,
String parentpath,
Map<String,RegistryPathStatus> stats)
Extract all service records under a list of stat operations...this non-atomic action skips entries that are too short or simply not matching. |
static String |
getCurrentUsernameUnencoded(String env_hadoop_username)
Get the current username, using the value of the parameter env_hadoop_username if it is set on an insecure cluster. |
static String |
homePathForCurrentUser()
Get the home path of the current user. |
static String |
homePathForUser(String username)
Buld the user path -switches to the system path if the user is "". |
static Map<String,ServiceRecord> |
listServiceRecords(RegistryOperations registryOperations,
String path)
List service records directly under a path |
static String |
serviceclassPath(String user,
String serviceClass)
Create a service classpath |
static String |
servicePath(String user,
String serviceClass,
String serviceName)
Create a path to a service under a user & service class |
static Map<String,RegistryPathStatus> |
statChildren(RegistryOperations registryOperations,
String path)
List children of a directory and retrieve their RegistryPathStatus values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RegistryUtils()
| Method Detail |
|---|
public static String homePathForUser(String username)
username - username or ""
public static String convertUsername(String username)
username - user
public static String serviceclassPath(String user,
String serviceClass)
user - username or ""serviceClass - service name
public static String servicePath(String user,
String serviceClass,
String serviceName)
user - username or ""serviceClass - service nameserviceName - service name unique for that user & service class
public static String componentListPath(String user,
String serviceClass,
String serviceName)
user - username or ""serviceClass - service nameserviceName - service name unique for that user & service class
public static String componentPath(String user,
String serviceClass,
String serviceName,
String componentName)
user - username or ""serviceClass - service nameserviceName - service name unique for that user & service classcomponentName - unique name/ID of the component
public static Map<String,ServiceRecord> listServiceRecords(RegistryOperations registryOperations,
String path)
throws IOException
registryOperations - registry operations instancepath - path to list
IOException
public static Map<String,RegistryPathStatus> statChildren(RegistryOperations registryOperations,
String path)
throws org.apache.hadoop.fs.PathNotFoundException,
InvalidPathnameException,
IOException
RegistryPathStatus values.
This is not an atomic operation; A child may be deleted
during the iteration through the child entries. If this happens,
the PathNotFoundException is caught and that child
entry ommitted.
path - path
org.apache.hadoop.fs.PathNotFoundException - path is not in the registry.
InvalidPathnameException - the path is invalid.
IOException - Any other IO Exceptionpublic static String homePathForCurrentUser()
In an insecure cluster, the environment variable
HADOOP_USER_NAME is queried first.
This means that in a YARN container where the creator set this environment variable to propagate their identity, the defined user name is used in preference to the actual user.
In a secure cluster, the kerberos identity of the current user is used.
RuntimeException - if the current user identity cannot be determined
from the OS/kerberos.public static String getCurrentUsernameUnencoded(String env_hadoop_username)
env_hadoop_username if it is set on an insecure cluster.
This ensures that the username propagates correctly across processes
started by YARN.
This method is primarly made visible for testing.
env_hadoop_username - the environment variable
RuntimeException - if there is a problem getting the short user
name of the current user.public static String currentUser()
In an insecure cluster, the environment variable
HADOOP_USER_NAME is queried first.
This means that in a YARN container where the creator set this environment variable to propagate their identity, the defined user name is used in preference to the actual user.
In a secure cluster, the kerberos identity of the current user is used.
RuntimeException - if the current user identity cannot be determined
from the OS/kerberos.
public static Map<String,ServiceRecord> extractServiceRecords(RegistryOperations operations,
String parentpath,
Collection<RegistryPathStatus> stats)
throws IOException
operations - operation support for fetchesparentpath - path of the parent of all the entriesstats - Collection of stat results
IOException - for any IO Operation that wasn't ignored.
public static Map<String,ServiceRecord> extractServiceRecords(RegistryOperations operations,
String parentpath,
Map<String,RegistryPathStatus> stats)
throws IOException
operations - operation support for fetchesparentpath - path of the parent of all the entries
IOException - for any IO Operation that wasn't ignored.
public static Map<String,ServiceRecord> extractServiceRecords(RegistryOperations operations,
String parentpath)
throws IOException
operations - operation support for fetchesparentpath - path of the parent of all the entries
IOException - for any IO Operation that wasn't ignored.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||