当前位置: 首页>>代码示例>>Java>>正文


Java RegistryOperations类代码示例

本文整理汇总了Java中org.apache.hadoop.registry.client.api.RegistryOperations的典型用法代码示例。如果您正苦于以下问题:Java RegistryOperations类的具体用法?Java RegistryOperations怎么用?Java RegistryOperations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


RegistryOperations类属于org.apache.hadoop.registry.client.api包,在下文中一共展示了RegistryOperations类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: statChildren

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
/**
 * List children of a directory and retrieve their
 * {@link RegistryPathStatus} values.
 * <p>
 * This is not an atomic operation; A child may be deleted
 * during the iteration through the child entries. If this happens,
 * the <code>PathNotFoundException</code> is caught and that child
 * entry ommitted.
 *
 * @param path path
 * @return a possibly empty map of child entries listed by
 * their short name.
 * @throws PathNotFoundException path is not in the registry.
 * @throws InvalidPathnameException the path is invalid.
 * @throws IOException Any other IO Exception
 */
public static Map<String, RegistryPathStatus> statChildren(
    RegistryOperations registryOperations,
    String path)
    throws PathNotFoundException,
    InvalidPathnameException,
    IOException {
  List<String> childNames = registryOperations.list(path);
  Map<String, RegistryPathStatus> results =
      new HashMap<String, RegistryPathStatus>();
  for (String childName : childNames) {
    String child = join(path, childName);
    try {
      RegistryPathStatus stat = registryOperations.stat(child);
      results.put(childName, stat);
    } catch (PathNotFoundException pnfe) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("stat failed on {}: moved? {}", child, pnfe, pnfe);
      }
      // and continue
    }
  }
  return results;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:40,代码来源:RegistryUtils.java

示例2: YarnRegistryViewForProviders

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
public YarnRegistryViewForProviders(RegistryOperations registryOperations,
    String user,
    String sliderServiceClass,
    String instanceName,
    ApplicationAttemptId applicationAttemptId) {
  Preconditions.checkArgument(registryOperations != null,
      "null registry operations");
  Preconditions.checkArgument(user != null, "null user");
  Preconditions.checkArgument(SliderUtils.isSet(sliderServiceClass),
      "unset service class");
  Preconditions.checkArgument(SliderUtils.isSet(instanceName),
      "instanceName");
  Preconditions.checkArgument(applicationAttemptId != null,
      "null applicationAttemptId");
  this.registryOperations = registryOperations;
  this.user = user;
  this.sliderServiceClass = sliderServiceClass;
  this.instanceName = instanceName;
  this.applicationAttemptId = applicationAttemptId;
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:21,代码来源:YarnRegistryViewForProviders.java

示例3: createYarnRegistryViewForProviders

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
protected YarnRegistryViewForProviders createYarnRegistryViewForProviders(
    Configuration conf) throws IOException {
  conf.set(SliderXmlConfKeys.REGISTRY_PATH,
      SliderXmlConfKeys.DEFAULT_REGISTRY_PATH);

  RegistryOperations registryOperations = new MockRegistryOperations();
  registryOperations.init(conf);
  YarnRegistryViewForProviders registryViewForProviders =
      new YarnRegistryViewForProviders(registryOperations,
          "hbase",
          SliderKeys.APP_TYPE,
          "hbase1",
          new MockApplicationAttemptId(new MockApplicationId(1), 1));
  registryViewForProviders.registerSelf(new ServiceRecord(), true);
  return registryViewForProviders;
}
 
开发者ID:apache,项目名称:incubator-slider,代码行数:17,代码来源:TestAgentProviderService.java

示例4: YarnRegistryViewForProviders

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
public YarnRegistryViewForProviders(RegistryOperations registryOperations,
                                    String user,
                                    String jstormServiceClass,
                                    String instanceName,
                                    ApplicationAttemptId applicationAttemptId) {
  Preconditions.checkArgument(registryOperations != null,
      "null registry operations");
  Preconditions.checkArgument(user != null, "null user");
  Preconditions.checkArgument(JstormYarnUtils.isSet(jstormServiceClass),
      "unset service class");
  Preconditions.checkArgument(JstormYarnUtils.isSet(instanceName),
      "instanceName");
  Preconditions.checkArgument(applicationAttemptId != null,
      "null applicationAttemptId");
  this.registryOperations = registryOperations;
  this.user = user;
  this.jstormServiceClass = jstormServiceClass;
  this.instanceName = instanceName;
  this.applicationAttemptId = applicationAttemptId;
}
 
开发者ID:alibaba,项目名称:jstorm,代码行数:21,代码来源:YarnRegistryViewForProviders.java

示例5: listServiceRecords

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
/**
 * List service records directly under a path
 * @param registryOperations registry operations instance
 * @param path path to list
 * @return a mapping of the service records that were resolved, indexed
 * by their full path
 * @throws IOException
 */
public static Map<String, ServiceRecord> listServiceRecords(
    RegistryOperations registryOperations,
    String path) throws IOException {
  Map<String, RegistryPathStatus> children =
      statChildren(registryOperations, path);
  return extractServiceRecords(registryOperations,
      path,
      children.values());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:RegistryUtils.java

示例6: RegistryCli

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
public RegistryCli(RegistryOperations reg,
    Configuration conf,
    PrintStream sysout,
    PrintStream syserr) {
  super(conf);
  Preconditions.checkArgument(reg != null, "Null registry");
  registry = reg;
  this.sysout = sysout;
  this.syserr = syserr;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:RegistryCli.java

示例7: testZookeeperCanWriteUnderSystem

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
/**
 * test that ZK can write as itself
 * @throws Throwable
 */
@Test
public void testZookeeperCanWriteUnderSystem() throws Throwable {

  RMRegistryOperationsService rmRegistryOperations =
      startRMRegistryOperations();
  RegistryOperations operations = rmRegistryOperations;
  operations.mknode(PATH_SYSTEM_SERVICES + "hdfs",
      false);
  ZKPathDumper pathDumper = rmRegistryOperations.dumpPath(true);
  LOG.info(pathDumper.toString());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TestSecureRMRegistryOperations.java

示例8: testAnonReadAccess

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
@Test
public void testAnonReadAccess() throws Throwable {
  RMRegistryOperationsService rmRegistryOperations =
      startRMRegistryOperations();
  describe(LOG, "testAnonReadAccess");
  RegistryOperations operations =
      RegistryOperationsFactory.createAnonymousInstance(zkClientConf);
  addToTeardown(operations);
  operations.start();

  assertFalse("RegistrySecurity.isClientSASLEnabled()==true",
      RegistrySecurity.isClientSASLEnabled());
  operations.list(PATH_SYSTEM_SERVICES);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestSecureRMRegistryOperations.java

示例9: testAnonNoWriteAccess

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
@Test
public void testAnonNoWriteAccess() throws Throwable {
  RMRegistryOperationsService rmRegistryOperations =
      startRMRegistryOperations();
  describe(LOG, "testAnonNoWriteAccess");
  RegistryOperations operations =
      RegistryOperationsFactory.createAnonymousInstance(zkClientConf);
  addToTeardown(operations);
  operations.start();

  String servicePath = PATH_SYSTEM_SERVICES + "hdfs";
  expectMkNodeFailure(operations, servicePath);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestSecureRMRegistryOperations.java

示例10: testAnonNoWriteAccessOffRoot

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
@Test
public void testAnonNoWriteAccessOffRoot() throws Throwable {
  RMRegistryOperationsService rmRegistryOperations =
      startRMRegistryOperations();
  describe(LOG, "testAnonNoWriteAccessOffRoot");
  RegistryOperations operations =
      RegistryOperationsFactory.createAnonymousInstance(zkClientConf);
  addToTeardown(operations);
  operations.start();
  assertFalse("mknode(/)", operations.mknode("/", false));
  expectMkNodeFailure(operations, "/sub");
  expectDeleteFailure(operations, PATH_SYSTEM_SERVICES, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestSecureRMRegistryOperations.java

示例11: testAlicePathRestrictedAnonAccess

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
@Test
public void testAlicePathRestrictedAnonAccess() throws Throwable {
  RMRegistryOperationsService rmRegistryOperations =
      startRMRegistryOperations();
  String aliceHome = rmRegistryOperations.initUserRegistry(ALICE);
  describe(LOG, "Creating anonymous accessor");
  RegistryOperations anonOperations =
      RegistryOperationsFactory.createAnonymousInstance(zkClientConf);
  addToTeardown(anonOperations);
  anonOperations.start();
  anonOperations.list(aliceHome);
  expectMkNodeFailure(anonOperations, aliceHome + "/anon");
  expectDeleteFailure(anonOperations, aliceHome, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestSecureRMRegistryOperations.java

示例12: createRegistryOperationsInstance

import org.apache.hadoop.registry.client.api.RegistryOperations; //导入依赖的package包/类
private RegistryOperations createRegistryOperationsInstance() {
  if (registryOperations == null) {
    registryOperations = RegistryOperationsFactory.createInstance("YarnRegistry", conf);
    registryOperations.start();
  }
  return registryOperations;
}
 
开发者ID:intel-hadoop,项目名称:yacop,代码行数:8,代码来源:NRegistryOperator.java


注:本文中的org.apache.hadoop.registry.client.api.RegistryOperations类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。