public ContainerTokenIdentifierForTest(ContainerId containerID, string hostName, string appSubmitter, Resource r, long expiryTimeStamp, int masterKeyId, long rmIdentifier , Priority priority, long creationTime, LogAggregationContext logAggregationContext ) { YarnSecurityTestTokenProtos.ContainerTokenIdentifierForTestProto.Builder builder = YarnSecurityTestTokenProtos.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 = ((YarnSecurityTestTokenProtos.ContainerTokenIdentifierForTestProto)builder .Build()); }
/// <exception cref="System.IO.IOException"/> public override void ReadFields(DataInput @in) { DataInputStream dis = (DataInputStream)@in; byte[] buffer = IOUtils.ToByteArray(dis); proto = YarnSecurityTestTokenProtos.ContainerTokenIdentifierForTestProto.ParseFrom (buffer); }
public ContainerTokenIdentifierForTest(ContainerTokenIdentifier identifier, string message) { YarnSecurityTestTokenProtos.ContainerTokenIdentifierForTestProto.Builder builder = YarnSecurityTestTokenProtos.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 = ((YarnSecurityTestTokenProtos.ContainerTokenIdentifierForTestProto)builder .Build()); }