Changing the API operation case
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/123cf87d Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/123cf87d Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/123cf87d Branch: refs/heads/master Commit: 123cf87d94f3702b1a169d2b86047c6995a4ee87 Parents: b240462 Author: Suresh Marru <[email protected]> Authored: Fri May 23 11:42:44 2014 -0400 Committer: Suresh Marru <[email protected]> Committed: Fri May 23 11:42:44 2014 -0400 ---------------------------------------------------------------------- client-samples/GetAPIVersion.php | 2 +- lib/Airavata/API/Airavata.php | 111 ++++++++++++++++++++++++++++------ 2 files changed, 94 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/123cf87d/client-samples/GetAPIVersion.php ---------------------------------------------------------------------- diff --git a/client-samples/GetAPIVersion.php b/client-samples/GetAPIVersion.php index a2732b1..22456a3 100644 --- a/client-samples/GetAPIVersion.php +++ b/client-samples/GetAPIVersion.php @@ -42,7 +42,7 @@ $airavataclient = new AiravataClient($protocol); try { - $version = $airavataclient->GetAPIVersion(); + $version = $airavataclient->getAPIVersion(); } catch (TException $texp) { http://git-wip-us.apache.org/repos/asf/airavata/blob/123cf87d/lib/Airavata/API/Airavata.php ---------------------------------------------------------------------- diff --git a/lib/Airavata/API/Airavata.php b/lib/Airavata/API/Airavata.php index fcb75a7..0dbe0b8 100644 --- a/lib/Airavata/API/Airavata.php +++ b/lib/Airavata/API/Airavata.php @@ -17,7 +17,7 @@ use Thrift\Exception\TApplicationException; interface AiravataIf { - public function GetAPIVersion(); + public function getAPIVersion(); public function createProject(\Airavata\Model\Workspace\Project $project); public function updateProject($projectId, \Airavata\Model\Workspace\Project $updatedProject); public function getProject($projectId); @@ -53,33 +53,33 @@ class AiravataClient implements \Airavata\API\AiravataIf { $this->output_ = $output ? $output : $input; } - public function GetAPIVersion() + public function getAPIVersion() { - $this->send_GetAPIVersion(); - return $this->recv_GetAPIVersion(); + $this->send_getAPIVersion(); + return $this->recv_getAPIVersion(); } - public function send_GetAPIVersion() + public function send_getAPIVersion() { - $args = new \Airavata\API\Airavata_GetAPIVersion_args(); + $args = new \Airavata\API\Airavata_getAPIVersion_args(); $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); if ($bin_accel) { - thrift_protocol_write_binary($this->output_, 'GetAPIVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + thrift_protocol_write_binary($this->output_, 'getAPIVersion', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); } else { - $this->output_->writeMessageBegin('GetAPIVersion', TMessageType::CALL, $this->seqid_); + $this->output_->writeMessageBegin('getAPIVersion', TMessageType::CALL, $this->seqid_); $args->write($this->output_); $this->output_->writeMessageEnd(); $this->output_->getTransport()->flush(); } } - public function recv_GetAPIVersion() + public function recv_getAPIVersion() { $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); - if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_GetAPIVersion_result', $this->input_->isStrictRead()); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Airavata_getAPIVersion_result', $this->input_->isStrictRead()); else { $rseqid = 0; @@ -93,14 +93,23 @@ class AiravataClient implements \Airavata\API\AiravataIf { $this->input_->readMessageEnd(); throw $x; } - $result = new \Airavata\API\Airavata_GetAPIVersion_result(); + $result = new \Airavata\API\Airavata_getAPIVersion_result(); $result->read($this->input_); $this->input_->readMessageEnd(); } if ($result->success !== null) { return $result->success; } - throw new \Exception("GetAPIVersion failed: unknown result"); + if ($result->ire !== null) { + throw $result->ire; + } + if ($result->ace !== null) { + throw $result->ace; + } + if ($result->ase !== null) { + throw $result->ase; + } + throw new \Exception("getAPIVersion failed: unknown result"); } public function createProject(\Airavata\Model\Workspace\Project $project) @@ -1407,7 +1416,7 @@ class AiravataClient implements \Airavata\API\AiravataIf { // HELPER FUNCTIONS AND STRUCTURES -class Airavata_GetAPIVersion_args { +class Airavata_getAPIVersion_args { static $_TSPEC; @@ -1419,7 +1428,7 @@ class Airavata_GetAPIVersion_args { } public function getName() { - return 'Airavata_GetAPIVersion_args'; + return 'Airavata_getAPIVersion_args'; } public function read($input) @@ -1449,7 +1458,7 @@ class Airavata_GetAPIVersion_args { public function write($output) { $xfer = 0; - $xfer += $output->writeStructBegin('Airavata_GetAPIVersion_args'); + $xfer += $output->writeStructBegin('Airavata_getAPIVersion_args'); $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; @@ -1457,10 +1466,13 @@ class Airavata_GetAPIVersion_args { } -class Airavata_GetAPIVersion_result { +class Airavata_getAPIVersion_result { static $_TSPEC; public $success = null; + public $ire = null; + public $ace = null; + public $ase = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -1469,17 +1481,41 @@ class Airavata_GetAPIVersion_result { 'var' => 'success', 'type' => TType::STRING, ), + 1 => array( + 'var' => 'ire', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\InvalidRequestException', + ), + 2 => array( + 'var' => 'ace', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\AiravataClientException', + ), + 3 => array( + 'var' => 'ase', + 'type' => TType::STRUCT, + 'class' => '\Airavata\API\Error\AiravataSystemException', + ), ); } if (is_array($vals)) { if (isset($vals['success'])) { $this->success = $vals['success']; } + if (isset($vals['ire'])) { + $this->ire = $vals['ire']; + } + if (isset($vals['ace'])) { + $this->ace = $vals['ace']; + } + if (isset($vals['ase'])) { + $this->ase = $vals['ase']; + } } } public function getName() { - return 'Airavata_GetAPIVersion_result'; + return 'Airavata_getAPIVersion_result'; } public function read($input) @@ -1504,6 +1540,30 @@ class Airavata_GetAPIVersion_result { $xfer += $input->skip($ftype); } break; + case 1: + if ($ftype == TType::STRUCT) { + $this->ire = new \Airavata\API\Error\InvalidRequestException(); + $xfer += $this->ire->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRUCT) { + $this->ace = new \Airavata\API\Error\AiravataClientException(); + $xfer += $this->ace->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRUCT) { + $this->ase = new \Airavata\API\Error\AiravataSystemException(); + $xfer += $this->ase->read($input); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -1516,12 +1576,27 @@ class Airavata_GetAPIVersion_result { public function write($output) { $xfer = 0; - $xfer += $output->writeStructBegin('Airavata_GetAPIVersion_result'); + $xfer += $output->writeStructBegin('Airavata_getAPIVersion_result'); if ($this->success !== null) { $xfer += $output->writeFieldBegin('success', TType::STRING, 0); $xfer += $output->writeString($this->success); $xfer += $output->writeFieldEnd(); } + if ($this->ire !== null) { + $xfer += $output->writeFieldBegin('ire', TType::STRUCT, 1); + $xfer += $this->ire->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->ace !== null) { + $xfer += $output->writeFieldBegin('ace', TType::STRUCT, 2); + $xfer += $this->ace->write($output); + $xfer += $output->writeFieldEnd(); + } + if ($this->ase !== null) { + $xfer += $output->writeFieldBegin('ase', TType::STRUCT, 3); + $xfer += $this->ase->write($output); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer;
