public ContainerTokenIdentifier(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext) { ContainerTokenIdentifierProto.Builder builder = ContainerTokenIdentifierProto.newBuilder(); if (containerID != null) { builder.setContainerId(((ContainerIdPBImpl)containerID).getProto()); } builder.setNmHostAddr(hostName); builder.setAppSubmitter(appSubmitter); if (r != null) { builder.setResource(((ResourcePBImpl)r).getProto()); } builder.setExpiryTimeStamp(expiryTimeStamp); builder.setMasterKeyId(masterKeyId); builder.setRmIdentifier(rmIdentifier); if (priority != null) { builder.setPriority(((PriorityPBImpl)priority).getProto()); } builder.setCreationTime(creationTime); if (logAggregationContext != null) { builder.setLogAggregationContext( ((LogAggregationContextPBImpl)logAggregationContext).getProto()); } proto = builder.build(); }
public ContainerTokenIdentifierForTest(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext) { ContainerTokenIdentifierForTestProto.Builder builder = ContainerTokenIdentifierForTestProto.newBuilder(); if (containerID != null) { builder.setContainerId(((ContainerIdPBImpl)containerID).getProto()); } builder.setNmHostAddr(hostName); builder.setAppSubmitter(appSubmitter); if (r != null) { builder.setResource(((ResourcePBImpl)r).getProto()); } builder.setExpiryTimeStamp(expiryTimeStamp); builder.setMasterKeyId(masterKeyId); builder.setRmIdentifier(rmIdentifier); if (priority != null) { builder.setPriority(((PriorityPBImpl)priority).getProto()); } builder.setCreationTime(creationTime); if (logAggregationContext != null) { builder.setLogAggregationContext( ((LogAggregationContextPBImpl)logAggregationContext).getProto()); } proto = builder.build(); }
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier, String message) { ContainerTokenIdentifierForTestProto.Builder builder = ContainerTokenIdentifierForTestProto.newBuilder(); ContainerIdPBImpl containerID = (ContainerIdPBImpl)identifier.getContainerID(); if (containerID != null) { builder.setContainerId(containerID.getProto()); } builder.setNmHostAddr(identifier.getNmHostAddress()); builder.setAppSubmitter(identifier.getApplicationSubmitter()); ResourcePBImpl resource = (ResourcePBImpl)identifier.getResource(); if (resource != null) { builder.setResource(resource.getProto()); } builder.setExpiryTimeStamp(identifier.getExpiryTimeStamp()); builder.setMasterKeyId(identifier.getMasterKeyId()); builder.setRmIdentifier(identifier.getRMIdentifier()); PriorityPBImpl priority = (PriorityPBImpl)identifier.getPriority(); if (priority != null) { builder.setPriority(priority.getProto()); } builder.setCreationTime(identifier.getCreationTime()); builder.setMessage(message); LogAggregationContextPBImpl logAggregationContext = (LogAggregationContextPBImpl)identifier.getLogAggregationContext(); if (logAggregationContext != null) { builder.setLogAggregationContext(logAggregationContext.getProto()); } proto = builder.build(); }
private ContainerManagerApplicationProto buildAppProto(ApplicationId appId, String user, Credentials credentials, Map<ApplicationAccessType, String> appAcls, LogAggregationContext logAggregationContext) { ContainerManagerApplicationProto.Builder builder = ContainerManagerApplicationProto.newBuilder(); builder.setId(((ApplicationIdPBImpl) appId).getProto()); builder.setUser(user); if (logAggregationContext != null) { builder.setLogAggregationContext(( (LogAggregationContextPBImpl)logAggregationContext).getProto()); } builder.clearCredentials(); if (credentials != null) { DataOutputBuffer dob = new DataOutputBuffer(); try { credentials.writeTokenStorageToStream(dob); builder.setCredentials(ByteString.copyFrom(dob.getData())); } catch (IOException e) { // should not occur LOG.error("Cannot serialize credentials", e); } } builder.clearAcls(); if (appAcls != null) { for (Map.Entry<ApplicationAccessType, String> acl : appAcls.entrySet()) { ApplicationACLMapProto p = ApplicationACLMapProto.newBuilder() .setAccessType(ProtoUtils.convertToProtoFormat(acl.getKey())) .setAcl(acl.getValue()) .build(); builder.addAcls(p); } } return builder.build(); }
public ContainerTokenIdentifier(ContainerId containerID, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression, ContainerType containerType, ExecutionType executionType) { ContainerTokenIdentifierProto.Builder builder = ContainerTokenIdentifierProto.newBuilder(); if (containerID != null) { builder.setContainerId(((ContainerIdPBImpl)containerID).getProto()); } builder.setNmHostAddr(hostName); builder.setAppSubmitter(appSubmitter); if (r != null) { builder.setResource(((ResourcePBImpl)r).getProto()); } builder.setExpiryTimeStamp(expiryTimeStamp); builder.setMasterKeyId(masterKeyId); builder.setRmIdentifier(rmIdentifier); if (priority != null) { builder.setPriority(((PriorityPBImpl)priority).getProto()); } builder.setCreationTime(creationTime); if (logAggregationContext != null) { builder.setLogAggregationContext( ((LogAggregationContextPBImpl)logAggregationContext).getProto()); } if (nodeLabelExpression != null) { builder.setNodeLabelExpression(nodeLabelExpression); } builder.setContainerType(convertToProtoFormat(containerType)); builder.setExecutionType(convertToProtoFormat(executionType)); proto = builder.build(); }
public ContainerTokenIdentifier(ContainerId containerID, int containerVersion, String hostName, String appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier, Priority priority, long creationTime, LogAggregationContext logAggregationContext, String nodeLabelExpression, ContainerType containerType, String appSubmitterFolder) { ContainerTokenIdentifierProto.Builder builder = ContainerTokenIdentifierProto.newBuilder(); if (containerID != null) { builder.setContainerId(((ContainerIdPBImpl)containerID).getProto()); } builder.setVersion(containerVersion); builder.setNmHostAddr(hostName); builder.setAppSubmitter(appSubmitter); builder.setAppSubmitterFolder(appSubmitterFolder); if (r != null) { builder.setResource(((ResourcePBImpl)r).getProto()); } builder.setExpiryTimeStamp(expiryTimeStamp); builder.setMasterKeyId(masterKeyId); builder.setRmIdentifier(rmIdentifier); if (priority != null) { builder.setPriority(((PriorityPBImpl)priority).getProto()); } builder.setCreationTime(creationTime); if (logAggregationContext != null) { builder.setLogAggregationContext( ((LogAggregationContextPBImpl)logAggregationContext).getProto()); } if (nodeLabelExpression != null) { builder.setNodeLabelExpression(nodeLabelExpression); } builder.setContainerType(convertToProtoFormat(containerType)); proto = builder.build(); }
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier, String message) { ContainerTokenIdentifierForTestProto.Builder builder = ContainerTokenIdentifierForTestProto.newBuilder(); ContainerIdPBImpl containerID = (ContainerIdPBImpl)identifier.getContainerID(); if (containerID != null) { builder.setContainerId(containerID.getProto()); } builder.setNmHostAddr(identifier.getNmHostAddress()); builder.setAppSubmitter(identifier.getApplicationSubmitter()); builder.setAppSubmitterFolder(identifier.getApplicationSubmitterFolder()); ResourcePBImpl resource = (ResourcePBImpl)identifier.getResource(); if (resource != null) { builder.setResource(resource.getProto()); } builder.setExpiryTimeStamp(identifier.getExpiryTimeStamp()); builder.setMasterKeyId(identifier.getMasterKeyId()); builder.setRmIdentifier(identifier.getRMIdentifier()); PriorityPBImpl priority = (PriorityPBImpl)identifier.getPriority(); if (priority != null) { builder.setPriority(priority.getProto()); } builder.setCreationTime(identifier.getCreationTime()); builder.setMessage(message); LogAggregationContextPBImpl logAggregationContext = (LogAggregationContextPBImpl)identifier.getLogAggregationContext(); if (logAggregationContext != null) { builder.setLogAggregationContext(logAggregationContext.getProto()); } proto = builder.build(); }
public LogAggregationContext getLogAggregationContext() { if (!proto.hasLogAggregationContext()) { return null; } return new LogAggregationContextPBImpl(proto.getLogAggregationContext()); }
private ContainerManagerApplicationProto buildAppProto(ApplicationId appId, String user, Credentials credentials, Map<ApplicationAccessType, String> appAcls, LogAggregationContext logAggregationContext, ByteBuffer keyStore, String keyStorePass, ByteBuffer trustStore, String trustStorePass) { ContainerManagerApplicationProto.Builder builder = ContainerManagerApplicationProto.newBuilder(); builder.setId(((ApplicationIdPBImpl) appId).getProto()); builder.setUser(user); if(keyStore!=null){ builder.setKeyStore(ProtoUtils.convertToProtoFormat(keyStore)); builder.setKeyStorePassword(keyStorePass); } if(trustStore!=null){ builder.setTrustStore(ProtoUtils.convertToProtoFormat(trustStore)); builder.setTrustStorePassword(trustStorePass); } if (logAggregationContext != null) { builder.setLogAggregationContext(( (LogAggregationContextPBImpl)logAggregationContext).getProto()); } builder.clearCredentials(); if (credentials != null) { DataOutputBuffer dob = new DataOutputBuffer(); try { credentials.writeTokenStorageToStream(dob); builder.setCredentials(ByteString.copyFrom(dob.getData())); } catch (IOException e) { // should not occur LOG.error("Cannot serialize credentials", e); } } builder.clearAcls(); if (appAcls != null) { for (Map.Entry<ApplicationAccessType, String> acl : appAcls.entrySet()) { ApplicationACLMapProto p = ApplicationACLMapProto.newBuilder() .setAccessType(ProtoUtils.convertToProtoFormat(acl.getKey())) .setAcl(acl.getValue()) .build(); builder.addAcls(p); } } return builder.build(); }