List of usage examples for org.apache.hadoop.registry.client.api RegistryConstants PATH_USERS
String PATH_USERS
To view the source code for org.apache.hadoop.registry.client.api RegistryConstants PATH_USERS.
Click Source Link
From source file:org.apache.slider.client.ClientRegistryBinder.java
License:Apache License
/** * Buld the user path -switches to the system path if the user is "". * It also cross-converts the username to ascii via punycode * @param username username or ""// w w w. j a va2s. c om * @return the path to the user */ public static String homePathForUser(String username) { Preconditions.checkArgument(username != null, "null user"); // catch recursion if (username.startsWith(RegistryConstants.PATH_USERS)) { return username; } if (username.isEmpty()) { return RegistryConstants.PATH_SYSTEM_SERVICES; } // convert username to registry name String convertedName = convertUsername(username); return RegistryPathUtils.join(RegistryConstants.PATH_USERS, encodeForRegistry(convertedName)); }
From source file:org.apache.slider.client.ClientRegistryBinder.java
License:Apache License
/** * Qualify a user./*from w ww. j av a 2 s . c om*/ * <ol> * <li> <code>"~"</code> maps to user home path home</li> * <li> <code>"~user"</code> maps to <code>/users/$user</code></li> * <li> <code>"/"</code> maps to <code>/services/</code></li> * </ol> * @param user the username * @return the base path */ public static String qualifyUser(String user) { // qualify the user String t = user.trim(); if (t.startsWith("/")) { // already resolved return t; } else if (t.equals("~")) { // self return currentUsernameUnencoded(); } else if (t.startsWith("~")) { // another user // convert username to registry name String convertedName = convertUsername(t.substring(1)); return RegistryPathUtils.join(RegistryConstants.PATH_USERS, encodeForRegistry(convertedName)); } else { return "/" + t; } }