adding thrift generate files
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/0f782d88 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/0f782d88 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/0f782d88 Branch: refs/heads/data-manager Commit: 0f782d8817ff2d2fae6b599e44448596620e9bf7 Parents: 09209ea Author: scnakandala <[email protected]> Authored: Wed Dec 2 11:39:44 2015 -0500 Committer: scnakandala <[email protected]> Committed: Tue Jan 12 10:56:03 2016 -0500 ---------------------------------------------------------------------- .../src/main/resources/lib/airavata/Airavata.h | 168 ++++++++++ .../lib/airavata/Airavata_server.skeleton.cpp | 5 + .../resources/lib/Airavata/API/Airavata.php | 330 +++++++++++++++++++ .../lib/apache/airavata/api/Airavata-remote | 7 + .../lib/apache/airavata/api/Airavata.py | 258 +++++++++++++++ .../airavata/data/manager/DataManager.java | 56 +++- .../data/manager/DataManagerFactory.java | 4 + .../airavata/data/manager/DataManagerImpl.java | 23 +- .../data/manager/DataManagerFactoryTest.java | 8 + pom.xml | 1 + 10 files changed, 856 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h index 758208b..0c19761 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.h @@ -2272,6 +2272,7 @@ class AiravataIf { virtual void updateWorkflow(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& workflowTemplateId, const ::Workflow& workflow) = 0; virtual void getWorkflowTemplateId(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& workflowName) = 0; virtual bool isWorkflowExistWithName(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& workflowName) = 0; + virtual void publishDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::data::resource::ResourceModel& resourceModel) = 0; }; class AiravataIfFactory { @@ -2739,6 +2740,9 @@ class AiravataNull : virtual public AiravataIf { bool _return = false; return _return; } + void publishDataResource(const ::apache::airavata::model::security::AuthzToken& /* authzToken */, const ::apache::airavata::model::data::resource::ResourceModel& /* resourceModel */) { + return; + } }; @@ -21341,6 +21345,156 @@ class Airavata_isWorkflowExistWithName_presult { }; +typedef struct _Airavata_publishDataResource_args__isset { + _Airavata_publishDataResource_args__isset() : resourceModel(false) {} + bool resourceModel :1; +} _Airavata_publishDataResource_args__isset; + +class Airavata_publishDataResource_args { + public: + + static const char* ascii_fingerprint; // = "312BA5A54BBA157D64BAD509924F7B34"; + static const uint8_t binary_fingerprint[16]; // = {0x31,0x2B,0xA5,0xA5,0x4B,0xBA,0x15,0x7D,0x64,0xBA,0xD5,0x09,0x92,0x4F,0x7B,0x34}; + + Airavata_publishDataResource_args(const Airavata_publishDataResource_args&); + Airavata_publishDataResource_args& operator=(const Airavata_publishDataResource_args&); + Airavata_publishDataResource_args() { + } + + virtual ~Airavata_publishDataResource_args() throw(); + ::apache::airavata::model::security::AuthzToken authzToken; + ::apache::airavata::model::data::resource::ResourceModel resourceModel; + + _Airavata_publishDataResource_args__isset __isset; + + void __set_authzToken(const ::apache::airavata::model::security::AuthzToken& val); + + void __set_resourceModel(const ::apache::airavata::model::data::resource::ResourceModel& val); + + bool operator == (const Airavata_publishDataResource_args & rhs) const + { + if (!(authzToken == rhs.authzToken)) + return false; + if (!(resourceModel == rhs.resourceModel)) + return false; + return true; + } + bool operator != (const Airavata_publishDataResource_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Airavata_publishDataResource_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + friend std::ostream& operator<<(std::ostream& out, const Airavata_publishDataResource_args& obj); +}; + + +class Airavata_publishDataResource_pargs { + public: + + static const char* ascii_fingerprint; // = "312BA5A54BBA157D64BAD509924F7B34"; + static const uint8_t binary_fingerprint[16]; // = {0x31,0x2B,0xA5,0xA5,0x4B,0xBA,0x15,0x7D,0x64,0xBA,0xD5,0x09,0x92,0x4F,0x7B,0x34}; + + + virtual ~Airavata_publishDataResource_pargs() throw(); + const ::apache::airavata::model::security::AuthzToken* authzToken; + const ::apache::airavata::model::data::resource::ResourceModel* resourceModel; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + friend std::ostream& operator<<(std::ostream& out, const Airavata_publishDataResource_pargs& obj); +}; + +typedef struct _Airavata_publishDataResource_result__isset { + _Airavata_publishDataResource_result__isset() : ire(false), ace(false), ase(false), ae(false) {} + bool ire :1; + bool ace :1; + bool ase :1; + bool ae :1; +} _Airavata_publishDataResource_result__isset; + +class Airavata_publishDataResource_result { + public: + + static const char* ascii_fingerprint; // = "0603929641B3F91F81AA6AC437512303"; + static const uint8_t binary_fingerprint[16]; // = {0x06,0x03,0x92,0x96,0x41,0xB3,0xF9,0x1F,0x81,0xAA,0x6A,0xC4,0x37,0x51,0x23,0x03}; + + Airavata_publishDataResource_result(const Airavata_publishDataResource_result&); + Airavata_publishDataResource_result& operator=(const Airavata_publishDataResource_result&); + Airavata_publishDataResource_result() { + } + + virtual ~Airavata_publishDataResource_result() throw(); + ::apache::airavata::api::error::InvalidRequestException ire; + ::apache::airavata::api::error::AiravataClientException ace; + ::apache::airavata::api::error::AiravataSystemException ase; + ::apache::airavata::api::error::AuthorizationException ae; + + _Airavata_publishDataResource_result__isset __isset; + + void __set_ire(const ::apache::airavata::api::error::InvalidRequestException& val); + + void __set_ace(const ::apache::airavata::api::error::AiravataClientException& val); + + void __set_ase(const ::apache::airavata::api::error::AiravataSystemException& val); + + void __set_ae(const ::apache::airavata::api::error::AuthorizationException& val); + + bool operator == (const Airavata_publishDataResource_result & rhs) const + { + if (!(ire == rhs.ire)) + return false; + if (!(ace == rhs.ace)) + return false; + if (!(ase == rhs.ase)) + return false; + if (!(ae == rhs.ae)) + return false; + return true; + } + bool operator != (const Airavata_publishDataResource_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Airavata_publishDataResource_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + friend std::ostream& operator<<(std::ostream& out, const Airavata_publishDataResource_result& obj); +}; + +typedef struct _Airavata_publishDataResource_presult__isset { + _Airavata_publishDataResource_presult__isset() : ire(false), ace(false), ase(false), ae(false) {} + bool ire :1; + bool ace :1; + bool ase :1; + bool ae :1; +} _Airavata_publishDataResource_presult__isset; + +class Airavata_publishDataResource_presult { + public: + + static const char* ascii_fingerprint; // = "0603929641B3F91F81AA6AC437512303"; + static const uint8_t binary_fingerprint[16]; // = {0x06,0x03,0x92,0x96,0x41,0xB3,0xF9,0x1F,0x81,0xAA,0x6A,0xC4,0x37,0x51,0x23,0x03}; + + + virtual ~Airavata_publishDataResource_presult() throw(); + ::apache::airavata::api::error::InvalidRequestException ire; + ::apache::airavata::api::error::AiravataClientException ace; + ::apache::airavata::api::error::AiravataSystemException ase; + ::apache::airavata::api::error::AuthorizationException ae; + + _Airavata_publishDataResource_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + + friend std::ostream& operator<<(std::ostream& out, const Airavata_publishDataResource_presult& obj); +}; + class AiravataClient : virtual public AiravataIf { public: AiravataClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { @@ -21762,6 +21916,9 @@ class AiravataClient : virtual public AiravataIf { bool isWorkflowExistWithName(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& workflowName); void send_isWorkflowExistWithName(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& workflowName); bool recv_isWorkflowExistWithName(); + void publishDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::data::resource::ResourceModel& resourceModel); + void send_publishDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::data::resource::ResourceModel& resourceModel); + void recv_publishDataResource(); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; @@ -21909,6 +22066,7 @@ class AiravataProcessor : public ::apache::thrift::TDispatchProcessor { void process_updateWorkflow(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_getWorkflowTemplateId(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_isWorkflowExistWithName(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_publishDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: AiravataProcessor(boost::shared_ptr<AiravataIf> iface) : iface_(iface) { @@ -22044,6 +22202,7 @@ class AiravataProcessor : public ::apache::thrift::TDispatchProcessor { processMap_["updateWorkflow"] = &AiravataProcessor::process_updateWorkflow; processMap_["getWorkflowTemplateId"] = &AiravataProcessor::process_getWorkflowTemplateId; processMap_["isWorkflowExistWithName"] = &AiravataProcessor::process_isWorkflowExistWithName; + processMap_["publishDataResource"] = &AiravataProcessor::process_publishDataResource; } virtual ~AiravataProcessor() {} @@ -23341,6 +23500,15 @@ class AiravataMultiface : virtual public AiravataIf { return ifaces_[i]->isWorkflowExistWithName(authzToken, workflowName); } + void publishDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::data::resource::ResourceModel& resourceModel) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->publishDataResource(authzToken, resourceModel); + } + ifaces_[i]->publishDataResource(authzToken, resourceModel); + } + }; // The 'concurrent' client is a thread safe client that correctly handles http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp index 382818b..1a949d0 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata_server.skeleton.cpp @@ -2688,6 +2688,11 @@ class AiravataHandler : virtual public AiravataIf { printf("isWorkflowExistWithName\n"); } + void publishDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::data::resource::ResourceModel& resourceModel) { + // Your implementation goes here + printf("publishDataResource\n"); + } + }; int main(int argc, char **argv) { http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index 394a8b9..ba22aca 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -3123,6 +3123,15 @@ interface AiravataIf { * @throws \Airavata\API\Error\AuthorizationException */ public function isWorkflowExistWithName(\Airavata\Model\Security\AuthzToken $authzToken, $workflowName); + /** + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @param \Airavata\Model\Data\Resource\ResourceModel $resourceModel + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function publishDataResource(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Data\Resource\ResourceModel $resourceModel); } class AiravataClient implements \Airavata\API\AiravataIf { @@ -11682,6 +11691,67 @@ class AiravataClient implements \Airavata\API\AiravataIf { throw new \Exception("isWorkflowExistWithName failed: unknown result"); } + public function publishDataResource(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Data\Resource\ResourceModel $resourceModel) + { + $this->send_publishDataResource($authzToken, $resourceModel); + $this->recv_publishDataResource(); + } + + public function send_publishDataResource(\Airavata\Model\Security\AuthzToken $authzToken, \Airavata\Model\Data\Resource\ResourceModel $resourceModel) + { + $args = new \Airavata\API\Airavata_publishDataResource_args(); + $args->authzToken = $authzToken; + $args->resourceModel = $resourceModel; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'publishDataResource', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('publishDataResource', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_publishDataResource() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_publishDataResource_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 \Airavata\API\Airavata_publishDataResource_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->ire !== null) { + throw $result->ire; + } + if ($result->ace !== null) { + throw $result->ace; + } + if ($result->ase !== null) { + throw $result->ase; + } + if ($result->ae !== null) { + throw $result->ae; + } + return; + } + } // HELPER FUNCTIONS AND STRUCTURES @@ -52213,4 +52283,264 @@ class Airavata_isWorkflowExistWithName_result { } +class Airavata_publishDataResource_args { + static $_TSPEC; + + /** + * @var \Airavata\Model\Security\AuthzToken + */ + public $authzToken = null; + /** + * @var \Airavata\Model\Data\Resource\ResourceModel + */ + public $resourceModel = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'authzToken', + 'type' => TType::STRUCT, + 'class' => '\Airavata\Model\Security\AuthzToken', + ), + 2 => array( + 'var' => 'resourceModel', + 'type' => TType::STRUCT, + 'class' => '\Airavata\Model\Data\Resource\ResourceModel', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['authzToken'])) { + $this->authzToken = $vals['authzToken']; + } + if (isset($vals['resourceModel'])) { + $this->resourceModel = $vals['resourceModel']; + } + } + } + + public function getName() { + return 'Airavata_publishDataResource_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::STRUCT) { + $this->authzToken = new \Airavata\Model\Security\AuthzToken(); + $xfer += $this->authzToken->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->resourceModel = new \Airavata\Model\Data\Resource\ResourceModel(); + $xfer += $this->resourceModel->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('Airavata_publishDataResource_args'); + if ($this->authzToken !== null) { + if (!is_object($this->authzToken)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('authzToken', TType::STRUCT, 1); + $xfer += $this->authzToken->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->resourceModel !== null) { + if (!is_object($this->resourceModel)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('resourceModel', TType::STRUCT, 2); + $xfer += $this->resourceModel->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class Airavata_publishDataResource_result { + static $_TSPEC; + + /** + * @var \Airavata\API\Error\InvalidRequestException + */ + public $ire = null; + /** + * @var \Airavata\API\Error\AiravataClientException + */ + public $ace = null; + /** + * @var \Airavata\API\Error\AiravataSystemException + */ + public $ase = null; + /** + * @var \Airavata\API\Error\AuthorizationException + */ + public $ae = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'ire', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\InvalidRequestException', + ), + 2 => array( + 'var' => 'ace', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\AiravataClientException', + ), + 3 => array( + 'var' => 'ase', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\AiravataSystemException', + ), + 4 => array( + 'var' => 'ae', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\AuthorizationException', + ), + ); + } + if (is_array($vals)) { + if (isset($vals['ire'])) { + $this->ire = $vals['ire']; + } + if (isset($vals['ace'])) { + $this->ace = $vals['ace']; + } + if (isset($vals['ase'])) { + $this->ase = $vals['ase']; + } + if (isset($vals['ae'])) { + $this->ae = $vals['ae']; + } + } + } + + public function getName() { + return 'Airavata_publishDataResource_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->ire = new \Airavata\API\Error\InvalidRequestException(); + $xfer += $this->ire->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->ace = new \Airavata\API\Error\AiravataClientException(); + $xfer += $this->ace->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRUCT) { + $this->ase = new \Airavata\API\Error\AiravataSystemException(); + $xfer += $this->ase->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::STRUCT) { + $this->ae = new \Airavata\API\Error\AuthorizationException(); + $xfer += $this->ae->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('Airavata_publishDataResource_result'); + if ($this->ire !== null) { + $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1); + $xfer += $this->ire->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->ace !== null) { + $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2); + $xfer += $this->ace->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->ase !== null) { + $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3); + $xfer += $this->ase->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->ae !== null) { + $xfer += $output->writeFieldBegin('ae', TType::STRUCT, 4); + $xfer += $this->ae->write($output); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote index 89d3a68..b09661a 100755 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata-remote @@ -156,6 +156,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' void updateWorkflow(AuthzToken authzToken, string workflowTemplateId, Workflow workflow)') print(' string getWorkflowTemplateId(AuthzToken authzToken, string workflowName)') print(' bool isWorkflowExistWithName(AuthzToken authzToken, string workflowName)') + print(' void publishDataResource(AuthzToken authzToken, ResourceModel resourceModel)') print('') sys.exit(0) @@ -1004,6 +1005,12 @@ elif cmd == 'isWorkflowExistWithName': sys.exit(1) pp.pprint(client.isWorkflowExistWithName(eval(args[0]),args[1],)) +elif cmd == 'publishDataResource': + if len(args) != 2: + print('publishDataResource requires 2 args') + sys.exit(1) + pp.pprint(client.publishDataResource(eval(args[0]),eval(args[1]),)) + else: print('Unrecognized method %s' % cmd) sys.exit(1) http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py index 2161889..299f5a2 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/api/Airavata.py @@ -2623,6 +2623,14 @@ class Iface: """ pass + def publishDataResource(self, authzToken, resourceModel): + """ + Parameters: + - authzToken + - resourceModel + """ + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -9693,6 +9701,45 @@ class Client(Iface): raise result.ae raise TApplicationException(TApplicationException.MISSING_RESULT, "isWorkflowExistWithName failed: unknown result") + def publishDataResource(self, authzToken, resourceModel): + """ + Parameters: + - authzToken + - resourceModel + """ + self.send_publishDataResource(authzToken, resourceModel) + self.recv_publishDataResource() + + def send_publishDataResource(self, authzToken, resourceModel): + self._oprot.writeMessageBegin('publishDataResource', TMessageType.CALL, self._seqid) + args = publishDataResource_args() + args.authzToken = authzToken + args.resourceModel = resourceModel + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_publishDataResource(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = publishDataResource_result() + result.read(iprot) + iprot.readMessageEnd() + if result.ire is not None: + raise result.ire + if result.ace is not None: + raise result.ace + if result.ase is not None: + raise result.ase + if result.ae is not None: + raise result.ae + return + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -9830,6 +9877,7 @@ class Processor(Iface, TProcessor): self._processMap["updateWorkflow"] = Processor.process_updateWorkflow self._processMap["getWorkflowTemplateId"] = Processor.process_getWorkflowTemplateId self._processMap["isWorkflowExistWithName"] = Processor.process_isWorkflowExistWithName + self._processMap["publishDataResource"] = Processor.process_publishDataResource def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -13953,6 +14001,26 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_publishDataResource(self, seqid, iprot, oprot): + args = publishDataResource_args() + args.read(iprot) + iprot.readMessageEnd() + result = publishDataResource_result() + try: + self._handler.publishDataResource(args.authzToken, args.resourceModel) + except apache.airavata.api.error.ttypes.InvalidRequestException, ire: + result.ire = ire + except apache.airavata.api.error.ttypes.AiravataClientException, ace: + result.ace = ace + except apache.airavata.api.error.ttypes.AiravataSystemException, ase: + result.ase = ase + except apache.airavata.api.error.ttypes.AuthorizationException, ae: + result.ae = ae + oprot.writeMessageBegin("publishDataResource", TMessageType.REPLY, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -42746,3 +42814,193 @@ class isWorkflowExistWithName_result: def __ne__(self, other): return not (self == other) + +class publishDataResource_args: + """ + Attributes: + - authzToken + - resourceModel + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'authzToken', (apache.airavata.model.security.ttypes.AuthzToken, apache.airavata.model.security.ttypes.AuthzToken.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'resourceModel', (apache.airavata.model.data.resource.ttypes.ResourceModel, apache.airavata.model.data.resource.ttypes.ResourceModel.thrift_spec), None, ), # 2 + ) + + def __init__(self, authzToken=None, resourceModel=None,): + self.authzToken = authzToken + self.resourceModel = resourceModel + + 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.authzToken = apache.airavata.model.security.ttypes.AuthzToken() + self.authzToken.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.resourceModel = apache.airavata.model.data.resource.ttypes.ResourceModel() + self.resourceModel.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('publishDataResource_args') + if self.authzToken is not None: + oprot.writeFieldBegin('authzToken', TType.STRUCT, 1) + self.authzToken.write(oprot) + oprot.writeFieldEnd() + if self.resourceModel is not None: + oprot.writeFieldBegin('resourceModel', TType.STRUCT, 2) + self.resourceModel.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.authzToken is None: + raise TProtocol.TProtocolException(message='Required field authzToken is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.authzToken) + value = (value * 31) ^ hash(self.resourceModel) + return value + + 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 publishDataResource_result: + """ + Attributes: + - ire + - ace + - ase + - ae + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRUCT, 'ire', (apache.airavata.api.error.ttypes.InvalidRequestException, apache.airavata.api.error.ttypes.InvalidRequestException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'ace', (apache.airavata.api.error.ttypes.AiravataClientException, apache.airavata.api.error.ttypes.AiravataClientException.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'ase', (apache.airavata.api.error.ttypes.AiravataSystemException, apache.airavata.api.error.ttypes.AiravataSystemException.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'ae', (apache.airavata.api.error.ttypes.AuthorizationException, apache.airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ), # 4 + ) + + def __init__(self, ire=None, ace=None, ase=None, ae=None,): + self.ire = ire + self.ace = ace + self.ase = ase + self.ae = ae + + 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.ire = apache.airavata.api.error.ttypes.InvalidRequestException() + self.ire.read(iprot) + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRUCT: + self.ace = apache.airavata.api.error.ttypes.AiravataClientException() + self.ace.read(iprot) + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRUCT: + self.ase = apache.airavata.api.error.ttypes.AiravataSystemException() + self.ase.read(iprot) + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRUCT: + self.ae = apache.airavata.api.error.ttypes.AuthorizationException() + self.ae.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('publishDataResource_result') + if self.ire is not None: + oprot.writeFieldBegin('ire', TType.STRUCT, 1) + self.ire.write(oprot) + oprot.writeFieldEnd() + if self.ace is not None: + oprot.writeFieldBegin('ace', TType.STRUCT, 2) + self.ace.write(oprot) + oprot.writeFieldEnd() + if self.ase is not None: + oprot.writeFieldBegin('ase', TType.STRUCT, 3) + self.ase.write(oprot) + oprot.writeFieldEnd() + if self.ae is not None: + oprot.writeFieldBegin('ae', TType.STRUCT, 4) + self.ae.write(oprot) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.ire) + value = (value * 31) ^ hash(self.ace) + value = (value * 31) ^ hash(self.ase) + value = (value * 31) ^ hash(self.ae) + return value + + 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) http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java index ed79edb..7451a94 100644 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManager.java @@ -1,7 +1,57 @@ +/* + * + * 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.airavata.data.manager; -/** - * Created by supun on 12/1/15. - */ +import org.apache.airavata.model.data.resource.ResourceModel; + public interface DataManager { + + /** + * To create a replica entry for an already existing file(s). This is how the system comes to know about already + * existing resources + * @param resource + * @return + */ + boolean publishResource(ResourceModel resource); + + /** + * To remove a resource entry from the replica catalog + * @param resourceId + * @return + */ + boolean removeResource(String resourceId); + + /** + * To copy an already existing resource to a specified location. After successful copying the new location will be + * added to the available replica locations of the resource + * @param resourceId + * @param destLocation + * @return + */ + boolean copyResource(String resourceId, String destLocation); + + /** + * To retrieve a resource object providing the resourceId + * @param resourceId + * @return + */ + ResourceModel getResource(String resourceId); } http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java index 74fd68f..e1fb18a 100644 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerFactory.java @@ -25,4 +25,8 @@ import org.slf4j.LoggerFactory; public class DataManagerFactory { private final static Logger logger = LoggerFactory.getLogger(DataManagerFactory.class); + + public static DataManager getDataManager(){ + return new DataManagerImpl(); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java index 379418f..fb92edf 100644 --- a/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java +++ b/modules/data-manager/src/main/java/org/apache/airavata/data/manager/DataManagerImpl.java @@ -20,9 +20,30 @@ */ package org.apache.airavata.data.manager; +import org.apache.airavata.model.data.resource.ResourceModel; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class DataManagerImpl { +public class DataManagerImpl implements DataManager{ private final static Logger logger = LoggerFactory.getLogger(DataManagerImpl.class); + + @Override + public boolean publishResource(ResourceModel resource) { + return false; + } + + @Override + public boolean removeResource(String resourceId) { + return false; + } + + @Override + public boolean copyResource(String resourceId, String destLocation) { + return false; + } + + @Override + public ResourceModel getResource(String resourceId) { + return null; + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java b/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java index 4bfa570..aa10724 100644 --- a/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java +++ b/modules/data-manager/src/test/java/org/apache/airavata/data/manager/DataManagerFactoryTest.java @@ -20,9 +20,17 @@ */ package org.apache.airavata.data.manager; +import junit.framework.Assert; +import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DataManagerFactoryTest { private final static Logger logger = LoggerFactory.getLogger(DataManagerFactoryTest.class); + + @Test + public void testCreateDataManager(){ + DataManager dataManager = DataManagerFactory.getDataManager(); + Assert.assertNotNull(dataManager); + } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/0f782d88/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index c82cc8d..056108a 100644 --- a/pom.xml +++ b/pom.xml @@ -555,6 +555,7 @@ <module>modules/registry</module> <module>modules/security</module> <module>modules/credential-store</module> + <module>modules/data-manager</module> <module>modules/orchestrator</module> <module>modules/server</module> <module>modules/test-suite</module>
