當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。