Java 类org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl 实例源码

项目:hadoop    文件:NMTokenIdentifier.java   
public NMTokenIdentifier(ApplicationAttemptId appAttemptId, 
    NodeId nodeId, String applicationSubmitter, int masterKeyId) {
  NMTokenIdentifierProto.Builder builder = NMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  if (nodeId != null) {
    builder.setNodeId(((NodeIdPBImpl)nodeId).getProto());
  }
  builder.setAppSubmitter(applicationSubmitter);
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
项目:hadoop    文件:NMTokenIdentifier.java   
@Override
public UserGroupInformation getUser() {
  String appAttemptId = null;
  if (proto.hasAppAttemptId()) {
    appAttemptId = new ApplicationAttemptIdPBImpl(
        proto.getAppAttemptId()).toString();
  }
  return UserGroupInformation.createRemoteUser(appAttemptId);
}
项目:hadoop    文件:AMRMTokenIdentifier.java   
public AMRMTokenIdentifier(ApplicationAttemptId appAttemptId,
    int masterKeyId) {
  AMRMTokenIdentifierProto.Builder builder = 
      AMRMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
项目:hadoop    文件:AMRMTokenIdentifier.java   
@Private
public ApplicationAttemptId getApplicationAttemptId() {
  if (!proto.hasAppAttemptId()) {
    return null;
  }
  return new ApplicationAttemptIdPBImpl(proto.getAppAttemptId());
}
项目:hadoop    文件:AMRMTokenIdentifier.java   
@Override
public UserGroupInformation getUser() {
  String appAttemptId = null;
  if (proto.hasAppAttemptId()) {
    appAttemptId = 
        new ApplicationAttemptIdPBImpl(proto.getAppAttemptId()).toString();
  }
  return UserGroupInformation.createRemoteUser(appAttemptId);
}
项目:hadoop    文件:ClientToAMTokenIdentifier.java   
public ClientToAMTokenIdentifier(ApplicationAttemptId id, String client) {
  ClientToAMTokenIdentifierProto.Builder builder = 
      ClientToAMTokenIdentifierProto.newBuilder();
  if (id != null) {
    builder.setAppAttemptId(((ApplicationAttemptIdPBImpl)id).getProto());
  }
  if (client != null) {
    builder.setClientName(client);
  }
  proto = builder.build();
}
项目:hadoop    文件:TestAggregatedLogsBlock.java   
private void writeLog(Configuration configuration, String user)
    throws Exception {
  ApplicationId appId =  ApplicationIdPBImpl.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =  ApplicationAttemptIdPBImpl.newInstance(appId, 1);
  ContainerId containerId = ContainerIdPBImpl.newContainerId(appAttemptId, 1);

  String path = "target/logs/" + user
      + "/logs/application_0_0001/localhost_1234";
  File f = new File(path);
  if (!f.getParentFile().exists()) {
   assertTrue(f.getParentFile().mkdirs());
  }
  List<String> rootLogDirs = Arrays.asList("target/logs/logs");
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();

  AggregatedLogFormat.LogWriter writer = new AggregatedLogFormat.LogWriter(
      configuration, new Path(path), ugi);
  writer.writeApplicationOwner(ugi.getUserName());

  Map<ApplicationAccessType, String> appAcls = new HashMap<ApplicationAccessType, String>();
  appAcls.put(ApplicationAccessType.VIEW_APP, ugi.getUserName());
  writer.writeApplicationACLs(appAcls);

  writer.append(new AggregatedLogFormat.LogKey("container_0_0001_01_000001"),
      new AggregatedLogFormat.LogValue(rootLogDirs, containerId,UserGroupInformation.getCurrentUser().getShortUserName()));
  writer.close();
}
项目:hadoop    文件:TestContainerLogsPage.java   
@Test
public void testLogDirWithDriveLetter() throws Exception {
  //To verify that logs paths which include drive letters (Windows)
  //do not lose their drive letter specification
  LocalDirsHandlerService localDirs = mock(LocalDirsHandlerService.class);
  List<String> logDirs = new ArrayList<String>();
  logDirs.add("F:/nmlogs");
  when(localDirs.getLogDirsForRead()).thenReturn(logDirs);

  ApplicationIdPBImpl appId = mock(ApplicationIdPBImpl.class);
  when(appId.toString()).thenReturn("app_id_1");

  ApplicationAttemptIdPBImpl appAttemptId =
             mock(ApplicationAttemptIdPBImpl.class);
  when(appAttemptId.getApplicationId()).thenReturn(appId);

  ContainerId containerId = mock(ContainerIdPBImpl.class);
  when(containerId.getApplicationAttemptId()).thenReturn(appAttemptId);

  List<File> logDirFiles = ContainerLogsUtils.getContainerLogDirs(
    containerId, localDirs);

  Assert.assertTrue("logDir lost drive letter " +
    logDirFiles.get(0),
    logDirFiles.get(0).toString().indexOf("F:" + File.separator +
      "nmlogs") > -1);
}
项目:hadoop    文件:ApplicationAttemptStateDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.attemptId != null) {
    builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
  }
  if(this.masterContainer != null) {
    builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
  }
  if(this.appAttemptTokens != null) {
    builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
        this.appAttemptTokens));
  }
}
项目:hadoop    文件:ApplicationAttemptStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.applicationAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
        .equals(builder.getApplicationAttemptId())) {
    builder
      .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
  }
  if (this.masterContainerId != null
      && !((ContainerIdPBImpl) this.masterContainerId).getProto().equals(
        builder.getMasterContainerId())) {
    builder
      .setMasterContainerId(convertToProtoFormat(this.masterContainerId));
  }
}
项目:hadoop    文件:ApplicationAttemptFinishDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.applicationAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
        .equals(builder.getApplicationAttemptId())) {
    builder
      .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
  }
}
项目:hadoop    文件:AMInfoPBImpl.java   
private synchronized void mergeLocalToBuilder() {
  if (this.appAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.appAttemptId).getProto().equals(
          builder.getApplicationAttemptId())) {
    builder.setApplicationAttemptId(convertToProtoFormat(this.appAttemptId));
  }
  if (this.getContainerId() != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
          builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
}
项目:aliyun-oss-hadoop-fs    文件:NMTokenIdentifier.java   
public NMTokenIdentifier(ApplicationAttemptId appAttemptId, 
    NodeId nodeId, String applicationSubmitter, int masterKeyId) {
  NMTokenIdentifierProto.Builder builder = NMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  if (nodeId != null) {
    builder.setNodeId(((NodeIdPBImpl)nodeId).getProto());
  }
  builder.setAppSubmitter(applicationSubmitter);
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:NMTokenIdentifier.java   
@Override
public UserGroupInformation getUser() {
  String appAttemptId = null;
  if (proto.hasAppAttemptId()) {
    appAttemptId = new ApplicationAttemptIdPBImpl(
        proto.getAppAttemptId()).toString();
  }
  return UserGroupInformation.createRemoteUser(appAttemptId);
}
项目:aliyun-oss-hadoop-fs    文件:AMRMTokenIdentifier.java   
public AMRMTokenIdentifier(ApplicationAttemptId appAttemptId,
    int masterKeyId) {
  AMRMTokenIdentifierProto.Builder builder = 
      AMRMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:AMRMTokenIdentifier.java   
@Private
public ApplicationAttemptId getApplicationAttemptId() {
  if (!proto.hasAppAttemptId()) {
    return null;
  }
  return new ApplicationAttemptIdPBImpl(proto.getAppAttemptId());
}
项目:aliyun-oss-hadoop-fs    文件:AMRMTokenIdentifier.java   
@Override
public UserGroupInformation getUser() {
  String appAttemptId = null;
  if (proto.hasAppAttemptId()) {
    appAttemptId = 
        new ApplicationAttemptIdPBImpl(proto.getAppAttemptId()).toString();
  }
  return UserGroupInformation.createRemoteUser(appAttemptId);
}
项目:aliyun-oss-hadoop-fs    文件:ClientToAMTokenIdentifier.java   
public ClientToAMTokenIdentifier(ApplicationAttemptId id, String client) {
  ClientToAMTokenIdentifierProto.Builder builder = 
      ClientToAMTokenIdentifierProto.newBuilder();
  if (id != null) {
    builder.setAppAttemptId(((ApplicationAttemptIdPBImpl)id).getProto());
  }
  if (client != null) {
    builder.setClientName(client);
  }
  proto = builder.build();
}
项目:aliyun-oss-hadoop-fs    文件:TestPBImplRecords.java   
@Test
@Ignore
// ignore cause ApplicationIdPBImpl is immutable
public void testApplicationAttemptIdPBImpl() throws Exception {
  validatePBImplRecord(ApplicationAttemptIdPBImpl.class,
      ApplicationAttemptIdProto.class);
}
项目:aliyun-oss-hadoop-fs    文件:TestAggregatedLogsBlock.java   
private void writeLog(Configuration configuration, String user)
    throws Exception {
  ApplicationId appId =  ApplicationIdPBImpl.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =  ApplicationAttemptIdPBImpl.newInstance(appId, 1);
  ContainerId containerId = ContainerIdPBImpl.newContainerId(appAttemptId, 1);

  String path = "target/logs/" + user
      + "/logs/application_0_0001/localhost_1234";
  File f = new File(path);
  if (!f.getParentFile().exists()) {
   assertTrue(f.getParentFile().mkdirs());
  }
  List<String> rootLogDirs = Arrays.asList("target/logs/logs");
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();

  AggregatedLogFormat.LogWriter writer = new AggregatedLogFormat.LogWriter(
      configuration, new Path(path), ugi);
  writer.writeApplicationOwner(ugi.getUserName());

  Map<ApplicationAccessType, String> appAcls = new HashMap<ApplicationAccessType, String>();
  appAcls.put(ApplicationAccessType.VIEW_APP, ugi.getUserName());
  writer.writeApplicationACLs(appAcls);

  writer.append(new AggregatedLogFormat.LogKey("container_0_0001_01_000001"),
      new AggregatedLogFormat.LogValue(rootLogDirs, containerId,UserGroupInformation.getCurrentUser().getShortUserName()));
  writer.close();
}
项目:aliyun-oss-hadoop-fs    文件:TestContainerLogsPage.java   
@Test
public void testLogDirWithDriveLetter() throws Exception {
  //To verify that logs paths which include drive letters (Windows)
  //do not lose their drive letter specification
  LocalDirsHandlerService localDirs = mock(LocalDirsHandlerService.class);
  List<String> logDirs = new ArrayList<String>();
  logDirs.add("F:/nmlogs");
  when(localDirs.getLogDirsForRead()).thenReturn(logDirs);

  ApplicationIdPBImpl appId = mock(ApplicationIdPBImpl.class);
  when(appId.toString()).thenReturn("app_id_1");

  ApplicationAttemptIdPBImpl appAttemptId =
             mock(ApplicationAttemptIdPBImpl.class);
  when(appAttemptId.getApplicationId()).thenReturn(appId);

  ContainerId containerId = mock(ContainerIdPBImpl.class);
  when(containerId.getApplicationAttemptId()).thenReturn(appAttemptId);

  List<File> logDirFiles = ContainerLogsUtils.getContainerLogDirs(
    containerId, localDirs);

  Assert.assertTrue("logDir lost drive letter " +
    logDirFiles.get(0),
    logDirFiles.get(0).toString().indexOf("F:" + File.separator +
      "nmlogs") > -1);
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationAttemptStateDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.attemptId != null) {
    builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
  }
  if(this.masterContainer != null) {
    builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
  }
  if(this.appAttemptTokens != null) {
    builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
        this.appAttemptTokens));
  }
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationAttemptStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.applicationAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
        .equals(builder.getApplicationAttemptId())) {
    builder
      .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
  }
  if (this.masterContainerId != null
      && !((ContainerIdPBImpl) this.masterContainerId).getProto().equals(
        builder.getMasterContainerId())) {
    builder
      .setMasterContainerId(convertToProtoFormat(this.masterContainerId));
  }
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationAttemptFinishDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.applicationAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
        .equals(builder.getApplicationAttemptId())) {
    builder
      .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
  }
}
项目:aliyun-oss-hadoop-fs    文件:AMInfoPBImpl.java   
private synchronized void mergeLocalToBuilder() {
  if (this.appAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.appAttemptId).getProto().equals(
          builder.getApplicationAttemptId())) {
    builder.setApplicationAttemptId(convertToProtoFormat(this.appAttemptId));
  }
  if (this.getContainerId() != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
          builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
}
项目:big-c    文件:NMTokenIdentifier.java   
public NMTokenIdentifier(ApplicationAttemptId appAttemptId, 
    NodeId nodeId, String applicationSubmitter, int masterKeyId) {
  NMTokenIdentifierProto.Builder builder = NMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  if (nodeId != null) {
    builder.setNodeId(((NodeIdPBImpl)nodeId).getProto());
  }
  builder.setAppSubmitter(applicationSubmitter);
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
项目:big-c    文件:NMTokenIdentifier.java   
@Override
public UserGroupInformation getUser() {
  String appAttemptId = null;
  if (proto.hasAppAttemptId()) {
    appAttemptId = new ApplicationAttemptIdPBImpl(
        proto.getAppAttemptId()).toString();
  }
  return UserGroupInformation.createRemoteUser(appAttemptId);
}
项目:big-c    文件:AMRMTokenIdentifier.java   
public AMRMTokenIdentifier(ApplicationAttemptId appAttemptId,
    int masterKeyId) {
  AMRMTokenIdentifierProto.Builder builder = 
      AMRMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
项目:big-c    文件:AMRMTokenIdentifier.java   
@Private
public ApplicationAttemptId getApplicationAttemptId() {
  if (!proto.hasAppAttemptId()) {
    return null;
  }
  return new ApplicationAttemptIdPBImpl(proto.getAppAttemptId());
}
项目:big-c    文件:AMRMTokenIdentifier.java   
@Override
public UserGroupInformation getUser() {
  String appAttemptId = null;
  if (proto.hasAppAttemptId()) {
    appAttemptId = 
        new ApplicationAttemptIdPBImpl(proto.getAppAttemptId()).toString();
  }
  return UserGroupInformation.createRemoteUser(appAttemptId);
}
项目:big-c    文件:ClientToAMTokenIdentifier.java   
public ClientToAMTokenIdentifier(ApplicationAttemptId id, String client) {
  ClientToAMTokenIdentifierProto.Builder builder = 
      ClientToAMTokenIdentifierProto.newBuilder();
  if (id != null) {
    builder.setAppAttemptId(((ApplicationAttemptIdPBImpl)id).getProto());
  }
  if (client != null) {
    builder.setClientName(client);
  }
  proto = builder.build();
}
项目:big-c    文件:TestAggregatedLogsBlock.java   
private void writeLog(Configuration configuration, String user)
    throws Exception {
  ApplicationId appId =  ApplicationIdPBImpl.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =  ApplicationAttemptIdPBImpl.newInstance(appId, 1);
  ContainerId containerId = ContainerIdPBImpl.newContainerId(appAttemptId, 1);

  String path = "target/logs/" + user
      + "/logs/application_0_0001/localhost_1234";
  File f = new File(path);
  if (!f.getParentFile().exists()) {
   assertTrue(f.getParentFile().mkdirs());
  }
  List<String> rootLogDirs = Arrays.asList("target/logs/logs");
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();

  AggregatedLogFormat.LogWriter writer = new AggregatedLogFormat.LogWriter(
      configuration, new Path(path), ugi);
  writer.writeApplicationOwner(ugi.getUserName());

  Map<ApplicationAccessType, String> appAcls = new HashMap<ApplicationAccessType, String>();
  appAcls.put(ApplicationAccessType.VIEW_APP, ugi.getUserName());
  writer.writeApplicationACLs(appAcls);

  writer.append(new AggregatedLogFormat.LogKey("container_0_0001_01_000001"),
      new AggregatedLogFormat.LogValue(rootLogDirs, containerId,UserGroupInformation.getCurrentUser().getShortUserName()));
  writer.close();
}
项目:big-c    文件:TestContainerLogsPage.java   
@Test
public void testLogDirWithDriveLetter() throws Exception {
  //To verify that logs paths which include drive letters (Windows)
  //do not lose their drive letter specification
  LocalDirsHandlerService localDirs = mock(LocalDirsHandlerService.class);
  List<String> logDirs = new ArrayList<String>();
  logDirs.add("F:/nmlogs");
  when(localDirs.getLogDirsForRead()).thenReturn(logDirs);

  ApplicationIdPBImpl appId = mock(ApplicationIdPBImpl.class);
  when(appId.toString()).thenReturn("app_id_1");

  ApplicationAttemptIdPBImpl appAttemptId =
             mock(ApplicationAttemptIdPBImpl.class);
  when(appAttemptId.getApplicationId()).thenReturn(appId);

  ContainerId containerId = mock(ContainerIdPBImpl.class);
  when(containerId.getApplicationAttemptId()).thenReturn(appAttemptId);

  List<File> logDirFiles = ContainerLogsUtils.getContainerLogDirs(
    containerId, localDirs);

  Assert.assertTrue("logDir lost drive letter " +
    logDirFiles.get(0),
    logDirFiles.get(0).toString().indexOf("F:" + File.separator +
      "nmlogs") > -1);
}
项目:big-c    文件:ApplicationAttemptStateDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.attemptId != null) {
    builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
  }
  if(this.masterContainer != null) {
    builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
  }
  if(this.appAttemptTokens != null) {
    builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
        this.appAttemptTokens));
  }
}
项目:big-c    文件:ApplicationAttemptStartDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.applicationAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
        .equals(builder.getApplicationAttemptId())) {
    builder
      .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
  }
  if (this.masterContainerId != null
      && !((ContainerIdPBImpl) this.masterContainerId).getProto().equals(
        builder.getMasterContainerId())) {
    builder
      .setMasterContainerId(convertToProtoFormat(this.masterContainerId));
  }
}
项目:big-c    文件:ApplicationAttemptFinishDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.applicationAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
        .equals(builder.getApplicationAttemptId())) {
    builder
      .setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
  }
}
项目:big-c    文件:AMInfoPBImpl.java   
private synchronized void mergeLocalToBuilder() {
  if (this.appAttemptId != null
      && !((ApplicationAttemptIdPBImpl) this.appAttemptId).getProto().equals(
          builder.getApplicationAttemptId())) {
    builder.setApplicationAttemptId(convertToProtoFormat(this.appAttemptId));
  }
  if (this.getContainerId() != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
          builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestAggregatedLogsBlock.java   
private void writeLog(Configuration configuration, String user)
    throws Exception {
  ApplicationId appId =  ApplicationIdPBImpl.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =  ApplicationAttemptIdPBImpl.newInstance(appId, 1);
  ContainerId containerId = ContainerIdPBImpl.newContainerId(appAttemptId, 1);

  String path = "target/logs/" + user
      + "/logs/application_0_0001/localhost_1234";
  File f = new File(path);
  if (!f.getParentFile().exists()) {
   assertTrue(f.getParentFile().mkdirs());
  }
  List<String> rootLogDirs = Arrays.asList("target/logs/logs");
  UserGroupInformation ugi = UserGroupInformation.getCurrentUser();

  AggregatedLogFormat.LogWriter writer = new AggregatedLogFormat.LogWriter(
      configuration, new Path(path), ugi);
  writer.writeApplicationOwner(ugi.getUserName());

  Map<ApplicationAccessType, String> appAcls = new HashMap<ApplicationAccessType, String>();
  appAcls.put(ApplicationAccessType.VIEW_APP, ugi.getUserName());
  writer.writeApplicationACLs(appAcls);

  writer.append(new AggregatedLogFormat.LogKey("container_0_0001_01_000001"),
      new AggregatedLogFormat.LogValue(rootLogDirs, containerId,UserGroupInformation.getCurrentUser().getShortUserName()));
  writer.close();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestContainerLogsPage.java   
@Test
public void testLogDirWithDriveLetter() throws Exception {
  //To verify that logs paths which include drive letters (Windows)
  //do not lose their drive letter specification
  LocalDirsHandlerService localDirs = mock(LocalDirsHandlerService.class);
  List<String> logDirs = new ArrayList<String>();
  logDirs.add("F:/nmlogs");
  when(localDirs.getLogDirs()).thenReturn(logDirs);

  ApplicationIdPBImpl appId = mock(ApplicationIdPBImpl.class);
  when(appId.toString()).thenReturn("app_id_1");

  ApplicationAttemptIdPBImpl appAttemptId =
             mock(ApplicationAttemptIdPBImpl.class);
  when(appAttemptId.getApplicationId()).thenReturn(appId);

  ContainerId containerId = mock(ContainerIdPBImpl.class);
  when(containerId.getApplicationAttemptId()).thenReturn(appAttemptId);

  List<File> logDirFiles = ContainerLogsUtils.getContainerLogDirs(
    containerId, localDirs);

  Assert.assertTrue("logDir lost drive letter " +
    logDirFiles.get(0),
    logDirFiles.get(0).toString().indexOf("F:" + File.separator +
      "nmlogs") > -1);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationAttemptStateDataPBImpl.java   
private void mergeLocalToBuilder() {
  if (this.attemptId != null) {
    builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
  }
  if(this.masterContainer != null) {
    builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
  }
  if(this.appAttemptTokens != null) {
    builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
        this.appAttemptTokens));
  }
}