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


Java GetUserMappingsProtocol类代码示例

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


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

示例1: createProxy

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T createProxy(Configuration conf, InetSocketAddress hsaddr,
    Class<T> xface, UserGroupInformation ugi) throws IOException {

  T proxy;
  if (xface == RefreshUserMappingsProtocol.class) {
    proxy = (T) createHSProxyWithRefreshUserMappingsProtocol(hsaddr, conf,
        ugi);
  } else if (xface == GetUserMappingsProtocol.class) {
    proxy = (T) createHSProxyWithGetUserMappingsProtocol(hsaddr, conf, ugi);
  } else if (xface == HSAdminRefreshProtocol.class) {
    proxy = (T) createHSProxyWithHSAdminRefreshProtocol(hsaddr, conf, ugi);
  } else {
    String message = "Unsupported protocol found when creating the proxy "
        + "connection to History server: "
        + ((xface != null) ? xface.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }
  return proxy;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:HSProxies.java

示例2: getProtocolVersion

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
public long getProtocolVersion(String protocol, 
                               long clientVersion) throws IOException {
  if (protocol.equals(ClientProtocol.class.getName())) {
    return ClientProtocol.versionID; 
  } else if (protocol.equals(DatanodeProtocol.class.getName())){
    return DatanodeProtocol.versionID;
  } else if (protocol.equals(NamenodeProtocol.class.getName())){
    return NamenodeProtocol.versionID;
  } else if (protocol.equals(RefreshAuthorizationPolicyProtocol.class.getName())){
    return RefreshAuthorizationPolicyProtocol.versionID;
  } else if (protocol.equals(RefreshUserMappingsProtocol.class.getName())){
    return RefreshUserMappingsProtocol.versionID;
  } else if (protocol.equals(RefreshCallQueueProtocol.class.getName())) {
    return RefreshCallQueueProtocol.versionID;
  } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){
    return GetUserMappingsProtocol.versionID;
  } else if (protocol.equals(TraceAdminProtocol.class.getName())){
    return TraceAdminProtocol.versionID;
  } else {
    throw new IOException("Unknown protocol to name node: " + protocol);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:NameNode.java

示例3: getProtocolVersion

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
public long getProtocolVersion(String protocol, 
                               long clientVersion) throws IOException {
  if (protocol.equals(ClientProtocol.class.getName())) {
    return ClientProtocol.versionID; 
  } else if (protocol.equals(DatanodeProtocol.class.getName())){
    return DatanodeProtocol.versionID;
  } else if (protocol.equals(NamenodeProtocol.class.getName())){
    return NamenodeProtocol.versionID;
  } else if (protocol.equals(RefreshAuthorizationPolicyProtocol.class.getName())){
    return RefreshAuthorizationPolicyProtocol.versionID;
  } else if (protocol.equals(RefreshUserMappingsProtocol.class.getName())){
    return RefreshUserMappingsProtocol.versionID;
  } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){
    return GetUserMappingsProtocol.versionID;
  } else {
    throw new IOException("Unknown protocol to name node: " + protocol);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:NameNode.java

示例4: getProtocolVersion

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
public long getProtocolVersion(String protocol, long clientVersion)
    throws IOException {
  if (protocol.equals(ClientProtocol.class.getName())) {
    return ClientProtocol.versionID;
  } else if (protocol.equals(DatanodeProtocol.class.getName())) {
    return DatanodeProtocol.versionID;
  } else if (protocol.equals(NamenodeProtocol.class.getName())) {
    return NamenodeProtocol.versionID;
  } else if (protocol
      .equals(RefreshAuthorizationPolicyProtocol.class.getName())) {
    return RefreshAuthorizationPolicyProtocol.versionID;
  } else if (protocol.equals(RefreshUserMappingsProtocol.class.getName())) {
    return RefreshUserMappingsProtocol.versionID;
  } else if (protocol.equals(GetUserMappingsProtocol.class.getName())) {
    return GetUserMappingsProtocol.versionID;
  } else {
    throw new IOException("Unknown protocol to name node: " + protocol);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:NameNode.java

示例5: getProtocolVersion

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
public long getProtocolVersion(String protocol, 
                               long clientVersion) throws IOException {
  if (protocol.equals(ClientProtocol.class.getName())) {
    return ClientProtocol.versionID; 
  } else if (protocol.equals(DatanodeProtocol.class.getName())){
    return DatanodeProtocol.versionID;
  } else if (protocol.equals(NamenodeProtocol.class.getName())){
    return NamenodeProtocol.versionID;
  } else if (protocol.equals(RefreshAuthorizationPolicyProtocol.class.getName())){
    return RefreshAuthorizationPolicyProtocol.versionID;
  } else if (protocol.equals(RefreshUserMappingsProtocol.class.getName())){
    return RefreshUserMappingsProtocol.versionID;
  } else if (protocol.equals(RefreshCallQueueProtocol.class.getName())) {
    return RefreshCallQueueProtocol.versionID;
  } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){
    return GetUserMappingsProtocol.versionID;
  } else {
    throw new IOException("Unknown protocol to name node: " + protocol);
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:21,代码来源:NameNode.java

示例6: getProtocolVersion

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
public long getProtocolVersion(String protocol, 
                               long clientVersion) throws IOException {
  if (protocol.equals(InterTrackerProtocol.class.getName())) {
    return InterTrackerProtocol.versionID;
  } else if (protocol.equals(ClientProtocol.class.getName())){
    return ClientProtocol.versionID;
  } else if (protocol.equals(RefreshAuthorizationPolicyProtocol.class.getName())){
    return RefreshAuthorizationPolicyProtocol.versionID;
  } else if (protocol.equals(AdminOperationsProtocol.class.getName())){
    return AdminOperationsProtocol.versionID;
  } else if (protocol.equals(RefreshUserMappingsProtocol.class.getName())){
    return RefreshUserMappingsProtocol.versionID;
  } else if (protocol.equals(GetUserMappingsProtocol.class.getName())){
    return GetUserMappingsProtocol.versionID;
  } else {
    throw new IOException("Unknown protocol to job tracker: " + protocol);
  }
}
 
开发者ID:rekhajoshm,项目名称:mapreduce-fork,代码行数:19,代码来源:JobTracker.java

示例7: getUgmProtocol

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
@Override
protected GetUserMappingsProtocol getUgmProtocol() throws IOException {
  Configuration conf = getConf();
  
  final InetSocketAddress addr = conf.getSocketAddr(
      YarnConfiguration.RM_ADMIN_ADDRESS,
      YarnConfiguration.DEFAULT_RM_ADMIN_ADDRESS,
      YarnConfiguration.DEFAULT_RM_ADMIN_PORT);
  final YarnRPC rpc = YarnRPC.create(conf);
  
  ResourceManagerAdministrationProtocol adminProtocol = (ResourceManagerAdministrationProtocol) rpc.getProxy(
      ResourceManagerAdministrationProtocol.class, addr, getConf());

  return adminProtocol;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:GetGroupsForTesting.java

示例8: createHSProxyWithGetUserMappingsProtocol

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
private static GetUserMappingsProtocol createHSProxyWithGetUserMappingsProtocol(
    InetSocketAddress address, Configuration conf, UserGroupInformation ugi)
    throws IOException {
  GetUserMappingsProtocolPB proxy = (GetUserMappingsProtocolPB) createHSProxy(
      address, conf, ugi, GetUserMappingsProtocolPB.class, 0);
  return new GetUserMappingsProtocolClientSideTranslatorPB(proxy);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:HSProxies.java

示例9: getGroups

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
private int getGroups(String[] usernames) throws IOException {
  // Get groups users belongs to
  if (usernames.length == 0) {
    usernames = new String[] { UserGroupInformation.getCurrentUser()
        .getUserName() };
  }

  // Get the current configuration
  Configuration conf = getConf();

  InetSocketAddress address = conf.getSocketAddr(
      JHAdminConfig.JHS_ADMIN_ADDRESS,
      JHAdminConfig.DEFAULT_JHS_ADMIN_ADDRESS,
      JHAdminConfig.DEFAULT_JHS_ADMIN_PORT);

  GetUserMappingsProtocol getUserMappingProtocol = HSProxies.createProxy(
      conf, address, GetUserMappingsProtocol.class,
      UserGroupInformation.getCurrentUser());
  for (String username : usernames) {
    StringBuilder sb = new StringBuilder();
    sb.append(username + " :");
    for (String group : getUserMappingProtocol.getGroupsForUser(username)) {
      sb.append(" ");
      sb.append(group);
    }
    System.out.println(sb);
  }

  return 0;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:HSAdmin.java

示例10: createNonHAProxy

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
/**
 * Creates an explicitly non-HA-enabled proxy object. Most of the time you
 * don't want to use this, and should instead use {@link NameNodeProxies#createProxy}.
 *
 * @param conf the configuration object
 * @param nnAddr address of the remote NN to connect to
 * @param xface the IPC interface which should be created
 * @param ugi the user who is making the calls on the proxy object
 * @param withRetries certain interfaces have a non-standard retry policy
 * @param fallbackToSimpleAuth - set to true or false during this method to
 *   indicate if a secure client falls back to simple auth
 * @return an object containing both the proxy and the associated
 *         delegation token service it corresponds to
 * @throws IOException
 */
@SuppressWarnings("unchecked")
public static <T> ProxyAndInfo<T> createNonHAProxy(
    Configuration conf, InetSocketAddress nnAddr, Class<T> xface,
    UserGroupInformation ugi, boolean withRetries,
    AtomicBoolean fallbackToSimpleAuth) throws IOException {
  Text dtService = SecurityUtil.buildTokenService(nnAddr);

  T proxy;
  if (xface == ClientProtocol.class) {
    proxy = (T) createNNProxyWithClientProtocol(nnAddr, conf, ugi,
        withRetries, fallbackToSimpleAuth);
  } else if (xface == JournalProtocol.class) {
    proxy = (T) createNNProxyWithJournalProtocol(nnAddr, conf, ugi);
  } else if (xface == NamenodeProtocol.class) {
    proxy = (T) createNNProxyWithNamenodeProtocol(nnAddr, conf, ugi,
        withRetries);
  } else if (xface == GetUserMappingsProtocol.class) {
    proxy = (T) createNNProxyWithGetUserMappingsProtocol(nnAddr, conf, ugi);
  } else if (xface == RefreshUserMappingsProtocol.class) {
    proxy = (T) createNNProxyWithRefreshUserMappingsProtocol(nnAddr, conf, ugi);
  } else if (xface == RefreshAuthorizationPolicyProtocol.class) {
    proxy = (T) createNNProxyWithRefreshAuthorizationPolicyProtocol(nnAddr,
        conf, ugi);
  } else if (xface == RefreshCallQueueProtocol.class) {
    proxy = (T) createNNProxyWithRefreshCallQueueProtocol(nnAddr, conf, ugi);
  } else {
    String message = "Unsupported protocol found when creating the proxy " +
        "connection to NameNode: " +
        ((xface != null) ? xface.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }

  return new ProxyAndInfo<T>(proxy, dtService, nnAddr);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:51,代码来源:NameNodeProxies.java

示例11: createNNProxyWithGetUserMappingsProtocol

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
private static GetUserMappingsProtocol createNNProxyWithGetUserMappingsProtocol(
    InetSocketAddress address, Configuration conf, UserGroupInformation ugi)
    throws IOException {
  GetUserMappingsProtocolPB proxy = (GetUserMappingsProtocolPB)
      createNameNodeProxy(address, conf, ugi, GetUserMappingsProtocolPB.class);
  return new GetUserMappingsProtocolClientSideTranslatorPB(proxy);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:NameNodeProxies.java

示例12: testGetUserMappingsProtocol

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
@Test
public void testGetUserMappingsProtocol() throws IOException {
  GetUserMappingsProtocolClientSideTranslatorPB translator = 
      (GetUserMappingsProtocolClientSideTranslatorPB)
      NameNodeProxies.createNonHAProxy(conf, nnAddress,
          GetUserMappingsProtocol.class, UserGroupInformation.getCurrentUser(),
          true).getProxy();
  assertTrue(translator.isMethodSupported("getGroupsForUser"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestIsMethodSupported.java

示例13: createNonHAProxy

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
/**
 * Creates an explicitly non-HA-enabled proxy object. Most of the time you
 * don't want to use this, and should instead use {@link NameNodeProxies#createProxy}.
 *
 * @param conf the configuration object
 * @param nnAddr address of the remote NN to connect to
 * @param xface the IPC interface which should be created
 * @param ugi the user who is making the calls on the proxy object
 * @param withRetries certain interfaces have a non-standard retry policy
 * @param fallbackToSimpleAuth - set to true or false during this method to
 *   indicate if a secure client falls back to simple auth
 * @return an object containing both the proxy and the associated
 *         delegation token service it corresponds to
 * @throws IOException
 */
@SuppressWarnings("unchecked")
public static <T> ProxyAndInfo<T> createNonHAProxy(
    Configuration conf, InetSocketAddress nnAddr, Class<T> xface,
    UserGroupInformation ugi, boolean withRetries,
    AtomicBoolean fallbackToSimpleAuth) throws IOException {
  Text dtService = SecurityUtil.buildTokenService(nnAddr);

  T proxy;
  if (xface == ClientProtocol.class) {
    proxy = (T) NameNodeProxiesClient.createNonHAProxyWithClientProtocol(
        nnAddr, conf, ugi, withRetries, fallbackToSimpleAuth);
  } else if (xface == JournalProtocol.class) {
    proxy = (T) createNNProxyWithJournalProtocol(nnAddr, conf, ugi);
  } else if (xface == NamenodeProtocol.class) {
    proxy = (T) createNNProxyWithNamenodeProtocol(nnAddr, conf, ugi,
        withRetries);
  } else if (xface == GetUserMappingsProtocol.class) {
    proxy = (T) createNNProxyWithGetUserMappingsProtocol(nnAddr, conf, ugi);
  } else if (xface == RefreshUserMappingsProtocol.class) {
    proxy = (T) createNNProxyWithRefreshUserMappingsProtocol(nnAddr, conf, ugi);
  } else if (xface == RefreshAuthorizationPolicyProtocol.class) {
    proxy = (T) createNNProxyWithRefreshAuthorizationPolicyProtocol(nnAddr,
        conf, ugi);
  } else if (xface == RefreshCallQueueProtocol.class) {
    proxy = (T) createNNProxyWithRefreshCallQueueProtocol(nnAddr, conf, ugi);
  } else {
    String message = "Unsupported protocol found when creating the proxy " +
        "connection to NameNode: " +
        ((xface != null) ? xface.getClass().getName() : "null");
    LOG.error(message);
    throw new IllegalStateException(message);
  }

  return new ProxyAndInfo<T>(proxy, dtService, nnAddr);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:51,代码来源:NameNodeProxies.java

示例14: createNNProxyWithGetUserMappingsProtocol

import org.apache.hadoop.tools.GetUserMappingsProtocol; //导入依赖的package包/类
private static GetUserMappingsProtocol createNNProxyWithGetUserMappingsProtocol(
    InetSocketAddress address, Configuration conf, UserGroupInformation ugi)
    throws IOException {
  GetUserMappingsProtocolPB proxy = (GetUserMappingsProtocolPB)
      createNameNodeProxy(address, conf, ugi, GetUserMappingsProtocolPB.class, 0);
  return new GetUserMappingsProtocolClientSideTranslatorPB(proxy);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:8,代码来源:NameNodeProxies.java


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