YARN-315. Using the common security token protobuf definition from hadoop common. Contributed by Suresh Srinivas.

svn merge --ignore-ancestry -c 1429748 ../../trunk/


git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1429749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-01-07 11:10:04 +00:00
parent 29a34c16a6
commit c166490bf0
13 changed files with 52 additions and 56 deletions

View File

@ -72,6 +72,9 @@ Release 2.0.3-alpha - Unreleased
YARN-254. Update fair scheduler web UI for hierarchical queues.
(sandyr via tucu)
YARN-315. Using the common security token protobuf definition from hadoop
common. (Suresh Srinivas via vinodkv)
OPTIMIZATIONS
BUG FIXES

View File

@ -62,6 +62,7 @@
<configuration>
<executable>protoc</executable>
<arguments>
<argument>-I../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
<argument>-Isrc/main/proto/</argument>
<argument>--java_out=target/generated-sources/proto</argument>
<argument>src/main/proto/yarn_protos.proto</argument>

View File

@ -17,11 +17,11 @@
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenRequest;
import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.DelegationTokenPBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.DelegationTokenProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.CancelDelegationTokenRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.CancelDelegationTokenRequestProtoOrBuilder;
@ -96,11 +96,11 @@ public class CancelDelegationTokenRequestPBImpl extends
viaProto = false;
}
private DelegationTokenPBImpl convertFromProtoFormat(DelegationTokenProto p) {
private DelegationTokenPBImpl convertFromProtoFormat(TokenProto p) {
return new DelegationTokenPBImpl(p);
}
private DelegationTokenProto convertToProtoFormat(DelegationToken t) {
private TokenProto convertToProtoFormat(DelegationToken t) {
return ((DelegationTokenPBImpl) t).getProto();
}
}

View File

@ -18,11 +18,11 @@
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse;
import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.DelegationTokenPBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.DelegationTokenProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetDelegationTokenResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetDelegationTokenResponseProtoOrBuilder;
@ -99,11 +99,11 @@ ProtoBase<GetDelegationTokenResponseProto> implements GetDelegationTokenResponse
}
private DelegationTokenPBImpl convertFromProtoFormat(DelegationTokenProto p) {
private DelegationTokenPBImpl convertFromProtoFormat(TokenProto p) {
return new DelegationTokenPBImpl(p);
}
private DelegationTokenProto convertToProtoFormat(DelegationToken t) {
private TokenProto convertToProtoFormat(DelegationToken t) {
return ((DelegationTokenPBImpl)t).getProto();
}
}

View File

@ -17,11 +17,11 @@
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.DelegationTokenPBImpl;
import org.apache.hadoop.yarn.proto.YarnProtos.DelegationTokenProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.RenewDelegationTokenRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.RenewDelegationTokenRequestProtoOrBuilder;
@ -97,11 +97,11 @@ public class RenewDelegationTokenRequestPBImpl extends
}
private DelegationTokenPBImpl convertFromProtoFormat(DelegationTokenProto p) {
private DelegationTokenPBImpl convertFromProtoFormat(TokenProto p) {
return new DelegationTokenPBImpl(p);
}
private DelegationTokenProto convertToProtoFormat(DelegationToken t) {
private TokenProto convertToProtoFormat(DelegationToken t) {
return ((DelegationTokenPBImpl)t).getProto();
}
}

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.yarn.api.records.impl.pb;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerState;
@ -33,7 +34,6 @@ import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProtoOrBuilder;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTokenProto;
import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
@ -324,11 +324,11 @@ public class ContainerPBImpl extends ProtoBase<ContainerProto> implements Contai
return ((PriorityPBImpl)p).getProto();
}
private ContainerTokenPBImpl convertFromProtoFormat(ContainerTokenProto p) {
private ContainerTokenPBImpl convertFromProtoFormat(TokenProto p) {
return new ContainerTokenPBImpl(p);
}
private ContainerTokenProto convertToProtoFormat(ContainerToken t) {
private TokenProto convertToProtoFormat(ContainerToken t) {
return ((ContainerTokenPBImpl)t).getProto();
}

View File

@ -23,14 +23,14 @@ import java.nio.ByteBuffer;
import org.apache.hadoop.yarn.api.records.ContainerToken;
import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTokenProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTokenProtoOrBuilder;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProtoOrBuilder;
public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> implements ContainerToken {
private ContainerTokenProto proto = ContainerTokenProto.getDefaultInstance();
private ContainerTokenProto.Builder builder = null;
public class ContainerTokenPBImpl extends ProtoBase<TokenProto> implements ContainerToken {
private TokenProto proto = TokenProto.getDefaultInstance();
private TokenProto.Builder builder = null;
private boolean viaProto = false;
private ByteBuffer identifier;
@ -38,15 +38,15 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
public ContainerTokenPBImpl() {
builder = ContainerTokenProto.newBuilder();
builder = TokenProto.newBuilder();
}
public ContainerTokenPBImpl(ContainerTokenProto proto) {
public ContainerTokenPBImpl(TokenProto proto) {
this.proto = proto;
viaProto = true;
}
public synchronized ContainerTokenProto getProto() {
public synchronized TokenProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
@ -72,7 +72,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
private synchronized void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = ContainerTokenProto.newBuilder(proto);
builder = TokenProto.newBuilder(proto);
}
viaProto = false;
}
@ -80,7 +80,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
@Override
public synchronized ByteBuffer getIdentifier() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (this.identifier != null) {
return this.identifier;
}
@ -100,7 +100,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
}
@Override
public synchronized ByteBuffer getPassword() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (this.password != null) {
return this.password;
}
@ -120,7 +120,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
}
@Override
public synchronized String getKind() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasKind()) {
return null;
}
@ -138,7 +138,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
}
@Override
public synchronized String getService() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasService()) {
return null;
}

View File

@ -20,15 +20,15 @@ package org.apache.hadoop.yarn.api.records.impl.pb;
import java.nio.ByteBuffer;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.security.proto.SecurityProtos.TokenProtoOrBuilder;
import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.proto.YarnProtos.DelegationTokenProto;
import org.apache.hadoop.yarn.proto.YarnProtos.DelegationTokenProtoOrBuilder;
public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
public class DelegationTokenPBImpl extends ProtoBase<TokenProto>
implements DelegationToken {
private DelegationTokenProto proto = DelegationTokenProto.getDefaultInstance();
private DelegationTokenProto.Builder builder = null;
private TokenProto proto = TokenProto.getDefaultInstance();
private TokenProto.Builder builder = null;
private boolean viaProto = false;
private ByteBuffer identifier;
@ -36,15 +36,15 @@ public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
public DelegationTokenPBImpl() {
builder = DelegationTokenProto.newBuilder();
builder = TokenProto.newBuilder();
}
public DelegationTokenPBImpl(DelegationTokenProto proto) {
public DelegationTokenPBImpl(TokenProto proto) {
this.proto = proto;
viaProto = true;
}
public synchronized DelegationTokenProto getProto() {
public synchronized TokenProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
@ -70,7 +70,7 @@ public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
private synchronized void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = DelegationTokenProto.newBuilder(proto);
builder = TokenProto.newBuilder(proto);
}
viaProto = false;
}
@ -78,7 +78,7 @@ public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
@Override
public synchronized ByteBuffer getIdentifier() {
DelegationTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (this.identifier != null) {
return this.identifier;
}
@ -98,7 +98,7 @@ public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
}
@Override
public synchronized ByteBuffer getPassword() {
DelegationTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (this.password != null) {
return this.password;
}
@ -118,7 +118,7 @@ public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
}
@Override
public synchronized String getKind() {
DelegationTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasKind()) {
return null;
}
@ -136,7 +136,7 @@ public class DelegationTokenPBImpl extends ProtoBase<DelegationTokenProto>
}
@Override
public synchronized String getService() {
DelegationTokenProtoOrBuilder p = viaProto ? proto : builder;
TokenProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasService()) {
return null;
}

View File

@ -21,6 +21,8 @@ option java_outer_classname = "YarnProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
import "Security.proto";
message YarnRemoteExceptionProto {
optional string message = 1;
optional string trace = 2;
@ -58,20 +60,6 @@ enum ContainerStateProto {
C_COMPLETE = 3;
}
message ContainerTokenProto {
optional bytes identifier = 1;
optional bytes password = 2;
optional string kind = 3;
optional string service = 4;
}
message DelegationTokenProto {
optional bytes identifier = 1;
optional bytes password = 2;
optional string kind = 3;
optional string service = 4;
}
message ContainerProto {
optional ContainerIdProto id = 1;
optional NodeIdProto nodeId = 2;
@ -79,7 +67,7 @@ message ContainerProto {
optional ResourceProto resource = 4;
optional PriorityProto priority = 5;
optional ContainerStateProto state = 6;
optional ContainerTokenProto container_token = 7;
optional hadoop.common.TokenProto container_token = 7;
optional ContainerStatusProto container_status = 8;
}

View File

@ -21,6 +21,7 @@ option java_outer_classname = "YarnServiceProtos";
option java_generic_services = true;
option java_generate_equals_and_hash = true;
import "Security.proto";
import "yarn_protos.proto";
//////////////////////////////////////////////////////
@ -144,11 +145,11 @@ message GetDelegationTokenRequestProto {
}
message GetDelegationTokenResponseProto {
optional DelegationTokenProto application_token = 1;
optional hadoop.common.TokenProto application_token = 1;
}
message RenewDelegationTokenRequestProto {
required DelegationTokenProto delegation_token = 1;
required hadoop.common.TokenProto delegation_token = 1;
}
message RenewDelegationTokenResponseProto {
@ -156,7 +157,7 @@ message RenewDelegationTokenResponseProto {
}
message CancelDelegationTokenRequestProto {
required DelegationTokenProto delegation_token = 1;
required hadoop.common.TokenProto delegation_token = 1;
}
message CancelDelegationTokenResponseProto {

View File

@ -98,6 +98,7 @@
<configuration>
<executable>protoc</executable>
<arguments>
<argument>-I../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
<argument>-I../hadoop-yarn-api/src/main/proto/</argument>
<argument>-Isrc/main/proto/</argument>
<argument>--java_out=target/generated-sources/proto</argument>

View File

@ -84,6 +84,7 @@
<configuration>
<executable>protoc</executable>
<arguments>
<argument>-I../../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
<argument>-I../../hadoop-yarn-api/src/main/proto/</argument>
<argument>-Isrc/main/proto/</argument>
<argument>--java_out=target/generated-sources/proto</argument>

View File

@ -182,6 +182,7 @@
<configuration>
<executable>protoc</executable>
<arguments>
<argument>-I../../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
<argument>-I../../hadoop-yarn-api/src/main/proto/</argument>
<argument>-Isrc/main/proto/</argument>
<argument>--java_out=target/generated-sources/proto</argument>