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


Java User.isHBaseSecurityEnabled方法代码示例

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


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

示例1: getDifferentUser

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
/**
 * This method clones the passed <code>c</code> configuration setting a new
 * user into the clone.  Use it getting new instances of FileSystem.  Only
 * works for DistributedFileSystem w/o Kerberos.
 * @param c Initial configuration
 * @param differentiatingSuffix Suffix to differentiate this user from others.
 * @return A new configuration instance with a different user set into it.
 * @throws IOException
 */
public static User getDifferentUser(final Configuration c,
  final String differentiatingSuffix)
throws IOException {
  FileSystem currentfs = FileSystem.get(c);
  if (!(currentfs instanceof DistributedFileSystem) || User.isHBaseSecurityEnabled(c)) {
    return User.getCurrent();
  }
  // Else distributed filesystem.  Make a new instance per daemon.  Below
  // code is taken from the AppendTestUtil over in hdfs.
  String username = User.getCurrent().getName() +
    differentiatingSuffix;
  User user = User.createUserForTesting(c, username,
      new String[]{"supergroup"});
  return user;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:25,代码来源:HBaseTestingUtility.java

示例2: getArgsForLoadTestTool

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
@Override
protected String[] getArgsForLoadTestTool(String mode, String modeSpecificArg, long startKey,
    long numKeys) {
  String[] args = super.getArgsForLoadTestTool(mode, modeSpecificArg, startKey, numKeys);
  List<String> tmp = new ArrayList<String>(Arrays.asList(args));
  tmp.add(HYPHEN + LoadTestTool.OPT_GENERATOR);
  StringBuilder sb = new StringBuilder(LoadTestDataGeneratorWithACL.class.getName());
  sb.append(COLON);
  if (User.isHBaseSecurityEnabled(getConf())) {
    sb.append(authnFileName);
    sb.append(COLON);
  }
  sb.append(superUser);
  sb.append(COLON);
  sb.append(userNames);
  sb.append(COLON);
  sb.append(Integer.toString(SPECIAL_PERM_CELL_INSERTION_FACTOR));
  tmp.add(sb.toString());
  return tmp.toArray(new String[tmp.size()]);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:21,代码来源:IntegrationTestIngestWithACL.java

示例3: processOptions

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
@Override
protected void processOptions(CommandLine cmd) {
  super.processOptions(cmd);
  if (cmd.hasOption(OPT_SUPERUSER)) {
    superUser = cmd.getOptionValue(OPT_SUPERUSER);
  }
  if (cmd.hasOption(OPT_USERS)) {
    userNames = cmd.getOptionValue(OPT_USERS);
  }
  if (User.isHBaseSecurityEnabled(getConf())) {
    boolean authFileNotFound = false;
    if (cmd.hasOption(OPT_AUTHN)) {
      authnFileName = cmd.getOptionValue(OPT_AUTHN);
      if (StringUtils.isEmpty(authnFileName)) {
        authFileNotFound = true;
      }
    } else {
      authFileNotFound = true;
    }
    if (authFileNotFound) {
      super.printUsage();
      System.exit(EXIT_FAILURE);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:26,代码来源:IntegrationTestIngestWithACL.java

示例4: getSecurityCapabilities

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
/** 
 * Returns the security capabilities in effect on the cluster
 */
@Override
public SecurityCapabilitiesResponse getSecurityCapabilities(RpcController controller,
    SecurityCapabilitiesRequest request) throws ServiceException {
  SecurityCapabilitiesResponse.Builder response = SecurityCapabilitiesResponse.newBuilder();
  try {
    master.checkInitialized();
    Set<Capability> capabilities = new HashSet<>();
    // Authentication
    if (User.isHBaseSecurityEnabled(master.getConfiguration())) {
      capabilities.add(Capability.SECURE_AUTHENTICATION);
    } else {
      capabilities.add(Capability.SIMPLE_AUTHENTICATION);
    }
    // The AccessController can provide AUTHORIZATION and CELL_AUTHORIZATION
    if (master.cpHost != null &&
          master.cpHost.findCoprocessor(AccessController.class.getName()) != null) {
      if (AccessController.isAuthorizationSupported(master.getConfiguration())) {
        capabilities.add(Capability.AUTHORIZATION);
      }
      if (AccessController.isCellAuthorizationSupported(master.getConfiguration())) {
        capabilities.add(Capability.CELL_AUTHORIZATION);
      }
    }
    // The VisibilityController can provide CELL_VISIBILITY
    if (master.cpHost != null &&
          master.cpHost.findCoprocessor(VisibilityController.class.getName()) != null) {
      if (VisibilityController.isCellAuthorizationSupported(master.getConfiguration())) {
        capabilities.add(Capability.CELL_VISIBILITY);
      }
    }
    response.addAllCapabilities(capabilities);
  } catch (IOException e) {
    throw new ServiceException(e);
  }
  return response.build();
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:40,代码来源:MasterRpcServices.java

示例5: execute

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
public PairOfSameType<Region> execute(final Server server,
  final RegionServerServices services)
      throws IOException {
  if (User.isHBaseSecurityEnabled(parent.getBaseConf())) {
    LOG.warn("Should use execute(Server, RegionServerServices, User)");
  }
  return execute(server, services, null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:SplitTransactionImpl.java

示例6: rollback

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
@Override
public boolean rollback(final Server server, final RegionServerServices services)
    throws IOException {
  if (User.isHBaseSecurityEnabled(parent.getBaseConf())) {
    LOG.warn("Should use rollback(Server, RegionServerServices, User)");
  }
  return rollback(server, services, null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:SplitTransactionImpl.java

示例7: rollback

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
/**
 * @param server Hosting server instance (May be null when testing).
 * @param services Services of regionserver, used to online regions.
 * @throws IOException If thrown, rollback failed. Take drastic action.
 * @return True if we successfully rolled back, false if we got to the point
 *         of no return and so now need to abort the server to minimize
 *         damage.
 */
@Override
@SuppressWarnings("deprecation")
public boolean rollback(final Server server,
    final RegionServerServices services) throws IOException {
  if (User.isHBaseSecurityEnabled(region_a.getBaseConf())) {
    LOG.warn("Should use execute(Server, RegionServerServices, User)");
  }
  return rollback(server, services, null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:18,代码来源:RegionMergeTransactionImpl.java

示例8: execute

import org.apache.hadoop.hbase.security.User; //导入方法依赖的package包/类
/**
 * Run the transaction.
 * @param server Hosting server instance. Can be null when testing
 * @param services Used to online/offline regions.
 * @throws IOException If thrown, transaction failed. Call
 *           {@link #rollback(Server, RegionServerServices)}
 * @return merged region
 * @throws IOException
 * @see #rollback(Server, RegionServerServices)
 */
@Override
public HRegion execute(final Server server,
    final RegionServerServices services) throws IOException {
  if (User.isHBaseSecurityEnabled(region_a.getBaseConf())) {
    LOG.warn("Should use execute(Server, RegionServerServices, User)");
  }
  return execute(server, services, null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:19,代码来源:RegionMergeTransactionImpl.java


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