List of usage examples for org.apache.hadoop.registry.client.binding RegistryPathUtils join
public static String join(String base, String path)
From source file:com.alibaba.jstorm.yarn.registry.YarnRegistryViewForProviders.java
License:Apache License
/** * Get the absolute path to where the service has registered itself. * This includes the base registry path//from w w w . j a v a 2s.c o m * Null until the service is registered * @return the service registration path. */ public String getAbsoluteSelfRegistrationPath() { if (selfRegistrationPath == null) { return null; } String root = registryOperations.getConfig().getTrimmed(RegistryConstants.KEY_REGISTRY_ZK_ROOT, RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT); return RegistryPathUtils.join(root, selfRegistrationPath); }
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 ""// ww w. j a v a 2 s . 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.//www . j ava 2 s . c o m * <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; } }