Example usage for org.apache.hadoop.registry.client.binding RegistryUtils homePathForCurrentUser

List of usage examples for org.apache.hadoop.registry.client.binding RegistryUtils homePathForCurrentUser

Introduction

In this page you can find the example usage for org.apache.hadoop.registry.client.binding RegistryUtils homePathForCurrentUser.

Prototype

public static String homePathForCurrentUser() 

Source Link

Document

Get the home path of the current user.

Usage

From source file:org.apache.slider.core.registry.SliderRegistryUtils.java

License:Apache License

/**
 * Process a path expanding it if needed.
 * Validation is delegated to later as the core registry will need
 * to do that anyway/*from  www .j  ava 2  s .com*/
 * @param path path
 * @return a path maybe with some expansion
 */
public static String resolvePath(String path) {
    Preconditions.checkArgument(path != null, "null path");
    Preconditions.checkArgument(!path.isEmpty(), "empty path");
    String newpath = path;
    if (path.startsWith("~/")) {
        // add user expansion
        newpath = RegistryUtils.homePathForCurrentUser() + path.substring(1);
    } else if (path.equals("~")) {
        newpath = RegistryUtils.homePathForCurrentUser();
    }
    return newpath;
}