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

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

Introduction

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

Prototype

public static String servicePath(String user, String serviceClass, String serviceName) 

Source Link

Document

Create a path to a service under a user and service class

Usage

From source file:com.alibaba.jstorm.yarn.registry.YarnRegistryViewForProviders.java

License:Apache License

/**
 * Add a service under a path, optionally purging any history
 * @param username user//from   w w w  .ja  v a2s . c  om
 * @param serviceClass service class to use under ~user
 * @param serviceName name of the service
 * @param record service record
 * @param deleteTreeFirst perform recursive delete of the path first.
 * @return the path the service was created at
 * @throws IOException
 */
public String putService(String username, String serviceClass, String serviceName, ServiceRecord record,
        boolean deleteTreeFirst) throws IOException {
    String path = RegistryUtils.servicePath(username, serviceClass, serviceName);
    if (deleteTreeFirst) {
        registryOperations.delete(path, true);
    }
    registryOperations.mknode(RegistryPathUtils.parentOf(path), true);
    registryOperations.bind(path, record, BindFlags.OVERWRITE);
    return path;
}

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

License:Apache License

/**
 * Get the registry path for an instance under the user's home node
 * @param instanceName application instance
 * @return a path to the registry location for this application instance.
 *//*  w w w.  ja  v a  2  s  .co m*/
public static String registryPathForInstance(String instanceName) {
    return RegistryUtils.servicePath(RegistryUtils.currentUser(), SliderKeys.APP_TYPE, instanceName);
}