diff --git common/src/java/org/apache/hadoop/hive/conf/HiveConf.java common/src/java/org/apache/hadoop/hive/conf/HiveConf.java index 1c9d073..18047f7 100644 --- common/src/java/org/apache/hadoop/hive/conf/HiveConf.java +++ common/src/java/org/apache/hadoop/hive/conf/HiveConf.java @@ -328,6 +328,8 @@ public class HiveConf extends Configuration { // Print column names in output HIVE_CLI_PRINT_HEADER("hive.cli.print.header", false), + METASTORE_TOKEN_SIGNATURE("metastore.token.signature", null), + HIVE_ERROR_ON_EMPTY_PARTITION("hive.error.on.empty.partition", false); ; diff --git metastore/if/hive_metastore.thrift metastore/if/hive_metastore.thrift index 36f1f1c..bea0041 100755 --- metastore/if/hive_metastore.thrift +++ metastore/if/hive_metastore.thrift @@ -272,6 +272,21 @@ service ThriftHiveMetastore extends fb303.FacebookService throws(1:NoSuchObjectException o1, 2:MetaException o2) list get_index_names(1:string db_name, 2:string tbl_name, 3:i16 max_indexes=-1) throws(1:MetaException o2) + // get metastore server delegation token for use from the map/reduce tasks to authenticate + // to metastore server + string get_delegation_token(1:string renewer_principal_name) throws (1:MetaException o1) + + // get metastore server delegation token for use from the map/reduce tasks to authenticate + // to metastore server - this method takes an extra token signature string which is just + // an identifier to associate with the token - this will be used by the token selector code + // to pick the right token given the associated identifier. + string get_delegation_token_with_signature(1:string renewer_principal_name, 2:string token_signature) throws (1:MetaException o1) + + // method to renew delegation token obtained from metastore server + i64 renew_delegation_token(1:string token_str_form) throws (1:MetaException o1) + + // method to cancel delegation token obtained from metastore server + void cancel_delegation_token(1:string token_str_form) throws (1:MetaException o1) } // * Note about the DDL_TIME: When creating or altering a table or a partition, diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp index ed13050..bf2229e 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.cpp @@ -8949,6 +8949,712 @@ uint32_t ThriftHiveMetastore_get_index_names_presult::read(::apache::thrift::pro return xfer; } +uint32_t ThriftHiveMetastore_get_delegation_token_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->renewer_principal_name); + this->__isset.renewer_principal_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_delegation_token_args"); + xfer += oprot->writeFieldBegin("renewer_principal_name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->renewer_principal_name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_delegation_token_pargs"); + xfer += oprot->writeFieldBegin("renewer_principal_name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->renewer_principal_name))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_delegation_token_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_with_signature_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->renewer_principal_name); + this->__isset.renewer_principal_name = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->token_signature); + this->__isset.token_signature = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_with_signature_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_delegation_token_with_signature_args"); + xfer += oprot->writeFieldBegin("renewer_principal_name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->renewer_principal_name); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("token_signature", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->token_signature); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_with_signature_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_delegation_token_with_signature_pargs"); + xfer += oprot->writeFieldBegin("renewer_principal_name", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->renewer_principal_name))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("token_signature", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->token_signature))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_with_signature_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_with_signature_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_delegation_token_with_signature_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRING, 0); + xfer += oprot->writeString(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_get_delegation_token_with_signature_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_renew_delegation_token_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->token_str_form); + this->__isset.token_str_form = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_renew_delegation_token_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_renew_delegation_token_args"); + xfer += oprot->writeFieldBegin("token_str_form", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->token_str_form); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_renew_delegation_token_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_renew_delegation_token_pargs"); + xfer += oprot->writeFieldBegin("token_str_form", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->token_str_form))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_renew_delegation_token_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->success); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_renew_delegation_token_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_renew_delegation_token_result"); + + if (this->__isset.success) { + xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_I64, 0); + xfer += oprot->writeI64(this->success); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_renew_delegation_token_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 0: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64((*(this->success))); + this->__isset.success = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_cancel_delegation_token_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->token_str_form); + this->__isset.token_str_form = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_cancel_delegation_token_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_cancel_delegation_token_args"); + xfer += oprot->writeFieldBegin("token_str_form", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->token_str_form); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_cancel_delegation_token_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + xfer += oprot->writeStructBegin("ThriftHiveMetastore_cancel_delegation_token_pargs"); + xfer += oprot->writeFieldBegin("token_str_form", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString((*(this->token_str_form))); + xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_cancel_delegation_token_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ThriftHiveMetastore_cancel_delegation_token_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("ThriftHiveMetastore_cancel_delegation_token_result"); + + if (this->__isset.o1) { + xfer += oprot->writeFieldBegin("o1", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->o1.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +uint32_t ThriftHiveMetastore_cancel_delegation_token_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->o1.read(iprot); + this->__isset.o1 = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + void ThriftHiveMetastoreClient::create_database(const Database& database) { send_create_database(database); @@ -11536,6 +12242,254 @@ void ThriftHiveMetastoreClient::recv_get_index_names(std::vector & throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_index_names failed: unknown result"); } +void ThriftHiveMetastoreClient::get_delegation_token(std::string& _return, const std::string& renewer_principal_name) +{ + send_get_delegation_token(renewer_principal_name); + recv_get_delegation_token(_return); +} + +void ThriftHiveMetastoreClient::send_get_delegation_token(const std::string& renewer_principal_name) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_delegation_token", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_get_delegation_token_pargs args; + args.renewer_principal_name = &renewer_principal_name; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->flush(); + oprot_->getTransport()->writeEnd(); +} + +void ThriftHiveMetastoreClient::recv_get_delegation_token(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE); + } + if (fname.compare("get_delegation_token") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::WRONG_METHOD_NAME); + } + ThriftHiveMetastore_get_delegation_token_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.o1) { + throw result.o1; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_delegation_token failed: unknown result"); +} + +void ThriftHiveMetastoreClient::get_delegation_token_with_signature(std::string& _return, const std::string& renewer_principal_name, const std::string& token_signature) +{ + send_get_delegation_token_with_signature(renewer_principal_name, token_signature); + recv_get_delegation_token_with_signature(_return); +} + +void ThriftHiveMetastoreClient::send_get_delegation_token_with_signature(const std::string& renewer_principal_name, const std::string& token_signature) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("get_delegation_token_with_signature", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_get_delegation_token_with_signature_pargs args; + args.renewer_principal_name = &renewer_principal_name; + args.token_signature = &token_signature; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->flush(); + oprot_->getTransport()->writeEnd(); +} + +void ThriftHiveMetastoreClient::recv_get_delegation_token_with_signature(std::string& _return) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE); + } + if (fname.compare("get_delegation_token_with_signature") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::WRONG_METHOD_NAME); + } + ThriftHiveMetastore_get_delegation_token_with_signature_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + return; + } + if (result.__isset.o1) { + throw result.o1; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "get_delegation_token_with_signature failed: unknown result"); +} + +int64_t ThriftHiveMetastoreClient::renew_delegation_token(const std::string& token_str_form) +{ + send_renew_delegation_token(token_str_form); + return recv_renew_delegation_token(); +} + +void ThriftHiveMetastoreClient::send_renew_delegation_token(const std::string& token_str_form) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("renew_delegation_token", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_renew_delegation_token_pargs args; + args.token_str_form = &token_str_form; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->flush(); + oprot_->getTransport()->writeEnd(); +} + +int64_t ThriftHiveMetastoreClient::recv_renew_delegation_token() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE); + } + if (fname.compare("renew_delegation_token") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::WRONG_METHOD_NAME); + } + int64_t _return; + ThriftHiveMetastore_renew_delegation_token_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + return _return; + } + if (result.__isset.o1) { + throw result.o1; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "renew_delegation_token failed: unknown result"); +} + +void ThriftHiveMetastoreClient::cancel_delegation_token(const std::string& token_str_form) +{ + send_cancel_delegation_token(token_str_form); + recv_cancel_delegation_token(); +} + +void ThriftHiveMetastoreClient::send_cancel_delegation_token(const std::string& token_str_form) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("cancel_delegation_token", ::apache::thrift::protocol::T_CALL, cseqid); + + ThriftHiveMetastore_cancel_delegation_token_pargs args; + args.token_str_form = &token_str_form; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->flush(); + oprot_->getTransport()->writeEnd(); +} + +void ThriftHiveMetastoreClient::recv_cancel_delegation_token() +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + iprot_->readMessageBegin(fname, mtype, rseqid); + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::INVALID_MESSAGE_TYPE); + } + if (fname.compare("cancel_delegation_token") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::WRONG_METHOD_NAME); + } + ThriftHiveMetastore_cancel_delegation_token_presult result; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.o1) { + throw result.o1; + } + return; +} + bool ThriftHiveMetastoreProcessor::process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot) { ::apache::thrift::protocol::TProtocol* iprot = piprot.get(); @@ -12888,5 +13842,128 @@ void ThriftHiveMetastoreProcessor::process_get_index_names(int32_t seqid, ::apac oprot->getTransport()->writeEnd(); } +void ThriftHiveMetastoreProcessor::process_get_delegation_token(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot) +{ + ThriftHiveMetastore_get_delegation_token_args args; + args.read(iprot); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + + ThriftHiveMetastore_get_delegation_token_result result; + try { + iface_->get_delegation_token(result.success, args.renewer_principal_name); + result.__isset.success = true; + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_delegation_token", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); + return; + } + + oprot->writeMessageBegin("get_delegation_token", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); +} + +void ThriftHiveMetastoreProcessor::process_get_delegation_token_with_signature(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot) +{ + ThriftHiveMetastore_get_delegation_token_with_signature_args args; + args.read(iprot); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + + ThriftHiveMetastore_get_delegation_token_with_signature_result result; + try { + iface_->get_delegation_token_with_signature(result.success, args.renewer_principal_name, args.token_signature); + result.__isset.success = true; + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("get_delegation_token_with_signature", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); + return; + } + + oprot->writeMessageBegin("get_delegation_token_with_signature", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); +} + +void ThriftHiveMetastoreProcessor::process_renew_delegation_token(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot) +{ + ThriftHiveMetastore_renew_delegation_token_args args; + args.read(iprot); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + + ThriftHiveMetastore_renew_delegation_token_result result; + try { + result.success = iface_->renew_delegation_token(args.token_str_form); + result.__isset.success = true; + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("renew_delegation_token", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); + return; + } + + oprot->writeMessageBegin("renew_delegation_token", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); +} + +void ThriftHiveMetastoreProcessor::process_cancel_delegation_token(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot) +{ + ThriftHiveMetastore_cancel_delegation_token_args args; + args.read(iprot); + iprot->readMessageEnd(); + iprot->getTransport()->readEnd(); + + ThriftHiveMetastore_cancel_delegation_token_result result; + try { + iface_->cancel_delegation_token(args.token_str_form); + } catch (MetaException &o1) { + result.o1 = o1; + result.__isset.o1 = true; + } catch (const std::exception& e) { + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("cancel_delegation_token", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); + return; + } + + oprot->writeMessageBegin("cancel_delegation_token", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->flush(); + oprot->getTransport()->writeEnd(); +} + }}} // namespace diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h index fb509f8..4a12c15 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore.h @@ -54,6 +54,10 @@ class ThriftHiveMetastoreIf : virtual public facebook::fb303::FacebookServiceIf virtual void get_index_by_name(Index& _return, const std::string& db_name, const std::string& tbl_name, const std::string& index_name) = 0; virtual void get_indexes(std::vector & _return, const std::string& db_name, const std::string& tbl_name, const int16_t max_indexes) = 0; virtual void get_index_names(std::vector & _return, const std::string& db_name, const std::string& tbl_name, const int16_t max_indexes) = 0; + virtual void get_delegation_token(std::string& _return, const std::string& renewer_principal_name) = 0; + virtual void get_delegation_token_with_signature(std::string& _return, const std::string& renewer_principal_name, const std::string& token_signature) = 0; + virtual int64_t renew_delegation_token(const std::string& token_str_form) = 0; + virtual void cancel_delegation_token(const std::string& token_str_form) = 0; }; class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual public facebook::fb303::FacebookServiceNull { @@ -181,6 +185,19 @@ class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual p void get_index_names(std::vector & /* _return */, const std::string& /* db_name */, const std::string& /* tbl_name */, const int16_t /* max_indexes */) { return; } + void get_delegation_token(std::string& /* _return */, const std::string& /* renewer_principal_name */) { + return; + } + void get_delegation_token_with_signature(std::string& /* _return */, const std::string& /* renewer_principal_name */, const std::string& /* token_signature */) { + return; + } + int64_t renew_delegation_token(const std::string& /* token_str_form */) { + int64_t _return = 0; + return _return; + } + void cancel_delegation_token(const std::string& /* token_str_form */) { + return; + } }; typedef struct _ThriftHiveMetastore_create_database_args__isset { @@ -4753,6 +4770,429 @@ class ThriftHiveMetastore_get_index_names_presult { }; +typedef struct _ThriftHiveMetastore_get_delegation_token_args__isset { + _ThriftHiveMetastore_get_delegation_token_args__isset() : renewer_principal_name(false) {} + bool renewer_principal_name; +} _ThriftHiveMetastore_get_delegation_token_args__isset; + +class ThriftHiveMetastore_get_delegation_token_args { + public: + + ThriftHiveMetastore_get_delegation_token_args() : renewer_principal_name("") { + } + + virtual ~ThriftHiveMetastore_get_delegation_token_args() throw() {} + + std::string renewer_principal_name; + + _ThriftHiveMetastore_get_delegation_token_args__isset __isset; + + bool operator == (const ThriftHiveMetastore_get_delegation_token_args & rhs) const + { + if (!(renewer_principal_name == rhs.renewer_principal_name)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_get_delegation_token_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_get_delegation_token_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_get_delegation_token_pargs { + public: + + + virtual ~ThriftHiveMetastore_get_delegation_token_pargs() throw() {} + + const std::string* renewer_principal_name; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_get_delegation_token_result__isset { + _ThriftHiveMetastore_get_delegation_token_result__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_get_delegation_token_result__isset; + +class ThriftHiveMetastore_get_delegation_token_result { + public: + + ThriftHiveMetastore_get_delegation_token_result() : success("") { + } + + virtual ~ThriftHiveMetastore_get_delegation_token_result() throw() {} + + std::string success; + MetaException o1; + + _ThriftHiveMetastore_get_delegation_token_result__isset __isset; + + bool operator == (const ThriftHiveMetastore_get_delegation_token_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_get_delegation_token_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_get_delegation_token_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_get_delegation_token_presult__isset { + _ThriftHiveMetastore_get_delegation_token_presult__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_get_delegation_token_presult__isset; + +class ThriftHiveMetastore_get_delegation_token_presult { + public: + + + virtual ~ThriftHiveMetastore_get_delegation_token_presult() throw() {} + + std::string* success; + MetaException o1; + + _ThriftHiveMetastore_get_delegation_token_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftHiveMetastore_get_delegation_token_with_signature_args__isset { + _ThriftHiveMetastore_get_delegation_token_with_signature_args__isset() : renewer_principal_name(false), token_signature(false) {} + bool renewer_principal_name; + bool token_signature; +} _ThriftHiveMetastore_get_delegation_token_with_signature_args__isset; + +class ThriftHiveMetastore_get_delegation_token_with_signature_args { + public: + + ThriftHiveMetastore_get_delegation_token_with_signature_args() : renewer_principal_name(""), token_signature("") { + } + + virtual ~ThriftHiveMetastore_get_delegation_token_with_signature_args() throw() {} + + std::string renewer_principal_name; + std::string token_signature; + + _ThriftHiveMetastore_get_delegation_token_with_signature_args__isset __isset; + + bool operator == (const ThriftHiveMetastore_get_delegation_token_with_signature_args & rhs) const + { + if (!(renewer_principal_name == rhs.renewer_principal_name)) + return false; + if (!(token_signature == rhs.token_signature)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_get_delegation_token_with_signature_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_get_delegation_token_with_signature_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_get_delegation_token_with_signature_pargs { + public: + + + virtual ~ThriftHiveMetastore_get_delegation_token_with_signature_pargs() throw() {} + + const std::string* renewer_principal_name; + const std::string* token_signature; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_get_delegation_token_with_signature_result__isset { + _ThriftHiveMetastore_get_delegation_token_with_signature_result__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_get_delegation_token_with_signature_result__isset; + +class ThriftHiveMetastore_get_delegation_token_with_signature_result { + public: + + ThriftHiveMetastore_get_delegation_token_with_signature_result() : success("") { + } + + virtual ~ThriftHiveMetastore_get_delegation_token_with_signature_result() throw() {} + + std::string success; + MetaException o1; + + _ThriftHiveMetastore_get_delegation_token_with_signature_result__isset __isset; + + bool operator == (const ThriftHiveMetastore_get_delegation_token_with_signature_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_get_delegation_token_with_signature_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_get_delegation_token_with_signature_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_get_delegation_token_with_signature_presult__isset { + _ThriftHiveMetastore_get_delegation_token_with_signature_presult__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_get_delegation_token_with_signature_presult__isset; + +class ThriftHiveMetastore_get_delegation_token_with_signature_presult { + public: + + + virtual ~ThriftHiveMetastore_get_delegation_token_with_signature_presult() throw() {} + + std::string* success; + MetaException o1; + + _ThriftHiveMetastore_get_delegation_token_with_signature_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftHiveMetastore_renew_delegation_token_args__isset { + _ThriftHiveMetastore_renew_delegation_token_args__isset() : token_str_form(false) {} + bool token_str_form; +} _ThriftHiveMetastore_renew_delegation_token_args__isset; + +class ThriftHiveMetastore_renew_delegation_token_args { + public: + + ThriftHiveMetastore_renew_delegation_token_args() : token_str_form("") { + } + + virtual ~ThriftHiveMetastore_renew_delegation_token_args() throw() {} + + std::string token_str_form; + + _ThriftHiveMetastore_renew_delegation_token_args__isset __isset; + + bool operator == (const ThriftHiveMetastore_renew_delegation_token_args & rhs) const + { + if (!(token_str_form == rhs.token_str_form)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_renew_delegation_token_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_renew_delegation_token_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_renew_delegation_token_pargs { + public: + + + virtual ~ThriftHiveMetastore_renew_delegation_token_pargs() throw() {} + + const std::string* token_str_form; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_renew_delegation_token_result__isset { + _ThriftHiveMetastore_renew_delegation_token_result__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_renew_delegation_token_result__isset; + +class ThriftHiveMetastore_renew_delegation_token_result { + public: + + ThriftHiveMetastore_renew_delegation_token_result() : success(0) { + } + + virtual ~ThriftHiveMetastore_renew_delegation_token_result() throw() {} + + int64_t success; + MetaException o1; + + _ThriftHiveMetastore_renew_delegation_token_result__isset __isset; + + bool operator == (const ThriftHiveMetastore_renew_delegation_token_result & rhs) const + { + if (!(success == rhs.success)) + return false; + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_renew_delegation_token_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_renew_delegation_token_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_renew_delegation_token_presult__isset { + _ThriftHiveMetastore_renew_delegation_token_presult__isset() : success(false), o1(false) {} + bool success; + bool o1; +} _ThriftHiveMetastore_renew_delegation_token_presult__isset; + +class ThriftHiveMetastore_renew_delegation_token_presult { + public: + + + virtual ~ThriftHiveMetastore_renew_delegation_token_presult() throw() {} + + int64_t* success; + MetaException o1; + + _ThriftHiveMetastore_renew_delegation_token_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + +typedef struct _ThriftHiveMetastore_cancel_delegation_token_args__isset { + _ThriftHiveMetastore_cancel_delegation_token_args__isset() : token_str_form(false) {} + bool token_str_form; +} _ThriftHiveMetastore_cancel_delegation_token_args__isset; + +class ThriftHiveMetastore_cancel_delegation_token_args { + public: + + ThriftHiveMetastore_cancel_delegation_token_args() : token_str_form("") { + } + + virtual ~ThriftHiveMetastore_cancel_delegation_token_args() throw() {} + + std::string token_str_form; + + _ThriftHiveMetastore_cancel_delegation_token_args__isset __isset; + + bool operator == (const ThriftHiveMetastore_cancel_delegation_token_args & rhs) const + { + if (!(token_str_form == rhs.token_str_form)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_cancel_delegation_token_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_cancel_delegation_token_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class ThriftHiveMetastore_cancel_delegation_token_pargs { + public: + + + virtual ~ThriftHiveMetastore_cancel_delegation_token_pargs() throw() {} + + const std::string* token_str_form; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_cancel_delegation_token_result__isset { + _ThriftHiveMetastore_cancel_delegation_token_result__isset() : o1(false) {} + bool o1; +} _ThriftHiveMetastore_cancel_delegation_token_result__isset; + +class ThriftHiveMetastore_cancel_delegation_token_result { + public: + + ThriftHiveMetastore_cancel_delegation_token_result() { + } + + virtual ~ThriftHiveMetastore_cancel_delegation_token_result() throw() {} + + MetaException o1; + + _ThriftHiveMetastore_cancel_delegation_token_result__isset __isset; + + bool operator == (const ThriftHiveMetastore_cancel_delegation_token_result & rhs) const + { + if (!(o1 == rhs.o1)) + return false; + return true; + } + bool operator != (const ThriftHiveMetastore_cancel_delegation_token_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ThriftHiveMetastore_cancel_delegation_token_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _ThriftHiveMetastore_cancel_delegation_token_presult__isset { + _ThriftHiveMetastore_cancel_delegation_token_presult__isset() : o1(false) {} + bool o1; +} _ThriftHiveMetastore_cancel_delegation_token_presult__isset; + +class ThriftHiveMetastore_cancel_delegation_token_presult { + public: + + + virtual ~ThriftHiveMetastore_cancel_delegation_token_presult() throw() {} + + MetaException o1; + + _ThriftHiveMetastore_cancel_delegation_token_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + class ThriftHiveMetastoreClient : virtual public ThriftHiveMetastoreIf, public facebook::fb303::FacebookServiceClient { public: ThriftHiveMetastoreClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) : @@ -4882,6 +5322,18 @@ class ThriftHiveMetastoreClient : virtual public ThriftHiveMetastoreIf, public f void get_index_names(std::vector & _return, const std::string& db_name, const std::string& tbl_name, const int16_t max_indexes); void send_get_index_names(const std::string& db_name, const std::string& tbl_name, const int16_t max_indexes); void recv_get_index_names(std::vector & _return); + void get_delegation_token(std::string& _return, const std::string& renewer_principal_name); + void send_get_delegation_token(const std::string& renewer_principal_name); + void recv_get_delegation_token(std::string& _return); + void get_delegation_token_with_signature(std::string& _return, const std::string& renewer_principal_name, const std::string& token_signature); + void send_get_delegation_token_with_signature(const std::string& renewer_principal_name, const std::string& token_signature); + void recv_get_delegation_token_with_signature(std::string& _return); + int64_t renew_delegation_token(const std::string& token_str_form); + void send_renew_delegation_token(const std::string& token_str_form); + int64_t recv_renew_delegation_token(); + void cancel_delegation_token(const std::string& token_str_form); + void send_cancel_delegation_token(const std::string& token_str_form); + void recv_cancel_delegation_token(); }; class ThriftHiveMetastoreProcessor : virtual public ::apache::thrift::TProcessor, public facebook::fb303::FacebookServiceProcessor { @@ -4929,6 +5381,10 @@ class ThriftHiveMetastoreProcessor : virtual public ::apache::thrift::TProcessor void process_get_index_by_name(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); void process_get_indexes(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); void process_get_index_names(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); + void process_get_delegation_token(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); + void process_get_delegation_token_with_signature(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); + void process_renew_delegation_token(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); + void process_cancel_delegation_token(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot); public: ThriftHiveMetastoreProcessor(boost::shared_ptr iface) : facebook::fb303::FacebookServiceProcessor(iface), @@ -4972,6 +5428,10 @@ class ThriftHiveMetastoreProcessor : virtual public ::apache::thrift::TProcessor processMap_["get_index_by_name"] = &ThriftHiveMetastoreProcessor::process_get_index_by_name; processMap_["get_indexes"] = &ThriftHiveMetastoreProcessor::process_get_indexes; processMap_["get_index_names"] = &ThriftHiveMetastoreProcessor::process_get_index_names; + processMap_["get_delegation_token"] = &ThriftHiveMetastoreProcessor::process_get_delegation_token; + processMap_["get_delegation_token_with_signature"] = &ThriftHiveMetastoreProcessor::process_get_delegation_token_with_signature; + processMap_["renew_delegation_token"] = &ThriftHiveMetastoreProcessor::process_renew_delegation_token; + processMap_["cancel_delegation_token"] = &ThriftHiveMetastoreProcessor::process_cancel_delegation_token; } virtual bool process(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot); @@ -5423,6 +5883,48 @@ class ThriftHiveMetastoreMultiface : virtual public ThriftHiveMetastoreIf, publi } } + void get_delegation_token(std::string& _return, const std::string& renewer_principal_name) { + uint32_t sz = ifaces_.size(); + for (uint32_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get_delegation_token(_return, renewer_principal_name); + return; + } else { + ifaces_[i]->get_delegation_token(_return, renewer_principal_name); + } + } + } + + void get_delegation_token_with_signature(std::string& _return, const std::string& renewer_principal_name, const std::string& token_signature) { + uint32_t sz = ifaces_.size(); + for (uint32_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + ifaces_[i]->get_delegation_token_with_signature(_return, renewer_principal_name, token_signature); + return; + } else { + ifaces_[i]->get_delegation_token_with_signature(_return, renewer_principal_name, token_signature); + } + } + } + + int64_t renew_delegation_token(const std::string& token_str_form) { + uint32_t sz = ifaces_.size(); + for (uint32_t i = 0; i < sz; ++i) { + if (i == sz - 1) { + return ifaces_[i]->renew_delegation_token(token_str_form); + } else { + ifaces_[i]->renew_delegation_token(token_str_form); + } + } + } + + void cancel_delegation_token(const std::string& token_str_form) { + uint32_t sz = ifaces_.size(); + for (uint32_t i = 0; i < sz; ++i) { + ifaces_[i]->cancel_delegation_token(token_str_form); + } + } + }; }}} // namespace diff --git metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp index 9fcfac2..9deb250 100644 --- metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp +++ metastore/src/gen/thrift/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp @@ -217,6 +217,26 @@ class ThriftHiveMetastoreHandler : virtual public ThriftHiveMetastoreIf { printf("get_index_names\n"); } + void get_delegation_token(std::string& _return, const std::string& renewer_principal_name) { + // Your implementation goes here + printf("get_delegation_token\n"); + } + + void get_delegation_token_with_signature(std::string& _return, const std::string& renewer_principal_name, const std::string& token_signature) { + // Your implementation goes here + printf("get_delegation_token_with_signature\n"); + } + + int64_t renew_delegation_token(const std::string& token_str_form) { + // Your implementation goes here + printf("renew_delegation_token\n"); + } + + void cancel_delegation_token(const std::string& token_str_form) { + // Your implementation goes here + printf("cancel_delegation_token\n"); + } + }; int main(int argc, char **argv) { diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java index 555e89c..52ad21d 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java @@ -111,6 +111,14 @@ public class ThriftHiveMetastore { public List get_index_names(String db_name, String tbl_name, short max_indexes) throws MetaException, TException; + public String get_delegation_token(String renewer_principal_name) throws MetaException, TException; + + public String get_delegation_token_with_signature(String renewer_principal_name, String token_signature) throws MetaException, TException; + + public long renew_delegation_token(String token_str_form) throws MetaException, TException; + + public void cancel_delegation_token(String token_str_form) throws MetaException, TException; + } public interface AsyncIface extends com.facebook.fb303.FacebookService .AsyncIface { @@ -193,6 +201,14 @@ public class ThriftHiveMetastore { public void get_index_names(String db_name, String tbl_name, short max_indexes, AsyncMethodCallback resultHandler) throws TException; + public void get_delegation_token(String renewer_principal_name, AsyncMethodCallback resultHandler) throws TException; + + public void get_delegation_token_with_signature(String renewer_principal_name, String token_signature, AsyncMethodCallback resultHandler) throws TException; + + public void renew_delegation_token(String token_str_form, AsyncMethodCallback resultHandler) throws TException; + + public void cancel_delegation_token(String token_str_form, AsyncMethodCallback resultHandler) throws TException; + } public static class Client extends com.facebook.fb303.FacebookService.Client implements TServiceClient, Iface { @@ -1881,6 +1897,160 @@ public class ThriftHiveMetastore { throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_index_names failed: unknown result"); } + public String get_delegation_token(String renewer_principal_name) throws MetaException, TException + { + send_get_delegation_token(renewer_principal_name); + return recv_get_delegation_token(); + } + + public void send_get_delegation_token(String renewer_principal_name) throws TException + { + oprot_.writeMessageBegin(new TMessage("get_delegation_token", TMessageType.CALL, ++seqid_)); + get_delegation_token_args args = new get_delegation_token_args(); + args.setRenewer_principal_name(renewer_principal_name); + args.write(oprot_); + oprot_.writeMessageEnd(); + oprot_.getTransport().flush(); + } + + public String recv_get_delegation_token() throws MetaException, TException + { + TMessage msg = iprot_.readMessageBegin(); + if (msg.type == TMessageType.EXCEPTION) { + TApplicationException x = TApplicationException.read(iprot_); + iprot_.readMessageEnd(); + throw x; + } + if (msg.seqid != seqid_) { + throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "get_delegation_token failed: out of sequence response"); + } + get_delegation_token_result result = new get_delegation_token_result(); + result.read(iprot_); + iprot_.readMessageEnd(); + if (result.isSetSuccess()) { + return result.success; + } + if (result.o1 != null) { + throw result.o1; + } + throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_delegation_token failed: unknown result"); + } + + public String get_delegation_token_with_signature(String renewer_principal_name, String token_signature) throws MetaException, TException + { + send_get_delegation_token_with_signature(renewer_principal_name, token_signature); + return recv_get_delegation_token_with_signature(); + } + + public void send_get_delegation_token_with_signature(String renewer_principal_name, String token_signature) throws TException + { + oprot_.writeMessageBegin(new TMessage("get_delegation_token_with_signature", TMessageType.CALL, ++seqid_)); + get_delegation_token_with_signature_args args = new get_delegation_token_with_signature_args(); + args.setRenewer_principal_name(renewer_principal_name); + args.setToken_signature(token_signature); + args.write(oprot_); + oprot_.writeMessageEnd(); + oprot_.getTransport().flush(); + } + + public String recv_get_delegation_token_with_signature() throws MetaException, TException + { + TMessage msg = iprot_.readMessageBegin(); + if (msg.type == TMessageType.EXCEPTION) { + TApplicationException x = TApplicationException.read(iprot_); + iprot_.readMessageEnd(); + throw x; + } + if (msg.seqid != seqid_) { + throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "get_delegation_token_with_signature failed: out of sequence response"); + } + get_delegation_token_with_signature_result result = new get_delegation_token_with_signature_result(); + result.read(iprot_); + iprot_.readMessageEnd(); + if (result.isSetSuccess()) { + return result.success; + } + if (result.o1 != null) { + throw result.o1; + } + throw new TApplicationException(TApplicationException.MISSING_RESULT, "get_delegation_token_with_signature failed: unknown result"); + } + + public long renew_delegation_token(String token_str_form) throws MetaException, TException + { + send_renew_delegation_token(token_str_form); + return recv_renew_delegation_token(); + } + + public void send_renew_delegation_token(String token_str_form) throws TException + { + oprot_.writeMessageBegin(new TMessage("renew_delegation_token", TMessageType.CALL, ++seqid_)); + renew_delegation_token_args args = new renew_delegation_token_args(); + args.setToken_str_form(token_str_form); + args.write(oprot_); + oprot_.writeMessageEnd(); + oprot_.getTransport().flush(); + } + + public long recv_renew_delegation_token() throws MetaException, TException + { + TMessage msg = iprot_.readMessageBegin(); + if (msg.type == TMessageType.EXCEPTION) { + TApplicationException x = TApplicationException.read(iprot_); + iprot_.readMessageEnd(); + throw x; + } + if (msg.seqid != seqid_) { + throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "renew_delegation_token failed: out of sequence response"); + } + renew_delegation_token_result result = new renew_delegation_token_result(); + result.read(iprot_); + iprot_.readMessageEnd(); + if (result.isSetSuccess()) { + return result.success; + } + if (result.o1 != null) { + throw result.o1; + } + throw new TApplicationException(TApplicationException.MISSING_RESULT, "renew_delegation_token failed: unknown result"); + } + + public void cancel_delegation_token(String token_str_form) throws MetaException, TException + { + send_cancel_delegation_token(token_str_form); + recv_cancel_delegation_token(); + } + + public void send_cancel_delegation_token(String token_str_form) throws TException + { + oprot_.writeMessageBegin(new TMessage("cancel_delegation_token", TMessageType.CALL, ++seqid_)); + cancel_delegation_token_args args = new cancel_delegation_token_args(); + args.setToken_str_form(token_str_form); + args.write(oprot_); + oprot_.writeMessageEnd(); + oprot_.getTransport().flush(); + } + + public void recv_cancel_delegation_token() throws MetaException, TException + { + TMessage msg = iprot_.readMessageBegin(); + if (msg.type == TMessageType.EXCEPTION) { + TApplicationException x = TApplicationException.read(iprot_); + iprot_.readMessageEnd(); + throw x; + } + if (msg.seqid != seqid_) { + throw new TApplicationException(TApplicationException.BAD_SEQUENCE_ID, "cancel_delegation_token failed: out of sequence response"); + } + cancel_delegation_token_result result = new cancel_delegation_token_result(); + result.read(iprot_); + iprot_.readMessageEnd(); + if (result.o1 != null) { + throw result.o1; + } + return; + } + } public static class AsyncClient extends com.facebook.fb303.FacebookService.AsyncClient implements AsyncIface { public static class Factory implements TAsyncClientFactory { @@ -3261,6 +3431,133 @@ public class ThriftHiveMetastore { } } + public void get_delegation_token(String renewer_principal_name, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + get_delegation_token_call method_call = new get_delegation_token_call(renewer_principal_name, resultHandler, this, protocolFactory, transport); + manager.call(method_call); + } + + public static class get_delegation_token_call extends TAsyncMethodCall { + private String renewer_principal_name; + public get_delegation_token_call(String renewer_principal_name, AsyncMethodCallback resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.renewer_principal_name = renewer_principal_name; + } + + public void write_args(TProtocol prot) throws TException { + prot.writeMessageBegin(new TMessage("get_delegation_token", TMessageType.CALL, 0)); + get_delegation_token_args args = new get_delegation_token_args(); + args.setRenewer_principal_name(renewer_principal_name); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws MetaException, TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); + TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_get_delegation_token(); + } + } + + public void get_delegation_token_with_signature(String renewer_principal_name, String token_signature, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + get_delegation_token_with_signature_call method_call = new get_delegation_token_with_signature_call(renewer_principal_name, token_signature, resultHandler, this, protocolFactory, transport); + manager.call(method_call); + } + + public static class get_delegation_token_with_signature_call extends TAsyncMethodCall { + private String renewer_principal_name; + private String token_signature; + public get_delegation_token_with_signature_call(String renewer_principal_name, String token_signature, AsyncMethodCallback resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.renewer_principal_name = renewer_principal_name; + this.token_signature = token_signature; + } + + public void write_args(TProtocol prot) throws TException { + prot.writeMessageBegin(new TMessage("get_delegation_token_with_signature", TMessageType.CALL, 0)); + get_delegation_token_with_signature_args args = new get_delegation_token_with_signature_args(); + args.setRenewer_principal_name(renewer_principal_name); + args.setToken_signature(token_signature); + args.write(prot); + prot.writeMessageEnd(); + } + + public String getResult() throws MetaException, TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); + TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_get_delegation_token_with_signature(); + } + } + + public void renew_delegation_token(String token_str_form, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + renew_delegation_token_call method_call = new renew_delegation_token_call(token_str_form, resultHandler, this, protocolFactory, transport); + manager.call(method_call); + } + + public static class renew_delegation_token_call extends TAsyncMethodCall { + private String token_str_form; + public renew_delegation_token_call(String token_str_form, AsyncMethodCallback resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.token_str_form = token_str_form; + } + + public void write_args(TProtocol prot) throws TException { + prot.writeMessageBegin(new TMessage("renew_delegation_token", TMessageType.CALL, 0)); + renew_delegation_token_args args = new renew_delegation_token_args(); + args.setToken_str_form(token_str_form); + args.write(prot); + prot.writeMessageEnd(); + } + + public long getResult() throws MetaException, TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); + TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_renew_delegation_token(); + } + } + + public void cancel_delegation_token(String token_str_form, AsyncMethodCallback resultHandler) throws TException { + checkReady(); + cancel_delegation_token_call method_call = new cancel_delegation_token_call(token_str_form, resultHandler, this, protocolFactory, transport); + manager.call(method_call); + } + + public static class cancel_delegation_token_call extends TAsyncMethodCall { + private String token_str_form; + public cancel_delegation_token_call(String token_str_form, AsyncMethodCallback resultHandler, TAsyncClient client, TProtocolFactory protocolFactory, TNonblockingTransport transport) throws TException { + super(client, protocolFactory, transport, resultHandler, false); + this.token_str_form = token_str_form; + } + + public void write_args(TProtocol prot) throws TException { + prot.writeMessageBegin(new TMessage("cancel_delegation_token", TMessageType.CALL, 0)); + cancel_delegation_token_args args = new cancel_delegation_token_args(); + args.setToken_str_form(token_str_form); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws MetaException, TException { + if (getState() != State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + TMemoryInputTransport memoryTransport = new TMemoryInputTransport(getFrameBuffer().array()); + TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_cancel_delegation_token(); + } + } + } public static class Processor extends com.facebook.fb303.FacebookService.Processor implements TProcessor { @@ -3308,6 +3605,10 @@ public class ThriftHiveMetastore { processMap_.put("get_index_by_name", new get_index_by_name()); processMap_.put("get_indexes", new get_indexes()); processMap_.put("get_index_names", new get_index_names()); + processMap_.put("get_delegation_token", new get_delegation_token()); + processMap_.put("get_delegation_token_with_signature", new get_delegation_token_with_signature()); + processMap_.put("renew_delegation_token", new renew_delegation_token()); + processMap_.put("cancel_delegation_token", new cancel_delegation_token()); } private Iface iface_; @@ -4893,6 +5194,159 @@ public class ThriftHiveMetastore { } + private class get_delegation_token implements ProcessFunction { + public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException + { + get_delegation_token_args args = new get_delegation_token_args(); + try { + args.read(iprot); + } catch (TProtocolException e) { + iprot.readMessageEnd(); + TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); + oprot.writeMessageBegin(new TMessage("get_delegation_token", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + iprot.readMessageEnd(); + get_delegation_token_result result = new get_delegation_token_result(); + try { + result.success = iface_.get_delegation_token(args.renewer_principal_name); + } catch (MetaException o1) { + result.o1 = o1; + } catch (Throwable th) { + LOGGER.error("Internal error processing get_delegation_token", th); + TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing get_delegation_token"); + oprot.writeMessageBegin(new TMessage("get_delegation_token", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + oprot.writeMessageBegin(new TMessage("get_delegation_token", TMessageType.REPLY, seqid)); + result.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + } + + } + + private class get_delegation_token_with_signature implements ProcessFunction { + public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException + { + get_delegation_token_with_signature_args args = new get_delegation_token_with_signature_args(); + try { + args.read(iprot); + } catch (TProtocolException e) { + iprot.readMessageEnd(); + TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); + oprot.writeMessageBegin(new TMessage("get_delegation_token_with_signature", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + iprot.readMessageEnd(); + get_delegation_token_with_signature_result result = new get_delegation_token_with_signature_result(); + try { + result.success = iface_.get_delegation_token_with_signature(args.renewer_principal_name, args.token_signature); + } catch (MetaException o1) { + result.o1 = o1; + } catch (Throwable th) { + LOGGER.error("Internal error processing get_delegation_token_with_signature", th); + TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing get_delegation_token_with_signature"); + oprot.writeMessageBegin(new TMessage("get_delegation_token_with_signature", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + oprot.writeMessageBegin(new TMessage("get_delegation_token_with_signature", TMessageType.REPLY, seqid)); + result.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + } + + } + + private class renew_delegation_token implements ProcessFunction { + public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException + { + renew_delegation_token_args args = new renew_delegation_token_args(); + try { + args.read(iprot); + } catch (TProtocolException e) { + iprot.readMessageEnd(); + TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); + oprot.writeMessageBegin(new TMessage("renew_delegation_token", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + iprot.readMessageEnd(); + renew_delegation_token_result result = new renew_delegation_token_result(); + try { + result.success = iface_.renew_delegation_token(args.token_str_form); + result.setSuccessIsSet(true); + } catch (MetaException o1) { + result.o1 = o1; + } catch (Throwable th) { + LOGGER.error("Internal error processing renew_delegation_token", th); + TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing renew_delegation_token"); + oprot.writeMessageBegin(new TMessage("renew_delegation_token", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + oprot.writeMessageBegin(new TMessage("renew_delegation_token", TMessageType.REPLY, seqid)); + result.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + } + + } + + private class cancel_delegation_token implements ProcessFunction { + public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException + { + cancel_delegation_token_args args = new cancel_delegation_token_args(); + try { + args.read(iprot); + } catch (TProtocolException e) { + iprot.readMessageEnd(); + TApplicationException x = new TApplicationException(TApplicationException.PROTOCOL_ERROR, e.getMessage()); + oprot.writeMessageBegin(new TMessage("cancel_delegation_token", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + iprot.readMessageEnd(); + cancel_delegation_token_result result = new cancel_delegation_token_result(); + try { + iface_.cancel_delegation_token(args.token_str_form); + } catch (MetaException o1) { + result.o1 = o1; + } catch (Throwable th) { + LOGGER.error("Internal error processing cancel_delegation_token", th); + TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing cancel_delegation_token"); + oprot.writeMessageBegin(new TMessage("cancel_delegation_token", TMessageType.EXCEPTION, seqid)); + x.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + return; + } + oprot.writeMessageBegin(new TMessage("cancel_delegation_token", TMessageType.REPLY, seqid)); + result.write(oprot); + oprot.writeMessageEnd(); + oprot.getTransport().flush(); + } + + } + } public static class create_database_args implements TBase, java.io.Serializable, Cloneable { @@ -37998,4 +38452,2577 @@ public class ThriftHiveMetastore { } + public static class get_delegation_token_args implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("get_delegation_token_args"); + + private static final TField RENEWER_PRINCIPAL_NAME_FIELD_DESC = new TField("renewer_principal_name", TType.STRING, (short)1); + + private String renewer_principal_name; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + RENEWER_PRINCIPAL_NAME((short)1, "renewer_principal_name"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // RENEWER_PRINCIPAL_NAME + return RENEWER_PRINCIPAL_NAME; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.RENEWER_PRINCIPAL_NAME, new FieldMetaData("renewer_principal_name", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(get_delegation_token_args.class, metaDataMap); + } + + public get_delegation_token_args() { + } + + public get_delegation_token_args( + String renewer_principal_name) + { + this(); + this.renewer_principal_name = renewer_principal_name; + } + + /** + * Performs a deep copy on other. + */ + public get_delegation_token_args(get_delegation_token_args other) { + if (other.isSetRenewer_principal_name()) { + this.renewer_principal_name = other.renewer_principal_name; + } + } + + public get_delegation_token_args deepCopy() { + return new get_delegation_token_args(this); + } + + @Override + public void clear() { + this.renewer_principal_name = null; + } + + public String getRenewer_principal_name() { + return this.renewer_principal_name; + } + + public void setRenewer_principal_name(String renewer_principal_name) { + this.renewer_principal_name = renewer_principal_name; + } + + public void unsetRenewer_principal_name() { + this.renewer_principal_name = null; + } + + /** Returns true if field renewer_principal_name is set (has been asigned a value) and false otherwise */ + public boolean isSetRenewer_principal_name() { + return this.renewer_principal_name != null; + } + + public void setRenewer_principal_nameIsSet(boolean value) { + if (!value) { + this.renewer_principal_name = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case RENEWER_PRINCIPAL_NAME: + if (value == null) { + unsetRenewer_principal_name(); + } else { + setRenewer_principal_name((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case RENEWER_PRINCIPAL_NAME: + return getRenewer_principal_name(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case RENEWER_PRINCIPAL_NAME: + return isSetRenewer_principal_name(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_delegation_token_args) + return this.equals((get_delegation_token_args)that); + return false; + } + + public boolean equals(get_delegation_token_args that) { + if (that == null) + return false; + + boolean this_present_renewer_principal_name = true && this.isSetRenewer_principal_name(); + boolean that_present_renewer_principal_name = true && that.isSetRenewer_principal_name(); + if (this_present_renewer_principal_name || that_present_renewer_principal_name) { + if (!(this_present_renewer_principal_name && that_present_renewer_principal_name)) + return false; + if (!this.renewer_principal_name.equals(that.renewer_principal_name)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(get_delegation_token_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + get_delegation_token_args typedOther = (get_delegation_token_args)other; + + lastComparison = Boolean.valueOf(isSetRenewer_principal_name()).compareTo(typedOther.isSetRenewer_principal_name()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRenewer_principal_name()) { + lastComparison = TBaseHelper.compareTo(this.renewer_principal_name, typedOther.renewer_principal_name); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 1: // RENEWER_PRINCIPAL_NAME + if (field.type == TType.STRING) { + this.renewer_principal_name = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.renewer_principal_name != null) { + oprot.writeFieldBegin(RENEWER_PRINCIPAL_NAME_FIELD_DESC); + oprot.writeString(this.renewer_principal_name); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_delegation_token_args("); + boolean first = true; + + sb.append("renewer_principal_name:"); + if (this.renewer_principal_name == null) { + sb.append("null"); + } else { + sb.append(this.renewer_principal_name); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class get_delegation_token_result implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("get_delegation_token_result"); + + private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRING, (short)0); + private static final TField O1_FIELD_DESC = new TField("o1", TType.STRUCT, (short)1); + + private String success; + private MetaException o1; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + SUCCESS((short)0, "success"), + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + tmpMap.put(_Fields.O1, new FieldMetaData("o1", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(get_delegation_token_result.class, metaDataMap); + } + + public get_delegation_token_result() { + } + + public get_delegation_token_result( + String success, + MetaException o1) + { + this(); + this.success = success; + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public get_delegation_token_result(get_delegation_token_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public get_delegation_token_result deepCopy() { + return new get_delegation_token_result(this); + } + + @Override + public void clear() { + this.success = null; + this.o1 = null; + } + + public String getSuccess() { + return this.success; + } + + public void setSuccess(String success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been asigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been asigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_delegation_token_result) + return this.equals((get_delegation_token_result)that); + return false; + } + + public boolean equals(get_delegation_token_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(get_delegation_token_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + get_delegation_token_result typedOther = (get_delegation_token_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == TType.STRING) { + this.success = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 1: // O1 + if (field.type == TType.STRUCT) { + this.o1 = new MetaException(); + this.o1.read(iprot); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } else if (this.isSetO1()) { + oprot.writeFieldBegin(O1_FIELD_DESC); + this.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_delegation_token_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class get_delegation_token_with_signature_args implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("get_delegation_token_with_signature_args"); + + private static final TField RENEWER_PRINCIPAL_NAME_FIELD_DESC = new TField("renewer_principal_name", TType.STRING, (short)1); + private static final TField TOKEN_SIGNATURE_FIELD_DESC = new TField("token_signature", TType.STRING, (short)2); + + private String renewer_principal_name; + private String token_signature; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + RENEWER_PRINCIPAL_NAME((short)1, "renewer_principal_name"), + TOKEN_SIGNATURE((short)2, "token_signature"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // RENEWER_PRINCIPAL_NAME + return RENEWER_PRINCIPAL_NAME; + case 2: // TOKEN_SIGNATURE + return TOKEN_SIGNATURE; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.RENEWER_PRINCIPAL_NAME, new FieldMetaData("renewer_principal_name", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + tmpMap.put(_Fields.TOKEN_SIGNATURE, new FieldMetaData("token_signature", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(get_delegation_token_with_signature_args.class, metaDataMap); + } + + public get_delegation_token_with_signature_args() { + } + + public get_delegation_token_with_signature_args( + String renewer_principal_name, + String token_signature) + { + this(); + this.renewer_principal_name = renewer_principal_name; + this.token_signature = token_signature; + } + + /** + * Performs a deep copy on other. + */ + public get_delegation_token_with_signature_args(get_delegation_token_with_signature_args other) { + if (other.isSetRenewer_principal_name()) { + this.renewer_principal_name = other.renewer_principal_name; + } + if (other.isSetToken_signature()) { + this.token_signature = other.token_signature; + } + } + + public get_delegation_token_with_signature_args deepCopy() { + return new get_delegation_token_with_signature_args(this); + } + + @Override + public void clear() { + this.renewer_principal_name = null; + this.token_signature = null; + } + + public String getRenewer_principal_name() { + return this.renewer_principal_name; + } + + public void setRenewer_principal_name(String renewer_principal_name) { + this.renewer_principal_name = renewer_principal_name; + } + + public void unsetRenewer_principal_name() { + this.renewer_principal_name = null; + } + + /** Returns true if field renewer_principal_name is set (has been asigned a value) and false otherwise */ + public boolean isSetRenewer_principal_name() { + return this.renewer_principal_name != null; + } + + public void setRenewer_principal_nameIsSet(boolean value) { + if (!value) { + this.renewer_principal_name = null; + } + } + + public String getToken_signature() { + return this.token_signature; + } + + public void setToken_signature(String token_signature) { + this.token_signature = token_signature; + } + + public void unsetToken_signature() { + this.token_signature = null; + } + + /** Returns true if field token_signature is set (has been asigned a value) and false otherwise */ + public boolean isSetToken_signature() { + return this.token_signature != null; + } + + public void setToken_signatureIsSet(boolean value) { + if (!value) { + this.token_signature = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case RENEWER_PRINCIPAL_NAME: + if (value == null) { + unsetRenewer_principal_name(); + } else { + setRenewer_principal_name((String)value); + } + break; + + case TOKEN_SIGNATURE: + if (value == null) { + unsetToken_signature(); + } else { + setToken_signature((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case RENEWER_PRINCIPAL_NAME: + return getRenewer_principal_name(); + + case TOKEN_SIGNATURE: + return getToken_signature(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case RENEWER_PRINCIPAL_NAME: + return isSetRenewer_principal_name(); + case TOKEN_SIGNATURE: + return isSetToken_signature(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_delegation_token_with_signature_args) + return this.equals((get_delegation_token_with_signature_args)that); + return false; + } + + public boolean equals(get_delegation_token_with_signature_args that) { + if (that == null) + return false; + + boolean this_present_renewer_principal_name = true && this.isSetRenewer_principal_name(); + boolean that_present_renewer_principal_name = true && that.isSetRenewer_principal_name(); + if (this_present_renewer_principal_name || that_present_renewer_principal_name) { + if (!(this_present_renewer_principal_name && that_present_renewer_principal_name)) + return false; + if (!this.renewer_principal_name.equals(that.renewer_principal_name)) + return false; + } + + boolean this_present_token_signature = true && this.isSetToken_signature(); + boolean that_present_token_signature = true && that.isSetToken_signature(); + if (this_present_token_signature || that_present_token_signature) { + if (!(this_present_token_signature && that_present_token_signature)) + return false; + if (!this.token_signature.equals(that.token_signature)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(get_delegation_token_with_signature_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + get_delegation_token_with_signature_args typedOther = (get_delegation_token_with_signature_args)other; + + lastComparison = Boolean.valueOf(isSetRenewer_principal_name()).compareTo(typedOther.isSetRenewer_principal_name()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetRenewer_principal_name()) { + lastComparison = TBaseHelper.compareTo(this.renewer_principal_name, typedOther.renewer_principal_name); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetToken_signature()).compareTo(typedOther.isSetToken_signature()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetToken_signature()) { + lastComparison = TBaseHelper.compareTo(this.token_signature, typedOther.token_signature); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 1: // RENEWER_PRINCIPAL_NAME + if (field.type == TType.STRING) { + this.renewer_principal_name = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 2: // TOKEN_SIGNATURE + if (field.type == TType.STRING) { + this.token_signature = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.renewer_principal_name != null) { + oprot.writeFieldBegin(RENEWER_PRINCIPAL_NAME_FIELD_DESC); + oprot.writeString(this.renewer_principal_name); + oprot.writeFieldEnd(); + } + if (this.token_signature != null) { + oprot.writeFieldBegin(TOKEN_SIGNATURE_FIELD_DESC); + oprot.writeString(this.token_signature); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_delegation_token_with_signature_args("); + boolean first = true; + + sb.append("renewer_principal_name:"); + if (this.renewer_principal_name == null) { + sb.append("null"); + } else { + sb.append(this.renewer_principal_name); + } + first = false; + if (!first) sb.append(", "); + sb.append("token_signature:"); + if (this.token_signature == null) { + sb.append("null"); + } else { + sb.append(this.token_signature); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class get_delegation_token_with_signature_result implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("get_delegation_token_with_signature_result"); + + private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.STRING, (short)0); + private static final TField O1_FIELD_DESC = new TField("o1", TType.STRUCT, (short)1); + + private String success; + private MetaException o1; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + SUCCESS((short)0, "success"), + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + tmpMap.put(_Fields.O1, new FieldMetaData("o1", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(get_delegation_token_with_signature_result.class, metaDataMap); + } + + public get_delegation_token_with_signature_result() { + } + + public get_delegation_token_with_signature_result( + String success, + MetaException o1) + { + this(); + this.success = success; + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public get_delegation_token_with_signature_result(get_delegation_token_with_signature_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public get_delegation_token_with_signature_result deepCopy() { + return new get_delegation_token_with_signature_result(this); + } + + @Override + public void clear() { + this.success = null; + this.o1 = null; + } + + public String getSuccess() { + return this.success; + } + + public void setSuccess(String success) { + this.success = success; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been asigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been asigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((String)value); + } + break; + + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof get_delegation_token_with_signature_result) + return this.equals((get_delegation_token_with_signature_result)that); + return false; + } + + public boolean equals(get_delegation_token_with_signature_result that) { + if (that == null) + return false; + + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(get_delegation_token_with_signature_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + get_delegation_token_with_signature_result typedOther = (get_delegation_token_with_signature_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == TType.STRING) { + this.success = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 1: // O1 + if (field.type == TType.STRUCT) { + this.o1 = new MetaException(); + this.o1.read(iprot); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(this.success); + oprot.writeFieldEnd(); + } else if (this.isSetO1()) { + oprot.writeFieldBegin(O1_FIELD_DESC); + this.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("get_delegation_token_with_signature_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class renew_delegation_token_args implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("renew_delegation_token_args"); + + private static final TField TOKEN_STR_FORM_FIELD_DESC = new TField("token_str_form", TType.STRING, (short)1); + + private String token_str_form; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + TOKEN_STR_FORM((short)1, "token_str_form"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // TOKEN_STR_FORM + return TOKEN_STR_FORM; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.TOKEN_STR_FORM, new FieldMetaData("token_str_form", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(renew_delegation_token_args.class, metaDataMap); + } + + public renew_delegation_token_args() { + } + + public renew_delegation_token_args( + String token_str_form) + { + this(); + this.token_str_form = token_str_form; + } + + /** + * Performs a deep copy on other. + */ + public renew_delegation_token_args(renew_delegation_token_args other) { + if (other.isSetToken_str_form()) { + this.token_str_form = other.token_str_form; + } + } + + public renew_delegation_token_args deepCopy() { + return new renew_delegation_token_args(this); + } + + @Override + public void clear() { + this.token_str_form = null; + } + + public String getToken_str_form() { + return this.token_str_form; + } + + public void setToken_str_form(String token_str_form) { + this.token_str_form = token_str_form; + } + + public void unsetToken_str_form() { + this.token_str_form = null; + } + + /** Returns true if field token_str_form is set (has been asigned a value) and false otherwise */ + public boolean isSetToken_str_form() { + return this.token_str_form != null; + } + + public void setToken_str_formIsSet(boolean value) { + if (!value) { + this.token_str_form = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TOKEN_STR_FORM: + if (value == null) { + unsetToken_str_form(); + } else { + setToken_str_form((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TOKEN_STR_FORM: + return getToken_str_form(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case TOKEN_STR_FORM: + return isSetToken_str_form(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof renew_delegation_token_args) + return this.equals((renew_delegation_token_args)that); + return false; + } + + public boolean equals(renew_delegation_token_args that) { + if (that == null) + return false; + + boolean this_present_token_str_form = true && this.isSetToken_str_form(); + boolean that_present_token_str_form = true && that.isSetToken_str_form(); + if (this_present_token_str_form || that_present_token_str_form) { + if (!(this_present_token_str_form && that_present_token_str_form)) + return false; + if (!this.token_str_form.equals(that.token_str_form)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(renew_delegation_token_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + renew_delegation_token_args typedOther = (renew_delegation_token_args)other; + + lastComparison = Boolean.valueOf(isSetToken_str_form()).compareTo(typedOther.isSetToken_str_form()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetToken_str_form()) { + lastComparison = TBaseHelper.compareTo(this.token_str_form, typedOther.token_str_form); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 1: // TOKEN_STR_FORM + if (field.type == TType.STRING) { + this.token_str_form = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.token_str_form != null) { + oprot.writeFieldBegin(TOKEN_STR_FORM_FIELD_DESC); + oprot.writeString(this.token_str_form); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("renew_delegation_token_args("); + boolean first = true; + + sb.append("token_str_form:"); + if (this.token_str_form == null) { + sb.append("null"); + } else { + sb.append(this.token_str_form); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class renew_delegation_token_result implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("renew_delegation_token_result"); + + private static final TField SUCCESS_FIELD_DESC = new TField("success", TType.I64, (short)0); + private static final TField O1_FIELD_DESC = new TField("o1", TType.STRUCT, (short)1); + + private long success; + private MetaException o1; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + SUCCESS((short)0, "success"), + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __SUCCESS_ISSET_ID = 0; + private BitSet __isset_bit_vector = new BitSet(1); + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.I64))); + tmpMap.put(_Fields.O1, new FieldMetaData("o1", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(renew_delegation_token_result.class, metaDataMap); + } + + public renew_delegation_token_result() { + } + + public renew_delegation_token_result( + long success, + MetaException o1) + { + this(); + this.success = success; + setSuccessIsSet(true); + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public renew_delegation_token_result(renew_delegation_token_result other) { + __isset_bit_vector.clear(); + __isset_bit_vector.or(other.__isset_bit_vector); + this.success = other.success; + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public renew_delegation_token_result deepCopy() { + return new renew_delegation_token_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = 0; + this.o1 = null; + } + + public long getSuccess() { + return this.success; + } + + public void setSuccess(long success) { + this.success = success; + setSuccessIsSet(true); + } + + public void unsetSuccess() { + __isset_bit_vector.clear(__SUCCESS_ISSET_ID); + } + + /** Returns true if field success is set (has been asigned a value) and false otherwise */ + public boolean isSetSuccess() { + return __isset_bit_vector.get(__SUCCESS_ISSET_ID); + } + + public void setSuccessIsSet(boolean value) { + __isset_bit_vector.set(__SUCCESS_ISSET_ID, value); + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been asigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((Long)value); + } + break; + + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return new Long(getSuccess()); + + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof renew_delegation_token_result) + return this.equals((renew_delegation_token_result)that); + return false; + } + + public boolean equals(renew_delegation_token_result that) { + if (that == null) + return false; + + boolean this_present_success = true; + boolean that_present_success = true; + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (this.success != that.success) + return false; + } + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(renew_delegation_token_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + renew_delegation_token_result typedOther = (renew_delegation_token_result)other; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(typedOther.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = TBaseHelper.compareTo(this.success, typedOther.success); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 0: // SUCCESS + if (field.type == TType.I64) { + this.success = iprot.readI64(); + setSuccessIsSet(true); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + case 1: // O1 + if (field.type == TType.STRUCT) { + this.o1 = new MetaException(); + this.o1.read(iprot); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeI64(this.success); + oprot.writeFieldEnd(); + } else if (this.isSetO1()) { + oprot.writeFieldBegin(O1_FIELD_DESC); + this.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("renew_delegation_token_result("); + boolean first = true; + + sb.append("success:"); + sb.append(this.success); + first = false; + if (!first) sb.append(", "); + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class cancel_delegation_token_args implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("cancel_delegation_token_args"); + + private static final TField TOKEN_STR_FORM_FIELD_DESC = new TField("token_str_form", TType.STRING, (short)1); + + private String token_str_form; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + TOKEN_STR_FORM((short)1, "token_str_form"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // TOKEN_STR_FORM + return TOKEN_STR_FORM; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.TOKEN_STR_FORM, new FieldMetaData("token_str_form", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(cancel_delegation_token_args.class, metaDataMap); + } + + public cancel_delegation_token_args() { + } + + public cancel_delegation_token_args( + String token_str_form) + { + this(); + this.token_str_form = token_str_form; + } + + /** + * Performs a deep copy on other. + */ + public cancel_delegation_token_args(cancel_delegation_token_args other) { + if (other.isSetToken_str_form()) { + this.token_str_form = other.token_str_form; + } + } + + public cancel_delegation_token_args deepCopy() { + return new cancel_delegation_token_args(this); + } + + @Override + public void clear() { + this.token_str_form = null; + } + + public String getToken_str_form() { + return this.token_str_form; + } + + public void setToken_str_form(String token_str_form) { + this.token_str_form = token_str_form; + } + + public void unsetToken_str_form() { + this.token_str_form = null; + } + + /** Returns true if field token_str_form is set (has been asigned a value) and false otherwise */ + public boolean isSetToken_str_form() { + return this.token_str_form != null; + } + + public void setToken_str_formIsSet(boolean value) { + if (!value) { + this.token_str_form = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case TOKEN_STR_FORM: + if (value == null) { + unsetToken_str_form(); + } else { + setToken_str_form((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case TOKEN_STR_FORM: + return getToken_str_form(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case TOKEN_STR_FORM: + return isSetToken_str_form(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof cancel_delegation_token_args) + return this.equals((cancel_delegation_token_args)that); + return false; + } + + public boolean equals(cancel_delegation_token_args that) { + if (that == null) + return false; + + boolean this_present_token_str_form = true && this.isSetToken_str_form(); + boolean that_present_token_str_form = true && that.isSetToken_str_form(); + if (this_present_token_str_form || that_present_token_str_form) { + if (!(this_present_token_str_form && that_present_token_str_form)) + return false; + if (!this.token_str_form.equals(that.token_str_form)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(cancel_delegation_token_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + cancel_delegation_token_args typedOther = (cancel_delegation_token_args)other; + + lastComparison = Boolean.valueOf(isSetToken_str_form()).compareTo(typedOther.isSetToken_str_form()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetToken_str_form()) { + lastComparison = TBaseHelper.compareTo(this.token_str_form, typedOther.token_str_form); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 1: // TOKEN_STR_FORM + if (field.type == TType.STRING) { + this.token_str_form = iprot.readString(); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (this.token_str_form != null) { + oprot.writeFieldBegin(TOKEN_STR_FORM_FIELD_DESC); + oprot.writeString(this.token_str_form); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("cancel_delegation_token_args("); + boolean first = true; + + sb.append("token_str_form:"); + if (this.token_str_form == null) { + sb.append("null"); + } else { + sb.append(this.token_str_form); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + + public static class cancel_delegation_token_result implements TBase, java.io.Serializable, Cloneable { + private static final TStruct STRUCT_DESC = new TStruct("cancel_delegation_token_result"); + + private static final TField O1_FIELD_DESC = new TField("o1", TType.STRUCT, (short)1); + + private MetaException o1; + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements TFieldIdEnum { + O1((short)1, "o1"); + + private static final Map byName = new HashMap(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // O1 + return O1; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + + public static final Map<_Fields, FieldMetaData> metaDataMap; + static { + Map<_Fields, FieldMetaData> tmpMap = new EnumMap<_Fields, FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.O1, new FieldMetaData("o1", TFieldRequirementType.DEFAULT, + new FieldValueMetaData(TType.STRUCT))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + FieldMetaData.addStructMetaDataMap(cancel_delegation_token_result.class, metaDataMap); + } + + public cancel_delegation_token_result() { + } + + public cancel_delegation_token_result( + MetaException o1) + { + this(); + this.o1 = o1; + } + + /** + * Performs a deep copy on other. + */ + public cancel_delegation_token_result(cancel_delegation_token_result other) { + if (other.isSetO1()) { + this.o1 = new MetaException(other.o1); + } + } + + public cancel_delegation_token_result deepCopy() { + return new cancel_delegation_token_result(this); + } + + @Override + public void clear() { + this.o1 = null; + } + + public MetaException getO1() { + return this.o1; + } + + public void setO1(MetaException o1) { + this.o1 = o1; + } + + public void unsetO1() { + this.o1 = null; + } + + /** Returns true if field o1 is set (has been asigned a value) and false otherwise */ + public boolean isSetO1() { + return this.o1 != null; + } + + public void setO1IsSet(boolean value) { + if (!value) { + this.o1 = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case O1: + if (value == null) { + unsetO1(); + } else { + setO1((MetaException)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case O1: + return getO1(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case O1: + return isSetO1(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof cancel_delegation_token_result) + return this.equals((cancel_delegation_token_result)that); + return false; + } + + public boolean equals(cancel_delegation_token_result that) { + if (that == null) + return false; + + boolean this_present_o1 = true && this.isSetO1(); + boolean that_present_o1 = true && that.isSetO1(); + if (this_present_o1 || that_present_o1) { + if (!(this_present_o1 && that_present_o1)) + return false; + if (!this.o1.equals(that.o1)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + public int compareTo(cancel_delegation_token_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + cancel_delegation_token_result typedOther = (cancel_delegation_token_result)other; + + lastComparison = Boolean.valueOf(isSetO1()).compareTo(typedOther.isSetO1()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetO1()) { + lastComparison = TBaseHelper.compareTo(this.o1, typedOther.o1); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(TProtocol iprot) throws TException { + TField field; + iprot.readStructBegin(); + while (true) + { + field = iprot.readFieldBegin(); + if (field.type == TType.STOP) { + break; + } + switch (field.id) { + case 1: // O1 + if (field.type == TType.STRUCT) { + this.o1 = new MetaException(); + this.o1.read(iprot); + } else { + TProtocolUtil.skip(iprot, field.type); + } + break; + default: + TProtocolUtil.skip(iprot, field.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + validate(); + } + + public void write(TProtocol oprot) throws TException { + oprot.writeStructBegin(STRUCT_DESC); + + if (this.isSetO1()) { + oprot.writeFieldBegin(O1_FIELD_DESC); + this.o1.write(oprot); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("cancel_delegation_token_result("); + boolean first = true; + + sb.append("o1:"); + if (this.o1 == null) { + sb.append("null"); + } else { + sb.append(this.o1); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws TException { + // check for required fields + } + + } + } diff --git metastore/src/gen/thrift/gen-php/hive_metastore/ThriftHiveMetastore.php metastore/src/gen/thrift/gen-php/hive_metastore/ThriftHiveMetastore.php index 90764b6..ff91a8c 100644 --- metastore/src/gen/thrift/gen-php/hive_metastore/ThriftHiveMetastore.php +++ metastore/src/gen/thrift/gen-php/hive_metastore/ThriftHiveMetastore.php @@ -49,6 +49,10 @@ interface ThriftHiveMetastoreIf extends FacebookServiceIf { public function get_index_by_name($db_name, $tbl_name, $index_name); public function get_indexes($db_name, $tbl_name, $max_indexes); public function get_index_names($db_name, $tbl_name, $max_indexes); + public function get_delegation_token($renewer_principal_name); + public function get_delegation_token_with_signature($renewer_principal_name, $token_signature); + public function renew_delegation_token($token_str_form); + public function cancel_delegation_token($token_str_form); } class ThriftHiveMetastoreClient extends FacebookServiceClient implements ThriftHiveMetastoreIf { @@ -2306,6 +2310,220 @@ class ThriftHiveMetastoreClient extends FacebookServiceClient implements ThriftH throw new Exception("get_index_names failed: unknown result"); } + public function get_delegation_token($renewer_principal_name) + { + $this->send_get_delegation_token($renewer_principal_name); + return $this->recv_get_delegation_token(); + } + + public function send_get_delegation_token($renewer_principal_name) + { + $args = new metastore_ThriftHiveMetastore_get_delegation_token_args(); + $args->renewer_principal_name = $renewer_principal_name; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'get_delegation_token', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('get_delegation_token', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_get_delegation_token() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 'metastore_ThriftHiveMetastore_get_delegation_token_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new metastore_ThriftHiveMetastore_get_delegation_token_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new Exception("get_delegation_token failed: unknown result"); + } + + public function get_delegation_token_with_signature($renewer_principal_name, $token_signature) + { + $this->send_get_delegation_token_with_signature($renewer_principal_name, $token_signature); + return $this->recv_get_delegation_token_with_signature(); + } + + public function send_get_delegation_token_with_signature($renewer_principal_name, $token_signature) + { + $args = new metastore_ThriftHiveMetastore_get_delegation_token_with_signature_args(); + $args->renewer_principal_name = $renewer_principal_name; + $args->token_signature = $token_signature; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'get_delegation_token_with_signature', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('get_delegation_token_with_signature', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_get_delegation_token_with_signature() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 'metastore_ThriftHiveMetastore_get_delegation_token_with_signature_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new metastore_ThriftHiveMetastore_get_delegation_token_with_signature_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new Exception("get_delegation_token_with_signature failed: unknown result"); + } + + public function renew_delegation_token($token_str_form) + { + $this->send_renew_delegation_token($token_str_form); + return $this->recv_renew_delegation_token(); + } + + public function send_renew_delegation_token($token_str_form) + { + $args = new metastore_ThriftHiveMetastore_renew_delegation_token_args(); + $args->token_str_form = $token_str_form; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'renew_delegation_token', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('renew_delegation_token', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_renew_delegation_token() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 'metastore_ThriftHiveMetastore_renew_delegation_token_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new metastore_ThriftHiveMetastore_renew_delegation_token_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + if ($result->o1 !== null) { + throw $result->o1; + } + throw new Exception("renew_delegation_token failed: unknown result"); + } + + public function cancel_delegation_token($token_str_form) + { + $this->send_cancel_delegation_token($token_str_form); + $this->recv_cancel_delegation_token(); + } + + public function send_cancel_delegation_token($token_str_form) + { + $args = new metastore_ThriftHiveMetastore_cancel_delegation_token_args(); + $args->token_str_form = $token_str_form; + $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'cancel_delegation_token', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('cancel_delegation_token', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_cancel_delegation_token() + { + $bin_accel = ($this->input_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, 'metastore_ThriftHiveMetastore_cancel_delegation_token_result', $this->input_->isStrictRead()); + else + { + $rseqid = 0; + $fname = null; + $mtype = 0; + + $this->input_->readMessageBegin($fname, $mtype, $rseqid); + if ($mtype == TMessageType::EXCEPTION) { + $x = new TApplicationException(); + $x->read($this->input_); + $this->input_->readMessageEnd(); + throw $x; + } + $result = new metastore_ThriftHiveMetastore_cancel_delegation_token_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->o1 !== null) { + throw $result->o1; + } + return; + } + } // HELPER FUNCTIONS AND STRUCTURES @@ -11169,4 +11387,668 @@ class metastore_ThriftHiveMetastore_get_index_names_result { } +class metastore_ThriftHiveMetastore_get_delegation_token_args { + static $_TSPEC; + + public $renewer_principal_name = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'renewer_principal_name', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['renewer_principal_name'])) { + $this->renewer_principal_name = $vals['renewer_principal_name']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_get_delegation_token_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->renewer_principal_name); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_get_delegation_token_args'); + if ($this->renewer_principal_name !== null) { + $xfer += $output->writeFieldBegin('renewer_principal_name', TType::STRING, 1); + $xfer += $output->writeString($this->renewer_principal_name); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_get_delegation_token_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRING, + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => 'metastore_MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_get_delegation_token_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->success); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new metastore_MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_get_delegation_token_result'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::STRING, 0); + $xfer += $output->writeString($this->success); + $xfer += $output->writeFieldEnd(); + } + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_get_delegation_token_with_signature_args { + static $_TSPEC; + + public $renewer_principal_name = null; + public $token_signature = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'renewer_principal_name', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'token_signature', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['renewer_principal_name'])) { + $this->renewer_principal_name = $vals['renewer_principal_name']; + } + if (isset($vals['token_signature'])) { + $this->token_signature = $vals['token_signature']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_get_delegation_token_with_signature_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->renewer_principal_name); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->token_signature); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_get_delegation_token_with_signature_args'); + if ($this->renewer_principal_name !== null) { + $xfer += $output->writeFieldBegin('renewer_principal_name', TType::STRING, 1); + $xfer += $output->writeString($this->renewer_principal_name); + $xfer += $output->writeFieldEnd(); + } + if ($this->token_signature !== null) { + $xfer += $output->writeFieldBegin('token_signature', TType::STRING, 2); + $xfer += $output->writeString($this->token_signature); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_get_delegation_token_with_signature_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::STRING, + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => 'metastore_MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_get_delegation_token_with_signature_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->success); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new metastore_MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_get_delegation_token_with_signature_result'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::STRING, 0); + $xfer += $output->writeString($this->success); + $xfer += $output->writeFieldEnd(); + } + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_renew_delegation_token_args { + static $_TSPEC; + + public $token_str_form = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'token_str_form', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['token_str_form'])) { + $this->token_str_form = $vals['token_str_form']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_renew_delegation_token_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->token_str_form); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_renew_delegation_token_args'); + if ($this->token_str_form !== null) { + $xfer += $output->writeFieldBegin('token_str_form', TType::STRING, 1); + $xfer += $output->writeString($this->token_str_form); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_renew_delegation_token_result { + static $_TSPEC; + + public $success = null; + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::I64, + ), + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => 'metastore_MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_renew_delegation_token_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 0: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->success); + } else { + $xfer += $input->skip($ftype); + } + break; + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new metastore_MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_renew_delegation_token_result'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::I64, 0); + $xfer += $output->writeI64($this->success); + $xfer += $output->writeFieldEnd(); + } + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_cancel_delegation_token_args { + static $_TSPEC; + + public $token_str_form = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'token_str_form', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['token_str_form'])) { + $this->token_str_form = $vals['token_str_form']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_cancel_delegation_token_args'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->token_str_form); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_cancel_delegation_token_args'); + if ($this->token_str_form !== null) { + $xfer += $output->writeFieldBegin('token_str_form', TType::STRING, 1); + $xfer += $output->writeString($this->token_str_form); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class metastore_ThriftHiveMetastore_cancel_delegation_token_result { + static $_TSPEC; + + public $o1 = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'o1', + 'type' => TType::STRUCT, + 'class' => 'metastore_MetaException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['o1'])) { + $this->o1 = $vals['o1']; + } + } + } + + public function getName() { + return 'ThriftHiveMetastore_cancel_delegation_token_result'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRUCT) { + $this->o1 = new metastore_MetaException(); + $xfer += $this->o1->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('ThriftHiveMetastore_cancel_delegation_token_result'); + if ($this->o1 !== null) { + $xfer += $output->writeFieldBegin('o1', TType::STRUCT, 1); + $xfer += $this->o1->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + ?> diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote old mode 100644 new mode 100755 index e4c096f..d0ae149 --- metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote +++ metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore-remote @@ -60,6 +60,10 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print ' Index get_index_by_name(string db_name, string tbl_name, string index_name)' print ' get_indexes(string db_name, string tbl_name, i16 max_indexes)' print ' get_index_names(string db_name, string tbl_name, i16 max_indexes)' + print ' string get_delegation_token(string renewer_principal_name)' + print ' string get_delegation_token_with_signature(string renewer_principal_name, string token_signature)' + print ' i64 renew_delegation_token(string token_str_form)' + print ' void cancel_delegation_token(string token_str_form)' print '' sys.exit(0) @@ -344,6 +348,30 @@ elif cmd == 'get_index_names': sys.exit(1) pp.pprint(client.get_index_names(args[0],args[1],eval(args[2]),)) +elif cmd == 'get_delegation_token': + if len(args) != 1: + print 'get_delegation_token requires 1 args' + sys.exit(1) + pp.pprint(client.get_delegation_token(args[0],)) + +elif cmd == 'get_delegation_token_with_signature': + if len(args) != 2: + print 'get_delegation_token_with_signature requires 2 args' + sys.exit(1) + pp.pprint(client.get_delegation_token_with_signature(args[0],args[1],)) + +elif cmd == 'renew_delegation_token': + if len(args) != 1: + print 'renew_delegation_token requires 1 args' + sys.exit(1) + pp.pprint(client.renew_delegation_token(args[0],)) + +elif cmd == 'cancel_delegation_token': + if len(args) != 1: + print 'cancel_delegation_token requires 1 args' + sys.exit(1) + pp.pprint(client.cancel_delegation_token(args[0],)) + else: print 'Unrecognized method %s' % cmd sys.exit(1) diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py index 9a89024..26373cc 100644 --- metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py +++ metastore/src/gen/thrift/gen-py/hive_metastore/ThriftHiveMetastore.py @@ -341,6 +341,35 @@ class Iface(fb303.FacebookService.Iface): """ pass + def get_delegation_token(self, renewer_principal_name): + """ + Parameters: + - renewer_principal_name + """ + pass + + def get_delegation_token_with_signature(self, renewer_principal_name, token_signature): + """ + Parameters: + - renewer_principal_name + - token_signature + """ + pass + + def renew_delegation_token(self, token_str_form): + """ + Parameters: + - token_str_form + """ + pass + + def cancel_delegation_token(self, token_str_form): + """ + Parameters: + - token_str_form + """ + pass + class Client(fb303.FacebookService.Client, Iface): """ @@ -1758,6 +1787,134 @@ class Client(fb303.FacebookService.Client, Iface): raise result.o2 raise TApplicationException(TApplicationException.MISSING_RESULT, "get_index_names failed: unknown result"); + def get_delegation_token(self, renewer_principal_name): + """ + Parameters: + - renewer_principal_name + """ + self.send_get_delegation_token(renewer_principal_name) + return self.recv_get_delegation_token() + + def send_get_delegation_token(self, renewer_principal_name): + self._oprot.writeMessageBegin('get_delegation_token', TMessageType.CALL, self._seqid) + args = get_delegation_token_args() + args.renewer_principal_name = renewer_principal_name + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_get_delegation_token(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = get_delegation_token_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + if result.o1 != None: + raise result.o1 + raise TApplicationException(TApplicationException.MISSING_RESULT, "get_delegation_token failed: unknown result"); + + def get_delegation_token_with_signature(self, renewer_principal_name, token_signature): + """ + Parameters: + - renewer_principal_name + - token_signature + """ + self.send_get_delegation_token_with_signature(renewer_principal_name, token_signature) + return self.recv_get_delegation_token_with_signature() + + def send_get_delegation_token_with_signature(self, renewer_principal_name, token_signature): + self._oprot.writeMessageBegin('get_delegation_token_with_signature', TMessageType.CALL, self._seqid) + args = get_delegation_token_with_signature_args() + args.renewer_principal_name = renewer_principal_name + args.token_signature = token_signature + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_get_delegation_token_with_signature(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = get_delegation_token_with_signature_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + if result.o1 != None: + raise result.o1 + raise TApplicationException(TApplicationException.MISSING_RESULT, "get_delegation_token_with_signature failed: unknown result"); + + def renew_delegation_token(self, token_str_form): + """ + Parameters: + - token_str_form + """ + self.send_renew_delegation_token(token_str_form) + return self.recv_renew_delegation_token() + + def send_renew_delegation_token(self, token_str_form): + self._oprot.writeMessageBegin('renew_delegation_token', TMessageType.CALL, self._seqid) + args = renew_delegation_token_args() + args.token_str_form = token_str_form + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_renew_delegation_token(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = renew_delegation_token_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.success != None: + return result.success + if result.o1 != None: + raise result.o1 + raise TApplicationException(TApplicationException.MISSING_RESULT, "renew_delegation_token failed: unknown result"); + + def cancel_delegation_token(self, token_str_form): + """ + Parameters: + - token_str_form + """ + self.send_cancel_delegation_token(token_str_form) + self.recv_cancel_delegation_token() + + def send_cancel_delegation_token(self, token_str_form): + self._oprot.writeMessageBegin('cancel_delegation_token', TMessageType.CALL, self._seqid) + args = cancel_delegation_token_args() + args.token_str_form = token_str_form + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_cancel_delegation_token(self, ): + (fname, mtype, rseqid) = self._iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(self._iprot) + self._iprot.readMessageEnd() + raise x + result = cancel_delegation_token_result() + result.read(self._iprot) + self._iprot.readMessageEnd() + if result.o1 != None: + raise result.o1 + return + class Processor(fb303.FacebookService.Processor, Iface, TProcessor): def __init__(self, handler): @@ -1801,6 +1958,10 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor): self._processMap["get_index_by_name"] = Processor.process_get_index_by_name self._processMap["get_indexes"] = Processor.process_get_indexes self._processMap["get_index_names"] = Processor.process_get_index_names + self._processMap["get_delegation_token"] = Processor.process_get_delegation_token + self._processMap["get_delegation_token_with_signature"] = Processor.process_get_delegation_token_with_signature + self._processMap["renew_delegation_token"] = Processor.process_renew_delegation_token + self._processMap["cancel_delegation_token"] = Processor.process_cancel_delegation_token def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -2439,6 +2600,62 @@ class Processor(fb303.FacebookService.Processor, Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_get_delegation_token(self, seqid, iprot, oprot): + args = get_delegation_token_args() + args.read(iprot) + iprot.readMessageEnd() + result = get_delegation_token_result() + try: + result.success = self._handler.get_delegation_token(args.renewer_principal_name) + except MetaException, o1: + result.o1 = o1 + oprot.writeMessageBegin("get_delegation_token", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_get_delegation_token_with_signature(self, seqid, iprot, oprot): + args = get_delegation_token_with_signature_args() + args.read(iprot) + iprot.readMessageEnd() + result = get_delegation_token_with_signature_result() + try: + result.success = self._handler.get_delegation_token_with_signature(args.renewer_principal_name, args.token_signature) + except MetaException, o1: + result.o1 = o1 + oprot.writeMessageBegin("get_delegation_token_with_signature", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_renew_delegation_token(self, seqid, iprot, oprot): + args = renew_delegation_token_args() + args.read(iprot) + iprot.readMessageEnd() + result = renew_delegation_token_result() + try: + result.success = self._handler.renew_delegation_token(args.token_str_form) + except MetaException, o1: + result.o1 = o1 + oprot.writeMessageBegin("renew_delegation_token", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_cancel_delegation_token(self, seqid, iprot, oprot): + args = cancel_delegation_token_args() + args.read(iprot) + iprot.readMessageEnd() + result = cancel_delegation_token_result() + try: + self._handler.cancel_delegation_token(args.token_str_form) + except MetaException, o1: + result.o1 = o1 + oprot.writeMessageBegin("cancel_delegation_token", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -8732,3 +8949,524 @@ class get_index_names_result: def __ne__(self, other): return not (self == other) + +class get_delegation_token_args: + """ + Attributes: + - renewer_principal_name + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'renewer_principal_name', None, None, ), # 1 + ) + + def __init__(self, renewer_principal_name=None,): + self.renewer_principal_name = renewer_principal_name + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.renewer_principal_name = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('get_delegation_token_args') + if self.renewer_principal_name != None: + oprot.writeFieldBegin('renewer_principal_name', TType.STRING, 1) + oprot.writeString(self.renewer_principal_name) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class get_delegation_token_result: + """ + Attributes: + - success + - o1 + """ + + thrift_spec = ( + (0, TType.STRING, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, o1=None,): + self.success = success + self.o1 = o1 + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('get_delegation_token_result') + if self.success != None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success) + oprot.writeFieldEnd() + if self.o1 != None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class get_delegation_token_with_signature_args: + """ + Attributes: + - renewer_principal_name + - token_signature + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'renewer_principal_name', None, None, ), # 1 + (2, TType.STRING, 'token_signature', None, None, ), # 2 + ) + + def __init__(self, renewer_principal_name=None, token_signature=None,): + self.renewer_principal_name = renewer_principal_name + self.token_signature = token_signature + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.renewer_principal_name = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.token_signature = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('get_delegation_token_with_signature_args') + if self.renewer_principal_name != None: + oprot.writeFieldBegin('renewer_principal_name', TType.STRING, 1) + oprot.writeString(self.renewer_principal_name) + oprot.writeFieldEnd() + if self.token_signature != None: + oprot.writeFieldBegin('token_signature', TType.STRING, 2) + oprot.writeString(self.token_signature) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class get_delegation_token_with_signature_result: + """ + Attributes: + - success + - o1 + """ + + thrift_spec = ( + (0, TType.STRING, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, o1=None,): + self.success = success + self.o1 = o1 + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.STRING: + self.success = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('get_delegation_token_with_signature_result') + if self.success != None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success) + oprot.writeFieldEnd() + if self.o1 != None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class renew_delegation_token_args: + """ + Attributes: + - token_str_form + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'token_str_form', None, None, ), # 1 + ) + + def __init__(self, token_str_form=None,): + self.token_str_form = token_str_form + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.token_str_form = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('renew_delegation_token_args') + if self.token_str_form != None: + oprot.writeFieldBegin('token_str_form', TType.STRING, 1) + oprot.writeString(self.token_str_form) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class renew_delegation_token_result: + """ + Attributes: + - success + - o1 + """ + + thrift_spec = ( + (0, TType.I64, 'success', None, None, ), # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, success=None, o1=None,): + self.success = success + self.o1 = o1 + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 0: + if ftype == TType.I64: + self.success = iprot.readI64(); + else: + iprot.skip(ftype) + elif fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('renew_delegation_token_result') + if self.success != None: + oprot.writeFieldBegin('success', TType.I64, 0) + oprot.writeI64(self.success) + oprot.writeFieldEnd() + if self.o1 != None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class cancel_delegation_token_args: + """ + Attributes: + - token_str_form + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'token_str_form', None, None, ), # 1 + ) + + def __init__(self, token_str_form=None,): + self.token_str_form = token_str_form + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.token_str_form = iprot.readString(); + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('cancel_delegation_token_args') + if self.token_str_form != None: + oprot.writeFieldBegin('token_str_form', TType.STRING, 1) + oprot.writeString(self.token_str_form) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) + +class cancel_delegation_token_result: + """ + Attributes: + - o1 + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'o1', (MetaException, MetaException.thrift_spec), None, ), # 1 + ) + + def __init__(self, o1=None,): + self.o1 = o1 + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRUCT: + self.o1 = MetaException() + self.o1.read(iprot) + else: + iprot.skip(ftype) + else: + iprot.skip(ftype) + iprot.readFieldEnd() + iprot.readStructEnd() + + def write(self, oprot): + if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None: + oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec))) + return + oprot.writeStructBegin('cancel_delegation_token_result') + if self.o1 != None: + oprot.writeFieldBegin('o1', TType.STRUCT, 1) + self.o1.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + def validate(self): + return + + + def __repr__(self): + L = ['%s=%r' % (key, value) + for key, value in self.__dict__.iteritems()] + return '%s(%s)' % (self.__class__.__name__, ', '.join(L)) + + def __eq__(self, other): + return isinstance(other, self.__class__) and self.__dict__ == other.__dict__ + + def __ne__(self, other): + return not (self == other) diff --git metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb index 2a1268e..ed67ce5 100644 --- metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb +++ metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb @@ -667,6 +667,69 @@ module ThriftHiveMetastore raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_index_names failed: unknown result') end + def get_delegation_token(renewer_principal_name) + send_get_delegation_token(renewer_principal_name) + return recv_get_delegation_token() + end + + def send_get_delegation_token(renewer_principal_name) + send_message('get_delegation_token', Get_delegation_token_args, :renewer_principal_name => renewer_principal_name) + end + + def recv_get_delegation_token() + result = receive_message(Get_delegation_token_result) + return result.success unless result.success.nil? + raise result.o1 unless result.o1.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_delegation_token failed: unknown result') + end + + def get_delegation_token_with_signature(renewer_principal_name, token_signature) + send_get_delegation_token_with_signature(renewer_principal_name, token_signature) + return recv_get_delegation_token_with_signature() + end + + def send_get_delegation_token_with_signature(renewer_principal_name, token_signature) + send_message('get_delegation_token_with_signature', Get_delegation_token_with_signature_args, :renewer_principal_name => renewer_principal_name, :token_signature => token_signature) + end + + def recv_get_delegation_token_with_signature() + result = receive_message(Get_delegation_token_with_signature_result) + return result.success unless result.success.nil? + raise result.o1 unless result.o1.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_delegation_token_with_signature failed: unknown result') + end + + def renew_delegation_token(token_str_form) + send_renew_delegation_token(token_str_form) + return recv_renew_delegation_token() + end + + def send_renew_delegation_token(token_str_form) + send_message('renew_delegation_token', Renew_delegation_token_args, :token_str_form => token_str_form) + end + + def recv_renew_delegation_token() + result = receive_message(Renew_delegation_token_result) + return result.success unless result.success.nil? + raise result.o1 unless result.o1.nil? + raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'renew_delegation_token failed: unknown result') + end + + def cancel_delegation_token(token_str_form) + send_cancel_delegation_token(token_str_form) + recv_cancel_delegation_token() + end + + def send_cancel_delegation_token(token_str_form) + send_message('cancel_delegation_token', Cancel_delegation_token_args, :token_str_form => token_str_form) + end + + def recv_cancel_delegation_token() + result = receive_message(Cancel_delegation_token_result) + raise result.o1 unless result.o1.nil? + return + end + end class Processor < FacebookService::Processor @@ -1177,6 +1240,50 @@ module ThriftHiveMetastore write_result(result, oprot, 'get_index_names', seqid) end + def process_get_delegation_token(seqid, iprot, oprot) + args = read_args(iprot, Get_delegation_token_args) + result = Get_delegation_token_result.new() + begin + result.success = @handler.get_delegation_token(args.renewer_principal_name) + rescue MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'get_delegation_token', seqid) + end + + def process_get_delegation_token_with_signature(seqid, iprot, oprot) + args = read_args(iprot, Get_delegation_token_with_signature_args) + result = Get_delegation_token_with_signature_result.new() + begin + result.success = @handler.get_delegation_token_with_signature(args.renewer_principal_name, args.token_signature) + rescue MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'get_delegation_token_with_signature', seqid) + end + + def process_renew_delegation_token(seqid, iprot, oprot) + args = read_args(iprot, Renew_delegation_token_args) + result = Renew_delegation_token_result.new() + begin + result.success = @handler.renew_delegation_token(args.token_str_form) + rescue MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'renew_delegation_token', seqid) + end + + def process_cancel_delegation_token(seqid, iprot, oprot) + args = read_args(iprot, Cancel_delegation_token_args) + result = Cancel_delegation_token_result.new() + begin + @handler.cancel_delegation_token(args.token_str_form) + rescue MetaException => o1 + result.o1 = o1 + end + write_result(result, oprot, 'cancel_delegation_token', seqid) + end + end # HELPER FUNCTIONS AND STRUCTURES @@ -2672,5 +2779,141 @@ module ThriftHiveMetastore ::Thrift::Struct.generate_accessors self end + class Get_delegation_token_args + include ::Thrift::Struct, ::Thrift::Struct_Union + RENEWER_PRINCIPAL_NAME = 1 + + FIELDS = { + RENEWER_PRINCIPAL_NAME => {:type => ::Thrift::Types::STRING, :name => 'renewer_principal_name'} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Get_delegation_token_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + O1 = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Get_delegation_token_with_signature_args + include ::Thrift::Struct, ::Thrift::Struct_Union + RENEWER_PRINCIPAL_NAME = 1 + TOKEN_SIGNATURE = 2 + + FIELDS = { + RENEWER_PRINCIPAL_NAME => {:type => ::Thrift::Types::STRING, :name => 'renewer_principal_name'}, + TOKEN_SIGNATURE => {:type => ::Thrift::Types::STRING, :name => 'token_signature'} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Get_delegation_token_with_signature_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + O1 = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Renew_delegation_token_args + include ::Thrift::Struct, ::Thrift::Struct_Union + TOKEN_STR_FORM = 1 + + FIELDS = { + TOKEN_STR_FORM => {:type => ::Thrift::Types::STRING, :name => 'token_str_form'} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Renew_delegation_token_result + include ::Thrift::Struct, ::Thrift::Struct_Union + SUCCESS = 0 + O1 = 1 + + FIELDS = { + SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'}, + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Cancel_delegation_token_args + include ::Thrift::Struct, ::Thrift::Struct_Union + TOKEN_STR_FORM = 1 + + FIELDS = { + TOKEN_STR_FORM => {:type => ::Thrift::Types::STRING, :name => 'token_str_form'} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + + class Cancel_delegation_token_result + include ::Thrift::Struct, ::Thrift::Struct_Union + O1 = 1 + + FIELDS = { + O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => MetaException} + } + + def struct_fields; FIELDS; end + + def validate + end + + ::Thrift::Struct.generate_accessors self + end + end diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 1fe7581..8db3167 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -23,6 +23,7 @@ import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_C import static org.apache.hadoop.hive.metastore.MetaStoreUtils.DEFAULT_DATABASE_NAME; import static org.apache.hadoop.hive.metastore.MetaStoreUtils.validateName; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; @@ -57,6 +58,7 @@ import org.apache.hadoop.hive.metastore.hooks.JDOConnectionURLHook; import org.apache.hadoop.hive.serde2.Deserializer; import org.apache.hadoop.hive.serde2.SerDeException; import org.apache.hadoop.hive.serde2.SerDeUtils; +import org.apache.hadoop.hive.shims.DelegationTokenManagerShim; import org.apache.hadoop.hive.shims.ShimLoader; import org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge; import org.apache.hadoop.util.ReflectionUtils; @@ -80,6 +82,8 @@ public class HiveMetaStore extends ThriftHiveMetastore { public static final Log LOG = LogFactory.getLog( HiveMetaStore.class); + private static DelegationTokenManagerShim secretManager; + public static class HMSHandler extends FacebookBase implements ThriftHiveMetastore.Iface { public static final Log LOG = HiveMetaStore.LOG; @@ -2166,6 +2170,90 @@ public class HiveMetaStore extends ThriftHiveMetastore { return ret; } + @Override + public void cancel_delegation_token(String token_str_form) throws MetaException, TException { + incrementCounter("cancel_delegation_token"); + logStartFunction("cancel_delegation_token"); + try{ + + HiveMetaStore.cancelDelegationToken(token_str_form); + } catch(IOException e) { + throw new MetaException(e.getMessage()); + } + + } + + @Override + public String get_delegation_token_with_signature(String renewer_principal_name, String token_signature) throws MetaException, + TException { + incrementCounter("get_delegation_token_with_signature"); + logStartFunction("get_delegation_token_with_signature"); + try{ + return + HiveMetaStore.getDelegationToken(renewer_principal_name, token_signature); + } catch(IOException e) { + throw new MetaException(e.getMessage()); + } + } + + @Override + public long renew_delegation_token(String token_str_form) throws MetaException, TException { + incrementCounter("renew_delegation_token"); + logStartFunction("renew_delegation_token"); + try{ + + return HiveMetaStore.renewDelegationToken(token_str_form); + } catch(IOException e) { + throw new MetaException(e.getMessage()); + } } + + @Override + public String get_delegation_token(String renewer_principal_name) + throws MetaException, TException { + incrementCounter("get_delegation_token_with_signature"); + logStartFunction("get_delegation_token_with_signature"); + try{ + return + HiveMetaStore.getDelegationToken(renewer_principal_name); + } catch(IOException e) { + throw new MetaException(e.getMessage()); + } + } + } + + /** + * Discard a current delegation token. + */ + public static void cancelDelegationToken(String tokenStrForm + ) throws IOException { + + secretManager.cancelDelegationToken(tokenStrForm); + } + /** + * Get a new delegation token. + * @param token_signature + */ + public static String getDelegationToken(String renewer, String token_signature + )throws IOException { + + return secretManager.getDelegationToken(renewer, token_signature); + } + + /** + * Get a new delegation token. + * @param token_signature + */ + public static String getDelegationToken(String renewer)throws IOException { + + return secretManager.getDelegationToken(renewer); + } + /** + * Renew a delegation token to extend its lifetime. + */ + public static long renewDelegationToken(String tokenStrForm + ) throws IOException { + + return secretManager.renewDelegationToken(tokenStrForm); } /** @@ -2199,8 +2287,11 @@ public class HiveMetaStore extends ThriftHiveMetastore { HadoopThriftAuthBridge.Server authBridge = ShimLoader.getHadoopThriftAuthBridge().createServer( conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_KEYTAB_FILE), conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL)); - transFactory = authBridge.createTransportFactory(); - processor = authBridge.wrapProcessor(processor); + + // start delegation token manager + secretManager = ShimLoader.getTokenManagerShim(conf); + transFactory = authBridge.createTransportFactory(secretManager); + processor = authBridge.wrapProcessor(processor, secretManager); } else { transFactory = new TTransportFactory(); } diff --git metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java index b0e4e61..92feb28 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java @@ -66,6 +66,8 @@ public class HiveMetaStoreClient implements IMetaStoreClient { private final boolean standAloneClient = false; private final HiveMetaHookLoader hookLoader; private final HiveConf conf; + private String tokenStrForm; + private final boolean localMetaStore; // for thrift connects private int retries = 5; @@ -86,7 +88,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient { } this.conf = conf; - boolean localMetaStore = conf.getBoolean("hive.metastore.local", false); + localMetaStore = conf.getBoolean("hive.metastore.local", false); if (localMetaStore) { // instantiate the metastore server handler directly instead of connecting // through the network @@ -183,9 +185,29 @@ public class HiveMetaStoreClient implements IMetaStoreClient { try { HadoopThriftAuthBridge.Client authBridge = ShimLoader.getHadoopThriftAuthBridge().createClient(); + + // check if we should use delegation tokens to authenticate + + // the call below gets hold of the tokens if they are set up by hadoop + // this should happen on the map/reduce tasks if the client added the + // tokens into hadoop's credential store in the front end during job + // submission. + String tokenSig = conf.getVar(HiveConf.ConfVars.METASTORE_TOKEN_SIGNATURE); + if(tokenSig == null) { + tokenStrForm = ShimLoader.getHadoopShims().getTokenStrForm(); + } else { + tokenStrForm = ShimLoader.getHadoopShims().getTokenStrForm(tokenSig); + } + if(tokenStrForm != null) { + // authenticate using delegation tokens via the "DIGEST" mechanism + transport = authBridge.createClientTransport(null, store.getHost(), + "DIGEST", tokenStrForm, transport); + } else { String principalConfig = conf.getVar(HiveConf.ConfVars.METASTORE_KERBEROS_PRINCIPAL); transport = authBridge.createClientTransport( - principalConfig, store.getHost(), "KERBEROS",transport); + principalConfig, store.getHost(), "KERBEROS", null, + transport); + } } catch (IOException ioe) { LOG.error("Couldn't create client transport", ioe); throw new MetaException(ioe.toString()); @@ -217,6 +239,10 @@ public class HiveMetaStoreClient implements IMetaStoreClient { } } + public String getTokenStrForm() throws IOException { + return tokenStrForm; + } + public void close() { open = false; if ((transport != null) && transport.isOpen()) { @@ -918,4 +944,43 @@ public class HiveMetaStoreClient implements IMetaStoreClient { return client.drop_index_by_name(dbName, tblName, name, deleteData); } + @Override + public String getDelegationTokenWithSignature(String renewerPrincipalName, + String tokenSignature) throws + MetaException, TException { + if(localMetaStore) { + throw new UnsupportedOperationException("getDelegationToken() can be " + + "called only in thrift (non local) mode"); + } + return client.get_delegation_token_with_signature(renewerPrincipalName, tokenSignature); + } + + @Override + public String getDelegationToken(String renewerPrincipalName) throws + MetaException, TException { + if(localMetaStore) { + throw new UnsupportedOperationException("getDelegationToken() can be " + + "called only in thrift (non local) mode"); + } + return client.get_delegation_token(renewerPrincipalName); + } + + @Override + public long renewDelegationToken(String tokenStrForm) throws MetaException, TException { + if(localMetaStore) { + throw new UnsupportedOperationException("renewDelegationToken() can be " + + "called only in thrift (non local) mode"); + } + return client.renew_delegation_token(tokenStrForm); + + } + + @Override + public void cancelDelegationToken(String tokenStrForm) throws MetaException, TException { + if(localMetaStore) { + throw new UnsupportedOperationException("renewDelegationToken() can be " + + "called only in thrift (non local) mode"); + } + client.cancel_delegation_token(tokenStrForm); + } } diff --git metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java index ee3eed0..f92770f 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java @@ -478,4 +478,14 @@ public interface IMetaStoreClient { public boolean dropIndex(String db_name, String tbl_name, String name, boolean deleteData) throws NoSuchObjectException, MetaException, TException; + + public String getDelegationTokenWithSignature(String renewerPrincipalName, String tokenSignature) + throws MetaException, TException; + + public String getDelegationToken(String renewerPrincipalName) + throws MetaException, TException; + + public long renewDelegationToken(String tokenStrForm) throws MetaException, TException; + + public void cancelDelegationToken(String tokenStrForm) throws MetaException, TException; } diff --git shims/src/0.20/java/org/apache/hadoop/hive/shims/Hadoop20Shims.java shims/src/0.20/java/org/apache/hadoop/hive/shims/Hadoop20Shims.java index 981377f..739e24c 100644 --- shims/src/0.20/java/org/apache/hadoop/hive/shims/Hadoop20Shims.java +++ shims/src/0.20/java/org/apache/hadoop/hive/shims/Hadoop20Shims.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.List; + import javax.security.auth.login.LoginException; import org.apache.hadoop.conf.Configuration; @@ -49,8 +50,8 @@ import org.apache.hadoop.mapred.TaskID; import org.apache.hadoop.mapred.lib.CombineFileInputFormat; import org.apache.hadoop.mapred.lib.CombineFileSplit; import org.apache.hadoop.mapred.lib.NullOutputFormat; -import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.UnixUserGroupInformation; +import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.tools.HadoopArchives; import org.apache.hadoop.util.ToolRunner; @@ -449,4 +450,14 @@ public class Hadoop20Shims implements HadoopShims { } return ugi; } + + @Override + public String getTokenStrForm() throws IOException { + throw new UnsupportedOperationException("Tokens are not supported in current hadoop version"); + } + + @Override + public String getTokenStrForm(String tokenSignature) throws IOException { + throw new UnsupportedOperationException("Tokens are not supported in current hadoop version"); + } } diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java index 12e8834..63c291b 100644 --- shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java @@ -1,6 +1,3 @@ -package org.apache.hadoop.hive.shims; - - /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -19,14 +16,14 @@ package org.apache.hadoop.hive.shims; * limitations under the License. */ -//import org.apache.hadoop.classification.InterfaceAudience; +package org.apache.hadoop.hive.shims; + import org.apache.hadoop.io.Text; import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier; /** * A delegation token identifier that is specific to HDFS. */ -//@InterfaceAudience.Private public class DelegationTokenIdentifier extends AbstractDelegationTokenIdentifier { public static final Text HIVE_DELEGATION_KIND = new Text("HIVE_DELEGATION_TOKEN"); diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java index 078a5da..3c46389 100644 --- shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.apache.hadoop.hive.shims; diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java index 05d970e..0d78353 100644 --- shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java @@ -1,4 +1,3 @@ -package org.apache.hadoop.hive.shims; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,8 +16,8 @@ package org.apache.hadoop.hive.shims; * limitations under the License. */ +package org.apache.hadoop.hive.shims; -//import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager; /** @@ -26,7 +25,6 @@ import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecret * The secret manager is responsible for generating and accepting the password * for each token. */ -//@InterfaceAudience.Private public class DelegationTokenSecretManager extends AbstractDelegationTokenSecretManager { diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java index b04baba..86a74ff 100644 --- shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java @@ -1,4 +1,3 @@ -package org.apache.hadoop.hive.shims; /** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -17,14 +16,14 @@ package org.apache.hadoop.hive.shims; * limitations under the License. */ +package org.apache.hadoop.hive.shims; -//import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSelector; /** * A delegation token that is specialized for HDFS */ -//@InterfaceAudience.Private + public class DelegationTokenSelector extends AbstractDelegationTokenSelector{ diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java index deb7c0f..db0de0e 100644 --- shims/src/0.20S/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/Hadoop20SShims.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.List; -import javax.security.auth.login.LoginException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileStatus; @@ -50,6 +49,9 @@ import org.apache.hadoop.mapred.lib.CombineFileInputFormat; import org.apache.hadoop.mapred.lib.CombineFileSplit; import org.apache.hadoop.mapred.lib.NullOutputFormat; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.token.Token; +import org.apache.hadoop.security.token.TokenIdentifier; +import org.apache.hadoop.security.token.TokenSelector; import org.apache.hadoop.tools.HadoopArchives; import org.apache.hadoop.util.ToolRunner; @@ -443,4 +445,19 @@ public class Hadoop20SShims implements HadoopShims { public UserGroupInformation getUGIForConf(Configuration conf) throws IOException { return UserGroupInformation.getCurrentUser(); } + + @Override + public String getTokenStrForm() throws IOException { + return getTokenStrForm(null); + } + + @Override + public String getTokenStrForm(String tokenSignature) throws IOException { + UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); + TokenSelector tokenSelector = new DelegationTokenSelector(); + + Token token = tokenSelector.selectToken( + tokenSignature == null ? new Text() : new Text(tokenSignature), ugi.getTokens()); + return token != null ? token.encodeToUrlString() : null; + } } diff --git shims/src/0.20S/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge20S.java shims/src/0.20S/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge20S.java index b60e500..00d0748 100644 --- shims/src/0.20S/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge20S.java +++ shims/src/0.20S/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge20S.java @@ -15,21 +15,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.hadoop.hive.thrift; - import java.io.IOException; +import java.io.IOException; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; +import javax.security.auth.callback.Callback; +import javax.security.auth.callback.CallbackHandler; +import javax.security.auth.callback.NameCallback; +import javax.security.auth.callback.PasswordCallback; +import javax.security.auth.callback.UnsupportedCallbackException; +import javax.security.sasl.AuthorizeCallback; +import javax.security.sasl.RealmCallback; +import javax.security.sasl.RealmChoiceCallback; import javax.security.sasl.SaslException; +import javax.security.sasl.SaslServer; +import org.apache.commons.codec.binary.Base64; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.hive.shims.DelegationTokenIdentifier; +import org.apache.hadoop.hive.shims.DelegationTokenManager20SShim; +import org.apache.hadoop.hive.shims.DelegationTokenManagerShim; +import org.apache.hadoop.hive.shims.DelegationTokenSecretManager; import org.apache.hadoop.security.SaslRpcServer; +import org.apache.hadoop.security.SaslRpcServer.AuthMethod; import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.UserGroupInformation; -import org.apache.hadoop.security.SaslRpcServer.AuthMethod; +import org.apache.hadoop.security.token.SecretManager.InvalidToken; +import org.apache.hadoop.security.token.Token; +import org.apache.hadoop.security.token.TokenIdentifier; import org.apache.thrift.TException; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TProtocol; @@ -40,11 +56,11 @@ import org.apache.thrift.transport.TTransportException; import org.apache.thrift.transport.TTransportFactory; - /** +/** * Functions that bridge Thrift's SASL transports to Hadoop's * SASL callback handlers and authentication classes. */ - public class HadoopThriftAuthBridge20S extends HadoopThriftAuthBridge { +public class HadoopThriftAuthBridge20S extends HadoopThriftAuthBridge { static final Log LOG = LogFactory.getLog(HadoopThriftAuthBridge.class); @Override @@ -66,14 +82,27 @@ import org.apache.thrift.transport.TTransportFactory; * @param serverPrincipal The Kerberos principal of the target server. * @param underlyingTransport The underlying transport mechanism, usually a TSocket. */ + @Override public TTransport createClientTransport( String principalConfig, String host, - String methodStr, TTransport underlyingTransport) + String methodStr, String tokenStrForm, TTransport underlyingTransport) throws IOException { AuthMethod method = AuthMethod.valueOf(AuthMethod.class, methodStr); + TTransport saslTransport = null; switch (method) { + case DIGEST: + Token t= new Token(); + t.decodeFromUrlString(tokenStrForm); + saslTransport = new TSaslClientTransport( + method.getMechanismName(), + null, + null, SaslRpcServer.SASL_DEFAULT_REALM, + SaslRpcServer.SASL_PROPS, new SaslClientCallbackHandler(t), + underlyingTransport); + return new TUGIAssumingTransport(saslTransport, UserGroupInformation.getCurrentUser()); + case KERBEROS: String serverPrincipal = SecurityUtil.getServerPrincipal(principalConfig, host); String names[] = SaslRpcServer.splitKerberosName(serverPrincipal); @@ -83,7 +112,7 @@ import org.apache.thrift.transport.TTransportFactory; + serverPrincipal); } try { - TTransport saslTransport = new TSaslClientTransport( + saslTransport = new TSaslClientTransport( method.getMechanismName(), null, names[0], names[1], @@ -95,7 +124,64 @@ import org.apache.thrift.transport.TTransportFactory; } default: - throw new IOException("Unsupported authentication method: " +method); + throw new IOException("Unsupported authentication method: " + method); + } + } + private static class SaslClientCallbackHandler implements CallbackHandler { + private final String userName; + private final char[] userPassword; + + public SaslClientCallbackHandler(Token token) { + this.userName = encodeIdentifier(token.getIdentifier()); + this.userPassword = encodePassword(token.getPassword()); + } + + public void handle(Callback[] callbacks) + throws UnsupportedCallbackException { + NameCallback nc = null; + PasswordCallback pc = null; + RealmCallback rc = null; + for (Callback callback : callbacks) { + if (callback instanceof RealmChoiceCallback) { + continue; + } else if (callback instanceof NameCallback) { + nc = (NameCallback) callback; + } else if (callback instanceof PasswordCallback) { + pc = (PasswordCallback) callback; + } else if (callback instanceof RealmCallback) { + rc = (RealmCallback) callback; + } else { + throw new UnsupportedCallbackException(callback, + "Unrecognized SASL client callback"); + } + } + if (nc != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("SASL client callback: setting username: " + userName); + } + nc.setName(userName); + } + if (pc != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("SASL client callback: setting userPassword"); + } + pc.setPassword(userPassword); + } + if (rc != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("SASL client callback: setting realm: " + + rc.getDefaultText()); + } + rc.setText(rc.getDefaultText()); + } + } + + static String encodeIdentifier(byte[] identifier) { + return new String(Base64.encodeBase64(identifier)); + } + + static char[] encodePassword(byte[] password) { + return new String(Base64.encodeBase64(password)).toCharArray(); } } } @@ -137,13 +223,13 @@ import org.apache.thrift.transport.TTransportFactory; * */ @Override - public TTransportFactory createTransportFactory() throws TTransportException + public TTransportFactory createTransportFactory(DelegationTokenManagerShim secretManager) throws TTransportException { // Parse out the kerberos principal, host, realm. String kerberosName = realUgi.getUserName(); final String names[] = SaslRpcServer.splitKerberosName(kerberosName); if (names.length != 3) { - throw new TTransportException("Kerberos principal should have 3 parts: " +kerberosName); + throw new TTransportException("Kerberos principal should have 3 parts: " + kerberosName); } TSaslServerTransport.Factory transFactory = new TSaslServerTransport.Factory(); @@ -152,6 +238,11 @@ import org.apache.thrift.transport.TTransportFactory; names[0], names[1], // two parts of kerberos principal SaslRpcServer.SASL_PROPS, new SaslRpcServer.SaslGssCallbackHandler()); + transFactory.addServerDefinition(AuthMethod.DIGEST.getMechanismName(), + null, SaslRpcServer.SASL_DEFAULT_REALM, + SaslRpcServer.SASL_PROPS, new SaslDigestCallbackHandler( + ((DelegationTokenManager20SShim)secretManager). + getDelegationTokenSecretManager())); return new TUGIAssumingTransportFactory(transFactory, realUgi); } @@ -162,8 +253,85 @@ import org.apache.thrift.transport.TTransportFactory; * the SASL transport. */ @Override - public TProcessor wrapProcessor(TProcessor processor) { - return new TUGIAssumingProcessor(processor); + public TProcessor wrapProcessor(TProcessor processor, + DelegationTokenManagerShim secretManager) { + return new TUGIAssumingProcessor(processor, + ((DelegationTokenManager20SShim) secretManager). + getDelegationTokenSecretManager()); + } + + /** CallbackHandler for SASL DIGEST-MD5 mechanism */ + // This code is pretty much completely based on Hadoop's + // SaslRpcServer.SaslDigestCallbackHandler - the only reason we could not + // use that Hadoop class as-is was because it needs a Server.Connection object + // which is relevant in hadoop rpc but not here in the metastore - so the + // code below does not deal with the Connection Server.object. + public static class SaslDigestCallbackHandler implements CallbackHandler { + private final DelegationTokenSecretManager secretManager; + + public SaslDigestCallbackHandler( + DelegationTokenSecretManager secretManager) { + this.secretManager = secretManager; + } + + private char[] getPassword(DelegationTokenIdentifier tokenid) throws InvalidToken { + return encodePassword(secretManager.retrievePassword(tokenid)); + } + + private char[] encodePassword(byte[] password) { + return new String(Base64.encodeBase64(password)).toCharArray(); + } + /** {@inheritDoc} */ + @Override + public void handle(Callback[] callbacks) throws InvalidToken, + UnsupportedCallbackException { + NameCallback nc = null; + PasswordCallback pc = null; + AuthorizeCallback ac = null; + for (Callback callback : callbacks) { + if (callback instanceof AuthorizeCallback) { + ac = (AuthorizeCallback) callback; + } else if (callback instanceof NameCallback) { + nc = (NameCallback) callback; + } else if (callback instanceof PasswordCallback) { + pc = (PasswordCallback) callback; + } else if (callback instanceof RealmCallback) { + continue; // realm is ignored + } else { + throw new UnsupportedCallbackException(callback, + "Unrecognized SASL DIGEST-MD5 Callback"); + } + } + if (pc != null) { + DelegationTokenIdentifier tokenIdentifier = SaslRpcServer. + getIdentifier(nc.getDefaultName(), secretManager); + char[] password = getPassword(tokenIdentifier); + + if (LOG.isDebugEnabled()) { + LOG.debug("SASL server DIGEST-MD5 callback: setting password " + + "for client: " + tokenIdentifier.getUser()); + } + pc.setPassword(password); + } + if (ac != null) { + String authid = ac.getAuthenticationID(); + String authzid = ac.getAuthorizationID(); + if (authid.equals(authzid)) { + ac.setAuthorized(true); + } else { + ac.setAuthorized(false); + } + if (ac.isAuthorized()) { + if (LOG.isDebugEnabled()) { + String username = + SaslRpcServer.getIdentifier(authzid, secretManager).getUser().getUserName(); + LOG.debug("SASL server DIGEST-MD5 callback: setting " + + "canonicalized client ID: " + username); + } + ac.setAuthorizedID(authzid); + } + } + } } /** @@ -175,22 +343,36 @@ import org.apache.thrift.transport.TTransportFactory; */ private class TUGIAssumingProcessor implements TProcessor { final TProcessor wrapped; - - TUGIAssumingProcessor(TProcessor wrapped) { + DelegationTokenSecretManager secretManager; + TUGIAssumingProcessor(TProcessor wrapped, DelegationTokenSecretManager secretManager) { this.wrapped = wrapped; + this.secretManager = secretManager; } public boolean process(final TProtocol inProt, final TProtocol outProt) throws TException { TTransport trans = inProt.getTransport(); if (!(trans instanceof TSaslServerTransport)) { - throw new TException("Unexpected non-SASL transport " +trans.getClass()); + throw new TException("Unexpected non-SASL transport " + trans.getClass()); } TSaslServerTransport saslTrans = (TSaslServerTransport)trans; - String authId = saslTrans.getSaslServer().getAuthorizationID(); + SaslServer saslServer = saslTrans.getSaslServer(); + String authId = saslServer.getAuthorizationID(); + LOG.debug("AUTH ID ======>" + authId); + String endUser = authId; + if(saslServer.getMechanismName().equals("DIGEST-MD5")) { + try { + TokenIdentifier tokenId = SaslRpcServer.getIdentifier(authId, + secretManager); + endUser = tokenId.getUser().getUserName(); + } catch (InvalidToken e) { + throw new TException(e.getMessage()); + } + } try { UserGroupInformation clientUgi = UserGroupInformation.createProxyUser( - authId, UserGroupInformation.getLoginUser()); + endUser, UserGroupInformation.getLoginUser()); + return clientUgi.doAs(new PrivilegedExceptionAction() { public Boolean run() { try { @@ -369,4 +551,4 @@ import org.apache.thrift.transport.TTransportFactory; wrapped.consumeBuffer(len); } } - } +} diff --git shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java index b215e2a..410728e 100644 --- shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java +++ shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.apache.hadoop.hive.shims; import java.io.IOException; diff --git shims/src/common/java/org/apache/hadoop/hive/shims/HadoopShims.java shims/src/common/java/org/apache/hadoop/hive/shims/HadoopShims.java index ee3faf0..b79f3ac 100644 --- shims/src/common/java/org/apache/hadoop/hive/shims/HadoopShims.java +++ shims/src/common/java/org/apache/hadoop/hive/shims/HadoopShims.java @@ -21,6 +21,10 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; +import javax.security.auth.login.LoginException; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; @@ -35,10 +39,6 @@ import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.mapred.RunningJob; import org.apache.hadoop.mapred.TaskCompletionEvent; import org.apache.hadoop.security.UserGroupInformation; -import javax.security.auth.login.LoginException; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * In order to be compatible with multiple versions of Hadoop, all parts @@ -159,6 +159,33 @@ public interface HadoopShims { public UserGroupInformation getUGIForConf(Configuration conf) throws LoginException, IOException; /** + * + * @return the string form of any delegation tokens present in the job's credential store + * This is relevant only when running against a "secure" hadoop release + * The method gets hold of the tokens if they are set up by hadoop- this should + * happen on the map/reduce tasks if the client added the tokens into hadoop's + * credential store in the front end during job submission. The method will + * select the hive delegation token among the set of tokens and return the string + * form of it + * @throws IOException + */ + String getTokenStrForm() throws IOException; + + + /** + * + * @return the string form of any delegation tokens present in the job's credential store + * This is relevant only when running against a "secure" hadoop release + * The method gets hold of the tokens if they are set up by hadoop- this should + * happen on the map/reduce tasks if the client added the tokens into hadoop's + * credential store in the front end during job submission. The method will + * select the hive delegation token among the set of tokens and return the string + * form of it + * @throws IOException + */ + String getTokenStrForm(String tokenSignature) throws IOException; + + /** * InputSplitShim. * */ diff --git shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java index 27a3540..553e037 100644 --- shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java +++ shims/src/common/java/org/apache/hadoop/hive/shims/ShimLoader.java @@ -17,9 +17,11 @@ */ package org.apache.hadoop.hive.shims; +import java.io.IOException; import java.util.HashMap; import java.util.Map; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge; import org.apache.hadoop.util.VersionInfo; @@ -30,6 +32,7 @@ import org.apache.hadoop.util.VersionInfo; public abstract class ShimLoader { private static HadoopShims hadoopShims; private static JettyShims jettyShims; + private static DelegationTokenManagerShim dtManagerShim; /** * The names of the classes for shimming Hadoop for each major version. @@ -85,6 +88,20 @@ public abstract class ShimLoader { } } + public static synchronized DelegationTokenManagerShim getTokenManagerShim(Configuration conf) throws IOException { + if ("0.20S".equals(getMajorVersion())) { + if(dtManagerShim == null) { + dtManagerShim = createShim("org.apache.hadoop.hive.shims.DelegationTokenManager20SShim", + DelegationTokenManagerShim.class); + dtManagerShim.initialize(conf); + } + return dtManagerShim; + } else { + throw new UnsupportedOperationException("Delegation Token manager shim instance can only be created" + + " for versions of hadoop which support security"); + } + } + @SuppressWarnings("unchecked") private static T loadShims(Map classMap, Class xface) { String vers = getMajorVersion(); diff --git shims/src/common/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java shims/src/common/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java index e8d0598..7f9e62d 100644 --- shims/src/common/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java +++ shims/src/common/java/org/apache/hadoop/hive/thrift/HadoopThriftAuthBridge.java @@ -20,6 +20,7 @@ import java.io.IOException; +import org.apache.hadoop.hive.shims.DelegationTokenManagerShim; import org.apache.thrift.TProcessor; import org.apache.thrift.transport.TTransport; import org.apache.thrift.transport.TTransportException; @@ -42,17 +43,43 @@ import org.apache.thrift.transport.TTransportFactory; "The current version of Hadoop does not support Authentication"); } + /** + * + * @param principalConfig In the case of Kerberos authentication this will + * be the kerberos principal name, for DIGEST-MD5 (delegation token) based + * authentication this will be null + * @param host The metastore server host name + * @param methodStr "KERBEROS" or "DIGEST" + * @param token This is url encoded string form of + * org.apache.hadoop.security.token. + * @param underlyingTransport the underlying transport + * @return + * @throws IOException + */ public static abstract class Client { public abstract TTransport createClientTransport( String principalConfig, String host, - String methodStr, TTransport underlyingTransport) + String methodStr,String tokenStrForm, TTransport underlyingTransport) throws IOException; } + /** + * + * @param secretManager an instance of + * org.apache.hadoop.hive.metastore.security.DelegationTokenSecretManager, + * the reason the type is Object is so that the shims will compile against + * non secure hadoop versions + * @return A secure {@link TTransportFactory} + * @throws TTransportException + */ + public static abstract class Server { - public abstract TTransportFactory createTransportFactory() throws TTransportException; - public abstract TProcessor wrapProcessor(TProcessor processor); + + public abstract TTransportFactory createTransportFactory( + DelegationTokenManagerShim secretManager) throws TTransportException; + + public abstract TProcessor wrapProcessor(TProcessor processor, DelegationTokenManagerShim secretManager); } } diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java new file mode 100644 index 0000000..12e8834 --- /dev/null +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenIdentifier.java @@ -0,0 +1,55 @@ +package org.apache.hadoop.hive.shims; + + +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +//import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier; + +/** + * A delegation token identifier that is specific to HDFS. + */ +//@InterfaceAudience.Private +public class DelegationTokenIdentifier + extends AbstractDelegationTokenIdentifier { + public static final Text HIVE_DELEGATION_KIND = new Text("HIVE_DELEGATION_TOKEN"); + + /** + * Create an empty delegation token identifier for reading into. + */ + public DelegationTokenIdentifier() { + } + + /** + * Create a new delegation token identifier + * @param owner the effective username of the token owner + * @param renewer the username of the renewer + * @param realUser the real username of the token owner + */ + public DelegationTokenIdentifier(Text owner, Text renewer, Text realUser) { + super(owner, renewer, realUser); + } + + @Override + public Text getKind() { + return HIVE_DELEGATION_KIND; + } + +} diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java new file mode 100644 index 0000000..078a5da --- /dev/null +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenManager20SShim.java @@ -0,0 +1,94 @@ +package org.apache.hadoop.hive.shims; + + +import java.io.IOException; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.io.Text; +import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.security.token.Token; + +public class DelegationTokenManager20SShim extends DelegationTokenManagerShim { + + private final static long DELEGATION_TOKEN_GC_INTERVAL = 3600000; // 1 hour + private static DelegationTokenSecretManager secretManager; + + //Delegation token related keys + public static final String DELEGATION_KEY_UPDATE_INTERVAL_KEY = + "mapreduce.cluster.delegation.key.update-interval"; + public static final long DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT = + 24*60*60*1000; // 1 day + public static final String DELEGATION_TOKEN_RENEW_INTERVAL_KEY = + "mapreduce.cluster.delegation.token.renew-interval"; + public static final long DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT = + 24*60*60*1000; // 1 day + public static final String DELEGATION_TOKEN_MAX_LIFETIME_KEY = + "mapreduce.cluster.delegation.token.max-lifetime"; + public static final long DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT = + 7*24*60*60*1000; // 7 days + private static DelegationTokenManager20SShim self; // singleton instance + + @Override + public void initialize(Configuration conf) throws IOException { + // start delegation token manager + long secretKeyInterval = + conf.getLong(DELEGATION_KEY_UPDATE_INTERVAL_KEY, + DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT); + long tokenMaxLifetime = + conf.getLong(DELEGATION_TOKEN_MAX_LIFETIME_KEY, + DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT); + long tokenRenewInterval = + conf.getLong(DELEGATION_TOKEN_RENEW_INTERVAL_KEY, + DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT); + secretManager = + new DelegationTokenSecretManager(secretKeyInterval, + tokenMaxLifetime, + tokenRenewInterval, + DELEGATION_TOKEN_GC_INTERVAL); + secretManager.startThreads(); + + } + + @Override + public synchronized void cancelDelegationToken(String tokenStrForm) throws IOException { + Token t= new Token(); + t.decodeFromUrlString(tokenStrForm); + String user = UserGroupInformation.getCurrentUser().getUserName(); + secretManager.cancelToken(t, user); + } + + @Override + public synchronized long renewDelegationToken(String tokenStrForm) throws IOException { + Token t= new Token(); + t.decodeFromUrlString(tokenStrForm); + String user = UserGroupInformation.getCurrentUser().getUserName(); + return secretManager.renewToken(t, user); + } + + @Override + public synchronized String getDelegationToken(String renewer, String tokenSignature) throws IOException { + UserGroupInformation ugi = UserGroupInformation.getCurrentUser(); + Text owner = new Text(ugi.getUserName()); + Text realUser = null; + if (ugi.getRealUser() != null) { + realUser = new Text(ugi.getRealUser().getUserName()); + } + DelegationTokenIdentifier ident = + new DelegationTokenIdentifier(owner, new Text(renewer), realUser); + Token t = new Token( + ident, secretManager); + if(tokenSignature != null) { + t.setService(new Text(tokenSignature)); + } + return t.encodeToUrlString(); + } + + @Override + public synchronized String getDelegationToken(String renewer) throws IOException { + return getDelegationToken(renewer, null); + } + + public DelegationTokenSecretManager getDelegationTokenSecretManager() { + return secretManager; + } +} diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java new file mode 100644 index 0000000..05d970e --- /dev/null +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSecretManager.java @@ -0,0 +1,57 @@ +package org.apache.hadoop.hive.shims; +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +//import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSecretManager; + +/** + * A MapReduce specific delegation token secret manager. + * The secret manager is responsible for generating and accepting the password + * for each token. + */ +//@InterfaceAudience.Private +public class DelegationTokenSecretManager + extends AbstractDelegationTokenSecretManager { + + /** + * Create a secret manager + * @param delegationKeyUpdateInterval the number of seconds for rolling new + * secret keys. + * @param delegationTokenMaxLifetime the maximum lifetime of the delegation + * tokens + * @param delegationTokenRenewInterval how often the tokens must be renewed + * @param delegationTokenRemoverScanInterval how often the tokens are scanned + * for expired tokens + */ + public DelegationTokenSecretManager(long delegationKeyUpdateInterval, + long delegationTokenMaxLifetime, + long delegationTokenRenewInterval, + long delegationTokenRemoverScanInterval) { + super(delegationKeyUpdateInterval, delegationTokenMaxLifetime, + delegationTokenRenewInterval, delegationTokenRemoverScanInterval); + } + + @Override + public DelegationTokenIdentifier createIdentifier() { + return new DelegationTokenIdentifier(); + } + +} + diff --git shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java new file mode 100644 index 0000000..b04baba --- /dev/null +++ shims/src/0.20S/java/org/apache/hadoop/hive/shims/DelegationTokenSelector.java @@ -0,0 +1,34 @@ +package org.apache.hadoop.hive.shims; +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +//import org.apache.hadoop.classification.InterfaceAudience; +import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenSelector; + +/** + * A delegation token that is specialized for HDFS + */ +//@InterfaceAudience.Private +public class DelegationTokenSelector + extends AbstractDelegationTokenSelector{ + + public DelegationTokenSelector() { + super(DelegationTokenIdentifier.HIVE_DELEGATION_KIND); + } +} diff --git shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java new file mode 100644 index 0000000..b215e2a --- /dev/null +++ shims/src/common/java/org/apache/hadoop/hive/shims/DelegationTokenManagerShim.java @@ -0,0 +1,20 @@ +package org.apache.hadoop.hive.shims; + +import java.io.IOException; + +import org.apache.hadoop.conf.Configuration; + +public abstract class DelegationTokenManagerShim { + + public abstract String getDelegationToken(String renewer, String tokenSignature) throws IOException; + + public abstract long renewDelegationToken(String tokenStrForm) throws IOException; + + public abstract void cancelDelegationToken(String tokenStrForm) throws IOException; + + public abstract void initialize(Configuration conf) throws IOException; + + public abstract String getDelegationToken(String renewer) throws IOException; + + +}