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


Java RequestContext.isInRequestContext方法代码示例

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


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

示例1: requireScannerOwner

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * Verify, when servicing an RPC, that the caller is the scanner owner. If so, we assume that
 * access control is correctly enforced based on the checks performed in preScannerOpen()
 */
private void requireScannerOwner(InternalScanner s) throws AccessDeniedException {
  if (RequestContext.isInRequestContext()) {
    String requestUName = RequestContext.getRequestUserName();
    String owner = scannerOwners.get(s);
    if (owner != null && !owner.equals(requestUName)) {
      throw new AccessDeniedException("User '" + requestUName + "' is not the scanner owner!");
    }
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:14,代码来源:VisibilityController.java

示例2: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * @return User who called RPC method. For non-RPC handling, falls back to system user
 * @throws IOException When there is IOE in getting the system user (During non-RPC handling).
 */
public static User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    user = User.getCurrent();
  }
  if (LOG.isTraceEnabled()) {
    LOG.trace("Current active user name is " + user.getShortName());
  }
  return user;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:15,代码来源:VisibilityUtils.java

示例3: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * Returns the active user to which authorization checks should be applied.
 * If we are in the context of an RPC call, the remote user is used,
 * otherwise the currently logged in user is used.
 */
private User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    // for non-rpc handling, fallback to system user
    user = userProvider.getCurrent();
  }
  return user;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:14,代码来源:AccessController.java

示例4: requireScannerOwner

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * Verify, when servicing an RPC, that the caller is the scanner owner.
 * If so, we assume that access control is correctly enforced based on
 * the checks performed in preScannerOpen()
 */
private void requireScannerOwner(InternalScanner s)
    throws AccessDeniedException {
  if (RequestContext.isInRequestContext()) {
    String requestUserName = RequestContext.getRequestUserName();
    String owner = scannerOwners.get(s);
    if (owner != null && !owner.equals(requestUserName)) {
      throw new AccessDeniedException("User '"+ requestUserName +"' is not the scanner owner!");
    }
  }
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:16,代码来源:AccessController.java

示例5: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
private User getActiveUser() {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    return null;
  }

  //this is for testing
  if (userProvider.isHadoopSecurityEnabled()
      && "simple".equalsIgnoreCase(conf.get(User.HBASE_SECURITY_CONF_KEY))) {
    return User.createUserForTesting(conf, user.getShortName(), new String[]{});
  }

  return user;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:15,代码来源:SecureBulkLoadEndpoint.java

示例6: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
private User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    // for non-rpc handling, fallback to system user
    user = User.getCurrent();
  }
  if (LOG.isTraceEnabled()) {
    LOG.trace("Current active user name is "+user.getShortName());
  }
  return user;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:12,代码来源:VisibilityController.java

示例7: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
private User getActiveUser() {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    return null;
  }

  //this is for testing
  if("simple".equalsIgnoreCase(conf.get(User.HBASE_SECURITY_CONF_KEY))) {
    return User.createUserForTesting(conf, user.getShortName(), new String[]{});
  }

  return user;
}
 
开发者ID:tenggyut,项目名称:HIndex,代码行数:14,代码来源:SecureBulkLoadEndpoint.java

示例8: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * Returns the active user to which authorization checks should be applied.
 * If we are in the context of an RPC call, the remote user is used,
 * otherwise the currently logged in user is used.
 */
private User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    // for non-rpc handling, fallback to system user
    user = userProvider.getCurrent();
  }

  return user;
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:15,代码来源:AccessController.java

示例9: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
private User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    throw new DoNotRetryIOException("Failed to get requesting user");
  }

  //this is for testing
  if("simple".equalsIgnoreCase(conf.get(User.HBASE_SECURITY_CONF_KEY))) {
    return User.createUserForTesting(conf, user.getShortName(), new String[]{});
  }

  return user;
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:14,代码来源:SecureBulkLoadEndpoint.java

示例10: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * Returns the active user to which authorization checks should be applied.
 * If we are in the context of an RPC call, the remote user is used,
 * otherwise the currently logged in user is used.
 */
private User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    // for non-rpc handling, fallback to system user
    user = User.getCurrent();
  }

  return user;
}
 
开发者ID:zwqjsj0404,项目名称:HBase-Research,代码行数:15,代码来源:AccessController.java

示例11: getActiveUser

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
/**
 * Returns the active user to which authorization checks should be applied.
 * If we are in the context of an RPC call, the remote user is used,
 * otherwise the currently logged in user is used.
 */
private User getActiveUser() throws IOException {
  User user = RequestContext.getRequestUser();
  if (!RequestContext.isInRequestContext()) {
    // for non-rpc handling, fallback to system user
    user = User.getCurrent();
  }
  return user;
}
 
开发者ID:daidong,项目名称:DominoHBase,代码行数:14,代码来源:AccessController.java

示例12: prepare

import org.apache.hadoop.hbase.ipc.RequestContext; //导入方法依赖的package包/类
@Override
public CreateTableHandler prepare()
    throws NotAllMetaRegionsOnlineException, TableExistsException, IOException {
  int timeout = conf.getInt("hbase.client.catalog.timeout", 10000);
  // Need hbase:meta availability to create a table
  try {
    if (server.getMetaTableLocator().waitMetaRegionLocation(
        server.getZooKeeper(), timeout) == null) {
      throw new NotAllMetaRegionsOnlineException();
    }
    // If we are creating the table in service to an RPC request, record the
    // active user for later, so proper permissions will be applied to the
    // new table by the AccessController if it is active
    if (RequestContext.isInRequestContext()) {
      this.activeUser = RequestContext.getRequestUser();
    } else {
      this.activeUser = UserProvider.instantiate(conf).getCurrent();
    }
  } catch (InterruptedException e) {
    LOG.warn("Interrupted waiting for meta availability", e);
    InterruptedIOException ie = new InterruptedIOException(e.getMessage());
    ie.initCause(e);
    throw ie;
  }

  //acquire the table write lock, blocking. Make sure that it is released.
  this.tableLock.acquire();
  boolean success = false;
  try {
    TableName tableName = this.hTableDescriptor.getTableName();
    if (MetaTableAccessor.tableExists(this.server.getConnection(), tableName)) {
      throw new TableExistsException(tableName);
    }

    checkAndSetEnablingTable(assignmentManager, tableName);
    success = true;
  } finally {
    if (!success) {
      releaseTableLock();
    }
  }
  return this;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:44,代码来源:CreateTableHandler.java


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