You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by zs...@apache.org on 2010/01/08 06:57:14 UTC
svn commit: r897109 - in /hadoop/hive/trunk: ./ metastore/if/
metastore/src/gen-cpp/
metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/
metastore/src/gen-php/ metastore/src/gen-py/hive_metastore/
metastore/src/java/org/apache/hadoop/hive/...
Author: zshao
Date: Fri Jan 8 05:56:50 2010
New Revision: 897109
URL: http://svn.apache.org/viewvc?rev=897109&view=rev
Log:
HIVE-1036. Add API Method to Query HiveConf Values of the Metastore. (Paul Yang via zshao)
Added:
hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ConfigValSecurityException.java
Modified:
hadoop/hive/trunk/CHANGES.txt
hadoop/hive/trunk/metastore/if/hive_metastore.thrift
hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.cpp
hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.h
hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp
hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.cpp
hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.h
hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java
hadoop/hive/trunk/metastore/src/gen-php/ThriftHiveMetastore.php
hadoop/hive/trunk/metastore/src/gen-php/hive_metastore_types.php
hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore-remote
hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore.py
hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ttypes.py
hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
hadoop/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java
Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Fri Jan 8 05:56:50 2010
@@ -101,6 +101,9 @@
HIVE-1015 Java MapReduce wrapper for TRANSFORM/MAP/REDUCE scripts
(Larry Odrognek via namit)
+ HIVE-1036. Add API Method to Query HiveConf Values of the Metastore.
+ (Paul Yang via zshao)
+
IMPROVEMENTS
HIVE-760. Add version info to META-INF/MANIFEST.MF.
Modified: hadoop/hive/trunk/metastore/if/hive_metastore.thrift
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/if/hive_metastore.thrift?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/if/hive_metastore.thrift (original)
+++ hadoop/hive/trunk/metastore/if/hive_metastore.thrift Fri Jan 8 05:56:50 2010
@@ -136,6 +136,10 @@
1: string message
}
+exception ConfigValSecurityException {
+ 1: string message
+}
+
/**
* This interface is live.
*/
@@ -202,6 +206,13 @@
// in the new_part
void alter_partition(1:string db_name, 2:string tbl_name, 3:Partition new_part)
throws(1:InvalidOperationException o1, 2:MetaException o2)
+
+ // gets the value of the configuration key in the metastore server. returns
+ // defaultValue if the key does not exist. if the configuration key does not
+ // begin with "hive", "mapred", or "hdfs", a ConfigValSecurityException is
+ // thrown.
+ string get_config_value(1:string name, 2:string defaultValue)
+ throws(1:ConfigValSecurityException o1)
}
// these should be needed only for backward compatibility with filestore
Modified: hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.cpp
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.cpp?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.cpp (original)
+++ hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.cpp Fri Jan 8 05:56:50 2010
@@ -4872,6 +4872,198 @@
return xfer;
}
+uint32_t ThriftHiveMetastore_get_config_value_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->name);
+ this->__isset.name = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 2:
+ if (ftype == apache::thrift::protocol::T_STRING) {
+ xfer += iprot->readString(this->defaultValue);
+ this->__isset.defaultValue = 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_config_value_args::write(apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_config_value_args");
+ xfer += oprot->writeFieldBegin("name", apache::thrift::protocol::T_STRING, 1);
+ xfer += oprot->writeString(this->name);
+ xfer += oprot->writeFieldEnd();
+ xfer += oprot->writeFieldBegin("defaultValue", apache::thrift::protocol::T_STRING, 2);
+ xfer += oprot->writeString(this->defaultValue);
+ xfer += oprot->writeFieldEnd();
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+uint32_t ThriftHiveMetastore_get_config_value_pargs::write(apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_config_value_pargs");
+ xfer += oprot->writeFieldBegin("name", apache::thrift::protocol::T_STRING, 1);
+ xfer += oprot->writeString((*(this->name)));
+ xfer += oprot->writeFieldEnd();
+ xfer += oprot->writeFieldBegin("defaultValue", apache::thrift::protocol::T_STRING, 2);
+ xfer += oprot->writeString((*(this->defaultValue)));
+ xfer += oprot->writeFieldEnd();
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+uint32_t ThriftHiveMetastore_get_config_value_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_config_value_result::write(apache::thrift::protocol::TProtocol* oprot) const {
+
+ uint32_t xfer = 0;
+
+ xfer += oprot->writeStructBegin("ThriftHiveMetastore_get_config_value_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_config_value_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;
+}
+
bool ThriftHiveMetastoreClient::create_database(const std::string& name, const std::string& description)
{
send_create_database(name, description);
@@ -6322,6 +6514,70 @@
return;
}
+void ThriftHiveMetastoreClient::get_config_value(std::string& _return, const std::string& name, const std::string& defaultValue)
+{
+ send_get_config_value(name, defaultValue);
+ recv_get_config_value(_return);
+}
+
+void ThriftHiveMetastoreClient::send_get_config_value(const std::string& name, const std::string& defaultValue)
+{
+ int32_t cseqid = 0;
+ oprot_->writeMessageBegin("get_config_value", apache::thrift::protocol::T_CALL, cseqid);
+
+ ThriftHiveMetastore_get_config_value_pargs args;
+ args.name = &name;
+ args.defaultValue = &defaultValue;
+ args.write(oprot_);
+
+ oprot_->writeMessageEnd();
+ oprot_->getTransport()->flush();
+ oprot_->getTransport()->writeEnd();
+}
+
+void ThriftHiveMetastoreClient::recv_get_config_value(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_config_value") != 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_config_value_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_config_value failed: unknown result");
+}
+
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();
@@ -7099,5 +7355,36 @@
oprot->getTransport()->writeEnd();
}
+void ThriftHiveMetastoreProcessor::process_get_config_value(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot)
+{
+ ThriftHiveMetastore_get_config_value_args args;
+ args.read(iprot);
+ iprot->readMessageEnd();
+ iprot->getTransport()->readEnd();
+
+ ThriftHiveMetastore_get_config_value_result result;
+ try {
+ iface_->get_config_value(result.success, args.name, args.defaultValue);
+ result.__isset.success = true;
+ } catch (ConfigValSecurityException &o1) {
+ result.o1 = o1;
+ result.__isset.o1 = true;
+ } catch (const std::exception& e) {
+ apache::thrift::TApplicationException x(e.what());
+ oprot->writeMessageBegin("get_config_value", apache::thrift::protocol::T_EXCEPTION, seqid);
+ x.write(oprot);
+ oprot->writeMessageEnd();
+ oprot->getTransport()->flush();
+ oprot->getTransport()->writeEnd();
+ return;
+ }
+
+ oprot->writeMessageBegin("get_config_value", apache::thrift::protocol::T_REPLY, seqid);
+ result.write(oprot);
+ oprot->writeMessageEnd();
+ oprot->getTransport()->flush();
+ oprot->getTransport()->writeEnd();
+}
+
}}} // namespace
Modified: hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.h?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.h (original)
+++ hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore.h Fri Jan 8 05:56:50 2010
@@ -37,6 +37,7 @@
virtual void get_partitions(std::vector<Partition> & _return, const std::string& db_name, const std::string& tbl_name, const int16_t max_parts) = 0;
virtual void get_partition_names(std::vector<std::string> & _return, const std::string& db_name, const std::string& tbl_name, const int16_t max_parts) = 0;
virtual void alter_partition(const std::string& db_name, const std::string& tbl_name, const Partition& new_part) = 0;
+ virtual void get_config_value(std::string& _return, const std::string& name, const std::string& defaultValue) = 0;
};
class ThriftHiveMetastoreNull : virtual public ThriftHiveMetastoreIf , virtual public facebook::fb303::FacebookServiceNull {
@@ -113,6 +114,9 @@
void alter_partition(const std::string& /* db_name */, const std::string& /* tbl_name */, const Partition& /* new_part */) {
return;
}
+ void get_config_value(std::string& /* _return */, const std::string& /* name */, const std::string& /* defaultValue */) {
+ return;
+ }
};
class ThriftHiveMetastore_create_database_args {
@@ -2496,6 +2500,110 @@
};
+class ThriftHiveMetastore_get_config_value_args {
+ public:
+
+ ThriftHiveMetastore_get_config_value_args() : name(""), defaultValue("") {
+ }
+
+ virtual ~ThriftHiveMetastore_get_config_value_args() throw() {}
+
+ std::string name;
+ std::string defaultValue;
+
+ struct __isset {
+ __isset() : name(false), defaultValue(false) {}
+ bool name;
+ bool defaultValue;
+ } __isset;
+
+ bool operator == (const ThriftHiveMetastore_get_config_value_args & rhs) const
+ {
+ if (!(name == rhs.name))
+ return false;
+ if (!(defaultValue == rhs.defaultValue))
+ return false;
+ return true;
+ }
+ bool operator != (const ThriftHiveMetastore_get_config_value_args &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const ThriftHiveMetastore_get_config_value_args & ) const;
+
+ uint32_t read(apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class ThriftHiveMetastore_get_config_value_pargs {
+ public:
+
+
+ virtual ~ThriftHiveMetastore_get_config_value_pargs() throw() {}
+
+ const std::string* name;
+ const std::string* defaultValue;
+
+ uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class ThriftHiveMetastore_get_config_value_result {
+ public:
+
+ ThriftHiveMetastore_get_config_value_result() : success("") {
+ }
+
+ virtual ~ThriftHiveMetastore_get_config_value_result() throw() {}
+
+ std::string success;
+ ConfigValSecurityException o1;
+
+ struct __isset {
+ __isset() : success(false), o1(false) {}
+ bool success;
+ bool o1;
+ } __isset;
+
+ bool operator == (const ThriftHiveMetastore_get_config_value_result & rhs) const
+ {
+ if (!(success == rhs.success))
+ return false;
+ if (!(o1 == rhs.o1))
+ return false;
+ return true;
+ }
+ bool operator != (const ThriftHiveMetastore_get_config_value_result &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const ThriftHiveMetastore_get_config_value_result & ) const;
+
+ uint32_t read(apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class ThriftHiveMetastore_get_config_value_presult {
+ public:
+
+
+ virtual ~ThriftHiveMetastore_get_config_value_presult() throw() {}
+
+ std::string* success;
+ ConfigValSecurityException o1;
+
+ struct __isset {
+ __isset() : success(false), o1(false) {}
+ bool success;
+ bool o1;
+ } __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) :
@@ -2574,6 +2682,9 @@
void alter_partition(const std::string& db_name, const std::string& tbl_name, const Partition& new_part);
void send_alter_partition(const std::string& db_name, const std::string& tbl_name, const Partition& new_part);
void recv_alter_partition();
+ void get_config_value(std::string& _return, const std::string& name, const std::string& defaultValue);
+ void send_get_config_value(const std::string& name, const std::string& defaultValue);
+ void recv_get_config_value(std::string& _return);
};
class ThriftHiveMetastoreProcessor : virtual public apache::thrift::TProcessor, public facebook::fb303::FacebookServiceProcessor {
@@ -2604,6 +2715,7 @@
void process_get_partitions(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot);
void process_get_partition_names(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot);
void process_alter_partition(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot);
+ void process_get_config_value(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot);
public:
ThriftHiveMetastoreProcessor(boost::shared_ptr<ThriftHiveMetastoreIf> iface) :
facebook::fb303::FacebookServiceProcessor(iface),
@@ -2630,6 +2742,7 @@
processMap_["get_partitions"] = &ThriftHiveMetastoreProcessor::process_get_partitions;
processMap_["get_partition_names"] = &ThriftHiveMetastoreProcessor::process_get_partition_names;
processMap_["alter_partition"] = &ThriftHiveMetastoreProcessor::process_alter_partition;
+ processMap_["get_config_value"] = &ThriftHiveMetastoreProcessor::process_get_config_value;
}
virtual bool process(boost::shared_ptr<apache::thrift::protocol::TProtocol> piprot, boost::shared_ptr<apache::thrift::protocol::TProtocol> poprot);
@@ -2892,6 +3005,18 @@
}
}
+ void get_config_value(std::string& _return, const std::string& name, const std::string& defaultValue) {
+ uint32_t sz = ifaces_.size();
+ for (uint32_t i = 0; i < sz; ++i) {
+ if (i == sz - 1) {
+ ifaces_[i]->get_config_value(_return, name, defaultValue);
+ return;
+ } else {
+ ifaces_[i]->get_config_value(_return, name, defaultValue);
+ }
+ }
+ }
+
};
}}} // namespace
Modified: hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp (original)
+++ hadoop/hive/trunk/metastore/src/gen-cpp/ThriftHiveMetastore_server.skeleton.cpp Fri Jan 8 05:56:50 2010
@@ -132,6 +132,11 @@
printf("alter_partition\n");
}
+ void get_config_value(std::string& _return, const std::string& name, const std::string& defaultValue) {
+ // Your implementation goes here
+ printf("get_config_value\n");
+ }
+
};
int main(int argc, char **argv) {
Modified: hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.cpp
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.cpp?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.cpp (original)
+++ hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.cpp Fri Jan 8 05:56:50 2010
@@ -1748,4 +1748,58 @@
return xfer;
}
+const char* ConfigValSecurityException::ascii_fingerprint = "EFB929595D312AC8F305D5A794CFEDA1";
+const uint8_t ConfigValSecurityException::binary_fingerprint[16] = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
+
+uint32_t ConfigValSecurityException::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->message);
+ this->__isset.message = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ return xfer;
+}
+
+uint32_t ConfigValSecurityException::write(apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ xfer += oprot->writeStructBegin("ConfigValSecurityException");
+ xfer += oprot->writeFieldBegin("message", apache::thrift::protocol::T_STRING, 1);
+ xfer += oprot->writeString(this->message);
+ xfer += oprot->writeFieldEnd();
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
}}} // namespace
Modified: hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.h
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.h?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.h (original)
+++ hadoop/hive/trunk/metastore/src/gen-cpp/hive_metastore_types.h Fri Jan 8 05:56:50 2010
@@ -842,6 +842,41 @@
};
+class ConfigValSecurityException : public apache::thrift::TException {
+ public:
+
+ static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1";
+ static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1};
+
+ ConfigValSecurityException() : message("") {
+ }
+
+ virtual ~ConfigValSecurityException() throw() {}
+
+ std::string message;
+
+ struct __isset {
+ __isset() : message(false) {}
+ bool message;
+ } __isset;
+
+ bool operator == (const ConfigValSecurityException & rhs) const
+ {
+ if (!(message == rhs.message))
+ return false;
+ return true;
+ }
+ bool operator != (const ConfigValSecurityException &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const ConfigValSecurityException & ) const;
+
+ uint32_t read(apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
}}} // namespace
#endif
Added: hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ConfigValSecurityException.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ConfigValSecurityException.java?rev=897109&view=auto
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ConfigValSecurityException.java (added)
+++ hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ConfigValSecurityException.java Fri Jan 8 05:56:50 2010
@@ -0,0 +1,211 @@
+/**
+ * Autogenerated by Thrift
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ */
+package org.apache.hadoop.hive.metastore.api;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import org.apache.log4j.Logger;
+
+import org.apache.thrift.*;
+import org.apache.thrift.meta_data.*;
+import org.apache.thrift.protocol.*;
+
+public class ConfigValSecurityException extends Exception implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("ConfigValSecurityException");
+ private static final TField MESSAGE_FIELD_DESC = new TField("message", TType.STRING, (short)1);
+
+ private String message;
+ public static final int MESSAGE = 1;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(MESSAGE, new FieldMetaData("message", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(ConfigValSecurityException.class, metaDataMap);
+ }
+
+ public ConfigValSecurityException() {
+ }
+
+ public ConfigValSecurityException(
+ String message)
+ {
+ this();
+ this.message = message;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public ConfigValSecurityException(ConfigValSecurityException other) {
+ if (other.isSetMessage()) {
+ this.message = other.message;
+ }
+ }
+
+ @Override
+ public ConfigValSecurityException clone() {
+ return new ConfigValSecurityException(this);
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ public void unsetMessage() {
+ this.message = null;
+ }
+
+ // Returns true if field message is set (has been asigned a value) and false otherwise
+ public boolean isSetMessage() {
+ return this.message != null;
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case MESSAGE:
+ if (value == null) {
+ unsetMessage();
+ } else {
+ setMessage((String)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case MESSAGE:
+ return getMessage();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case MESSAGE:
+ return isSetMessage();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof ConfigValSecurityException)
+ return this.equals((ConfigValSecurityException)that);
+ return false;
+ }
+
+ public boolean equals(ConfigValSecurityException that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_message = true && this.isSetMessage();
+ boolean that_present_message = true && that.isSetMessage();
+ if (this_present_message || that_present_message) {
+ if (!(this_present_message && that_present_message))
+ return false;
+ if (!this.message.equals(that.message))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ 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 MESSAGE:
+ if (field.type == TType.STRING) {
+ this.message = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ validate();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.message != null) {
+ oprot.writeFieldBegin(MESSAGE_FIELD_DESC);
+ oprot.writeString(this.message);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("ConfigValSecurityException(");
+ boolean first = true;
+
+ sb.append("message:");
+ if (this.message == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.message);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
+}
+
Modified: hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java (original)
+++ hadoop/hive/trunk/metastore/src/gen-javabean/org/apache/hadoop/hive/metastore/api/ThriftHiveMetastore.java Fri Jan 8 05:56:50 2010
@@ -69,6 +69,8 @@
public void alter_partition(String db_name, String tbl_name, Partition new_part) throws InvalidOperationException, MetaException, TException;
+ public String get_config_value(String name, String defaultValue) throws ConfigValSecurityException, TException;
+
}
public static class Client extends com.facebook.fb303.FacebookService.Client implements Iface {
@@ -946,6 +948,43 @@
return;
}
+ public String get_config_value(String name, String defaultValue) throws ConfigValSecurityException, TException
+ {
+ send_get_config_value(name, defaultValue);
+ return recv_get_config_value();
+ }
+
+ public void send_get_config_value(String name, String defaultValue) throws TException
+ {
+ oprot_.writeMessageBegin(new TMessage("get_config_value", TMessageType.CALL, seqid_));
+ get_config_value_args args = new get_config_value_args();
+ args.name = name;
+ args.defaultValue = defaultValue;
+ args.write(oprot_);
+ oprot_.writeMessageEnd();
+ oprot_.getTransport().flush();
+ }
+
+ public String recv_get_config_value() throws ConfigValSecurityException, TException
+ {
+ TMessage msg = iprot_.readMessageBegin();
+ if (msg.type == TMessageType.EXCEPTION) {
+ TApplicationException x = TApplicationException.read(iprot_);
+ iprot_.readMessageEnd();
+ throw x;
+ }
+ get_config_value_result result = new get_config_value_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_config_value failed: unknown result");
+ }
+
}
public static class Processor extends com.facebook.fb303.FacebookService.Processor implements TProcessor {
private static final Logger LOGGER = Logger.getLogger(Processor.class.getName());
@@ -975,6 +1014,7 @@
processMap_.put("get_partitions", new get_partitions());
processMap_.put("get_partition_names", new get_partition_names());
processMap_.put("alter_partition", new alter_partition());
+ processMap_.put("get_config_value", new get_config_value());
}
private Iface iface_;
@@ -1660,6 +1700,34 @@
}
+ private class get_config_value implements ProcessFunction {
+ public void process(int seqid, TProtocol iprot, TProtocol oprot) throws TException
+ {
+ get_config_value_args args = new get_config_value_args();
+ args.read(iprot);
+ iprot.readMessageEnd();
+ get_config_value_result result = new get_config_value_result();
+ try {
+ result.success = iface_.get_config_value(args.name, args.defaultValue);
+ } catch (ConfigValSecurityException o1) {
+ result.o1 = o1;
+ } catch (Throwable th) {
+ LOGGER.error("Internal error processing get_config_value", th);
+ TApplicationException x = new TApplicationException(TApplicationException.INTERNAL_ERROR, "Internal error processing get_config_value");
+ oprot.writeMessageBegin(new TMessage("get_config_value", TMessageType.EXCEPTION, seqid));
+ x.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ return;
+ }
+ oprot.writeMessageBegin(new TMessage("get_config_value", TMessageType.REPLY, seqid));
+ result.write(oprot);
+ oprot.writeMessageEnd();
+ oprot.getTransport().flush();
+ }
+
+ }
+
}
public static class create_database_args implements TBase, java.io.Serializable, Cloneable {
@@ -14549,4 +14617,523 @@
}
+ public static class get_config_value_args implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("get_config_value_args");
+ private static final TField NAME_FIELD_DESC = new TField("name", TType.STRING, (short)1);
+ private static final TField DEFAULT_VALUE_FIELD_DESC = new TField("defaultValue", TType.STRING, (short)2);
+
+ private String name;
+ public static final int NAME = 1;
+ private String defaultValue;
+ public static final int DEFAULTVALUE = 2;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(NAME, new FieldMetaData("name", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(DEFAULTVALUE, new FieldMetaData("defaultValue", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(get_config_value_args.class, metaDataMap);
+ }
+
+ public get_config_value_args() {
+ }
+
+ public get_config_value_args(
+ String name,
+ String defaultValue)
+ {
+ this();
+ this.name = name;
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public get_config_value_args(get_config_value_args other) {
+ if (other.isSetName()) {
+ this.name = other.name;
+ }
+ if (other.isSetDefaultValue()) {
+ this.defaultValue = other.defaultValue;
+ }
+ }
+
+ @Override
+ public get_config_value_args clone() {
+ return new get_config_value_args(this);
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void unsetName() {
+ this.name = null;
+ }
+
+ // Returns true if field name is set (has been asigned a value) and false otherwise
+ public boolean isSetName() {
+ return this.name != null;
+ }
+
+ public String getDefaultValue() {
+ return this.defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public void unsetDefaultValue() {
+ this.defaultValue = null;
+ }
+
+ // Returns true if field defaultValue is set (has been asigned a value) and false otherwise
+ public boolean isSetDefaultValue() {
+ return this.defaultValue != null;
+ }
+
+ public void setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case NAME:
+ if (value == null) {
+ unsetName();
+ } else {
+ setName((String)value);
+ }
+ break;
+
+ case DEFAULTVALUE:
+ if (value == null) {
+ unsetDefaultValue();
+ } else {
+ setDefaultValue((String)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case NAME:
+ return getName();
+
+ case DEFAULTVALUE:
+ return getDefaultValue();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case NAME:
+ return isSetName();
+ case DEFAULTVALUE:
+ return isSetDefaultValue();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof get_config_value_args)
+ return this.equals((get_config_value_args)that);
+ return false;
+ }
+
+ public boolean equals(get_config_value_args that) {
+ if (that == null)
+ return false;
+
+ boolean this_present_name = true && this.isSetName();
+ boolean that_present_name = true && that.isSetName();
+ if (this_present_name || that_present_name) {
+ if (!(this_present_name && that_present_name))
+ return false;
+ if (!this.name.equals(that.name))
+ return false;
+ }
+
+ boolean this_present_defaultValue = true && this.isSetDefaultValue();
+ boolean that_present_defaultValue = true && that.isSetDefaultValue();
+ if (this_present_defaultValue || that_present_defaultValue) {
+ if (!(this_present_defaultValue && that_present_defaultValue))
+ return false;
+ if (!this.defaultValue.equals(that.defaultValue))
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return 0;
+ }
+
+ 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 NAME:
+ if (field.type == TType.STRING) {
+ this.name = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case DEFAULTVALUE:
+ if (field.type == TType.STRING) {
+ this.defaultValue = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ iprot.readFieldEnd();
+ }
+ iprot.readStructEnd();
+
+ validate();
+ }
+
+ public void write(TProtocol oprot) throws TException {
+ validate();
+
+ oprot.writeStructBegin(STRUCT_DESC);
+ if (this.name != null) {
+ oprot.writeFieldBegin(NAME_FIELD_DESC);
+ oprot.writeString(this.name);
+ oprot.writeFieldEnd();
+ }
+ if (this.defaultValue != null) {
+ oprot.writeFieldBegin(DEFAULT_VALUE_FIELD_DESC);
+ oprot.writeString(this.defaultValue);
+ oprot.writeFieldEnd();
+ }
+ oprot.writeFieldStop();
+ oprot.writeStructEnd();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("get_config_value_args(");
+ boolean first = true;
+
+ sb.append("name:");
+ if (this.name == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.name);
+ }
+ first = false;
+ if (!first) sb.append(", ");
+ sb.append("defaultValue:");
+ if (this.defaultValue == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.defaultValue);
+ }
+ first = false;
+ sb.append(")");
+ return sb.toString();
+ }
+
+ public void validate() throws TException {
+ // check for required fields
+ // check that fields of type enum have valid values
+ }
+
+ }
+
+ public static class get_config_value_result implements TBase, java.io.Serializable, Cloneable {
+ private static final TStruct STRUCT_DESC = new TStruct("get_config_value_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;
+ public static final int SUCCESS = 0;
+ private ConfigValSecurityException o1;
+ public static final int O1 = 1;
+
+ private final Isset __isset = new Isset();
+ private static final class Isset implements java.io.Serializable {
+ }
+
+ public static final Map<Integer, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new HashMap<Integer, FieldMetaData>() {{
+ put(SUCCESS, new FieldMetaData("success", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRING)));
+ put(O1, new FieldMetaData("o1", TFieldRequirementType.DEFAULT,
+ new FieldValueMetaData(TType.STRUCT)));
+ }});
+
+ static {
+ FieldMetaData.addStructMetaDataMap(get_config_value_result.class, metaDataMap);
+ }
+
+ public get_config_value_result() {
+ }
+
+ public get_config_value_result(
+ String success,
+ ConfigValSecurityException o1)
+ {
+ this();
+ this.success = success;
+ this.o1 = o1;
+ }
+
+ /**
+ * Performs a deep copy on <i>other</i>.
+ */
+ public get_config_value_result(get_config_value_result other) {
+ if (other.isSetSuccess()) {
+ this.success = other.success;
+ }
+ if (other.isSetO1()) {
+ this.o1 = new ConfigValSecurityException(other.o1);
+ }
+ }
+
+ @Override
+ public get_config_value_result clone() {
+ return new get_config_value_result(this);
+ }
+
+ 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 ConfigValSecurityException getO1() {
+ return this.o1;
+ }
+
+ public void setO1(ConfigValSecurityException 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 setFieldValue(int fieldID, Object value) {
+ switch (fieldID) {
+ case SUCCESS:
+ if (value == null) {
+ unsetSuccess();
+ } else {
+ setSuccess((String)value);
+ }
+ break;
+
+ case O1:
+ if (value == null) {
+ unsetO1();
+ } else {
+ setO1((ConfigValSecurityException)value);
+ }
+ break;
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ public Object getFieldValue(int fieldID) {
+ switch (fieldID) {
+ case SUCCESS:
+ return getSuccess();
+
+ case O1:
+ return getO1();
+
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ // Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise
+ public boolean isSet(int fieldID) {
+ switch (fieldID) {
+ case SUCCESS:
+ return isSetSuccess();
+ case O1:
+ return isSetO1();
+ default:
+ throw new IllegalArgumentException("Field " + fieldID + " doesn't exist!");
+ }
+ }
+
+ @Override
+ public boolean equals(Object that) {
+ if (that == null)
+ return false;
+ if (that instanceof get_config_value_result)
+ return this.equals((get_config_value_result)that);
+ return false;
+ }
+
+ public boolean equals(get_config_value_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 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 SUCCESS:
+ if (field.type == TType.STRING) {
+ this.success = iprot.readString();
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ case O1:
+ if (field.type == TType.STRUCT) {
+ this.o1 = new ConfigValSecurityException();
+ this.o1.read(iprot);
+ } else {
+ TProtocolUtil.skip(iprot, field.type);
+ }
+ break;
+ default:
+ TProtocolUtil.skip(iprot, field.type);
+ break;
+ }
+ 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_config_value_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
+ // check that fields of type enum have valid values
+ }
+
+ }
+
}
Modified: hadoop/hive/trunk/metastore/src/gen-php/ThriftHiveMetastore.php
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-php/ThriftHiveMetastore.php?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-php/ThriftHiveMetastore.php (original)
+++ hadoop/hive/trunk/metastore/src/gen-php/ThriftHiveMetastore.php Fri Jan 8 05:56:50 2010
@@ -32,6 +32,7 @@
public function get_partitions($db_name, $tbl_name, $max_parts);
public function get_partition_names($db_name, $tbl_name, $max_parts);
public function alter_partition($db_name, $tbl_name, $new_part);
+ public function get_config_value($name, $defaultValue);
}
class ThriftHiveMetastoreClient extends FacebookServiceClient implements ThriftHiveMetastoreIf {
@@ -1299,6 +1300,61 @@
return;
}
+ public function get_config_value($name, $defaultValue)
+ {
+ $this->send_get_config_value($name, $defaultValue);
+ return $this->recv_get_config_value();
+ }
+
+ public function send_get_config_value($name, $defaultValue)
+ {
+ $args = new metastore_ThriftHiveMetastore_get_config_value_args();
+ $args->name = $name;
+ $args->defaultValue = $defaultValue;
+ $bin_accel = ($this->output_ instanceof TProtocol::$TBINARYPROTOCOLACCELERATED) && function_exists('thrift_protocol_write_binary');
+ if ($bin_accel)
+ {
+ thrift_protocol_write_binary($this->output_, 'get_config_value', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite());
+ }
+ else
+ {
+ $this->output_->writeMessageBegin('get_config_value', TMessageType::CALL, $this->seqid_);
+ $args->write($this->output_);
+ $this->output_->writeMessageEnd();
+ $this->output_->getTransport()->flush();
+ }
+ }
+
+ public function recv_get_config_value()
+ {
+ $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_config_value_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_config_value_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_config_value failed: unknown result");
+ }
+
}
// HELPER FUNCTIONS AND STRUCTURES
@@ -6086,4 +6142,190 @@
}
+class metastore_ThriftHiveMetastore_get_config_value_args {
+ static $_TSPEC;
+
+ public $name = null;
+ public $defaultValue = null;
+
+ public function __construct($vals=null) {
+ if (!isset(self::$_TSPEC)) {
+ self::$_TSPEC = array(
+ 1 => array(
+ 'var' => 'name',
+ 'type' => TType::STRING,
+ ),
+ 2 => array(
+ 'var' => 'defaultValue',
+ 'type' => TType::STRING,
+ ),
+ );
+ }
+ if (is_array($vals)) {
+ if (isset($vals['name'])) {
+ $this->name = $vals['name'];
+ }
+ if (isset($vals['defaultValue'])) {
+ $this->defaultValue = $vals['defaultValue'];
+ }
+ }
+ }
+
+ public function getName() {
+ return 'ThriftHiveMetastore_get_config_value_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->name);
+ } else {
+ $xfer += $input->skip($ftype);
+ }
+ break;
+ case 2:
+ if ($ftype == TType::STRING) {
+ $xfer += $input->readString($this->defaultValue);
+ } 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_config_value_args');
+ if ($this->name !== null) {
+ $xfer += $output->writeFieldBegin('name', TType::STRING, 1);
+ $xfer += $output->writeString($this->name);
+ $xfer += $output->writeFieldEnd();
+ }
+ if ($this->defaultValue !== null) {
+ $xfer += $output->writeFieldBegin('defaultValue', TType::STRING, 2);
+ $xfer += $output->writeString($this->defaultValue);
+ $xfer += $output->writeFieldEnd();
+ }
+ $xfer += $output->writeFieldStop();
+ $xfer += $output->writeStructEnd();
+ return $xfer;
+ }
+
+}
+
+class metastore_ThriftHiveMetastore_get_config_value_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_ConfigValSecurityException',
+ ),
+ );
+ }
+ 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_config_value_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_ConfigValSecurityException();
+ $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_config_value_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;
+ }
+
+}
+
?>
Modified: hadoop/hive/trunk/metastore/src/gen-php/hive_metastore_types.php
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-php/hive_metastore_types.php?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-php/hive_metastore_types.php (original)
+++ hadoop/hive/trunk/metastore/src/gen-php/hive_metastore_types.php Fri Jan 8 05:56:50 2010
@@ -2559,4 +2559,76 @@
}
+class metastore_ConfigValSecurityException extends TException {
+ static $_TSPEC;
+
+ public $message = null;
+
+ public function __construct($vals=null) {
+ if (!isset(self::$_TSPEC)) {
+ self::$_TSPEC = array(
+ 1 => array(
+ 'var' => 'message',
+ 'type' => TType::STRING,
+ ),
+ );
+ }
+ if (is_array($vals)) {
+ if (isset($vals['message'])) {
+ $this->message = $vals['message'];
+ }
+ }
+ }
+
+ public function getName() {
+ return 'ConfigValSecurityException';
+ }
+
+ 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->message);
+ } 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('ConfigValSecurityException');
+ if ($this->message !== null) {
+ $xfer += $output->writeFieldBegin('message', TType::STRING, 1);
+ $xfer += $output->writeString($this->message);
+ $xfer += $output->writeFieldEnd();
+ }
+ $xfer += $output->writeFieldStop();
+ $xfer += $output->writeStructEnd();
+ return $xfer;
+ }
+
+}
+
?>
Modified: hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore-remote
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore-remote?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore-remote (original)
+++ hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore-remote Fri Jan 8 05:56:50 2010
@@ -43,6 +43,7 @@
print ' get_partitions(string db_name, string tbl_name, i16 max_parts)'
print ' get_partition_names(string db_name, string tbl_name, i16 max_parts)'
print ' void alter_partition(string db_name, string tbl_name, Partition new_part)'
+ print ' string get_config_value(string name, string defaultValue)'
print ''
sys.exit(0)
@@ -223,4 +224,10 @@
sys.exit(1)
pp.pprint(client.alter_partition(args[0],args[1],eval(args[2]),))
+elif cmd == 'get_config_value':
+ if len(args) != 2:
+ print 'get_config_value requires 2 args'
+ sys.exit(1)
+ pp.pprint(client.get_config_value(args[0],args[1],))
+
transport.close()
Modified: hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore.py
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore.py?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore.py (original)
+++ hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ThriftHiveMetastore.py Fri Jan 8 05:56:50 2010
@@ -192,6 +192,14 @@
"""
pass
+ def get_config_value(self, name, defaultValue):
+ """
+ Parameters:
+ - name
+ - defaultValue
+ """
+ pass
+
class Client(fb303.FacebookService.Client, Iface):
"""
@@ -977,6 +985,40 @@
raise result.o2
return
+ def get_config_value(self, name, defaultValue):
+ """
+ Parameters:
+ - name
+ - defaultValue
+ """
+ self.send_get_config_value(name, defaultValue)
+ return self.recv_get_config_value()
+
+ def send_get_config_value(self, name, defaultValue):
+ self._oprot.writeMessageBegin('get_config_value', TMessageType.CALL, self._seqid)
+ args = get_config_value_args()
+ args.name = name
+ args.defaultValue = defaultValue
+ args.write(self._oprot)
+ self._oprot.writeMessageEnd()
+ self._oprot.trans.flush()
+
+ def recv_get_config_value(self, ):
+ (fname, mtype, rseqid) = self._iprot.readMessageBegin()
+ if mtype == TMessageType.EXCEPTION:
+ x = TApplicationException()
+ x.read(self._iprot)
+ self._iprot.readMessageEnd()
+ raise x
+ result = get_config_value_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_config_value failed: unknown result");
+
class Processor(fb303.FacebookService.Processor, Iface, TProcessor):
def __init__(self, handler):
@@ -1003,6 +1045,7 @@
self._processMap["get_partitions"] = Processor.process_get_partitions
self._processMap["get_partition_names"] = Processor.process_get_partition_names
self._processMap["alter_partition"] = Processor.process_alter_partition
+ self._processMap["get_config_value"] = Processor.process_get_config_value
def process(self, iprot, oprot):
(name, type, seqid) = iprot.readMessageBegin()
@@ -1369,6 +1412,20 @@
oprot.writeMessageEnd()
oprot.trans.flush()
+ def process_get_config_value(self, seqid, iprot, oprot):
+ args = get_config_value_args()
+ args.read(iprot)
+ iprot.readMessageEnd()
+ result = get_config_value_result()
+ try:
+ result.success = self._handler.get_config_value(args.name, args.defaultValue)
+ except ConfigValSecurityException, o1:
+ result.o1 = o1
+ oprot.writeMessageBegin("get_config_value", TMessageType.REPLY, seqid)
+ result.write(oprot)
+ oprot.writeMessageEnd()
+ oprot.trans.flush()
+
# HELPER FUNCTIONS AND STRUCTURES
@@ -4673,4 +4730,140 @@
def __ne__(self, other):
return not (self == other)
+class get_config_value_args:
+ """
+ Attributes:
+ - name
+ - defaultValue
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'name', None, None, ), # 1
+ (2, TType.STRING, 'defaultValue', None, None, ), # 2
+ )
+
+ def __init__(self, name=None, defaultValue=None,):
+ self.name = name
+ self.defaultValue = defaultValue
+
+ 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.name = iprot.readString();
+ else:
+ iprot.skip(ftype)
+ elif fid == 2:
+ if ftype == TType.STRING:
+ self.defaultValue = 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_config_value_args')
+ if self.name != None:
+ oprot.writeFieldBegin('name', TType.STRING, 1)
+ oprot.writeString(self.name)
+ oprot.writeFieldEnd()
+ if self.defaultValue != None:
+ oprot.writeFieldBegin('defaultValue', TType.STRING, 2)
+ oprot.writeString(self.defaultValue)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ 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_config_value_result:
+ """
+ Attributes:
+ - success
+ - o1
+ """
+
+ thrift_spec = (
+ (0, TType.STRING, 'success', None, None, ), # 0
+ (1, TType.STRUCT, 'o1', (ConfigValSecurityException, ConfigValSecurityException.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 = ConfigValSecurityException()
+ 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_config_value_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 __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)
+
Modified: hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ttypes.py
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ttypes.py?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ttypes.py (original)
+++ hadoop/hive/trunk/metastore/src/gen-py/hive_metastore/ttypes.py Fri Jan 8 05:56:50 2010
@@ -1694,3 +1694,62 @@
def __ne__(self, other):
return not (self == other)
+class ConfigValSecurityException(Exception):
+ """
+ Attributes:
+ - message
+ """
+
+ thrift_spec = (
+ None, # 0
+ (1, TType.STRING, 'message', None, None, ), # 1
+ )
+
+ def __init__(self, message=None,):
+ self.message = message
+
+ 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.message = 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('ConfigValSecurityException')
+ if self.message != None:
+ oprot.writeFieldBegin('message', TType.STRING, 1)
+ oprot.writeString(self.message)
+ oprot.writeFieldEnd()
+ oprot.writeFieldStop()
+ oprot.writeStructEnd()
+
+ def __str__(self):
+ return repr(self)
+
+ 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)
+
Modified: hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java (original)
+++ hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java Fri Jan 8 05:56:50 2010
@@ -21,6 +21,8 @@
import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -28,6 +30,7 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.AlreadyExistsException;
+import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.Index;
@@ -712,6 +715,38 @@
public String getCpuProfile(int profileDurationInSec) throws TException {
return "";
}
+
+ /**
+ * Returns the value of the given configuration variable name. If the
+ * configuration variable with the given name doesn't exist, or if there
+ * were an exception thrown while retrieving the variable, or if name is
+ * null, defaultValue is returned.
+ */
+ public String get_config_value(String name, String defaultValue)
+ throws TException, ConfigValSecurityException {
+ this.incrementCounter("get_config_value");
+ logStartFunction("get_config_value: name=" + name +
+ " defaultValue=" + defaultValue);
+ if(name == null) {
+ return defaultValue;
+ }
+ // Allow only keys that start with hive.*, hdfs.*, mapred.* for security
+ // i.e. don't allow access to db password
+ if(!Pattern.matches("(hive|hdfs|mapred).*", name)) {
+ throw new ConfigValSecurityException("For security reasons, the " +
+ "config key " + name + " cannot be accessed");
+ }
+
+ String toReturn = defaultValue;
+ try {
+ toReturn = hiveConf.get(name, defaultValue);
+ } catch(RuntimeException e) {
+ LOG.error(threadLocalId.get().toString() + ": " +
+ "RuntimeException thrown in get_config_value - msg: " +
+ e.getMessage() + " cause: " + e.getCause());
+ }
+ return toReturn;
+ }
}
/**
Modified: hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java (original)
+++ hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java Fri Jan 8 05:56:50 2010
@@ -27,6 +27,7 @@
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.AlreadyExistsException;
+import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
@@ -509,4 +510,9 @@
return client.get_schema(db, tableName);
}
+ public String getConfigValue(String name, String defaultValue)
+ throws TException, ConfigValSecurityException {
+ return client.get_config_value(name, defaultValue);
+ }
+
}
Modified: hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java (original)
+++ hadoop/hive/trunk/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java Fri Jan 8 05:56:50 2010
@@ -21,6 +21,7 @@
import java.util.List;
import org.apache.hadoop.hive.metastore.api.AlreadyExistsException;
+import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
import org.apache.hadoop.hive.metastore.api.InvalidOperationException;
@@ -214,4 +215,14 @@
*/
public List<FieldSchema> getSchema(String db, String tableName)
throws MetaException, TException, UnknownTableException, UnknownDBException;
+
+ /**
+ * @param name name of the configuration property to get the value of
+ * @param defaultValue the value to return if property with the given name doesn't exist
+ * @return
+ * @throws TException
+ * @throws ConfigValSecurityException
+ */
+ public String getConfigValue(String name, String defaultValue)
+ throws TException, ConfigValSecurityException;
}
Modified: hadoop/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java?rev=897109&r1=897108&r2=897109&view=diff
==============================================================================
--- hadoop/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java (original)
+++ hadoop/hive/trunk/metastore/src/test/org/apache/hadoop/hive/metastore/TestHiveMetaStore.java Fri Jan 8 05:56:50 2010
@@ -28,6 +28,7 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.serde.Constants;
+import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
import org.apache.hadoop.hive.metastore.api.Database;
import org.apache.hadoop.hive.metastore.api.FieldSchema;
import org.apache.hadoop.hive.metastore.api.InvalidObjectException;
@@ -39,6 +40,7 @@
import org.apache.hadoop.hive.metastore.api.Table;
import org.apache.hadoop.hive.metastore.api.Type;
import org.apache.hadoop.util.StringUtils;
+import org.apache.thrift.TException;
public class TestHiveMetaStore extends TestCase {
private HiveMetaStoreClient client;
@@ -47,6 +49,13 @@
protected void setUp() throws Exception {
super.setUp();
hiveConf = new HiveConf(this.getClass());
+
+ // set some values to use for getting conf. vars
+ hiveConf.set("hive.key1", "value1");
+ hiveConf.set("hive.key2", "http://www.example.com");
+ hiveConf.set("hive.key3", "");
+ hiveConf.set("hive.key4", "0");
+
try {
client = new HiveMetaStoreClient(hiveConf);
} catch (Throwable e) {
@@ -663,4 +672,37 @@
assertTrue("Unable to create the databse " + dbName, ret);
}
}
+
+ public void testGetConfigValue() {
+
+ String val = "value";
+
+ try {
+ assertEquals(client.getConfigValue("hive.key1", val), "value1");
+ assertEquals(client.getConfigValue("hive.key2", val),
+ "http://www.example.com");
+ assertEquals(client.getConfigValue("hive.key3", val), "");
+ assertEquals(client.getConfigValue("hive.key4", val), "0");
+ assertEquals(client.getConfigValue("hive.key5", val), val);
+ assertEquals(client.getConfigValue(null, val), val);
+ } catch (TException e) {
+ e.printStackTrace();
+ assert(false);
+ } catch (ConfigValSecurityException e) {
+ e.printStackTrace();
+ assert(false);
+ }
+
+ boolean threwException = false;
+ try {
+ // Attempting to get the password should throw an exception
+ client.getConfigValue("javax.jdo.option.ConnectionPassword", "password");
+ } catch (TException e) {
+ e.printStackTrace();
+ assert(false);
+ } catch (ConfigValSecurityException e) {
+ threwException = true;
+ }
+ assert(threwException);
+ }
}
\ No newline at end of file