| <?php |
| namespace Airavata\Data\Manager\Cpi; |
| /** |
| * Autogenerated by Thrift Compiler (0.9.3) |
| * |
| * 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; |
| |
| |
| interface DataManagerServiceIf { |
| /** |
| * Query DM server to fetch the CPI version |
| * |
| * @return string |
| */ |
| public function getDMServiceVersion(); |
| /** |
| * * Query the DM server to fetch matching metadata models |
| * * |
| * |
| * @param string $username |
| * @param string $gatewayId |
| * @param string $searchText |
| * @return \Airavata\Model\Data\Metadata\MetadataModel[] |
| * @throws \Airavata\API\Error\DataManagerServiceException |
| */ |
| public function searchMetadata($username, $gatewayId, $searchText); |
| } |
| |
| class DataManagerServiceClient implements \Airavata\Data\Manager\Cpi\DataManagerServiceIf { |
| protected $input_ = null; |
| protected $output_ = null; |
| |
| protected $seqid_ = 0; |
| |
| public function __construct($input, $output=null) { |
| $this->input_ = $input; |
| $this->output_ = $output ? $output : $input; |
| } |
| |
| public function getDMServiceVersion() |
| { |
| $this->send_getDMServiceVersion(); |
| return $this->recv_getDMServiceVersion(); |
| } |
| |
| public function send_getDMServiceVersion() |
| { |
| $args = new \Airavata\Data\Manager\Cpi\DataManagerService_getDMServiceVersion_args(); |
| $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); |
| if ($bin_accel) |
| { |
| thrift_protocol_write_binary($this->output_, 'getDMServiceVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); |
| } |
| else |
| { |
| $this->output_->writeMessageBegin('getDMServiceVersion', TMessageType::CALL, $this->seqid_); |
| $args->write($this->output_); |
| $this->output_->writeMessageEnd(); |
| $this->output_->getTransport()->flush(); |
| } |
| } |
| |
| public function recv_getDMServiceVersion() |
| { |
| $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); |
| if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Data\Manager\Cpi\DataManagerService_getDMServiceVersion_result', $this->input_->isStrictRead()); |
| else |
| { |
| $rseqid = 0; |
| $fname = null; |
| $mtype = 0; |
| |
| $this->input_->readMessageBegin($fname, $mtype, $rseqid); |
| if ($mtype == TMessageType::EXCEPTION) { |
| $x = new TApplicationException(); |
| $x->read($this->input_); |
| $this->input_->readMessageEnd(); |
| throw $x; |
| } |
| $result = new \Airavata\Data\Manager\Cpi\DataManagerService_getDMServiceVersion_result(); |
| $result->read($this->input_); |
| $this->input_->readMessageEnd(); |
| } |
| if ($result->success !== null) { |
| return $result->success; |
| } |
| throw new \Exception("getDMServiceVersion failed: unknown result"); |
| } |
| |
| public function searchMetadata($username, $gatewayId, $searchText) |
| { |
| $this->send_searchMetadata($username, $gatewayId, $searchText); |
| return $this->recv_searchMetadata(); |
| } |
| |
| public function send_searchMetadata($username, $gatewayId, $searchText) |
| { |
| $args = new \Airavata\Data\Manager\Cpi\DataManagerService_searchMetadata_args(); |
| $args->username = $username; |
| $args->gatewayId = $gatewayId; |
| $args->searchText = $searchText; |
| $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); |
| if ($bin_accel) |
| { |
| thrift_protocol_write_binary($this->output_, 'searchMetadata', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); |
| } |
| else |
| { |
| $this->output_->writeMessageBegin('searchMetadata', TMessageType::CALL, $this->seqid_); |
| $args->write($this->output_); |
| $this->output_->writeMessageEnd(); |
| $this->output_->getTransport()->flush(); |
| } |
| } |
| |
| public function recv_searchMetadata() |
| { |
| $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); |
| if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\Data\Manager\Cpi\DataManagerService_searchMetadata_result', $this->input_->isStrictRead()); |
| else |
| { |
| $rseqid = 0; |
| $fname = null; |
| $mtype = 0; |
| |
| $this->input_->readMessageBegin($fname, $mtype, $rseqid); |
| if ($mtype == TMessageType::EXCEPTION) { |
| $x = new TApplicationException(); |
| $x->read($this->input_); |
| $this->input_->readMessageEnd(); |
| throw $x; |
| } |
| $result = new \Airavata\Data\Manager\Cpi\DataManagerService_searchMetadata_result(); |
| $result->read($this->input_); |
| $this->input_->readMessageEnd(); |
| } |
| if ($result->success !== null) { |
| return $result->success; |
| } |
| if ($result->dme !== null) { |
| throw $result->dme; |
| } |
| throw new \Exception("searchMetadata failed: unknown result"); |
| } |
| |
| } |
| |
| // HELPER FUNCTIONS AND STRUCTURES |
| |
| class DataManagerService_getDMServiceVersion_args { |
| static $_TSPEC; |
| |
| |
| public function __construct() { |
| if (!isset(self::$_TSPEC)) { |
| self::$_TSPEC = array( |
| ); |
| } |
| } |
| |
| public function getName() { |
| return 'DataManagerService_getDMServiceVersion_args'; |
| } |
| |
| public function read($input) |
| { |
| $xfer = 0; |
| $fname = null; |
| $ftype = 0; |
| $fid = 0; |
| $xfer += $input->readStructBegin($fname); |
| while (true) |
| { |
| $xfer += $input->readFieldBegin($fname, $ftype, $fid); |
| if ($ftype == TType::STOP) { |
| break; |
| } |
| switch ($fid) |
| { |
| default: |
| $xfer += $input->skip($ftype); |
| break; |
| } |
| $xfer += $input->readFieldEnd(); |
| } |
| $xfer += $input->readStructEnd(); |
| return $xfer; |
| } |
| |
| public function write($output) { |
| $xfer = 0; |
| $xfer += $output->writeStructBegin('DataManagerService_getDMServiceVersion_args'); |
| $xfer += $output->writeFieldStop(); |
| $xfer += $output->writeStructEnd(); |
| return $xfer; |
| } |
| |
| } |
| |
| class DataManagerService_getDMServiceVersion_result { |
| static $_TSPEC; |
| |
| /** |
| * @var string |
| */ |
| public $success = null; |
| |
| public function __construct($vals=null) { |
| if (!isset(self::$_TSPEC)) { |
| self::$_TSPEC = array( |
| 0 => array( |
| 'var' => 'success', |
| 'type' => TType::STRING, |
| ), |
| ); |
| } |
| if (is_array($vals)) { |
| if (isset($vals['success'])) { |
| $this->success = $vals['success']; |
| } |
| } |
| } |
| |
| public function getName() { |
| return 'DataManagerService_getDMServiceVersion_result'; |
| } |
| |
| public function read($input) |
| { |
| $xfer = 0; |
| $fname = null; |
| $ftype = 0; |
| $fid = 0; |
| $xfer += $input->readStructBegin($fname); |
| while (true) |
| { |
| $xfer += $input->readFieldBegin($fname, $ftype, $fid); |
| if ($ftype == TType::STOP) { |
| break; |
| } |
| switch ($fid) |
| { |
| case 0: |
| if ($ftype == TType::STRING) { |
| $xfer += $input->readString($this->success); |
| } else { |
| $xfer += $input->skip($ftype); |
| } |
| break; |
| default: |
| $xfer += $input->skip($ftype); |
| break; |
| } |
| $xfer += $input->readFieldEnd(); |
| } |
| $xfer += $input->readStructEnd(); |
| return $xfer; |
| } |
| |
| public function write($output) { |
| $xfer = 0; |
| $xfer += $output->writeStructBegin('DataManagerService_getDMServiceVersion_result'); |
| if ($this->success !== null) { |
| $xfer += $output->writeFieldBegin('success', TType::STRING, 0); |
| $xfer += $output->writeString($this->success); |
| $xfer += $output->writeFieldEnd(); |
| } |
| $xfer += $output->writeFieldStop(); |
| $xfer += $output->writeStructEnd(); |
| return $xfer; |
| } |
| |
| } |
| |
| class DataManagerService_searchMetadata_args { |
| static $_TSPEC; |
| |
| /** |
| * @var string |
| */ |
| public $username = null; |
| /** |
| * @var string |
| */ |
| public $gatewayId = null; |
| /** |
| * @var string |
| */ |
| public $searchText = null; |
| |
| public function __construct($vals=null) { |
| if (!isset(self::$_TSPEC)) { |
| self::$_TSPEC = array( |
| 1 => array( |
| 'var' => 'username', |
| 'type' => TType::STRING, |
| ), |
| 2 => array( |
| 'var' => 'gatewayId', |
| 'type' => TType::STRING, |
| ), |
| 3 => array( |
| 'var' => 'searchText', |
| 'type' => TType::STRING, |
| ), |
| ); |
| } |
| if (is_array($vals)) { |
| if (isset($vals['username'])) { |
| $this->username = $vals['username']; |
| } |
| if (isset($vals['gatewayId'])) { |
| $this->gatewayId = $vals['gatewayId']; |
| } |
| if (isset($vals['searchText'])) { |
| $this->searchText = $vals['searchText']; |
| } |
| } |
| } |
| |
| public function getName() { |
| return 'DataManagerService_searchMetadata_args'; |
| } |
| |
| public function read($input) |
| { |
| $xfer = 0; |
| $fname = null; |
| $ftype = 0; |
| $fid = 0; |
| $xfer += $input->readStructBegin($fname); |
| while (true) |
| { |
| $xfer += $input->readFieldBegin($fname, $ftype, $fid); |
| if ($ftype == TType::STOP) { |
| break; |
| } |
| switch ($fid) |
| { |
| case 1: |
| if ($ftype == TType::STRING) { |
| $xfer += $input->readString($this->username); |
| } else { |
| $xfer += $input->skip($ftype); |
| } |
| break; |
| case 2: |
| if ($ftype == TType::STRING) { |
| $xfer += $input->readString($this->gatewayId); |
| } else { |
| $xfer += $input->skip($ftype); |
| } |
| break; |
| case 3: |
| if ($ftype == TType::STRING) { |
| $xfer += $input->readString($this->searchText); |
| } 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('DataManagerService_searchMetadata_args'); |
| if ($this->username !== null) { |
| $xfer += $output->writeFieldBegin('username', TType::STRING, 1); |
| $xfer += $output->writeString($this->username); |
| $xfer += $output->writeFieldEnd(); |
| } |
| if ($this->gatewayId !== null) { |
| $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2); |
| $xfer += $output->writeString($this->gatewayId); |
| $xfer += $output->writeFieldEnd(); |
| } |
| if ($this->searchText !== null) { |
| $xfer += $output->writeFieldBegin('searchText', TType::STRING, 3); |
| $xfer += $output->writeString($this->searchText); |
| $xfer += $output->writeFieldEnd(); |
| } |
| $xfer += $output->writeFieldStop(); |
| $xfer += $output->writeStructEnd(); |
| return $xfer; |
| } |
| |
| } |
| |
| class DataManagerService_searchMetadata_result { |
| static $_TSPEC; |
| |
| /** |
| * @var \Airavata\Model\Data\Metadata\MetadataModel[] |
| */ |
| public $success = null; |
| /** |
| * @var \Airavata\API\Error\DataManagerServiceException |
| */ |
| public $dme = null; |
| |
| public function __construct($vals=null) { |
| if (!isset(self::$_TSPEC)) { |
| self::$_TSPEC = array( |
| 0 => array( |
| 'var' => 'success', |
| 'type' => TType::LST, |
| 'etype' => TType::STRUCT, |
| 'elem' => array( |
| 'type' => TType::STRUCT, |
| 'class' => '\Airavata\Model\Data\Metadata\MetadataModel', |
| ), |
| ), |
| 1 => array( |
| 'var' => 'dme', |
| 'type' => TType::STRUCT, |
| 'class' => '\Airavata\API\Error\DataManagerServiceException', |
| ), |
| ); |
| } |
| if (is_array($vals)) { |
| if (isset($vals['success'])) { |
| $this->success = $vals['success']; |
| } |
| if (isset($vals['dme'])) { |
| $this->dme = $vals['dme']; |
| } |
| } |
| } |
| |
| public function getName() { |
| return 'DataManagerService_searchMetadata_result'; |
| } |
| |
| public function read($input) |
| { |
| $xfer = 0; |
| $fname = null; |
| $ftype = 0; |
| $fid = 0; |
| $xfer += $input->readStructBegin($fname); |
| while (true) |
| { |
| $xfer += $input->readFieldBegin($fname, $ftype, $fid); |
| if ($ftype == TType::STOP) { |
| break; |
| } |
| switch ($fid) |
| { |
| case 0: |
| if ($ftype == TType::LST) { |
| $this->success = array(); |
| $_size0 = 0; |
| $_etype3 = 0; |
| $xfer += $input->readListBegin($_etype3, $_size0); |
| for ($_i4 = 0; $_i4 < $_size0; ++$_i4) |
| { |
| $elem5 = null; |
| $elem5 = new \Airavata\Model\Data\Metadata\MetadataModel(); |
| $xfer += $elem5->read($input); |
| $this->success []= $elem5; |
| } |
| $xfer += $input->readListEnd(); |
| } else { |
| $xfer += $input->skip($ftype); |
| } |
| break; |
| case 1: |
| if ($ftype == TType::STRUCT) { |
| $this->dme = new \Airavata\API\Error\DataManagerServiceException(); |
| $xfer += $this->dme->read($input); |
| } else { |
| $xfer += $input->skip($ftype); |
| } |
| break; |
| default: |
| $xfer += $input->skip($ftype); |
| break; |
| } |
| $xfer += $input->readFieldEnd(); |
| } |
| $xfer += $input->readStructEnd(); |
| return $xfer; |
| } |
| |
| public function write($output) { |
| $xfer = 0; |
| $xfer += $output->writeStructBegin('DataManagerService_searchMetadata_result'); |
| if ($this->success !== null) { |
| if (!is_array($this->success)) { |
| throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); |
| } |
| $xfer += $output->writeFieldBegin('success', TType::LST, 0); |
| { |
| $output->writeListBegin(TType::STRUCT, count($this->success)); |
| { |
| foreach ($this->success as $iter6) |
| { |
| $xfer += $iter6->write($output); |
| } |
| } |
| $output->writeListEnd(); |
| } |
| $xfer += $output->writeFieldEnd(); |
| } |
| if ($this->dme !== null) { |
| $xfer += $output->writeFieldBegin('dme', TType::STRUCT, 1); |
| $xfer += $this->dme->write($output); |
| $xfer += $output->writeFieldEnd(); |
| } |
| $xfer += $output->writeFieldStop(); |
| $xfer += $output->writeStructEnd(); |
| return $xfer; |
| } |
| |
| } |
| |
| |