List of usage examples for org.apache.hadoop.registry.client.binding RegistryPathUtils parentOf
public static String parentOf(String path) throws PathNotFoundException
From source file:com.alibaba.jstorm.yarn.registry.YarnRegistryViewForProviders.java
License:Apache License
/** * Add a component /*from w ww.j a va 2 s .co m*/ * @param serviceClass service class to use under ~user * @param componentName component name * @param record record to put * @throws IOException */ public void putComponent(String serviceClass, String serviceName, String componentName, ServiceRecord record) throws IOException { String path = RegistryUtils.componentPath(user, serviceClass, serviceName, componentName); registryOperations.mknode(RegistryPathUtils.parentOf(path), true); registryOperations.bind(path, record, BindFlags.OVERWRITE); }
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/* w ww . j a v a 2 s. 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; }