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


Java TimelineDomain.setOwner方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.records.timeline.TimelineDomain.setOwner方法的典型用法代码示例。如果您正苦于以下问题:Java TimelineDomain.setOwner方法的具体用法?Java TimelineDomain.setOwner怎么用?Java TimelineDomain.setOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.records.timeline.TimelineDomain的用法示例。


在下文中一共展示了TimelineDomain.setOwner方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: putDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
/**
 * Add or update an domain. If the domain already exists, only the owner
 * and the admin can update it.
 */
public void putDomain(TimelineDomain domain,
    UserGroupInformation callerUGI) throws YarnException, IOException {
  TimelineDomain existingDomain =
      store.getDomain(domain.getId());
  if (existingDomain != null) {
    if (!timelineACLsManager.checkAccess(callerUGI, existingDomain)) {
      throw new YarnException(callerUGI.getShortUserName() +
          " is not allowed to override an existing domain " +
          existingDomain.getId());
    }
    // Set it again in case ACLs are not enabled: The domain can be
    // modified by every body, but the owner is not changed.
    domain.setOwner(existingDomain.getOwner());
  }
  store.put(domain);
  // If the domain exists already, it is likely to be in the cache.
  // We need to invalidate it.
  if (existingDomain != null) {
    timelineACLsManager.replaceIfExist(domain);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:26,代码来源:TimelineDataManager.java

示例2: testYarnACLsEnabledForDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
@Test
public void testYarnACLsEnabledForDomain() throws Exception {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
  conf.set(YarnConfiguration.YARN_ADMIN_ACL, "admin");
  TimelineACLsManager timelineACLsManager =
      new TimelineACLsManager(conf);
  TimelineDomain domain = new TimelineDomain();
  domain.setOwner("owner");
  Assert.assertTrue(
      "Owner should be allowed to access",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("owner"), domain));
  Assert.assertFalse(
      "Other shouldn't be allowed to access",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("other"), domain));
  Assert.assertTrue(
      "Admin should be allowed to access",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("admin"), domain));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestTimelineACLsManager.java

示例3: doPutDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
private void doPutDomain(TimelineDomain domain,
    UserGroupInformation callerUGI) throws YarnException, IOException {
  TimelineDomain existingDomain =
      store.getDomain(domain.getId());
  if (existingDomain != null) {
    if (!timelineACLsManager.checkAccess(callerUGI, existingDomain)) {
      throw new YarnException(callerUGI.getShortUserName() +
          " is not allowed to override an existing domain " +
          existingDomain.getId());
    }
    // Set it again in case ACLs are not enabled: The domain can be
    // modified by every body, but the owner is not changed.
    domain.setOwner(existingDomain.getOwner());
  }
  store.put(domain);
  // If the domain exists already, it is likely to be in the cache.
  // We need to invalidate it.
  if (existingDomain != null) {
    timelineACLsManager.replaceIfExist(domain);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:22,代码来源:TimelineDataManager.java

示例4: setup

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
  config.set(MiniDFSCluster.HDFS_MINIDFS_BASEDIR, TEST_ROOT_DIR.toString());
  HdfsConfiguration hdfsConfig = new HdfsConfiguration();
  hdfsCluster = new MiniDFSCluster.Builder(hdfsConfig).numDataNodes(1).build();
  fs = hdfsCluster.getFileSystem();
  fc = FileContext.getFileContext(hdfsCluster.getURI(0), config);
  Path testAppDirPath = getTestRootPath(TEST_ATTEMPT_DIR_NAME);
  fs.mkdirs(testAppDirPath, new FsPermission(FILE_LOG_DIR_PERMISSIONS));
  objMapper = PluginStoreTestUtils.createObjectMapper();

  TimelineEntities testEntities = PluginStoreTestUtils.generateTestEntities();
  writeEntitiesLeaveOpen(testEntities,
      new Path(testAppDirPath, TEST_ENTITY_FILE_NAME));

  testDomain = new TimelineDomain();
  testDomain.setId("domain_1");
  testDomain.setReaders(UserGroupInformation.getLoginUser().getUserName());
  testDomain.setOwner(UserGroupInformation.getLoginUser().getUserName());
  testDomain.setDescription("description");
  writeDomainLeaveOpen(testDomain,
      new Path(testAppDirPath, TEST_DOMAIN_FILE_NAME));

  writeBrokenFile(new Path(testAppDirPath, TEST_BROKEN_FILE_NAME));
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestLogInfo.java

示例5: generateDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
public static TimelineDomain generateDomain() {
  TimelineDomain domain = new TimelineDomain();
  domain.setId("namesapce id");
  domain.setDescription("domain description");
  domain.setOwner("domain owner");
  domain.setReaders("domain_reader");
  domain.setWriters("domain_writer");
  domain.setCreatedTime(0L);
  domain.setModifiedTime(1L);
  return domain;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestTimelineClient.java

示例6: createTimelineDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
private static TimelineDomain createTimelineDomain(
    String id, String description, String owner,
    String readers, String writers,
    Long createdTime, Long modifiedTime) {
  TimelineDomain domainToStore = new TimelineDomain();
  domainToStore.setId(id);
  domainToStore.setDescription(description);
  domainToStore.setOwner(owner);
  domainToStore.setReaders(readers);
  domainToStore.setWriters(writers);
  domainToStore.setCreatedTime(createdTime);
  domainToStore.setModifiedTime(modifiedTime);
  return domainToStore;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:MemoryTimelineStore.java

示例7: testYarnACLsNotEnabledForDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
@Test
public void testYarnACLsNotEnabledForDomain() throws Exception {
  Configuration conf = new YarnConfiguration();
  conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, false);
  TimelineACLsManager timelineACLsManager =
      new TimelineACLsManager(conf);
  TimelineDomain domain = new TimelineDomain();
  domain.setOwner("owner");
  Assert.assertTrue(
      "Always true when ACLs are not enabled",
      timelineACLsManager.checkAccess(
          UserGroupInformation.createRemoteUser("user"), domain));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestTimelineACLsManager.java

示例8: generateDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
private static TimelineDomain generateDomain() {
  TimelineDomain domain = new TimelineDomain();
  domain.setId("namesapce id");
  domain.setDescription("domain description");
  domain.setOwner("domain owner");
  domain.setReaders("domain_reader");
  domain.setWriters("domain_writer");
  domain.setCreatedTime(0L);
  domain.setModifiedTime(1L);
  return domain;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:12,代码来源:TestTimelineClientForATS1_5.java

示例9: getTimelineDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
private static TimelineDomain getTimelineDomain(DBIterator iterator,
    String domainId, byte[] prefix) throws IOException {
  // Iterate over all the rows whose key starts with prefix to retrieve the
  // domain information.
  TimelineDomain domain = new TimelineDomain();
  domain.setId(domainId);
  boolean noRows = true;
  for (; iterator.hasNext(); iterator.next()) {
    byte[] key = iterator.peekNext().getKey();
    if (!prefixMatches(prefix, prefix.length, key)) {
      break;
    }
    if (noRows) {
      noRows = false;
    }
    byte[] value = iterator.peekNext().getValue();
    if (value != null && value.length > 0) {
      if (key[prefix.length] == DESCRIPTION_COLUMN[0]) {
        domain.setDescription(new String(value, UTF_8));
      } else if (key[prefix.length] == OWNER_COLUMN[0]) {
        domain.setOwner(new String(value, UTF_8));
      } else if (key[prefix.length] == READER_COLUMN[0]) {
        domain.setReaders(new String(value, UTF_8));
      } else if (key[prefix.length] == WRITER_COLUMN[0]) {
        domain.setWriters(new String(value, UTF_8));
      } else if (key[prefix.length] == TIMESTAMP_COLUMN[0]) {
        domain.setCreatedTime(readReverseOrderedLong(value, 0));
        domain.setModifiedTime(readReverseOrderedLong(value, 8));
      } else {
        LOG.error("Unrecognized domain column: " + key[prefix.length]);
      }
    }
  }
  if (noRows) {
    return null;
  } else {
    return domain;
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:40,代码来源:RollingLevelDBTimelineStore.java

示例10: getTimelineDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
private static TimelineDomain getTimelineDomain(
    DBIterator iterator, String domainId, byte[] prefix) throws IOException {
  // Iterate over all the rows whose key starts with prefix to retrieve the
  // domain information.
  TimelineDomain domain = new TimelineDomain();
  domain.setId(domainId);
  boolean noRows = true;
  for (; iterator.hasNext(); iterator.next()) {
    byte[] key = iterator.peekNext().getKey();
    if (!prefixMatches(prefix, prefix.length, key)) {
      break;
    }
    if (noRows) {
      noRows = false;
    }
    byte[] value = iterator.peekNext().getValue();
    if (value != null && value.length > 0) {
      if (key[prefix.length] == DESCRIPTION_COLUMN[0]) {
        domain.setDescription(new String(value));
      } else if (key[prefix.length] == OWNER_COLUMN[0]) {
        domain.setOwner(new String(value));
      } else if (key[prefix.length] == READER_COLUMN[0]) {
        domain.setReaders(new String(value));
      } else if (key[prefix.length] == WRITER_COLUMN[0]) {
        domain.setWriters(new String(value));
      } else if (key[prefix.length] == TIMESTAMP_COLUMN[0]) {
        domain.setCreatedTime(readReverseOrderedLong(value, 0));
        domain.setModifiedTime(readReverseOrderedLong(value, 8));
      } else {
        LOG.error("Unrecognized domain column: " + key[prefix.length]);
      }
    }
  }
  if (noRows) {
    return null;
  } else {
    return domain;
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:40,代码来源:LeveldbTimelineStore.java

示例11: loadTestDomainData

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
protected void loadTestDomainData() throws IOException {
  domain1 = new TimelineDomain();
  domain1.setId("domain_id_1");
  domain1.setDescription("description_1");
  domain1.setOwner("owner_1");
  domain1.setReaders("reader_user_1 reader_group_1");
  domain1.setWriters("writer_user_1 writer_group_1");
  store.put(domain1);

  domain2 = new TimelineDomain();
  domain2.setId("domain_id_2");
  domain2.setDescription("description_2");
  domain2.setOwner("owner_2");
  domain2.setReaders("reader_user_2 reader_group_2");
  domain2.setWriters("writer_user_2 writer_group_2");
  store.put(domain2);

  // Wait a second before updating the domain information
  elapsedTime = 1000;
  try {
    Thread.sleep(elapsedTime);
  } catch (InterruptedException e) {
    throw new IOException(e);
  }

  domain2.setDescription("description_3");
  domain2.setOwner("owner_3");
  domain2.setReaders("reader_user_3 reader_group_3");
  domain2.setWriters("writer_user_3 writer_group_3");
  store.put(domain2);

  domain3 = new TimelineDomain();
  domain3.setId("domain_id_4");
  domain3.setDescription("description_4");
  domain3.setOwner("owner_1");
  domain3.setReaders("reader_user_4 reader_group_4");
  domain3.setWriters("writer_user_4 writer_group_4");
  store.put(domain3);
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:40,代码来源:TimelineStoreTestUtils.java

示例12: createTimelineDomain

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
static TimelineDomain createTimelineDomain(
    String id, String description, String owner,
    String readers, String writers,
    Long createdTime, Long modifiedTime) {
  TimelineDomain domainToStore = new TimelineDomain();
  domainToStore.setId(id);
  domainToStore.setDescription(description);
  domainToStore.setOwner(owner);
  domainToStore.setReaders(readers);
  domainToStore.setWriters(writers);
  domainToStore.setCreatedTime(createdTime);
  domainToStore.setModifiedTime(modifiedTime);
  return domainToStore;
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:15,代码来源:KeyValueBasedTimelineStore.java

示例13: loadTestDomainData

import org.apache.hadoop.yarn.api.records.timeline.TimelineDomain; //导入方法依赖的package包/类
protected void loadTestDomainData() throws IOException {
  domain1 = new TimelineDomain();
  domain1.setId("domain_id_1");
  domain1.setDescription("description_1");
  domain1.setOwner("owner_1");
  domain1.setReaders("reader_user_1 reader_group_1");
  domain1.setWriters("writer_user_1 writer_group_1");
  store.put(domain1);

  domain2 = new TimelineDomain();
  domain2.setId("domain_id_2");
  domain2.setDescription("description_2");
  domain2.setOwner("owner_2");
  domain2.setReaders("reader_user_2 reader_group_2");
  domain2.setWriters("writer_user_2 writer_group_2");
  store.put(domain2);

  // Wait a second before updating the domain information
  elapsedTime = 1000;
  try {
    Thread.sleep(elapsedTime);
  } catch (InterruptedException e) {
    throw new IOException(e);
  }

  domain2.setDescription("description_3");
  domain2.setOwner("owner_3");
  domain2.setReaders("reader_user_3 reader_group_3");
  domain2.setWriters("writer_user_3 writer_group_3");
  store.put(domain2);

  domain3 = new TimelineDomain();
  domain3.setId("domain_id_4");
  domain3.setDescription("description_4");
  domain3.setOwner("owner_1");
  domain3.setReaders("reader_user_4 reader_group_4");
  domain3.setWriters("writer_user_4 writer_group_4");
  store.put(domain3);

  TimelineEntities entities = new TimelineEntities();
  if (store instanceof LeveldbTimelineStore) {
    LeveldbTimelineStore leveldb = (LeveldbTimelineStore) store;
    entities.setEntities(Collections.singletonList(createEntity(
            "ACL_ENTITY_ID_11", "ACL_ENTITY_TYPE_1", 63l, null, null, null, null,
            "domain_id_4")));
    leveldb.put(entities);
    entities.setEntities(Collections.singletonList(createEntity(
            "ACL_ENTITY_ID_22", "ACL_ENTITY_TYPE_1", 64l, null, null, null, null,
            "domain_id_2")));
    leveldb.put(entities);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:53,代码来源:TimelineStoreTestUtils.java


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