Java Code Examples for org.apache.hadoop.yarn.api.records.timeline.TimelineDomain#getId()

The following examples show how to use org.apache.hadoop.yarn.api.records.timeline.TimelineDomain#getId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TimelineACLsManager.java    From hadoop with Apache License 2.0 6 votes vote down vote up
public boolean checkAccess(UserGroupInformation callerUGI,
    TimelineDomain domain) throws YarnException, IOException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Verifying the access of "
        + (callerUGI == null ? null : callerUGI.getShortUserName())
        + " on the timeline domain " + domain);
  }

  if (!adminAclsManager.areACLsEnabled()) {
    return true;
  }

  String owner = domain.getOwner();
  if (owner == null || owner.length() == 0) {
    throw new YarnException("Owner information of the timeline domain "
        + domain.getId() + " is corrupted.");
  }
  if (callerUGI != null
      && (adminAclsManager.isAdmin(callerUGI) ||
          callerUGI.getShortUserName().equals(owner))) {
    return true;
  }
  return false;
}
 
Example 2
Source File: TimelineDataManager.java    From hadoop with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
  }
}
 
Example 3
Source File: TimelineACLsManager.java    From big-c with Apache License 2.0 6 votes vote down vote up
public boolean checkAccess(UserGroupInformation callerUGI,
    TimelineDomain domain) throws YarnException, IOException {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Verifying the access of "
        + (callerUGI == null ? null : callerUGI.getShortUserName())
        + " on the timeline domain " + domain);
  }

  if (!adminAclsManager.areACLsEnabled()) {
    return true;
  }

  String owner = domain.getOwner();
  if (owner == null || owner.length() == 0) {
    throw new YarnException("Owner information of the timeline domain "
        + domain.getId() + " is corrupted.");
  }
  if (callerUGI != null
      && (adminAclsManager.isAdmin(callerUGI) ||
          callerUGI.getShortUserName().equals(owner))) {
    return true;
  }
  return false;
}
 
Example 4
Source File: TimelineDataManager.java    From big-c with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
  }
}