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


Java Credentials.readTokenStorageFile方法代码示例

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


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

示例1: mergeBinaryTokens

import org.apache.hadoop.security.Credentials; //导入方法依赖的package包/类
private static void mergeBinaryTokens(Credentials creds, Configuration conf) {
  String binaryTokenFilename =
      conf.get(MRJobConfig.MAPREDUCE_JOB_CREDENTIALS_BINARY);
  if (binaryTokenFilename != null) {
    Credentials binary;
    try {
      binary = Credentials.readTokenStorageFile(
          FileSystem.getLocal(conf).makeQualified(
              new Path(binaryTokenFilename)),
          conf);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    // supplement existing tokens with the tokens in the binary file
    creds.mergeAll(binary);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TokenCache.java

示例2: loadTokens

import org.apache.hadoop.security.Credentials; //导入方法依赖的package包/类
/**
 * load job token from a file
 * @deprecated Use {@link Credentials#readTokenStorageFile} instead,
 * this method is included for compatibility against Hadoop-1.
 * @param conf
 * @throws IOException
 */
@InterfaceAudience.Private
@Deprecated
public static Credentials loadTokens(String jobTokenFile, JobConf conf)
throws IOException {
  Path localJobTokenFile = new Path ("file:///" + jobTokenFile);

  Credentials ts = Credentials.readTokenStorageFile(localJobTokenFile, conf);

  if(LOG.isDebugEnabled()) {
    LOG.debug("Task: Loaded jobTokenFile from: "+
        localJobTokenFile.toUri().getPath() 
        +"; num of sec keys  = " + ts.numberOfSecretKeys() +
        " Number of tokens " +  ts.numberOfTokens());
  }
  return ts;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:TokenCache.java

示例3: expectedTokenIsRetrievedFromHttp

import org.apache.hadoop.security.Credentials; //导入方法依赖的package包/类
/**
 * Call fetch token using http server 
 */
@Test
public void expectedTokenIsRetrievedFromHttp() throws Exception {
  bootstrap = startHttpServer(httpPort, testToken, serviceUrl);
  DelegationTokenFetcher.main(new String[] { "-webservice=" + serviceUrl,
      tokenFile });
  Path p = new Path(fileSys.getWorkingDirectory(), tokenFile);
  Credentials creds = Credentials.readTokenStorageFile(p, conf);
  Iterator<Token<?>> itr = creds.getAllTokens().iterator();
  assertTrue("token not exist error", itr.hasNext());
  Token<?> fetchedToken = itr.next();
  Assert.assertArrayEquals("token wrong identifier error",
      testToken.getIdentifier(), fetchedToken.getIdentifier());
  Assert.assertArrayEquals("token wrong password error",
      testToken.getPassword(), fetchedToken.getPassword());
  if (assertionError != null)
    throw assertionError;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestDelegationTokenRemoteFetcher.java

示例4: readTokens

import org.apache.hadoop.security.Credentials; //导入方法依赖的package包/类
private static Collection<Token<?>> readTokens(Path file, Configuration conf)
    throws IOException {
  Credentials creds = Credentials.readTokenStorageFile(file, conf);
  return creds.getAllTokens();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:DelegationTokenFetcher.java


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