HADOOP-7876. Provided access to encoded key in DelegationKey for use in protobuf based RPCs. Contributed by Suresh Srinivas.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1210320 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Suresh Srinivas 2011-12-05 03:40:34 +00:00
parent 560c8946ea
commit 0acc00bbab
2 changed files with 17 additions and 5 deletions

View File

@ -66,8 +66,11 @@ Trunk (unreleased changes)
HADOOP-7590. Mavenize streaming and MR examples. (tucu)
HADOOP-7862 Move the support for multiple protocols to lower layer so that Writable,
PB and Avro can all use it (Sanjay)
HADOOP-7862. Move the support for multiple protocols to lower layer so
that Writable, PB and Avro can all use it (Sanjay)
HADOOP-7876. Provided access to encoded key in DelegationKey for
use in protobuf based RPCs. (suresh)
BUGS

View File

@ -42,15 +42,20 @@ public class DelegationKey implements Writable {
@Nullable
private byte[] keyBytes = null;
/** Default constructore required for Writable */
public DelegationKey() {
this(0, 0L, null);
this(0, 0L, (SecretKey)null);
}
public DelegationKey(int keyId, long expiryDate, SecretKey key) {
this(keyId, expiryDate, key != null ? key.getEncoded() : null);
}
public DelegationKey(int keyId, long expiryDate, byte[] encodedKey) {
this.keyId = keyId;
this.expiryDate = expiryDate;
if (key!=null) {
this.keyBytes = key.getEncoded();
if (encodedKey != null) {
this.keyBytes = encodedKey;
}
}
@ -71,6 +76,10 @@ public class DelegationKey implements Writable {
}
}
public byte[] getEncodedKey() {
return keyBytes;
}
public void setExpiryDate(long expiryDate) {
this.expiryDate = expiryDate;
}