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:
parent
81222adc11
commit
917ff03b2c
@ -89,6 +89,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
|
||||
|
@ -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>
|
||||
|
@ -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 @@ private void maybeInitBuilder() {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ private void maybeInitBuilder() {
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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 @@ private void maybeInitBuilder() {
|
||||
}
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -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.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 @@ private PriorityProto convertToProtoFormat(Priority p) {
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
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 @@ private synchronized void mergeLocalToProto() {
|
||||
|
||||
private synchronized void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = ContainerTokenProto.newBuilder(proto);
|
||||
builder = TokenProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
@ -80,7 +80,7 @@ private synchronized void maybeInitBuilder() {
|
||||
|
||||
@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 synchronized void setIdentifier(ByteBuffer identifier) {
|
||||
}
|
||||
@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 synchronized void setPassword(ByteBuffer password) {
|
||||
}
|
||||
@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 synchronized void setKind(String kind) {
|
||||
}
|
||||
@Override
|
||||
public synchronized String getService() {
|
||||
ContainerTokenProtoOrBuilder p = viaProto ? proto : builder;
|
||||
TokenProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (!p.hasService()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -20,15 +20,15 @@
|
||||
|
||||
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 @@ private synchronized void mergeLocalToProto() {
|
||||
|
||||
private synchronized void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = DelegationTokenProto.newBuilder(proto);
|
||||
builder = TokenProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
@ -78,7 +78,7 @@ private synchronized void maybeInitBuilder() {
|
||||
|
||||
@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 synchronized void setIdentifier(ByteBuffer identifier) {
|
||||
}
|
||||
@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 synchronized void setPassword(ByteBuffer password) {
|
||||
}
|
||||
@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 synchronized void setKind(String kind) {
|
||||
}
|
||||
@Override
|
||||
public synchronized String getService() {
|
||||
DelegationTokenProtoOrBuilder p = viaProto ? proto : builder;
|
||||
TokenProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (!p.hasService()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user