http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp new file mode 100644 index 0000000..d260a1c --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.cpp @@ -0,0 +1,299 @@ +/** + * 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. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#include "data_resource_models_types.h" + +#include <algorithm> +#include <ostream> + +#include <thrift/TToString.h> + +namespace apache { namespace airavata { namespace model { namespace data { namespace resource { + + +ResourceModel::~ResourceModel() throw() { +} + + +void ResourceModel::__set_resourceId(const std::string& val) { + this->resourceId = val; +__isset.resourceId = true; +} + +void ResourceModel::__set_resourceName(const std::string& val) { + this->resourceName = val; +__isset.resourceName = true; +} + +void ResourceModel::__set_replicaLocations(const std::vector<ReplicaLocationModel> & val) { + this->replicaLocations = val; +} + +const char* ResourceModel::ascii_fingerprint = "D638A8293F444DF2C34755C1D925146E"; +const uint8_t ResourceModel::binary_fingerprint[16] = {0xD6,0x38,0xA8,0x29,0x3F,0x44,0x4D,0xF2,0xC3,0x47,0x55,0xC1,0xD9,0x25,0x14,0x6E}; + +uint32_t ResourceModel::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->resourceId); + this->__isset.resourceId = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->resourceName); + this->__isset.resourceName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->replicaLocations.clear(); + uint32_t _size0; + ::apache::thrift::protocol::TType _etype3; + xfer += iprot->readListBegin(_etype3, _size0); + this->replicaLocations.resize(_size0); + uint32_t _i4; + for (_i4 = 0; _i4 < _size0; ++_i4) + { + xfer += this->replicaLocations[_i4].read(iprot); + } + xfer += iprot->readListEnd(); + } + this->__isset.replicaLocations = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ResourceModel::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + oprot->incrementRecursionDepth(); + xfer += oprot->writeStructBegin("ResourceModel"); + + if (this->__isset.resourceId) { + xfer += oprot->writeFieldBegin("resourceId", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->resourceId); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.resourceName) { + xfer += oprot->writeFieldBegin("resourceName", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->resourceName); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldBegin("replicaLocations", ::apache::thrift::protocol::T_LIST, 3); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->replicaLocations.size())); + std::vector<ReplicaLocationModel> ::const_iterator _iter5; + for (_iter5 = this->replicaLocations.begin(); _iter5 != this->replicaLocations.end(); ++_iter5) + { + xfer += (*_iter5).write(oprot); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + oprot->decrementRecursionDepth(); + return xfer; +} + +void swap(ResourceModel &a, ResourceModel &b) { + using ::std::swap; + swap(a.resourceId, b.resourceId); + swap(a.resourceName, b.resourceName); + swap(a.replicaLocations, b.replicaLocations); + swap(a.__isset, b.__isset); +} + +ResourceModel::ResourceModel(const ResourceModel& other6) { + resourceId = other6.resourceId; + resourceName = other6.resourceName; + replicaLocations = other6.replicaLocations; + __isset = other6.__isset; +} +ResourceModel& ResourceModel::operator=(const ResourceModel& other7) { + resourceId = other7.resourceId; + resourceName = other7.resourceName; + replicaLocations = other7.replicaLocations; + __isset = other7.__isset; + return *this; +} +std::ostream& operator<<(std::ostream& out, const ResourceModel& obj) { + using apache::thrift::to_string; + out << "ResourceModel("; + out << "resourceId="; (obj.__isset.resourceId ? (out << to_string(obj.resourceId)) : (out << "<null>")); + out << ", " << "resourceName="; (obj.__isset.resourceName ? (out << to_string(obj.resourceName)) : (out << "<null>")); + out << ", " << "replicaLocations=" << to_string(obj.replicaLocations); + out << ")"; + return out; +} + + +ReplicaLocationModel::~ReplicaLocationModel() throw() { +} + + +void ReplicaLocationModel::__set_physicalLocations(const std::vector<std::string> & val) { + this->physicalLocations = val; +__isset.physicalLocations = true; +} + +const char* ReplicaLocationModel::ascii_fingerprint = "6A3474ADDA840BE2091105F0DFB630C7"; +const uint8_t ReplicaLocationModel::binary_fingerprint[16] = {0x6A,0x34,0x74,0xAD,0xDA,0x84,0x0B,0xE2,0x09,0x11,0x05,0xF0,0xDF,0xB6,0x30,0xC7}; + +uint32_t ReplicaLocationModel::read(::apache::thrift::protocol::TProtocol* iprot) { + + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; + + xfer += iprot->readStructBegin(fname); + + using ::apache::thrift::protocol::TProtocolException; + + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_LIST) { + { + this->physicalLocations.clear(); + uint32_t _size8; + ::apache::thrift::protocol::TType _etype11; + xfer += iprot->readListBegin(_etype11, _size8); + this->physicalLocations.resize(_size8); + uint32_t _i12; + for (_i12 = 0; _i12 < _size8; ++_i12) + { + xfer += iprot->readString(this->physicalLocations[_i12]); + } + xfer += iprot->readListEnd(); + } + this->__isset.physicalLocations = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; + } + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + return xfer; +} + +uint32_t ReplicaLocationModel::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + oprot->incrementRecursionDepth(); + xfer += oprot->writeStructBegin("ReplicaLocationModel"); + + if (this->__isset.physicalLocations) { + xfer += oprot->writeFieldBegin("physicalLocations", ::apache::thrift::protocol::T_LIST, 1); + { + xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRING, static_cast<uint32_t>(this->physicalLocations.size())); + std::vector<std::string> ::const_iterator _iter13; + for (_iter13 = this->physicalLocations.begin(); _iter13 != this->physicalLocations.end(); ++_iter13) + { + xfer += oprot->writeString((*_iter13)); + } + xfer += oprot->writeListEnd(); + } + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + oprot->decrementRecursionDepth(); + return xfer; +} + +void swap(ReplicaLocationModel &a, ReplicaLocationModel &b) { + using ::std::swap; + swap(a.physicalLocations, b.physicalLocations); + swap(a.__isset, b.__isset); +} + +ReplicaLocationModel::ReplicaLocationModel(const ReplicaLocationModel& other14) { + physicalLocations = other14.physicalLocations; + __isset = other14.__isset; +} +ReplicaLocationModel& ReplicaLocationModel::operator=(const ReplicaLocationModel& other15) { + physicalLocations = other15.physicalLocations; + __isset = other15.__isset; + return *this; +} +std::ostream& operator<<(std::ostream& out, const ReplicaLocationModel& obj) { + using apache::thrift::to_string; + out << "ReplicaLocationModel("; + out << "physicalLocations="; (obj.__isset.physicalLocations ? (out << to_string(obj.physicalLocations)) : (out << "<null>")); + out << ")"; + return out; +} + +}}}}} // namespace
http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h new file mode 100644 index 0000000..213bd9e --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-cpp-sdk/src/main/resources/lib/airavata/data_resource_models_types.h @@ -0,0 +1,149 @@ +/** + * 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. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +#ifndef data_resource_models_TYPES_H +#define data_resource_models_TYPES_H + +#include <iosfwd> + +#include <thrift/Thrift.h> +#include <thrift/TApplicationException.h> +#include <thrift/protocol/TProtocol.h> +#include <thrift/transport/TTransport.h> + +#include <thrift/cxxfunctional.h> + + +namespace apache { namespace airavata { namespace model { namespace data { namespace resource { + +class ResourceModel; + +class ReplicaLocationModel; + +typedef struct _ResourceModel__isset { + _ResourceModel__isset() : resourceId(false), resourceName(false), replicaLocations(false) {} + bool resourceId :1; + bool resourceName :1; + bool replicaLocations :1; +} _ResourceModel__isset; + +class ResourceModel { + public: + + static const char* ascii_fingerprint; // = "D638A8293F444DF2C34755C1D925146E"; + static const uint8_t binary_fingerprint[16]; // = {0xD6,0x38,0xA8,0x29,0x3F,0x44,0x4D,0xF2,0xC3,0x47,0x55,0xC1,0xD9,0x25,0x14,0x6E}; + + ResourceModel(const ResourceModel&); + ResourceModel& operator=(const ResourceModel&); + ResourceModel() : resourceId(), resourceName() { + } + + virtual ~ResourceModel() throw(); + std::string resourceId; + std::string resourceName; + std::vector<ReplicaLocationModel> replicaLocations; + + _ResourceModel__isset __isset; + + void __set_resourceId(const std::string& val); + + void __set_resourceName(const std::string& val); + + void __set_replicaLocations(const std::vector<ReplicaLocationModel> & val); + + bool operator == (const ResourceModel & rhs) const + { + if (__isset.resourceId != rhs.__isset.resourceId) + return false; + else if (__isset.resourceId && !(resourceId == rhs.resourceId)) + return false; + if (__isset.resourceName != rhs.__isset.resourceName) + return false; + else if (__isset.resourceName && !(resourceName == rhs.resourceName)) + return false; + if (!(replicaLocations == rhs.replicaLocations)) + return false; + return true; + } + bool operator != (const ResourceModel &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ResourceModel & ) 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 ResourceModel& obj); +}; + +void swap(ResourceModel &a, ResourceModel &b); + +typedef struct _ReplicaLocationModel__isset { + _ReplicaLocationModel__isset() : physicalLocations(false) {} + bool physicalLocations :1; +} _ReplicaLocationModel__isset; + +class ReplicaLocationModel { + public: + + static const char* ascii_fingerprint; // = "6A3474ADDA840BE2091105F0DFB630C7"; + static const uint8_t binary_fingerprint[16]; // = {0x6A,0x34,0x74,0xAD,0xDA,0x84,0x0B,0xE2,0x09,0x11,0x05,0xF0,0xDF,0xB6,0x30,0xC7}; + + ReplicaLocationModel(const ReplicaLocationModel&); + ReplicaLocationModel& operator=(const ReplicaLocationModel&); + ReplicaLocationModel() { + } + + virtual ~ReplicaLocationModel() throw(); + std::vector<std::string> physicalLocations; + + _ReplicaLocationModel__isset __isset; + + void __set_physicalLocations(const std::vector<std::string> & val); + + bool operator == (const ReplicaLocationModel & rhs) const + { + if (__isset.physicalLocations != rhs.__isset.physicalLocations) + return false; + else if (__isset.physicalLocations && !(physicalLocations == rhs.physicalLocations)) + return false; + return true; + } + bool operator != (const ReplicaLocationModel &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ReplicaLocationModel & ) 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 ReplicaLocationModel& obj); +}; + +void swap(ReplicaLocationModel &a, ReplicaLocationModel &b); + +}}}}} // namespace + +#endif http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php new file mode 100644 index 0000000..4e638e6 --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Resource/Types.php @@ -0,0 +1,270 @@ +<?php +namespace Airavata\Model\Data\Resource; + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +use Thrift\Base\TBase; +use Thrift\Type\TType; +use Thrift\Type\TMessageType; +use Thrift\Exception\TException; +use Thrift\Exception\TProtocolException; +use Thrift\Protocol\TProtocol; +use Thrift\Protocol\TBinaryProtocolAccelerated; +use Thrift\Exception\TApplicationException; + + +class ResourceModel { + static $_TSPEC; + + /** + * @var string + */ + public $resourceId = null; + /** + * @var string + */ + public $resourceName = null; + /** + * @var \Airavata\Model\Data\Resource\ReplicaLocationModel[] + */ + public $replicaLocations = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'resourceId', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'resourceName', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'replicaLocations', + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\Airavata\Model\Data\Resource\ReplicaLocationModel', + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['resourceId'])) { + $this->resourceId = $vals['resourceId']; + } + if (isset($vals['resourceName'])) { + $this->resourceName = $vals['resourceName']; + } + if (isset($vals['replicaLocations'])) { + $this->replicaLocations = $vals['replicaLocations']; + } + } + } + + public function getName() { + return 'ResourceModel'; + } + + public function read($input) + { + $xfer = 0; + $fname = null; + $ftype = 0; + $fid = 0; + $xfer += $input->readStructBegin($fname); + while (true) + { + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { + break; + } + switch ($fid) + { + case 1: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->resourceId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->resourceName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::LST) { + $this->replicaLocations = array(); + $_size0 = 0; + $_etype3 = 0; + $xfer += $input->readListBegin($_etype3, $_size0); + for ($_i4 = 0; $_i4 < $_size0; ++$_i4) + { + $elem5 = null; + $elem5 = new \Airavata\Model\Data\Resource\ReplicaLocationModel(); + $xfer += $elem5->read($input); + $this->replicaLocations []= $elem5; + } + $xfer += $input->readListEnd(); + } 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('ResourceModel'); + if ($this->resourceId !== null) { + $xfer += $output->writeFieldBegin('resourceId', TType::STRING, 1); + $xfer += $output->writeString($this->resourceId); + $xfer += $output->writeFieldEnd(); + } + if ($this->resourceName !== null) { + $xfer += $output->writeFieldBegin('resourceName', TType::STRING, 2); + $xfer += $output->writeString($this->resourceName); + $xfer += $output->writeFieldEnd(); + } + if ($this->replicaLocations !== null) { + if (!is_array($this->replicaLocations)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('replicaLocations', TType::LST, 3); + { + $output->writeListBegin(TType::STRUCT, count($this->replicaLocations)); + { + foreach ($this->replicaLocations as $iter6) + { + $xfer += $iter6->write($output); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class ReplicaLocationModel { + static $_TSPEC; + + /** + * @var string[] + */ + public $physicalLocations = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'physicalLocations', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['physicalLocations'])) { + $this->physicalLocations = $vals['physicalLocations']; + } + } + } + + public function getName() { + return 'ReplicaLocationModel'; + } + + 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::LST) { + $this->physicalLocations = array(); + $_size7 = 0; + $_etype10 = 0; + $xfer += $input->readListBegin($_etype10, $_size7); + for ($_i11 = 0; $_i11 < $_size7; ++$_i11) + { + $elem12 = null; + $xfer += $input->readString($elem12); + $this->physicalLocations []= $elem12; + } + $xfer += $input->readListEnd(); + } 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('ReplicaLocationModel'); + if ($this->physicalLocations !== null) { + if (!is_array($this->physicalLocations)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('physicalLocations', TType::LST, 1); + { + $output->writeListBegin(TType::STRING, count($this->physicalLocations)); + { + foreach ($this->physicalLocations as $iter13) + { + $xfer += $output->writeString($iter13); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + + http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/__init__.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/__init__.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/__init__.py new file mode 100644 index 0000000..adefd8e --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/__init__.py @@ -0,0 +1 @@ +__all__ = ['ttypes', 'constants'] http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/constants.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/constants.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/constants.py new file mode 100644 index 0000000..99717a9 --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/constants.py @@ -0,0 +1,11 @@ +# +# Autogenerated by Thrift Compiler (0.9.2) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TException, TApplicationException +from ttypes import * + http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py new file mode 100644 index 0000000..7d5197e --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/resource/ttypes.py @@ -0,0 +1,191 @@ +# +# Autogenerated by Thrift Compiler (0.9.2) +# +# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING +# +# options string: py +# + +from thrift.Thrift import TType, TMessageType, TException, TApplicationException + +from thrift.transport import TTransport +from thrift.protocol import TBinaryProtocol, TProtocol +try: + from thrift.protocol import fastbinary +except: + fastbinary = None + + + +class ResourceModel: + """ + Attributes: + - resourceId + - resourceName + - replicaLocations + """ + + thrift_spec = ( + None, # 0 + (1, TType.STRING, 'resourceId', None, None, ), # 1 + (2, TType.STRING, 'resourceName', None, None, ), # 2 + (3, TType.LIST, 'replicaLocations', (TType.STRUCT,(ReplicaLocationModel, ReplicaLocationModel.thrift_spec)), None, ), # 3 + ) + + def __init__(self, resourceId=None, resourceName=None, replicaLocations=None,): + self.resourceId = resourceId + self.resourceName = resourceName + self.replicaLocations = replicaLocations + + def read(self, iprot): + if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: + fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) + return + iprot.readStructBegin() + while True: + (fname, ftype, fid) = iprot.readFieldBegin() + if ftype == TType.STOP: + break + if fid == 1: + if ftype == TType.STRING: + self.resourceId = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 2: + if ftype == TType.STRING: + self.resourceName = iprot.readString(); + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.LIST: + self.replicaLocations = [] + (_etype3, _size0) = iprot.readListBegin() + for _i4 in xrange(_size0): + _elem5 = ReplicaLocationModel() + _elem5.read(iprot) + self.replicaLocations.append(_elem5) + iprot.readListEnd() + 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('ResourceModel') + if self.resourceId is not None: + oprot.writeFieldBegin('resourceId', TType.STRING, 1) + oprot.writeString(self.resourceId) + oprot.writeFieldEnd() + if self.resourceName is not None: + oprot.writeFieldBegin('resourceName', TType.STRING, 2) + oprot.writeString(self.resourceName) + oprot.writeFieldEnd() + if self.replicaLocations is not None: + oprot.writeFieldBegin('replicaLocations', TType.LIST, 3) + oprot.writeListBegin(TType.STRUCT, len(self.replicaLocations)) + for iter6 in self.replicaLocations: + iter6.write(oprot) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.resourceId) + value = (value * 31) ^ hash(self.resourceName) + value = (value * 31) ^ hash(self.replicaLocations) + 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 ReplicaLocationModel: + """ + Attributes: + - physicalLocations + """ + + thrift_spec = ( + None, # 0 + (1, TType.LIST, 'physicalLocations', (TType.STRING,None), None, ), # 1 + ) + + def __init__(self, physicalLocations=None,): + self.physicalLocations = physicalLocations + + 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.LIST: + self.physicalLocations = [] + (_etype10, _size7) = iprot.readListBegin() + for _i11 in xrange(_size7): + _elem12 = iprot.readString(); + self.physicalLocations.append(_elem12) + iprot.readListEnd() + 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('ReplicaLocationModel') + if self.physicalLocations is not None: + oprot.writeFieldBegin('physicalLocations', TType.LIST, 1) + oprot.writeListBegin(TType.STRING, len(self.physicalLocations)) + for iter13 in self.physicalLocations: + oprot.writeString(iter13) + oprot.writeListEnd() + oprot.writeFieldEnd() + oprot.writeFieldStop() + oprot.writeStructEnd() + + def validate(self): + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.physicalLocations) + 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/25da582a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java new file mode 100644 index 0000000..f3af020 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ReplicaLocationModel.java @@ -0,0 +1,459 @@ +/** + * 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. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.data.resource; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-12-2") +public class ReplicaLocationModel implements org.apache.thrift.TBase<ReplicaLocationModel, ReplicaLocationModel._Fields>, java.io.Serializable, Cloneable, Comparable<ReplicaLocationModel> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ReplicaLocationModel"); + + private static final org.apache.thrift.protocol.TField PHYSICAL_LOCATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("physicalLocations", org.apache.thrift.protocol.TType.LIST, (short)1); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ReplicaLocationModelStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ReplicaLocationModelTupleSchemeFactory()); + } + + private List<String> physicalLocations; // optional + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + PHYSICAL_LOCATIONS((short)1, "physicalLocations"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // PHYSICAL_LOCATIONS + return PHYSICAL_LOCATIONS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final _Fields optionals[] = {_Fields.PHYSICAL_LOCATIONS}; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.PHYSICAL_LOCATIONS, new org.apache.thrift.meta_data.FieldMetaData("physicalLocations", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ReplicaLocationModel.class, metaDataMap); + } + + public ReplicaLocationModel() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ReplicaLocationModel(ReplicaLocationModel other) { + if (other.isSetPhysicalLocations()) { + List<String> __this__physicalLocations = new ArrayList<String>(other.physicalLocations); + this.physicalLocations = __this__physicalLocations; + } + } + + public ReplicaLocationModel deepCopy() { + return new ReplicaLocationModel(this); + } + + @Override + public void clear() { + this.physicalLocations = null; + } + + public int getPhysicalLocationsSize() { + return (this.physicalLocations == null) ? 0 : this.physicalLocations.size(); + } + + public java.util.Iterator<String> getPhysicalLocationsIterator() { + return (this.physicalLocations == null) ? null : this.physicalLocations.iterator(); + } + + public void addToPhysicalLocations(String elem) { + if (this.physicalLocations == null) { + this.physicalLocations = new ArrayList<String>(); + } + this.physicalLocations.add(elem); + } + + public List<String> getPhysicalLocations() { + return this.physicalLocations; + } + + public void setPhysicalLocations(List<String> physicalLocations) { + this.physicalLocations = physicalLocations; + } + + public void unsetPhysicalLocations() { + this.physicalLocations = null; + } + + /** Returns true if field physicalLocations is set (has been assigned a value) and false otherwise */ + public boolean isSetPhysicalLocations() { + return this.physicalLocations != null; + } + + public void setPhysicalLocationsIsSet(boolean value) { + if (!value) { + this.physicalLocations = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case PHYSICAL_LOCATIONS: + if (value == null) { + unsetPhysicalLocations(); + } else { + setPhysicalLocations((List<String>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case PHYSICAL_LOCATIONS: + return getPhysicalLocations(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case PHYSICAL_LOCATIONS: + return isSetPhysicalLocations(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ReplicaLocationModel) + return this.equals((ReplicaLocationModel)that); + return false; + } + + public boolean equals(ReplicaLocationModel that) { + if (that == null) + return false; + + boolean this_present_physicalLocations = true && this.isSetPhysicalLocations(); + boolean that_present_physicalLocations = true && that.isSetPhysicalLocations(); + if (this_present_physicalLocations || that_present_physicalLocations) { + if (!(this_present_physicalLocations && that_present_physicalLocations)) + return false; + if (!this.physicalLocations.equals(that.physicalLocations)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_physicalLocations = true && (isSetPhysicalLocations()); + list.add(present_physicalLocations); + if (present_physicalLocations) + list.add(physicalLocations); + + return list.hashCode(); + } + + @Override + public int compareTo(ReplicaLocationModel other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetPhysicalLocations()).compareTo(other.isSetPhysicalLocations()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetPhysicalLocations()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.physicalLocations, other.physicalLocations); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ReplicaLocationModel("); + boolean first = true; + + if (isSetPhysicalLocations()) { + sb.append("physicalLocations:"); + if (this.physicalLocations == null) { + sb.append("null"); + } else { + sb.append(this.physicalLocations); + } + first = false; + } + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class ReplicaLocationModelStandardSchemeFactory implements SchemeFactory { + public ReplicaLocationModelStandardScheme getScheme() { + return new ReplicaLocationModelStandardScheme(); + } + } + + private static class ReplicaLocationModelStandardScheme extends StandardScheme<ReplicaLocationModel> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ReplicaLocationModel struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // PHYSICAL_LOCATIONS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); + struct.physicalLocations = new ArrayList<String>(_list8.size); + String _elem9; + for (int _i10 = 0; _i10 < _list8.size; ++_i10) + { + _elem9 = iprot.readString(); + struct.physicalLocations.add(_elem9); + } + iprot.readListEnd(); + } + struct.setPhysicalLocationsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, ReplicaLocationModel struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.physicalLocations != null) { + if (struct.isSetPhysicalLocations()) { + oprot.writeFieldBegin(PHYSICAL_LOCATIONS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.physicalLocations.size())); + for (String _iter11 : struct.physicalLocations) + { + oprot.writeString(_iter11); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ReplicaLocationModelTupleSchemeFactory implements SchemeFactory { + public ReplicaLocationModelTupleScheme getScheme() { + return new ReplicaLocationModelTupleScheme(); + } + } + + private static class ReplicaLocationModelTupleScheme extends TupleScheme<ReplicaLocationModel> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ReplicaLocationModel struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetPhysicalLocations()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetPhysicalLocations()) { + { + oprot.writeI32(struct.physicalLocations.size()); + for (String _iter12 : struct.physicalLocations) + { + oprot.writeString(_iter12); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ReplicaLocationModel struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.physicalLocations = new ArrayList<String>(_list13.size); + String _elem14; + for (int _i15 = 0; _i15 < _list13.size; ++_i15) + { + _elem14 = iprot.readString(); + struct.physicalLocations.add(_elem14); + } + } + struct.setPhysicalLocationsIsSet(true); + } + } + } + +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/25da582a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java new file mode 100644 index 0000000..bdaf535 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/resource/ResourceModel.java @@ -0,0 +1,679 @@ +/** + * 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. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.data.resource; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-12-2") +public class ResourceModel implements org.apache.thrift.TBase<ResourceModel, ResourceModel._Fields>, java.io.Serializable, Cloneable, Comparable<ResourceModel> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ResourceModel"); + + private static final org.apache.thrift.protocol.TField RESOURCE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField RESOURCE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("resourceName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField REPLICA_LOCATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("replicaLocations", org.apache.thrift.protocol.TType.LIST, (short)3); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new ResourceModelStandardSchemeFactory()); + schemes.put(TupleScheme.class, new ResourceModelTupleSchemeFactory()); + } + + private String resourceId; // optional + private String resourceName; // optional + private List<ReplicaLocationModel> replicaLocations; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + RESOURCE_ID((short)1, "resourceId"), + RESOURCE_NAME((short)2, "resourceName"), + REPLICA_LOCATIONS((short)3, "replicaLocations"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // RESOURCE_ID + return RESOURCE_ID; + case 2: // RESOURCE_NAME + return RESOURCE_NAME; + case 3: // REPLICA_LOCATIONS + return REPLICA_LOCATIONS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final _Fields optionals[] = {_Fields.RESOURCE_ID,_Fields.RESOURCE_NAME}; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.RESOURCE_ID, new org.apache.thrift.meta_data.FieldMetaData("resourceId", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.RESOURCE_NAME, new org.apache.thrift.meta_data.FieldMetaData("resourceName", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.REPLICA_LOCATIONS, new org.apache.thrift.meta_data.FieldMetaData("replicaLocations", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT , "ReplicaLocationModel")))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ResourceModel.class, metaDataMap); + } + + public ResourceModel() { + } + + public ResourceModel( + List<ReplicaLocationModel> replicaLocations) + { + this(); + this.replicaLocations = replicaLocations; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public ResourceModel(ResourceModel other) { + if (other.isSetResourceId()) { + this.resourceId = other.resourceId; + } + if (other.isSetResourceName()) { + this.resourceName = other.resourceName; + } + if (other.isSetReplicaLocations()) { + List<ReplicaLocationModel> __this__replicaLocations = new ArrayList<ReplicaLocationModel>(other.replicaLocations.size()); + for (ReplicaLocationModel other_element : other.replicaLocations) { + __this__replicaLocations.add(other_element); + } + this.replicaLocations = __this__replicaLocations; + } + } + + public ResourceModel deepCopy() { + return new ResourceModel(this); + } + + @Override + public void clear() { + this.resourceId = null; + this.resourceName = null; + this.replicaLocations = null; + } + + public String getResourceId() { + return this.resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public void unsetResourceId() { + this.resourceId = null; + } + + /** Returns true if field resourceId is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceId() { + return this.resourceId != null; + } + + public void setResourceIdIsSet(boolean value) { + if (!value) { + this.resourceId = null; + } + } + + public String getResourceName() { + return this.resourceName; + } + + public void setResourceName(String resourceName) { + this.resourceName = resourceName; + } + + public void unsetResourceName() { + this.resourceName = null; + } + + /** Returns true if field resourceName is set (has been assigned a value) and false otherwise */ + public boolean isSetResourceName() { + return this.resourceName != null; + } + + public void setResourceNameIsSet(boolean value) { + if (!value) { + this.resourceName = null; + } + } + + public int getReplicaLocationsSize() { + return (this.replicaLocations == null) ? 0 : this.replicaLocations.size(); + } + + public java.util.Iterator<ReplicaLocationModel> getReplicaLocationsIterator() { + return (this.replicaLocations == null) ? null : this.replicaLocations.iterator(); + } + + public void addToReplicaLocations(ReplicaLocationModel elem) { + if (this.replicaLocations == null) { + this.replicaLocations = new ArrayList<ReplicaLocationModel>(); + } + this.replicaLocations.add(elem); + } + + public List<ReplicaLocationModel> getReplicaLocations() { + return this.replicaLocations; + } + + public void setReplicaLocations(List<ReplicaLocationModel> replicaLocations) { + this.replicaLocations = replicaLocations; + } + + public void unsetReplicaLocations() { + this.replicaLocations = null; + } + + /** Returns true if field replicaLocations is set (has been assigned a value) and false otherwise */ + public boolean isSetReplicaLocations() { + return this.replicaLocations != null; + } + + public void setReplicaLocationsIsSet(boolean value) { + if (!value) { + this.replicaLocations = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case RESOURCE_ID: + if (value == null) { + unsetResourceId(); + } else { + setResourceId((String)value); + } + break; + + case RESOURCE_NAME: + if (value == null) { + unsetResourceName(); + } else { + setResourceName((String)value); + } + break; + + case REPLICA_LOCATIONS: + if (value == null) { + unsetReplicaLocations(); + } else { + setReplicaLocations((List<ReplicaLocationModel>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case RESOURCE_ID: + return getResourceId(); + + case RESOURCE_NAME: + return getResourceName(); + + case REPLICA_LOCATIONS: + return getReplicaLocations(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case RESOURCE_ID: + return isSetResourceId(); + case RESOURCE_NAME: + return isSetResourceName(); + case REPLICA_LOCATIONS: + return isSetReplicaLocations(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof ResourceModel) + return this.equals((ResourceModel)that); + return false; + } + + public boolean equals(ResourceModel that) { + if (that == null) + return false; + + boolean this_present_resourceId = true && this.isSetResourceId(); + boolean that_present_resourceId = true && that.isSetResourceId(); + if (this_present_resourceId || that_present_resourceId) { + if (!(this_present_resourceId && that_present_resourceId)) + return false; + if (!this.resourceId.equals(that.resourceId)) + return false; + } + + boolean this_present_resourceName = true && this.isSetResourceName(); + boolean that_present_resourceName = true && that.isSetResourceName(); + if (this_present_resourceName || that_present_resourceName) { + if (!(this_present_resourceName && that_present_resourceName)) + return false; + if (!this.resourceName.equals(that.resourceName)) + return false; + } + + boolean this_present_replicaLocations = true && this.isSetReplicaLocations(); + boolean that_present_replicaLocations = true && that.isSetReplicaLocations(); + if (this_present_replicaLocations || that_present_replicaLocations) { + if (!(this_present_replicaLocations && that_present_replicaLocations)) + return false; + if (!this.replicaLocations.equals(that.replicaLocations)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + List<Object> list = new ArrayList<Object>(); + + boolean present_resourceId = true && (isSetResourceId()); + list.add(present_resourceId); + if (present_resourceId) + list.add(resourceId); + + boolean present_resourceName = true && (isSetResourceName()); + list.add(present_resourceName); + if (present_resourceName) + list.add(resourceName); + + boolean present_replicaLocations = true && (isSetReplicaLocations()); + list.add(present_replicaLocations); + if (present_replicaLocations) + list.add(replicaLocations); + + return list.hashCode(); + } + + @Override + public int compareTo(ResourceModel other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetResourceId()).compareTo(other.isSetResourceId()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceId()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceId, other.resourceId); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetResourceName()).compareTo(other.isSetResourceName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetResourceName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.resourceName, other.resourceName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetReplicaLocations()).compareTo(other.isSetReplicaLocations()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetReplicaLocations()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.replicaLocations, other.replicaLocations); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("ResourceModel("); + boolean first = true; + + if (isSetResourceId()) { + sb.append("resourceId:"); + if (this.resourceId == null) { + sb.append("null"); + } else { + sb.append(this.resourceId); + } + first = false; + } + if (isSetResourceName()) { + if (!first) sb.append(", "); + sb.append("resourceName:"); + if (this.resourceName == null) { + sb.append("null"); + } else { + sb.append(this.resourceName); + } + first = false; + } + if (!first) sb.append(", "); + sb.append("replicaLocations:"); + if (this.replicaLocations == null) { + sb.append("null"); + } else { + sb.append(this.replicaLocations); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class ResourceModelStandardSchemeFactory implements SchemeFactory { + public ResourceModelStandardScheme getScheme() { + return new ResourceModelStandardScheme(); + } + } + + private static class ResourceModelStandardScheme extends StandardScheme<ResourceModel> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, ResourceModel struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // RESOURCE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceId = iprot.readString(); + struct.setResourceIdIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // RESOURCE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.resourceName = iprot.readString(); + struct.setResourceNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // REPLICA_LOCATIONS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); + struct.replicaLocations = new ArrayList<ReplicaLocationModel>(_list0.size); + ReplicaLocationModel _elem1; + for (int _i2 = 0; _i2 < _list0.size; ++_i2) + { + _elem1 = new ReplicaLocationModel(); + _elem1.read(iprot); + struct.replicaLocations.add(_elem1); + } + iprot.readListEnd(); + } + struct.setReplicaLocationsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, ResourceModel struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.resourceId != null) { + if (struct.isSetResourceId()) { + oprot.writeFieldBegin(RESOURCE_ID_FIELD_DESC); + oprot.writeString(struct.resourceId); + oprot.writeFieldEnd(); + } + } + if (struct.resourceName != null) { + if (struct.isSetResourceName()) { + oprot.writeFieldBegin(RESOURCE_NAME_FIELD_DESC); + oprot.writeString(struct.resourceName); + oprot.writeFieldEnd(); + } + } + if (struct.replicaLocations != null) { + oprot.writeFieldBegin(REPLICA_LOCATIONS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.replicaLocations.size())); + for (ReplicaLocationModel _iter3 : struct.replicaLocations) + { + _iter3.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class ResourceModelTupleSchemeFactory implements SchemeFactory { + public ResourceModelTupleScheme getScheme() { + return new ResourceModelTupleScheme(); + } + } + + private static class ResourceModelTupleScheme extends TupleScheme<ResourceModel> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, ResourceModel struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetResourceId()) { + optionals.set(0); + } + if (struct.isSetResourceName()) { + optionals.set(1); + } + if (struct.isSetReplicaLocations()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetResourceId()) { + oprot.writeString(struct.resourceId); + } + if (struct.isSetResourceName()) { + oprot.writeString(struct.resourceName); + } + if (struct.isSetReplicaLocations()) { + { + oprot.writeI32(struct.replicaLocations.size()); + for (ReplicaLocationModel _iter4 : struct.replicaLocations) + { + _iter4.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, ResourceModel struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.resourceId = iprot.readString(); + struct.setResourceIdIsSet(true); + } + if (incoming.get(1)) { + struct.resourceName = iprot.readString(); + struct.setResourceNameIsSet(true); + } + if (incoming.get(2)) { + { + org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.replicaLocations = new ArrayList<ReplicaLocationModel>(_list5.size); + ReplicaLocationModel _elem6; + for (int _i7 = 0; _i7 < _list5.size; ++_i7) + { + _elem6 = new ReplicaLocationModel(); + _elem6.read(iprot); + struct.replicaLocations.add(_elem6); + } + } + struct.setReplicaLocationsIsSet(true); + } + } + } + +} +
