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


Java DelegationKey.readFields方法代码示例

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


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

示例1: loadAllKeys

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
/**
 * Private helper method to load delegation keys from fsimage.
 * @throws IOException on error
 */
private synchronized void loadAllKeys(DataInput in) throws IOException {
  StartupProgress prog = NameNode.getStartupProgress();
  Step step = new Step(StepType.DELEGATION_KEYS);
  prog.beginStep(Phase.LOADING_FSIMAGE, step);
  int numberOfKeys = in.readInt();
  prog.setTotal(Phase.LOADING_FSIMAGE, step, numberOfKeys);
  Counter counter = prog.getCounter(Phase.LOADING_FSIMAGE, step);
  for (int i = 0; i < numberOfKeys; i++) {
    DelegationKey value = new DelegationKey();
    value.readFields(in);
    addKey(value);
    counter.increment();
  }
  prog.endStep(Phase.LOADING_FSIMAGE, step);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:DelegationTokenSecretManager.java

示例2: loadDelegationKey

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private DelegationKey loadDelegationKey(byte[] data) throws IOException {
  DelegationKey key = new DelegationKey();
  DataInputStream in = new DataInputStream(new ByteArrayInputStream(data));
  try {
    key.readFields(in);
  } finally {
    IOUtils.cleanup(LOG, in);
  }
  return key;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:11,代码来源:LeveldbRMStateStore.java

示例3: loadRMDelegationKeyState

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private void loadRMDelegationKeyState(RMState rmState) throws Exception {
  List<String> childNodes =
      getChildrenWithRetries(dtMasterKeysRootPath, false);
  for (String childNodeName : childNodes) {
    String childNodePath = getNodePath(dtMasterKeysRootPath, childNodeName);
    byte[] childData = getDataWithRetries(childNodePath, false);

    if (childData == null) {
      LOG.warn("Content of " + childNodePath + " is broken.");
      continue;
    }

    ByteArrayInputStream is = new ByteArrayInputStream(childData);
    DataInputStream fsIn = new DataInputStream(is);

    try {
      if (childNodeName.startsWith(DELEGATION_KEY_PREFIX)) {
        DelegationKey key = new DelegationKey();
        key.readFields(fsIn);
        rmState.rmSecretManagerState.masterKeyState.add(key);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Loaded delegation key: keyId=" + key.getKeyId()
              + ", expirationDate=" + key.getExpiryDate());
        }
      }
    } finally {
      is.close();
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:ZKRMStateStore.java

示例4: loadTokenMasterKeyData

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private static void loadTokenMasterKeyData(TimelineServiceState state,
    byte[] keyData)
    throws IOException {
  DelegationKey key = new DelegationKey();
  DataInputStream in =
      new DataInputStream(new ByteArrayInputStream(keyData));
  try {
    key.readFields(in);
  } finally {
    IOUtils.cleanup(LOG, in);
  }
  state.tokenMasterKeyState.add(key);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:LeveldbTimelineStateStore.java

示例5: loadTokenMasterKey

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private void loadTokenMasterKey(HistoryServerState state, byte[] data)
    throws IOException {
  DelegationKey key = new DelegationKey();
  DataInputStream in =
      new DataInputStream(new ByteArrayInputStream(data));
  try {
    key.readFields(in);
  } finally {
    IOUtils.cleanup(LOG, in);
  }
  state.tokenMasterKeyState.add(key);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:HistoryServerLeveldbStateStoreService.java

示例6: loadTokenMasterKey

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private void loadTokenMasterKey(HistoryServerState state, Path keyFile,
    long numKeyFileBytes) throws IOException {
  DelegationKey key = new DelegationKey();
  byte[] keyData = readFile(keyFile, numKeyFileBytes);
  DataInputStream in =
      new DataInputStream(new ByteArrayInputStream(keyData));
  try {
    key.readFields(in);
  } finally {
    IOUtils.cleanup(LOG, in);
  }
  state.tokenMasterKeyState.add(key);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:HistoryServerFileSystemStateStoreService.java

示例7: loadRMDelegationKeyState

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
private void loadRMDelegationKeyState(RMState rmState) throws Exception {
  List<String> childNodes =
      getChildren(dtMasterKeysRootPath);
  for (String childNodeName : childNodes) {
    String childNodePath = getNodePath(dtMasterKeysRootPath, childNodeName);
    byte[] childData = getData(childNodePath);

    if (childData == null) {
      LOG.warn("Content of " + childNodePath + " is broken.");
      continue;
    }

    ByteArrayInputStream is = new ByteArrayInputStream(childData);
    DataInputStream fsIn = new DataInputStream(is);

    try {
      if (childNodeName.startsWith(DELEGATION_KEY_PREFIX)) {
        DelegationKey key = new DelegationKey();
        key.readFields(fsIn);
        rmState.rmSecretManagerState.masterKeyState.add(key);
        if (LOG.isDebugEnabled()) {
          LOG.debug("Loaded delegation key: keyId=" + key.getKeyId()
              + ", expirationDate=" + key.getExpiryDate());
        }
      }
    } finally {
      is.close();
    }
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:31,代码来源:ZKRMStateStore.java

示例8: processDelegationTokens

import org.apache.hadoop.security.token.delegation.DelegationKey; //导入方法依赖的package包/类
/**
 * Process the Delegation Token related section in fsimage.
 * 
 * @param in DataInputStream to process
 * @param v Visitor to walk over records
 */
private void processDelegationTokens(DataInputStream in, ImageVisitor v)
    throws IOException {
  v.visit(ImageElement.CURRENT_DELEGATION_KEY_ID, in.readInt());
  int numDKeys = in.readInt();
  v.visitEnclosingElement(ImageElement.DELEGATION_KEYS,
      ImageElement.NUM_DELEGATION_KEYS, numDKeys);
  for(int i =0; i < numDKeys; i++) {
    DelegationKey key = new DelegationKey();
    key.readFields(in);
    v.visit(ImageElement.DELEGATION_KEY, key.toString());
  }
  v.leaveEnclosingElement();
  v.visit(ImageElement.DELEGATION_TOKEN_SEQUENCE_NUMBER, in.readInt());
  int numDTokens = in.readInt();
  v.visitEnclosingElement(ImageElement.DELEGATION_TOKENS,
      ImageElement.NUM_DELEGATION_TOKENS, numDTokens);
  for(int i=0; i<numDTokens; i++){
    DelegationTokenIdentifier id = new  DelegationTokenIdentifier();
    id.readFields(in);
    long expiryTime = in.readLong();
    v.visitEnclosingElement(ImageElement.DELEGATION_TOKEN_IDENTIFIER);
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_KIND,
        id.getKind().toString());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_SEQNO,
        id.getSequenceNumber());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_OWNER,
        id.getOwner().toString());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_RENEWER,
        id.getRenewer().toString());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_REALUSER,
        id.getRealUser().toString());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_ISSUE_DATE,
        id.getIssueDate());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_MAX_DATE,
        id.getMaxDate());
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_EXPIRY_TIME,
        expiryTime);
    v.visit(ImageElement.DELEGATION_TOKEN_IDENTIFIER_MASTER_KEY_ID,
        id.getMasterKeyId());
    v.leaveEnclosingElement(); // DELEGATION_TOKEN_IDENTIFIER
  }
  v.leaveEnclosingElement(); // DELEGATION_TOKENS
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:ImageLoaderCurrent.java


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