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

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1429748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-01-07 11:08:21 +00:00
parent 81222adc11
commit 917ff03b2c
13 changed files with 52 additions and 56 deletions

View File

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

View File

@ -62,6 +62,7 @@
<configuration> <configuration>
<executable>protoc</executable> <executable>protoc</executable>
<arguments> <arguments>
<argument>-I../../../hadoop-common-project/hadoop-common/src/main/proto/</argument>
<argument>-Isrc/main/proto/</argument> <argument>-Isrc/main/proto/</argument>
<argument>--java_out=target/generated-sources/proto</argument> <argument>--java_out=target/generated-sources/proto</argument>
<argument>src/main/proto/yarn_protos.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; 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.protocolrecords.CancelDelegationTokenRequest;
import org.apache.hadoop.yarn.api.records.DelegationToken; import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.DelegationTokenPBImpl; 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.CancelDelegationTokenRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.CancelDelegationTokenRequestProtoOrBuilder; import org.apache.hadoop.yarn.proto.YarnServiceProtos.CancelDelegationTokenRequestProtoOrBuilder;
@ -96,11 +96,11 @@ public class CancelDelegationTokenRequestPBImpl extends
viaProto = false; viaProto = false;
} }
private DelegationTokenPBImpl convertFromProtoFormat(DelegationTokenProto p) { private DelegationTokenPBImpl convertFromProtoFormat(TokenProto p) {
return new DelegationTokenPBImpl(p); return new DelegationTokenPBImpl(p);
} }
private DelegationTokenProto convertToProtoFormat(DelegationToken t) { private TokenProto convertToProtoFormat(DelegationToken t) {
return ((DelegationTokenPBImpl) t).getProto(); return ((DelegationTokenPBImpl) t).getProto();
} }
} }

View File

@ -18,11 +18,11 @@
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb; 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.protocolrecords.GetDelegationTokenResponse;
import org.apache.hadoop.yarn.api.records.DelegationToken; import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.DelegationTokenPBImpl; 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.GetDelegationTokenResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetDelegationTokenResponseProtoOrBuilder; 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); return new DelegationTokenPBImpl(p);
} }
private DelegationTokenProto convertToProtoFormat(DelegationToken t) { private TokenProto convertToProtoFormat(DelegationToken t) {
return ((DelegationTokenPBImpl)t).getProto(); return ((DelegationTokenPBImpl)t).getProto();
} }
} }

View File

@ -17,11 +17,11 @@
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb; 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.protocolrecords.RenewDelegationTokenRequest;
import org.apache.hadoop.yarn.api.records.DelegationToken; import org.apache.hadoop.yarn.api.records.DelegationToken;
import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.DelegationTokenPBImpl; 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.RenewDelegationTokenRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.RenewDelegationTokenRequestProtoOrBuilder; 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); return new DelegationTokenPBImpl(p);
} }
private DelegationTokenProto convertToProtoFormat(DelegationToken t) { private TokenProto convertToProtoFormat(DelegationToken t) {
return ((DelegationTokenPBImpl)t).getProto(); return ((DelegationTokenPBImpl)t).getProto();
} }
} }

View File

@ -19,6 +19,7 @@
package org.apache.hadoop.yarn.api.records.impl.pb; 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.Container;
import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerState; 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.ContainerProtoOrBuilder;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto; import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto; 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.NodeIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto; import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto; import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
@ -324,11 +324,11 @@ public class ContainerPBImpl extends ProtoBase<ContainerProto> implements Contai
return ((PriorityPBImpl)p).getProto(); return ((PriorityPBImpl)p).getProto();
} }
private ContainerTokenPBImpl convertFromProtoFormat(ContainerTokenProto p) { private ContainerTokenPBImpl convertFromProtoFormat(TokenProto p) {
return new ContainerTokenPBImpl(p); return new ContainerTokenPBImpl(p);
} }
private ContainerTokenProto convertToProtoFormat(ContainerToken t) { private TokenProto convertToProtoFormat(ContainerToken t) {
return ((ContainerTokenPBImpl)t).getProto(); 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.ContainerToken;
import org.apache.hadoop.yarn.api.records.ProtoBase; import org.apache.hadoop.yarn.api.records.ProtoBase;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTokenProto; import org.apache.hadoop.security.proto.SecurityProtos.TokenProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerTokenProtoOrBuilder; import org.apache.hadoop.security.proto.SecurityProtos.TokenProtoOrBuilder;
public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> implements ContainerToken { public class ContainerTokenPBImpl extends ProtoBase<TokenProto> implements ContainerToken {
private ContainerTokenProto proto = ContainerTokenProto.getDefaultInstance(); private TokenProto proto = TokenProto.getDefaultInstance();
private ContainerTokenProto.Builder builder = null; private TokenProto.Builder builder = null;
private boolean viaProto = false; private boolean viaProto = false;
private ByteBuffer identifier; private ByteBuffer identifier;
@ -38,15 +38,15 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
public ContainerTokenPBImpl() { public ContainerTokenPBImpl() {
builder = ContainerTokenProto.newBuilder(); builder = TokenProto.newBuilder();
} }
public ContainerTokenPBImpl(ContainerTokenProto proto) { public ContainerTokenPBImpl(TokenProto proto) {
this.proto = proto; this.proto = proto;
viaProto = true; viaProto = true;
} }
public synchronized ContainerTokenProto getProto() { public synchronized TokenProto getProto() {
mergeLocalToProto(); mergeLocalToProto();
proto = viaProto ? proto : builder.build(); proto = viaProto ? proto : builder.build();
viaProto = true; viaProto = true;
@ -72,7 +72,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
private synchronized void maybeInitBuilder() { private synchronized void maybeInitBuilder() {
if (viaProto || builder == null) { if (viaProto || builder == null) {
builder = ContainerTokenProto.newBuilder(proto); builder = TokenProto.newBuilder(proto);
} }
viaProto = false; viaProto = false;
} }
@ -80,7 +80,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
@Override @Override
public synchronized ByteBuffer getIdentifier() { public synchronized ByteBuffer getIdentifier() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder; TokenProtoOrBuilder p = viaProto ? proto : builder;
if (this.identifier != null) { if (this.identifier != null) {
return this.identifier; return this.identifier;
} }
@ -100,7 +100,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
} }
@Override @Override
public synchronized ByteBuffer getPassword() { public synchronized ByteBuffer getPassword() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder; TokenProtoOrBuilder p = viaProto ? proto : builder;
if (this.password != null) { if (this.password != null) {
return this.password; return this.password;
} }
@ -120,7 +120,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
} }
@Override @Override
public synchronized String getKind() { public synchronized String getKind() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder; TokenProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasKind()) { if (!p.hasKind()) {
return null; return null;
} }
@ -138,7 +138,7 @@ public class ContainerTokenPBImpl extends ProtoBase<ContainerTokenProto> impleme
} }
@Override @Override
public synchronized String getService() { public synchronized String getService() {
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder; TokenProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasService()) { if (!p.hasService()) {
return null; return null;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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