Repository: airavata Updated Branches: refs/heads/develop 18cd83c37 -> 3357169c6
http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Replica/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Replica/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Replica/Types.php index a2970ee..03978b0 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Replica/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Data/Replica/Types.php @@ -105,10 +105,6 @@ class DataProductModel { * @var \Airavata\Model\Data\Replica\DataReplicaLocationModel[] */ public $replicaLocations = null; - /** - * @var \Airavata\Model\Data\Replica\DataProductModel[] - */ - public $childProducts = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -178,15 +174,6 @@ class DataProductModel { 'class' => '\Airavata\Model\Data\Replica\DataReplicaLocationModel', ), ), - 14 => array( - 'var' => 'childProducts', - 'type' => TType::LST, - 'etype' => TType::STRUCT, - 'elem' => array( - 'type' => TType::STRUCT, - 'class' => '\Airavata\Model\Data\Replica\DataProductModel', - ), - ), ); } if (is_array($vals)) { @@ -229,9 +216,6 @@ class DataProductModel { if (isset($vals['replicaLocations'])) { $this->replicaLocations = $vals['replicaLocations']; } - if (isset($vals['childProducts'])) { - $this->childProducts = $vals['childProducts']; - } } } @@ -369,24 +353,6 @@ class DataProductModel { $xfer += $input->skip($ftype); } break; - case 14: - if ($ftype == TType::LST) { - $this->childProducts = array(); - $_size13 = 0; - $_etype16 = 0; - $xfer += $input->readListBegin($_etype16, $_size13); - for ($_i17 = 0; $_i17 < $_size13; ++$_i17) - { - $elem18 = null; - $elem18 = new \Airavata\Model\Data\Replica\DataProductModel(); - $xfer += $elem18->read($input); - $this->childProducts []= $elem18; - } - $xfer += $input->readListEnd(); - } else { - $xfer += $input->skip($ftype); - } - break; default: $xfer += $input->skip($ftype); break; @@ -463,10 +429,10 @@ class DataProductModel { { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->productMetadata)); { - foreach ($this->productMetadata as $kiter19 => $viter20) + foreach ($this->productMetadata as $kiter13 => $viter14) { - $xfer += $output->writeString($kiter19); - $xfer += $output->writeString($viter20); + $xfer += $output->writeString($kiter13); + $xfer += $output->writeString($viter14); } } $output->writeMapEnd(); @@ -481,26 +447,9 @@ class DataProductModel { { $output->writeListBegin(TType::STRUCT, count($this->replicaLocations)); { - foreach ($this->replicaLocations as $iter21) - { - $xfer += $iter21->write($output); - } - } - $output->writeListEnd(); - } - $xfer += $output->writeFieldEnd(); - } - if ($this->childProducts !== null) { - if (!is_array($this->childProducts)) { - throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); - } - $xfer += $output->writeFieldBegin('childProducts', TType::LST, 14); - { - $output->writeListBegin(TType::STRUCT, count($this->childProducts)); - { - foreach ($this->childProducts as $iter22) + foreach ($this->replicaLocations as $iter15) { - $xfer += $iter22->write($output); + $xfer += $iter15->write($output); } } $output->writeListEnd(); @@ -766,17 +715,17 @@ class DataReplicaLocationModel { case 12: if ($ftype == TType::MAP) { $this->replicaMetadata = array(); - $_size23 = 0; - $_ktype24 = 0; - $_vtype25 = 0; - $xfer += $input->readMapBegin($_ktype24, $_vtype25, $_size23); - for ($_i27 = 0; $_i27 < $_size23; ++$_i27) + $_size16 = 0; + $_ktype17 = 0; + $_vtype18 = 0; + $xfer += $input->readMapBegin($_ktype17, $_vtype18, $_size16); + for ($_i20 = 0; $_i20 < $_size16; ++$_i20) { - $key28 = ''; - $val29 = ''; - $xfer += $input->readString($key28); - $xfer += $input->readString($val29); - $this->replicaMetadata[$key28] = $val29; + $key21 = ''; + $val22 = ''; + $xfer += $input->readString($key21); + $xfer += $input->readString($val22); + $this->replicaMetadata[$key21] = $val22; } $xfer += $input->readMapEnd(); } else { @@ -859,10 +808,10 @@ class DataReplicaLocationModel { { $output->writeMapBegin(TType::STRING, TType::STRING, count($this->replicaMetadata)); { - foreach ($this->replicaMetadata as $kiter30 => $viter31) + foreach ($this->replicaMetadata as $kiter23 => $viter24) { - $xfer += $output->writeString($kiter30); - $xfer += $output->writeString($viter31); + $xfer += $output->writeString($kiter23); + $xfer += $output->writeString($viter24); } } $output->writeMapEnd(); http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/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 ac42357..67910c4 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 @@ -161,6 +161,8 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help': print(' string registerDataProduct(AuthzToken authzToken, DataProductModel dataProductModel)') print(' DataProductModel getDataProduct(AuthzToken authzToken, string dataProductUri)') print(' string registerReplicaLocation(AuthzToken authzToken, DataReplicaLocationModel replicaLocationModel)') + print(' DataProductModel getParentDataProduct(AuthzToken authzToken, string productUri)') + print(' getChildDataProducts(AuthzToken authzToken, string productUri)') print('') sys.exit(0) @@ -1039,6 +1041,18 @@ elif cmd == 'registerReplicaLocation': sys.exit(1) pp.pprint(client.registerReplicaLocation(eval(args[0]),eval(args[1]),)) +elif cmd == 'getParentDataProduct': + if len(args) != 2: + print('getParentDataProduct requires 2 args') + sys.exit(1) + pp.pprint(client.getParentDataProduct(eval(args[0]),args[1],)) + +elif cmd == 'getChildDataProducts': + if len(args) != 2: + print('getChildDataProducts requires 2 args') + sys.exit(1) + pp.pprint(client.getChildDataProducts(eval(args[0]),args[1],)) + else: print('Unrecognized method %s' % cmd) sys.exit(1) http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/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 ea2913c..bcebcdd 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 @@ -2919,7 +2919,7 @@ class Iface: def registerDataProduct(self, authzToken, dataProductModel): """ - API Methods related to data catalog + API Methods related to replica catalog Parameters: @@ -2944,6 +2944,22 @@ class Iface: """ pass + def getParentDataProduct(self, authzToken, productUri): + """ + Parameters: + - authzToken + - productUri + """ + pass + + def getChildDataProducts(self, authzToken, productUri): + """ + Parameters: + - authzToken + - productUri + """ + pass + class Client(Iface): def __init__(self, iprot, oprot=None): @@ -10380,7 +10396,7 @@ class Client(Iface): def registerDataProduct(self, authzToken, dataProductModel): """ - API Methods related to data catalog + API Methods related to replica catalog Parameters: @@ -10504,6 +10520,88 @@ class Client(Iface): raise result.ae raise TApplicationException(TApplicationException.MISSING_RESULT, "registerReplicaLocation failed: unknown result") + def getParentDataProduct(self, authzToken, productUri): + """ + Parameters: + - authzToken + - productUri + """ + self.send_getParentDataProduct(authzToken, productUri) + return self.recv_getParentDataProduct() + + def send_getParentDataProduct(self, authzToken, productUri): + self._oprot.writeMessageBegin('getParentDataProduct', TMessageType.CALL, self._seqid) + args = getParentDataProduct_args() + args.authzToken = authzToken + args.productUri = productUri + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getParentDataProduct(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getParentDataProduct_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, "getParentDataProduct failed: unknown result") + + def getChildDataProducts(self, authzToken, productUri): + """ + Parameters: + - authzToken + - productUri + """ + self.send_getChildDataProducts(authzToken, productUri) + return self.recv_getChildDataProducts() + + def send_getChildDataProducts(self, authzToken, productUri): + self._oprot.writeMessageBegin('getChildDataProducts', TMessageType.CALL, self._seqid) + args = getChildDataProducts_args() + args.authzToken = authzToken + args.productUri = productUri + args.write(self._oprot) + self._oprot.writeMessageEnd() + self._oprot.trans.flush() + + def recv_getChildDataProducts(self): + iprot = self._iprot + (fname, mtype, rseqid) = iprot.readMessageBegin() + if mtype == TMessageType.EXCEPTION: + x = TApplicationException() + x.read(iprot) + iprot.readMessageEnd() + raise x + result = getChildDataProducts_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, "getChildDataProducts failed: unknown result") + class Processor(Iface, TProcessor): def __init__(self, handler): @@ -10646,6 +10744,8 @@ class Processor(Iface, TProcessor): self._processMap["registerDataProduct"] = Processor.process_registerDataProduct self._processMap["getDataProduct"] = Processor.process_getDataProduct self._processMap["registerReplicaLocation"] = Processor.process_registerReplicaLocation + self._processMap["getParentDataProduct"] = Processor.process_getParentDataProduct + self._processMap["getChildDataProducts"] = Processor.process_getChildDataProducts def process(self, iprot, oprot): (name, type, seqid) = iprot.readMessageBegin() @@ -14924,6 +15024,68 @@ class Processor(Iface, TProcessor): oprot.writeMessageEnd() oprot.trans.flush() + def process_getParentDataProduct(self, seqid, iprot, oprot): + args = getParentDataProduct_args() + args.read(iprot) + iprot.readMessageEnd() + result = getParentDataProduct_result() + try: + result.success = self._handler.getParentDataProduct(args.authzToken, args.productUri) + 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("getParentDataProduct", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + + def process_getChildDataProducts(self, seqid, iprot, oprot): + args = getChildDataProducts_args() + args.read(iprot) + iprot.readMessageEnd() + result = getChildDataProducts_result() + try: + result.success = self._handler.getChildDataProducts(args.authzToken, args.productUri) + 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("getChildDataProducts", msg_type, seqid) + result.write(oprot) + oprot.writeMessageEnd() + oprot.trans.flush() + # HELPER FUNCTIONS AND STRUCTURES @@ -44789,3 +44951,419 @@ class registerReplicaLocation_result: def __ne__(self, other): return not (self == other) + +class getParentDataProduct_args: + """ + Attributes: + - authzToken + - productUri + """ + + 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, 'productUri', None, None, ), # 2 + ) + + def __init__(self, authzToken=None, productUri=None,): + self.authzToken = authzToken + self.productUri = productUri + + 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.productUri = 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('getParentDataProduct_args') + if self.authzToken is not None: + oprot.writeFieldBegin('authzToken', TType.STRUCT, 1) + self.authzToken.write(oprot) + oprot.writeFieldEnd() + if self.productUri is not None: + oprot.writeFieldBegin('productUri', TType.STRING, 2) + oprot.writeString(self.productUri) + 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.productUri is None: + raise TProtocol.TProtocolException(message='Required field productUri is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.authzToken) + value = (value * 31) ^ hash(self.productUri) + 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 getParentDataProduct_result: + """ + Attributes: + - success + - ire + - ace + - ase + - ae + """ + + thrift_spec = ( + (0, TType.STRUCT, 'success', (apache.airavata.model.data.replica.ttypes.DataProductModel, apache.airavata.model.data.replica.ttypes.DataProductModel.thrift_spec), None, ), # 0 + (1, TType.STRUCT, 'ire', (apache.airavata.api.error.ttypes.InvalidRequestException, apache.airavata.api.error.ttypes.InvalidRequestException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'ace', (apache.airavata.api.error.ttypes.AiravataClientException, apache.airavata.api.error.ttypes.AiravataClientException.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'ase', (apache.airavata.api.error.ttypes.AiravataSystemException, apache.airavata.api.error.ttypes.AiravataSystemException.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'ae', (apache.airavata.api.error.ttypes.AuthorizationException, apache.airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ), # 4 + ) + + def __init__(self, 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.STRUCT: + self.success = apache.airavata.model.data.replica.ttypes.DataProductModel() + self.success.read(iprot) + 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('getParentDataProduct_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.STRUCT, 0) + self.success.write(oprot) + 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) + +class getChildDataProducts_args: + """ + Attributes: + - authzToken + - productUri + """ + + 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, 'productUri', None, None, ), # 2 + ) + + def __init__(self, authzToken=None, productUri=None,): + self.authzToken = authzToken + self.productUri = productUri + + 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.productUri = 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('getChildDataProducts_args') + if self.authzToken is not None: + oprot.writeFieldBegin('authzToken', TType.STRUCT, 1) + self.authzToken.write(oprot) + oprot.writeFieldEnd() + if self.productUri is not None: + oprot.writeFieldBegin('productUri', TType.STRING, 2) + oprot.writeString(self.productUri) + 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.productUri is None: + raise TProtocol.TProtocolException(message='Required field productUri is unset!') + return + + + def __hash__(self): + value = 17 + value = (value * 31) ^ hash(self.authzToken) + value = (value * 31) ^ hash(self.productUri) + 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 getChildDataProducts_result: + """ + Attributes: + - success + - ire + - ace + - ase + - ae + """ + + thrift_spec = ( + (0, TType.LIST, 'success', (TType.STRUCT,(apache.airavata.model.data.replica.ttypes.DataProductModel, apache.airavata.model.data.replica.ttypes.DataProductModel.thrift_spec)), None, ), # 0 + (1, TType.STRUCT, 'ire', (apache.airavata.api.error.ttypes.InvalidRequestException, apache.airavata.api.error.ttypes.InvalidRequestException.thrift_spec), None, ), # 1 + (2, TType.STRUCT, 'ace', (apache.airavata.api.error.ttypes.AiravataClientException, apache.airavata.api.error.ttypes.AiravataClientException.thrift_spec), None, ), # 2 + (3, TType.STRUCT, 'ase', (apache.airavata.api.error.ttypes.AiravataSystemException, apache.airavata.api.error.ttypes.AiravataSystemException.thrift_spec), None, ), # 3 + (4, TType.STRUCT, 'ae', (apache.airavata.api.error.ttypes.AuthorizationException, apache.airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ), # 4 + ) + + def __init__(self, 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.LIST: + self.success = [] + (_etype268, _size265) = iprot.readListBegin() + for _i269 in xrange(_size265): + _elem270 = apache.airavata.model.data.replica.ttypes.DataProductModel() + _elem270.read(iprot) + self.success.append(_elem270) + iprot.readListEnd() + 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('getChildDataProducts_result') + if self.success is not None: + oprot.writeFieldBegin('success', TType.LIST, 0) + oprot.writeListBegin(TType.STRUCT, len(self.success)) + for iter271 in self.success: + iter271.write(oprot) + oprot.writeListEnd() + 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/02cbb8dc/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/replica/ttypes.py ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/replica/ttypes.py b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/replica/ttypes.py index 271b9c0..38f07f5 100644 --- a/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/replica/ttypes.py +++ b/airavata-api/airavata-client-sdks/airavata-python-sdk/src/main/resources/lib/apache/airavata/model/data/replica/ttypes.py @@ -84,7 +84,6 @@ class DataProductModel: - lastModifiedTime - productMetadata - replicaLocations - - childProducts """ thrift_spec = ( @@ -102,10 +101,9 @@ class DataProductModel: (11, TType.I64, 'lastModifiedTime', None, None, ), # 11 (12, TType.MAP, 'productMetadata', (TType.STRING,None,TType.STRING,None), None, ), # 12 (13, TType.LIST, 'replicaLocations', (TType.STRUCT,(DataReplicaLocationModel, DataReplicaLocationModel.thrift_spec)), None, ), # 13 - (14, TType.LIST, 'childProducts', (TType.STRUCT,(DataProductModel, DataProductModel.thrift_spec)), None, ), # 14 ) - def __init__(self, productUri=None, gatewayId=None, parentProductUri=None, logicalPath=None, productName=None, productDescription=None, ownerName=None, dataProductType=None, productSize=None, creationTime=None, lastModifiedTime=None, productMetadata=None, replicaLocations=None, childProducts=None,): + def __init__(self, productUri=None, gatewayId=None, parentProductUri=None, logicalPath=None, productName=None, productDescription=None, ownerName=None, dataProductType=None, productSize=None, creationTime=None, lastModifiedTime=None, productMetadata=None, replicaLocations=None,): self.productUri = productUri self.gatewayId = gatewayId self.parentProductUri = parentProductUri @@ -119,7 +117,6 @@ class DataProductModel: self.lastModifiedTime = lastModifiedTime self.productMetadata = productMetadata self.replicaLocations = replicaLocations - self.childProducts = childProducts 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: @@ -207,17 +204,6 @@ class DataProductModel: iprot.readListEnd() else: iprot.skip(ftype) - elif fid == 14: - if ftype == TType.LIST: - self.childProducts = [] - (_etype16, _size13) = iprot.readListBegin() - for _i17 in xrange(_size13): - _elem18 = DataProductModel() - _elem18.read(iprot) - self.childProducts.append(_elem18) - iprot.readListEnd() - else: - iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -275,23 +261,16 @@ class DataProductModel: if self.productMetadata is not None: oprot.writeFieldBegin('productMetadata', TType.MAP, 12) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.productMetadata)) - for kiter19,viter20 in self.productMetadata.items(): - oprot.writeString(kiter19) - oprot.writeString(viter20) + for kiter13,viter14 in self.productMetadata.items(): + oprot.writeString(kiter13) + oprot.writeString(viter14) oprot.writeMapEnd() oprot.writeFieldEnd() if self.replicaLocations is not None: oprot.writeFieldBegin('replicaLocations', TType.LIST, 13) oprot.writeListBegin(TType.STRUCT, len(self.replicaLocations)) - for iter21 in self.replicaLocations: - iter21.write(oprot) - oprot.writeListEnd() - oprot.writeFieldEnd() - if self.childProducts is not None: - oprot.writeFieldBegin('childProducts', TType.LIST, 14) - oprot.writeListBegin(TType.STRUCT, len(self.childProducts)) - for iter22 in self.childProducts: - iter22.write(oprot) + for iter15 in self.replicaLocations: + iter15.write(oprot) oprot.writeListEnd() oprot.writeFieldEnd() oprot.writeFieldStop() @@ -316,7 +295,6 @@ class DataProductModel: value = (value * 31) ^ hash(self.lastModifiedTime) value = (value * 31) ^ hash(self.productMetadata) value = (value * 31) ^ hash(self.replicaLocations) - value = (value * 31) ^ hash(self.childProducts) return value def __repr__(self): @@ -444,11 +422,11 @@ class DataReplicaLocationModel: elif fid == 12: if ftype == TType.MAP: self.replicaMetadata = {} - (_ktype24, _vtype25, _size23 ) = iprot.readMapBegin() - for _i27 in xrange(_size23): - _key28 = iprot.readString() - _val29 = iprot.readString() - self.replicaMetadata[_key28] = _val29 + (_ktype17, _vtype18, _size16 ) = iprot.readMapBegin() + for _i20 in xrange(_size16): + _key21 = iprot.readString() + _val22 = iprot.readString() + self.replicaMetadata[_key21] = _val22 iprot.readMapEnd() else: iprot.skip(ftype) @@ -509,9 +487,9 @@ class DataReplicaLocationModel: if self.replicaMetadata is not None: oprot.writeFieldBegin('replicaMetadata', TType.MAP, 12) oprot.writeMapBegin(TType.STRING, TType.STRING, len(self.replicaMetadata)) - for kiter30,viter31 in self.replicaMetadata.items(): - oprot.writeString(kiter30) - oprot.writeString(viter31) + for kiter23,viter24 in self.replicaMetadata.items(): + oprot.writeString(kiter23) + oprot.writeString(viter24) oprot.writeMapEnd() oprot.writeFieldEnd() oprot.writeFieldStop() http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataProductModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataProductModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataProductModel.java index 16a6aa9..8f44e79 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataProductModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataProductModel.java @@ -68,7 +68,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode private static final org.apache.thrift.protocol.TField LAST_MODIFIED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("lastModifiedTime", org.apache.thrift.protocol.TType.I64, (short)11); private static final org.apache.thrift.protocol.TField PRODUCT_METADATA_FIELD_DESC = new org.apache.thrift.protocol.TField("productMetadata", org.apache.thrift.protocol.TType.MAP, (short)12); 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)13); - private static final org.apache.thrift.protocol.TField CHILD_PRODUCTS_FIELD_DESC = new org.apache.thrift.protocol.TField("childProducts", org.apache.thrift.protocol.TType.LIST, (short)14); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -89,7 +88,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode private long lastModifiedTime; // optional private Map<String,String> productMetadata; // optional private List<DataReplicaLocationModel> replicaLocations; // optional - private List<DataProductModel> childProducts; // 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 { @@ -109,8 +107,7 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode CREATION_TIME((short)10, "creationTime"), LAST_MODIFIED_TIME((short)11, "lastModifiedTime"), PRODUCT_METADATA((short)12, "productMetadata"), - REPLICA_LOCATIONS((short)13, "replicaLocations"), - CHILD_PRODUCTS((short)14, "childProducts"); + REPLICA_LOCATIONS((short)13, "replicaLocations"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -151,8 +148,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode return PRODUCT_METADATA; case 13: // REPLICA_LOCATIONS return REPLICA_LOCATIONS; - case 14: // CHILD_PRODUCTS - return CHILD_PRODUCTS; default: return null; } @@ -197,7 +192,7 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode private static final int __CREATIONTIME_ISSET_ID = 1; private static final int __LASTMODIFIEDTIME_ISSET_ID = 2; private byte __isset_bitfield = 0; - private static final _Fields optionals[] = {_Fields.PRODUCT_URI,_Fields.GATEWAY_ID,_Fields.PARENT_PRODUCT_URI,_Fields.LOGICAL_PATH,_Fields.PRODUCT_NAME,_Fields.PRODUCT_DESCRIPTION,_Fields.OWNER_NAME,_Fields.DATA_PRODUCT_TYPE,_Fields.PRODUCT_SIZE,_Fields.CREATION_TIME,_Fields.LAST_MODIFIED_TIME,_Fields.PRODUCT_METADATA,_Fields.REPLICA_LOCATIONS,_Fields.CHILD_PRODUCTS}; + private static final _Fields optionals[] = {_Fields.PRODUCT_URI,_Fields.GATEWAY_ID,_Fields.PARENT_PRODUCT_URI,_Fields.LOGICAL_PATH,_Fields.PRODUCT_NAME,_Fields.PRODUCT_DESCRIPTION,_Fields.OWNER_NAME,_Fields.DATA_PRODUCT_TYPE,_Fields.PRODUCT_SIZE,_Fields.CREATION_TIME,_Fields.LAST_MODIFIED_TIME,_Fields.PRODUCT_METADATA,_Fields.REPLICA_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); @@ -230,9 +225,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode tmpMap.put(_Fields.REPLICA_LOCATIONS, new org.apache.thrift.meta_data.FieldMetaData("replicaLocations", 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.STRUCT , "DataReplicaLocationModel")))); - tmpMap.put(_Fields.CHILD_PRODUCTS, new org.apache.thrift.meta_data.FieldMetaData("childProducts", 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.STRUCT , "DataProductModel")))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(DataProductModel.class, metaDataMap); } @@ -283,13 +275,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode } this.replicaLocations = __this__replicaLocations; } - if (other.isSetChildProducts()) { - List<DataProductModel> __this__childProducts = new ArrayList<DataProductModel>(other.childProducts.size()); - for (DataProductModel other_element : other.childProducts) { - __this__childProducts.add(other_element); - } - this.childProducts = __this__childProducts; - } } public DataProductModel deepCopy() { @@ -314,7 +299,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode this.lastModifiedTime = 0; this.productMetadata = null; this.replicaLocations = null; - this.childProducts = null; } public String getProductUri() { @@ -647,44 +631,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode } } - public int getChildProductsSize() { - return (this.childProducts == null) ? 0 : this.childProducts.size(); - } - - public java.util.Iterator<DataProductModel> getChildProductsIterator() { - return (this.childProducts == null) ? null : this.childProducts.iterator(); - } - - public void addToChildProducts(DataProductModel elem) { - if (this.childProducts == null) { - this.childProducts = new ArrayList<DataProductModel>(); - } - this.childProducts.add(elem); - } - - public List<DataProductModel> getChildProducts() { - return this.childProducts; - } - - public void setChildProducts(List<DataProductModel> childProducts) { - this.childProducts = childProducts; - } - - public void unsetChildProducts() { - this.childProducts = null; - } - - /** Returns true if field childProducts is set (has been assigned a value) and false otherwise */ - public boolean isSetChildProducts() { - return this.childProducts != null; - } - - public void setChildProductsIsSet(boolean value) { - if (!value) { - this.childProducts = null; - } - } - public void setFieldValue(_Fields field, Object value) { switch (field) { case PRODUCT_URI: @@ -791,14 +737,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode } break; - case CHILD_PRODUCTS: - if (value == null) { - unsetChildProducts(); - } else { - setChildProducts((List<DataProductModel>)value); - } - break; - } } @@ -843,9 +781,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode case REPLICA_LOCATIONS: return getReplicaLocations(); - case CHILD_PRODUCTS: - return getChildProducts(); - } throw new IllegalStateException(); } @@ -883,8 +818,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode return isSetProductMetadata(); case REPLICA_LOCATIONS: return isSetReplicaLocations(); - case CHILD_PRODUCTS: - return isSetChildProducts(); } throw new IllegalStateException(); } @@ -1019,15 +952,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode return false; } - boolean this_present_childProducts = true && this.isSetChildProducts(); - boolean that_present_childProducts = true && that.isSetChildProducts(); - if (this_present_childProducts || that_present_childProducts) { - if (!(this_present_childProducts && that_present_childProducts)) - return false; - if (!this.childProducts.equals(that.childProducts)) - return false; - } - return true; } @@ -1100,11 +1024,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode if (present_replicaLocations) list.add(replicaLocations); - boolean present_childProducts = true && (isSetChildProducts()); - list.add(present_childProducts); - if (present_childProducts) - list.add(childProducts); - return list.hashCode(); } @@ -1246,16 +1165,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode return lastComparison; } } - lastComparison = Boolean.valueOf(isSetChildProducts()).compareTo(other.isSetChildProducts()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetChildProducts()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.childProducts, other.childProducts); - if (lastComparison != 0) { - return lastComparison; - } - } return 0; } @@ -1393,16 +1302,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode } first = false; } - if (isSetChildProducts()) { - if (!first) sb.append(", "); - sb.append("childProducts:"); - if (this.childProducts == null) { - sb.append("null"); - } else { - sb.append(this.childProducts); - } - first = false; - } sb.append(")"); return sb.toString(); } @@ -1575,25 +1474,6 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 14: // CHILD_PRODUCTS - if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { - { - org.apache.thrift.protocol.TList _list7 = iprot.readListBegin(); - struct.childProducts = new ArrayList<DataProductModel>(_list7.size); - DataProductModel _elem8; - for (int _i9 = 0; _i9 < _list7.size; ++_i9) - { - _elem8 = new DataProductModel(); - _elem8.read(iprot); - struct.childProducts.add(_elem8); - } - iprot.readListEnd(); - } - struct.setChildProductsIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -1683,10 +1563,10 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode oprot.writeFieldBegin(PRODUCT_METADATA_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.productMetadata.size())); - for (Map.Entry<String, String> _iter10 : struct.productMetadata.entrySet()) + for (Map.Entry<String, String> _iter7 : struct.productMetadata.entrySet()) { - oprot.writeString(_iter10.getKey()); - oprot.writeString(_iter10.getValue()); + oprot.writeString(_iter7.getKey()); + oprot.writeString(_iter7.getValue()); } oprot.writeMapEnd(); } @@ -1698,23 +1578,9 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode oprot.writeFieldBegin(REPLICA_LOCATIONS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.replicaLocations.size())); - for (DataReplicaLocationModel _iter11 : struct.replicaLocations) + for (DataReplicaLocationModel _iter8 : struct.replicaLocations) { - _iter11.write(oprot); - } - oprot.writeListEnd(); - } - oprot.writeFieldEnd(); - } - } - if (struct.childProducts != null) { - if (struct.isSetChildProducts()) { - oprot.writeFieldBegin(CHILD_PRODUCTS_FIELD_DESC); - { - oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.childProducts.size())); - for (DataProductModel _iter12 : struct.childProducts) - { - _iter12.write(oprot); + _iter8.write(oprot); } oprot.writeListEnd(); } @@ -1778,10 +1644,7 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode if (struct.isSetReplicaLocations()) { optionals.set(12); } - if (struct.isSetChildProducts()) { - optionals.set(13); - } - oprot.writeBitSet(optionals, 14); + oprot.writeBitSet(optionals, 13); if (struct.isSetProductUri()) { oprot.writeString(struct.productUri); } @@ -1818,28 +1681,19 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode if (struct.isSetProductMetadata()) { { oprot.writeI32(struct.productMetadata.size()); - for (Map.Entry<String, String> _iter13 : struct.productMetadata.entrySet()) + for (Map.Entry<String, String> _iter9 : struct.productMetadata.entrySet()) { - oprot.writeString(_iter13.getKey()); - oprot.writeString(_iter13.getValue()); + oprot.writeString(_iter9.getKey()); + oprot.writeString(_iter9.getValue()); } } } if (struct.isSetReplicaLocations()) { { oprot.writeI32(struct.replicaLocations.size()); - for (DataReplicaLocationModel _iter14 : struct.replicaLocations) - { - _iter14.write(oprot); - } - } - } - if (struct.isSetChildProducts()) { - { - oprot.writeI32(struct.childProducts.size()); - for (DataProductModel _iter15 : struct.childProducts) + for (DataReplicaLocationModel _iter10 : struct.replicaLocations) { - _iter15.write(oprot); + _iter10.write(oprot); } } } @@ -1848,7 +1702,7 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode @Override public void read(org.apache.thrift.protocol.TProtocol prot, DataProductModel struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(14); + BitSet incoming = iprot.readBitSet(13); if (incoming.get(0)) { struct.productUri = iprot.readString(); struct.setProductUriIsSet(true); @@ -1895,47 +1749,33 @@ public class DataProductModel implements org.apache.thrift.TBase<DataProductMode } if (incoming.get(11)) { { - org.apache.thrift.protocol.TMap _map16 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.productMetadata = new HashMap<String,String>(2*_map16.size); - String _key17; - String _val18; - for (int _i19 = 0; _i19 < _map16.size; ++_i19) + org.apache.thrift.protocol.TMap _map11 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.productMetadata = new HashMap<String,String>(2*_map11.size); + String _key12; + String _val13; + for (int _i14 = 0; _i14 < _map11.size; ++_i14) { - _key17 = iprot.readString(); - _val18 = iprot.readString(); - struct.productMetadata.put(_key17, _val18); + _key12 = iprot.readString(); + _val13 = iprot.readString(); + struct.productMetadata.put(_key12, _val13); } } struct.setProductMetadataIsSet(true); } if (incoming.get(12)) { { - org.apache.thrift.protocol.TList _list20 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.replicaLocations = new ArrayList<DataReplicaLocationModel>(_list20.size); - DataReplicaLocationModel _elem21; - for (int _i22 = 0; _i22 < _list20.size; ++_i22) + org.apache.thrift.protocol.TList _list15 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.replicaLocations = new ArrayList<DataReplicaLocationModel>(_list15.size); + DataReplicaLocationModel _elem16; + for (int _i17 = 0; _i17 < _list15.size; ++_i17) { - _elem21 = new DataReplicaLocationModel(); - _elem21.read(iprot); - struct.replicaLocations.add(_elem21); + _elem16 = new DataReplicaLocationModel(); + _elem16.read(iprot); + struct.replicaLocations.add(_elem16); } } struct.setReplicaLocationsIsSet(true); } - if (incoming.get(13)) { - { - org.apache.thrift.protocol.TList _list23 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.childProducts = new ArrayList<DataProductModel>(_list23.size); - DataProductModel _elem24; - for (int _i25 = 0; _i25 < _list23.size; ++_i25) - { - _elem24 = new DataProductModel(); - _elem24.read(iprot); - struct.childProducts.add(_elem24); - } - } - struct.setChildProductsIsSet(true); - } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataReplicaLocationModel.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataReplicaLocationModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataReplicaLocationModel.java index 91a3948..defc214 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataReplicaLocationModel.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/data/replica/DataReplicaLocationModel.java @@ -1349,15 +1349,15 @@ public class DataReplicaLocationModel implements org.apache.thrift.TBase<DataRep case 12: // REPLICA_METADATA if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map26 = iprot.readMapBegin(); - struct.replicaMetadata = new HashMap<String,String>(2*_map26.size); - String _key27; - String _val28; - for (int _i29 = 0; _i29 < _map26.size; ++_i29) + org.apache.thrift.protocol.TMap _map18 = iprot.readMapBegin(); + struct.replicaMetadata = new HashMap<String,String>(2*_map18.size); + String _key19; + String _val20; + for (int _i21 = 0; _i21 < _map18.size; ++_i21) { - _key27 = iprot.readString(); - _val28 = iprot.readString(); - struct.replicaMetadata.put(_key27, _val28); + _key19 = iprot.readString(); + _val20 = iprot.readString(); + struct.replicaMetadata.put(_key19, _val20); } iprot.readMapEnd(); } @@ -1455,10 +1455,10 @@ public class DataReplicaLocationModel implements org.apache.thrift.TBase<DataRep oprot.writeFieldBegin(REPLICA_METADATA_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.replicaMetadata.size())); - for (Map.Entry<String, String> _iter30 : struct.replicaMetadata.entrySet()) + for (Map.Entry<String, String> _iter22 : struct.replicaMetadata.entrySet()) { - oprot.writeString(_iter30.getKey()); - oprot.writeString(_iter30.getValue()); + oprot.writeString(_iter22.getKey()); + oprot.writeString(_iter22.getValue()); } oprot.writeMapEnd(); } @@ -1556,10 +1556,10 @@ public class DataReplicaLocationModel implements org.apache.thrift.TBase<DataRep if (struct.isSetReplicaMetadata()) { { oprot.writeI32(struct.replicaMetadata.size()); - for (Map.Entry<String, String> _iter31 : struct.replicaMetadata.entrySet()) + for (Map.Entry<String, String> _iter23 : struct.replicaMetadata.entrySet()) { - oprot.writeString(_iter31.getKey()); - oprot.writeString(_iter31.getValue()); + oprot.writeString(_iter23.getKey()); + oprot.writeString(_iter23.getValue()); } } } @@ -1615,15 +1615,15 @@ public class DataReplicaLocationModel implements org.apache.thrift.TBase<DataRep } if (incoming.get(11)) { { - org.apache.thrift.protocol.TMap _map32 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.replicaMetadata = new HashMap<String,String>(2*_map32.size); - String _key33; - String _val34; - for (int _i35 = 0; _i35 < _map32.size; ++_i35) + org.apache.thrift.protocol.TMap _map24 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.replicaMetadata = new HashMap<String,String>(2*_map24.size); + String _key25; + String _val26; + for (int _i27 = 0; _i27 < _map24.size; ++_i27) { - _key33 = iprot.readString(); - _val34 = iprot.readString(); - struct.replicaMetadata.put(_key33, _val34); + _key25 = iprot.readString(); + _val26 = iprot.readString(); + struct.replicaMetadata.put(_key25, _val26); } } struct.setReplicaMetadataIsSet(true); http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/impl/ReplicaCatalogImpl.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/impl/ReplicaCatalogImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/impl/ReplicaCatalogImpl.java index 3e4c835..b946710 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/impl/ReplicaCatalogImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/impl/ReplicaCatalogImpl.java @@ -37,6 +37,7 @@ import javax.persistence.EntityManager; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.UUID; @@ -360,4 +361,49 @@ public class ReplicaCatalogImpl implements ReplicaCatalog { } } } + + @Override + public DataProductModel getParentDataProduct(String productUri) throws ReplicaCatalogException { + EntityManager em = null; + try { + em = ReplicaCatalogJPAUtils.getEntityManager(); + DataProduct dataProduct = em.find(DataProduct.class, productUri); + return ThriftDataModelConversion.getDataProductModel(dataProduct.getParentDataProduct()); + } catch (Exception e) { + logger.error(e.getMessage(), e); + throw new ReplicaCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + } + + @Override + public List<DataProductModel> getChildDataProducts(String productUri) throws ReplicaCatalogException { + EntityManager em = null; + try { + em = ReplicaCatalogJPAUtils.getEntityManager(); + DataProduct dataProduct = em.find(DataProduct.class, productUri); + Collection<DataProduct> childProducts = dataProduct.getChildDataProducts(); + ArrayList<DataProductModel> returnModels = new ArrayList<>(); + childProducts.stream().forEach(cp->{ + returnModels.add(ThriftDataModelConversion.getDataProductModel(cp)); + }); + return returnModels; + } catch (Exception e) { + logger.error(e.getMessage(), e); + throw new ReplicaCatalogException(e); + } finally { + if (em != null && em.isOpen()) { + if (em.getTransaction().isActive()) { + em.getTransaction().rollback(); + } + em.close(); + } + } + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/utils/ThriftDataModelConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/utils/ThriftDataModelConversion.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/utils/ThriftDataModelConversion.java index 676f84b..741215a 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/utils/ThriftDataModelConversion.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/replica/catalog/utils/ThriftDataModelConversion.java @@ -65,11 +65,6 @@ public class ThriftDataModelConversion { .add(getDataReplicaLocationModel(r))); dataProductModel.setReplicaLocations(dataReplicaLocationModels); } - if(!dataProductModel.getDataProductType().equals(DataProductType.FILE) && dataProduct.getChildDataProducts() != null){ - ArrayList<DataProductModel> childDataProducts = new ArrayList<>(); - dataProduct.getChildDataProducts().stream().forEach(r->childDataProducts.add(getDataProductModel(r))); - dataProductModel.setChildProducts(childDataProducts); - } return dataProductModel; } return null; @@ -121,11 +116,6 @@ public class ThriftDataModelConversion { }); dataProduct.setDataReplicaLocations(dataReplicaLocations); } - if(dataProductModel.getDataProductType() == DataProductType.COLLECTION && dataProductModel.getChildProducts() != null){ - ArrayList<DataProduct> childDataProducts = new ArrayList<>(); - dataProductModel.getChildProducts().stream().forEach(r->childDataProducts.add(getDataProduct(r))); - dataProduct.setChildDataProducts(childDataProducts); - } return dataProduct; } http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ReplicaCatalog.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ReplicaCatalog.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ReplicaCatalog.java index 1897356..9db6dc6 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ReplicaCatalog.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ReplicaCatalog.java @@ -47,4 +47,8 @@ public interface ReplicaCatalog { DataReplicaLocationModel getReplicaLocation(String replicaId) throws ReplicaCatalogException; List<DataReplicaLocationModel> getAllReplicaLocations(String productUri) throws ReplicaCatalogException; + + DataProductModel getParentDataProduct(String productUri) throws ReplicaCatalogException; + + List<DataProductModel> getChildDataProducts(String productUri) throws ReplicaCatalogException; } http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/thrift-interface-descriptions/airavata-apis/airavata_api.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift index 5fcdb88..d54a6d9 100644 --- a/thrift-interface-descriptions/airavata-apis/airavata_api.thrift +++ b/thrift-interface-descriptions/airavata-apis/airavata_api.thrift @@ -2982,6 +2982,17 @@ service Airavata { 3: airavata_errors.AiravataSystemException ase, 4: airavata_errors.AuthorizationException ae) + replica_catalog_models.DataProductModel getParentDataProduct(1: required security_model.AuthzToken authzToken, 2: required string productUri) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) + + list<replica_catalog_models.DataProductModel> getChildDataProducts(1: required security_model.AuthzToken authzToken, 2: required string productUri) + throws (1: airavata_errors.InvalidRequestException ire, + 2: airavata_errors.AiravataClientException ace, + 3: airavata_errors.AiravataSystemException ase, + 4: airavata_errors.AuthorizationException ae) //End of API } http://git-wip-us.apache.org/repos/asf/airavata/blob/02cbb8dc/thrift-interface-descriptions/data-models/replica-catalog-models/replica_catalog_models.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/data-models/replica-catalog-models/replica_catalog_models.thrift b/thrift-interface-descriptions/data-models/replica-catalog-models/replica_catalog_models.thrift index 424f532..cd41eda 100644 --- a/thrift-interface-descriptions/data-models/replica-catalog-models/replica_catalog_models.thrift +++ b/thrift-interface-descriptions/data-models/replica-catalog-models/replica_catalog_models.thrift @@ -54,7 +54,6 @@ struct DataProductModel { 11: optional i64 lastModifiedTime, 12: optional map<string, string> productMetadata, 13: optional list<DataReplicaLocationModel> replicaLocations, - 14: optional list<DataProductModel> childProducts } struct DataReplicaLocationModel {
