http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp index 3b8976d..5fa7f87 100644 --- a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/Airavata.cpp @@ -42468,6 +42468,333 @@ uint32_t Airavata_getDataResource_presult::read(::apache::thrift::protocol::TPro return xfer; } + +Airavata_copyDataResource_args::~Airavata_copyDataResource_args() throw() { +} + + +uint32_t Airavata_copyDataResource_args::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*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; + + bool isset_authzToken = false; + bool isset_resourceId = false; + bool isset_destStorageResourceId = false; + bool isset_destinationParentPath = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->authzToken.read(iprot); + isset_authzToken = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->resourceId); + isset_resourceId = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->destStorageResourceId); + isset_destStorageResourceId = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->destinationParentPath); + isset_destinationParentPath = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_authzToken) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_resourceId) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_destStorageResourceId) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_destinationParentPath) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Airavata_copyDataResource_args::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("Airavata_copyDataResource_args"); + + xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->authzToken.write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("resourceId", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->resourceId); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("destStorageResourceId", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->destStorageResourceId); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("destinationParentPath", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->destinationParentPath); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +Airavata_copyDataResource_pargs::~Airavata_copyDataResource_pargs() throw() { +} + + +uint32_t Airavata_copyDataResource_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("Airavata_copyDataResource_pargs"); + + xfer += oprot->writeFieldBegin("authzToken", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += (*(this->authzToken)).write(oprot); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("resourceId", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString((*(this->resourceId))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("destStorageResourceId", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString((*(this->destStorageResourceId))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("destinationParentPath", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString((*(this->destinationParentPath))); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +Airavata_copyDataResource_result::~Airavata_copyDataResource_result() throw() { +} + + +uint32_t Airavata_copyDataResource_result::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*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->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ace.read(iprot); + this->__isset.ace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ase.read(iprot); + this->__isset.ase = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ae.read(iprot); + this->__isset.ae = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t Airavata_copyDataResource_result::write(::apache::thrift::protocol::TProtocol* oprot) const { + + uint32_t xfer = 0; + + xfer += oprot->writeStructBegin("Airavata_copyDataResource_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.ire) { + xfer += oprot->writeFieldBegin("ire", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->ire.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ace) { + xfer += oprot->writeFieldBegin("ace", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->ace.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ase) { + xfer += oprot->writeFieldBegin("ase", ::apache::thrift::protocol::T_STRUCT, 3); + xfer += this->ase.write(oprot); + xfer += oprot->writeFieldEnd(); + } else if (this->__isset.ae) { + xfer += oprot->writeFieldBegin("ae", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->ae.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + + +Airavata_copyDataResource_presult::~Airavata_copyDataResource_presult() throw() { +} + + +uint32_t Airavata_copyDataResource_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + + apache::thrift::protocol::TInputRecursionTracker tracker(*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->ire.read(iprot); + this->__isset.ire = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ace.read(iprot); + this->__isset.ace = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ase.read(iprot); + this->__isset.ase = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->ae.read(iprot); + this->__isset.ae = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + void AiravataClient::getAPIVersion(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken) { send_getAPIVersion(authzToken); @@ -52194,6 +52521,79 @@ void AiravataClient::recv_getDataResource( ::apache::airavata::model::data::reso throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getDataResource failed: unknown result"); } +void AiravataClient::copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) +{ + send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath); + recv_copyDataResource(_return); +} + +void AiravataClient::send_copyDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) +{ + int32_t cseqid = 0; + oprot_->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_CALL, cseqid); + + Airavata_copyDataResource_pargs args; + args.authzToken = &authzToken; + args.resourceId = &resourceId; + args.destStorageResourceId = &destStorageResourceId; + args.destinationParentPath = &destinationParentPath; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); +} + +void AiravataClient::recv_copyDataResource(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(); + } + if (fname.compare("copyDataResource") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + Airavata_copyDataResource_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.ire) { + throw result.ire; + } + if (result.__isset.ace) { + throw result.ace; + } + if (result.__isset.ase) { + throw result.ase; + } + if (result.__isset.ae) { + throw result.ae; + } + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "copyDataResource failed: unknown result"); +} + bool AiravataProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { ProcessMap::iterator pfn; pfn = processMap_.find(fname); @@ -61193,6 +61593,72 @@ void AiravataProcessor::process_getDataResource(int32_t seqid, ::apache::thrift: } } +void AiravataProcessor::process_copyDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) +{ + void* ctx = NULL; + if (this->eventHandler_.get() != NULL) { + ctx = this->eventHandler_->getContext("Airavata.copyDataResource", callContext); + } + ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Airavata.copyDataResource"); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preRead(ctx, "Airavata.copyDataResource"); + } + + Airavata_copyDataResource_args args; + args.read(iprot); + iprot->readMessageEnd(); + uint32_t bytes = iprot->getTransport()->readEnd(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postRead(ctx, "Airavata.copyDataResource", bytes); + } + + Airavata_copyDataResource_result result; + try { + iface_->copyDataResource(result.success, args.authzToken, args.resourceId, args.destStorageResourceId, args.destinationParentPath); + result.__isset.success = true; + } catch ( ::apache::airavata::api::error::InvalidRequestException &ire) { + result.ire = ire; + result.__isset.ire = true; + } catch ( ::apache::airavata::api::error::AiravataClientException &ace) { + result.ace = ace; + result.__isset.ace = true; + } catch ( ::apache::airavata::api::error::AiravataSystemException &ase) { + result.ase = ase; + result.__isset.ase = true; + } catch ( ::apache::airavata::api::error::AuthorizationException &ae) { + result.ae = ae; + result.__isset.ae = true; + } catch (const std::exception& e) { + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->handlerError(ctx, "Airavata.copyDataResource"); + } + + ::apache::thrift::TApplicationException x(e.what()); + oprot->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_EXCEPTION, seqid); + x.write(oprot); + oprot->writeMessageEnd(); + oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + return; + } + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->preWrite(ctx, "Airavata.copyDataResource"); + } + + oprot->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_REPLY, seqid); + result.write(oprot); + oprot->writeMessageEnd(); + bytes = oprot->getTransport()->writeEnd(); + oprot->getTransport()->flush(); + + if (this->eventHandler_.get() != NULL) { + this->eventHandler_->postWrite(ctx, "Airavata.copyDataResource", bytes); + } +} + ::boost::shared_ptr< ::apache::thrift::TProcessor > AiravataProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< AiravataIfFactory > cleanup(handlerFactory_); ::boost::shared_ptr< AiravataIf > handler(handlerFactory_->getHandler(connInfo), cleanup); @@ -75000,5 +75466,108 @@ void AiravataConcurrentClient::recv_getDataResource( ::apache::airavata::model:: } // end while(true) } +void AiravataConcurrentClient::copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) +{ + int32_t seqid = send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath); + recv_copyDataResource(_return, seqid); +} + +int32_t AiravataConcurrentClient::send_copyDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("copyDataResource", ::apache::thrift::protocol::T_CALL, cseqid); + + Airavata_copyDataResource_pargs args; + args.authzToken = &authzToken; + args.resourceId = &resourceId; + args.destStorageResourceId = &destStorageResourceId; + args.destinationParentPath = &destinationParentPath; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void AiravataConcurrentClient::recv_copyDataResource(std::string& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("copyDataResource") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + Airavata_copyDataResource_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + if (result.__isset.ire) { + sentry.commit(); + throw result.ire; + } + if (result.__isset.ace) { + sentry.commit(); + throw result.ace; + } + if (result.__isset.ase) { + sentry.commit(); + throw result.ase; + } + if (result.__isset.ae) { + sentry.commit(); + throw result.ae; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "copyDataResource failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }}} // namespace
http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/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 9d9df84..5a4d1e4 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 @@ -2284,6 +2284,7 @@ class AiravataIf { virtual void updateDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const ::apache::airavata::model::data::resource::DataResourceModel& dataResourceModel) = 0; virtual void removeDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId) = 0; virtual void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId) = 0; + virtual void copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) = 0; }; class AiravataIfFactory { @@ -2763,6 +2764,9 @@ class AiravataNull : virtual public AiravataIf { void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& /* _return */, const ::apache::airavata::model::security::AuthzToken& /* authzToken */, const std::string& /* resourceId */) { return; } + void copyDataResource(std::string& /* _return */, const ::apache::airavata::model::security::AuthzToken& /* authzToken */, const std::string& /* resourceId */, const std::string& /* destStorageResourceId */, const std::string& /* destinationParentPath */) { + return; + } }; @@ -21893,6 +21897,154 @@ class Airavata_getDataResource_presult { }; + +class Airavata_copyDataResource_args { + public: + + Airavata_copyDataResource_args(const Airavata_copyDataResource_args&); + Airavata_copyDataResource_args& operator=(const Airavata_copyDataResource_args&); + Airavata_copyDataResource_args() : resourceId(), destStorageResourceId(), destinationParentPath() { + } + + virtual ~Airavata_copyDataResource_args() throw(); + ::apache::airavata::model::security::AuthzToken authzToken; + std::string resourceId; + std::string destStorageResourceId; + std::string destinationParentPath; + + void __set_authzToken(const ::apache::airavata::model::security::AuthzToken& val); + + void __set_resourceId(const std::string& val); + + void __set_destStorageResourceId(const std::string& val); + + void __set_destinationParentPath(const std::string& val); + + bool operator == (const Airavata_copyDataResource_args & rhs) const + { + if (!(authzToken == rhs.authzToken)) + return false; + if (!(resourceId == rhs.resourceId)) + return false; + if (!(destStorageResourceId == rhs.destStorageResourceId)) + return false; + if (!(destinationParentPath == rhs.destinationParentPath)) + return false; + return true; + } + bool operator != (const Airavata_copyDataResource_args &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Airavata_copyDataResource_args & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + + +class Airavata_copyDataResource_pargs { + public: + + + virtual ~Airavata_copyDataResource_pargs() throw(); + const ::apache::airavata::model::security::AuthzToken* authzToken; + const std::string* resourceId; + const std::string* destStorageResourceId; + const std::string* destinationParentPath; + + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Airavata_copyDataResource_result__isset { + _Airavata_copyDataResource_result__isset() : success(false), ire(false), ace(false), ase(false), ae(false) {} + bool success :1; + bool ire :1; + bool ace :1; + bool ase :1; + bool ae :1; +} _Airavata_copyDataResource_result__isset; + +class Airavata_copyDataResource_result { + public: + + Airavata_copyDataResource_result(const Airavata_copyDataResource_result&); + Airavata_copyDataResource_result& operator=(const Airavata_copyDataResource_result&); + Airavata_copyDataResource_result() : success() { + } + + virtual ~Airavata_copyDataResource_result() throw(); + std::string success; + ::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_copyDataResource_result__isset __isset; + + void __set_success(const std::string& val); + + 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_copyDataResource_result & rhs) const + { + if (!(success == rhs.success)) + return false; + 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_copyDataResource_result &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Airavata_copyDataResource_result & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + +}; + +typedef struct _Airavata_copyDataResource_presult__isset { + _Airavata_copyDataResource_presult__isset() : success(false), ire(false), ace(false), ase(false), ae(false) {} + bool success :1; + bool ire :1; + bool ace :1; + bool ase :1; + bool ae :1; +} _Airavata_copyDataResource_presult__isset; + +class Airavata_copyDataResource_presult { + public: + + + virtual ~Airavata_copyDataResource_presult() throw(); + std::string* success; + ::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_copyDataResource_presult__isset __isset; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + +}; + class AiravataClient : virtual public AiravataIf { public: AiravataClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { @@ -22326,6 +22478,9 @@ class AiravataClient : virtual public AiravataIf { void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId); void send_getDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId); void recv_getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return); + void copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath); + void send_copyDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath); + void recv_copyDataResource(std::string& _return); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; @@ -22477,6 +22632,7 @@ class AiravataProcessor : public ::apache::thrift::TDispatchProcessor { void process_updateDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_removeDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_getDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); + void process_copyDataResource(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: AiravataProcessor(boost::shared_ptr<AiravataIf> iface) : iface_(iface) { @@ -22616,6 +22772,7 @@ class AiravataProcessor : public ::apache::thrift::TDispatchProcessor { processMap_["updateDataResource"] = &AiravataProcessor::process_updateDataResource; processMap_["removeDataResource"] = &AiravataProcessor::process_removeDataResource; processMap_["getDataResource"] = &AiravataProcessor::process_getDataResource; + processMap_["copyDataResource"] = &AiravataProcessor::process_copyDataResource; } virtual ~AiravataProcessor() {} @@ -23951,6 +24108,16 @@ class AiravataMultiface : virtual public AiravataIf { return; } + void copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) { + size_t sz = ifaces_.size(); + size_t i = 0; + for (; i < (sz - 1); ++i) { + ifaces_[i]->copyDataResource(_return, authzToken, resourceId, destStorageResourceId, destinationParentPath); + } + ifaces_[i]->copyDataResource(_return, authzToken, resourceId, destStorageResourceId, destinationParentPath); + return; + } + }; // The 'concurrent' client is a thread safe client that correctly handles @@ -24389,6 +24556,9 @@ class AiravataConcurrentClient : virtual public AiravataIf { void getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId); int32_t send_getDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId); void recv_getDataResource( ::apache::airavata::model::data::resource::DataResourceModel& _return, const int32_t seqid); + void copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath); + int32_t send_copyDataResource(const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath); + void recv_copyDataResource(std::string& _return, const int32_t seqid); protected: boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/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 4be84d3..38db54e 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 @@ -2715,6 +2715,11 @@ class AiravataHandler : virtual public AiravataIf { printf("getDataResource\n"); } + void copyDataResource(std::string& _return, const ::apache::airavata::model::security::AuthzToken& authzToken, const std::string& resourceId, const std::string& destStorageResourceId, const std::string& destinationParentPath) { + // Your implementation goes here + printf("copyDataResource\n"); + } + }; int main(int argc, char **argv) { http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/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 bcdeb0b..4cc073b 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 @@ -3164,6 +3164,18 @@ interface AiravataIf { * @throws \Airavata\API\Error\AuthorizationException */ public function getDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId); + /** + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @param string $resourceId + * @param string $destStorageResourceId + * @param string $destinationParentPath + * @return string + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath); } class AiravataClient implements \Airavata\API\AiravataIf { @@ -11973,6 +11985,72 @@ class AiravataClient implements \Airavata\API\AiravataIf { throw new \Exception("getDataResource failed: unknown result"); } + public function copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath) + { + $this->send_copyDataResource($authzToken, $resourceId, $destStorageResourceId, $destinationParentPath); + return $this->recv_copyDataResource(); + } + + public function send_copyDataResource(\Airavata\Model\Security\AuthzToken $authzToken, $resourceId, $destStorageResourceId, $destinationParentPath) + { + $args = new \Airavata\API\Airavata_copyDataResource_args(); + $args->authzToken = $authzToken; + $args->resourceId = $resourceId; + $args->destStorageResourceId = $destStorageResourceId; + $args->destinationParentPath = $destinationParentPath; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'copyDataResource', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('copyDataResource', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_copyDataResource() + { + $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_copyDataResource_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_copyDataResource_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + 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; + } + throw new \Exception("copyDataResource failed: unknown result"); + } + } // HELPER FUNCTIONS AND STRUCTURES @@ -53585,4 +53663,328 @@ class Airavata_getDataResource_result { } +class Airavata_copyDataResource_args { + static $_TSPEC; + + /** + * @var \Airavata\Model\Security\AuthzToken + */ + public $authzToken = null; + /** + * @var string + */ + public $resourceId = null; + /** + * @var string + */ + public $destStorageResourceId = null; + /** + * @var string + */ + public $destinationParentPath = 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' => 'resourceId', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'destStorageResourceId', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'destinationParentPath', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['authzToken'])) { + $this->authzToken = $vals['authzToken']; + } + if (isset($vals['resourceId'])) { + $this->resourceId = $vals['resourceId']; + } + if (isset($vals['destStorageResourceId'])) { + $this->destStorageResourceId = $vals['destStorageResourceId']; + } + if (isset($vals['destinationParentPath'])) { + $this->destinationParentPath = $vals['destinationParentPath']; + } + } + } + + public function getName() { + return 'Airavata_copyDataResource_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::STRING) { + $xfer += $input->readString($this->resourceId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->destStorageResourceId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->destinationParentPath); + } 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_copyDataResource_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->resourceId !== null) { + $xfer += $output->writeFieldBegin('resourceId', TType::STRING, 2); + $xfer += $output->writeString($this->resourceId); + $xfer += $output->writeFieldEnd(); + } + if ($this->destStorageResourceId !== null) { + $xfer += $output->writeFieldBegin('destStorageResourceId', TType::STRING, 3); + $xfer += $output->writeString($this->destStorageResourceId); + $xfer += $output->writeFieldEnd(); + } + if ($this->destinationParentPath !== null) { + $xfer += $output->writeFieldBegin('destinationParentPath', TType::STRING, 4); + $xfer += $output->writeString($this->destinationParentPath); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class Airavata_copyDataResource_result { + static $_TSPEC; + + /** + * @var string + */ + public $success = null; + /** + * @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( + 0 => array( + 'var' => 'success', + 'type' => TType::STRING, + ), + 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['success'])) { + $this->success = $vals['success']; + } + 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_copyDataResource_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->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_copyDataResource_result'); + if ($this->success !== null) { + $xfer += $output->writeFieldBegin('success', TType::STRING, 0); + $xfer += $output->writeString($this->success); + $xfer += $output->writeFieldEnd(); + } + 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/6572a821/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 5c82656..0d08767 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 @@ -160,6 +160,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' void updateDataResource(AuthzToken authzToken, DataResourceModel dataResourceModel)') print(' void removeDataResource(AuthzToken authzToken, string resourceId)') print(' DataResourceModel getDataResource(AuthzToken authzToken, string resourceId)') + print(' string copyDataResource(AuthzToken authzToken, string resourceId, string destStorageResourceId, string destinationParentPath)') print('') sys.exit(0) @@ -1032,6 +1033,12 @@ elif cmd == 'getDataResource': sys.exit(1) pp.pprint(client.getDataResource(eval(args[0]),args[1],)) +elif cmd == 'copyDataResource': + if len(args) != 4: + print('copyDataResource requires 4 args') + sys.exit(1) + pp.pprint(client.copyDataResource(eval(args[0]),args[1],args[2],args[3],)) + else: print('Unrecognized method %s' % cmd) sys.exit(1) http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/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 1ff70ac..81d711f 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 @@ -2658,6 +2658,16 @@ class Iface: """ pass + def copyDataResource(self, authzToken, resourceId, destStorageResourceId, destinationParentPath): + """ + Parameters: + - authzToken + - resourceId + - destStorageResourceId + - destinationParentPath + """ + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -9891,6 +9901,51 @@ class Client(Iface): raise result.ae raise TApplicationException(TApplicationException.MISSING_RESULT, "getDataResource failed: unknown result") + def copyDataResource(self, authzToken, resourceId, destStorageResourceId, destinationParentPath): + """ + Parameters: + - authzToken + - resourceId + - destStorageResourceId + - destinationParentPath + """ + self.send_copyDataResource(authzToken, resourceId, destStorageResourceId, destinationParentPath) + return self.recv_copyDataResource() + + def send_copyDataResource(self, authzToken, resourceId, destStorageResourceId, destinationParentPath): + self._oprot.writeMessageBegin('copyDataResource', TMessageType.CALL, self._seqid) + args = copyDataResource_args() + args.authzToken = authzToken + args.resourceId = resourceId + args.destStorageResourceId = destStorageResourceId + args.destinationParentPath = destinationParentPath + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_copyDataResource(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = copyDataResource_result() + result.read(iprot) + iprot.readMessageEnd() + if result.success is not None: + return result.success + 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 + raise TApplicationException(TApplicationException.MISSING_RESULT, "copyDataResource failed: unknown result") + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -10032,6 +10087,7 @@ class Processor(Iface, TProcessor): self._processMap["updateDataResource"] = Processor.process_updateDataResource self._processMap["removeDataResource"] = Processor.process_removeDataResource self._processMap["getDataResource"] = Processor.process_getDataResource + self._processMap["copyDataResource"] = Processor.process_copyDataResource def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -14279,6 +14335,37 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_copyDataResource(self, seqid, iprot, oprot): + args = copyDataResource_args() + args.read(iprot) + iprot.readMessageEnd() + result = copyDataResource_result() + try: + result.success = self._handler.copyDataResource(args.authzToken, args.resourceId, args.destStorageResourceId, args.destinationParentPath) + msg_type = TMessageType.REPLY + except (TTransport.TTransportException, KeyboardInterrupt, SystemExit): + raise + except apache.airavata.api.error.ttypes.InvalidRequestException as ire: + msg_type = TMessageType.REPLY + result.ire = ire + except apache.airavata.api.error.ttypes.AiravataClientException as ace: + msg_type = TMessageType.REPLY + result.ace = ace + except apache.airavata.api.error.ttypes.AiravataSystemException as ase: + msg_type = TMessageType.REPLY + result.ase = ase + except apache.airavata.api.error.ttypes.AuthorizationException as ae: + msg_type = TMessageType.REPLY + result.ae = ae + except Exception as ex: + msg_type = TMessageType.EXCEPTION + logging.exception(ex) + result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error') + oprot.writeMessageBegin("copyDataResource", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -43863,3 +43950,236 @@ class getDataResource_result: def __ne__(self, other): return not (self == other) + +class copyDataResource_args: + """ + Attributes: + - authzToken + - resourceId + - destStorageResourceId + - destinationParentPath + """ + + 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.STRING, 'resourceId', None, None, ), # 2 + (3, TType.STRING, 'destStorageResourceId', None, None, ), # 3 + (4, TType.STRING, 'destinationParentPath', None, None, ), # 4 + ) + + def __init__(self, authzToken=None, resourceId=None, destStorageResourceId=None, destinationParentPath=None,): + self.authzToken = authzToken + self.resourceId = resourceId + self.destStorageResourceId = destStorageResourceId + self.destinationParentPath = destinationParentPath + + 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.STRING: + self.resourceId = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.STRING: + self.destStorageResourceId = iprot.readString() + else: + iprot.skip(ftype) + elif fid == 4: + if ftype == TType.STRING: + self.destinationParentPath = 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('copyDataResource_args') + if self.authzToken is not None: + oprot.writeFieldBegin('authzToken', TType.STRUCT, 1) + self.authzToken.write(oprot) + oprot.writeFieldEnd() + if self.resourceId is not None: + oprot.writeFieldBegin('resourceId', TType.STRING, 2) + oprot.writeString(self.resourceId) + oprot.writeFieldEnd() + if self.destStorageResourceId is not None: + oprot.writeFieldBegin('destStorageResourceId', TType.STRING, 3) + oprot.writeString(self.destStorageResourceId) + oprot.writeFieldEnd() + if self.destinationParentPath is not None: + oprot.writeFieldBegin('destinationParentPath', TType.STRING, 4) + oprot.writeString(self.destinationParentPath) + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + if self.authzToken is None: + raise TProtocol.TProtocolException(message='Required field authzToken is unset!') + if self.resourceId is None: + raise TProtocol.TProtocolException(message='Required field resourceId is unset!') + if self.destStorageResourceId is None: + raise TProtocol.TProtocolException(message='Required field destStorageResourceId is unset!') + if self.destinationParentPath is None: + raise TProtocol.TProtocolException(message='Required field destinationParentPath is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.authzToken) + value = (value * 31) ^ hash(self.resourceId) + value = (value * 31) ^ hash(self.destStorageResourceId) + value = (value * 31) ^ hash(self.destinationParentPath) + 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 copyDataResource_result: + """ + Attributes: + - success + - ire + - ace + - ase + - ae + """ + + thrift_spec = ( + (0, TType.STRING, 'success', None, 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, success=None, ire=None, ace=None, ase=None, ae=None,): + self.success = success + 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 == 0: + if ftype == TType.STRING: + self.success = iprot.readString() + else: + iprot.skip(ftype) + elif 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('copyDataResource_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRING, 0) + oprot.writeString(self.success) + oprot.writeFieldEnd() + 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.success) + 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/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java deleted file mode 100644 index b11548e..0000000 --- a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * 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.catalog.core; - -import org.apache.airavata.data.catalog.cpi.DataManager; -import org.apache.airavata.data.catalog.cpi.DataManagerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class DataManagerFactory { - private final static Logger logger = LoggerFactory.getLogger(DataManagerFactory.class); - - public static DataManager getDataManager() throws DataManagerException { - return new DataManagerImpl(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java deleted file mode 100644 index d54479d..0000000 --- a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/catalog/core/DataManagerImpl.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * - * 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.catalog.core; - -import org.apache.airavata.model.data.resource.DataReplicaLocationModel; -import org.apache.airavata.model.data.resource.DataResourceModel; -import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.DataCatalog; -import org.apache.airavata.registry.cpi.DataCatalogException; - -import org.apache.airavata.data.catalog.cpi.DataManager; -import org.apache.airavata.data.catalog.cpi.DataManagerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.List; - -public class DataManagerImpl implements DataManager { - private final static Logger logger = LoggerFactory.getLogger(DataManagerImpl.class); - - private final DataCatalog dataCatalog; - - public DataManagerImpl() throws DataManagerException { - try { - this.dataCatalog = RegistryFactory.getDataCatalog(); - } catch (Exception e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - public DataManagerImpl(DataCatalog dataCatalog){ - this.dataCatalog = dataCatalog; - } - - /** - * To create a replica entry for an already existing file(s). This is how the system comes to know about already - * existing resources - * @param dataResourceModel - * @return - */ - @Override - public String registerResource(DataResourceModel dataResourceModel) throws DataManagerException { - try { - String resourceId = dataCatalog.publishResource(dataResourceModel); - return resourceId; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To remove a resource entry from the replica catalog - * @param resourceId - * @return - */ - @Override - public boolean removeResource(String resourceId) throws DataManagerException { - try { - boolean result = dataCatalog.removeResource(resourceId); - return result; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To update an existing data resource model - * @param dataResourceModel - * @return - * @throws DataCatalogException - */ - @Override - public boolean updateResource(DataResourceModel dataResourceModel) throws DataManagerException { - try { - boolean result = dataCatalog.updateResource(dataResourceModel); - return result; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To retrieve a resource object providing the resourceId - * @param resourceId - * @return - */ - @Override - public DataResourceModel getResource(String resourceId) throws DataManagerException { - try { - DataResourceModel dataResource = dataCatalog.getResource(resourceId); - return dataResource; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To create a new data replica location. This is how the system comes to know about already - * existing resources - * - * @param dataReplicaLocationModel - * @return - */ - @Override - public String registerReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException { - try { - String replicaId = dataCatalog.publishReplicaLocation(dataReplicaLocationModel); - return replicaId; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To remove a replica entry from the replica catalog - * - * @param replicaId - * @return - */ - @Override - public boolean removeReplicaLocation(String replicaId) throws DataManagerException { - try { - boolean result = dataCatalog.removeReplicaLocation(replicaId); - return result; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To update an existing data replica model - * - * @param dataReplicaLocationModel - * @return - * @throws DataCatalogException - */ - @Override - public boolean updateReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel) throws DataManagerException { - try { - boolean result = dataCatalog.updateReplicaLocation(dataReplicaLocationModel); - return result; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To retrieve a replica object providing the replicaId - * - * @param replicaId - * @return - */ - @Override - public DataReplicaLocationModel getReplicaLocation(String replicaId) throws DataManagerException { - try { - DataReplicaLocationModel dataReplicaLocationModel = dataCatalog.getReplicaLocation(replicaId); - return dataReplicaLocationModel; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } - - /** - * To retrieve all the replica entries for a given resource id - * - * @param resourceId - * @return - * @throws DataCatalogException - */ - @Override - public List<DataReplicaLocationModel> getAllReplicaLocations(String resourceId) throws DataManagerException { - try { - List<DataReplicaLocationModel> dataReplicaLocationModelList = dataCatalog.getAllReplicaLocations(resourceId); - return dataReplicaLocationModelList; - } catch (DataCatalogException e) { - logger.error(e.getMessage(), e); - throw new DataManagerException(e); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/6572a821/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java ---------------------------------------------------------------------- diff --git a/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java new file mode 100644 index 0000000..cd92146 --- /dev/null +++ b/modules/data-manager/data-manager-core/src/main/java/org/apache/airavata/data/manager/core/DataManagerFactory.java @@ -0,0 +1,34 @@ +/* + * + * 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.core; + +import org.apache.airavata.data.manager.cpi.DataManager; +import org.apache.airavata.data.manager.cpi.DataManagerException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataManagerFactory { + private final static Logger logger = LoggerFactory.getLogger(DataManagerFactory.class); + + public static DataManager getDataManager() throws DataManagerException { + return new DataManagerImpl(); + } +} \ No newline at end of file
