adding basic uis for data browsing
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/bca9259f Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/bca9259f Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/bca9259f Branch: refs/heads/data-manager Commit: bca9259f47381dcf7baa062a372166760d03f71d Parents: 894346d Author: scnakandala <[email protected]> Authored: Tue Jan 12 17:00:48 2016 -0500 Committer: scnakandala <[email protected]> Committed: Tue Jan 12 17:00:48 2016 -0500 ---------------------------------------------------------------------- app/config/app.php | 2 + app/config/pga_config.php | 224 ++++ app/config/pga_config.php.template | 15 + app/controllers/DataController.php | 13 + .../Data/Manager/Cpi/DataManagerService.php | 534 +++++++++ .../Airavata/Data/Manager/Cpi/Types.php | 28 + .../Data/Manager/DataManagerServiceProvider.php | 78 ++ .../Data/Manager/Facades/DataManager.php | 16 + .../Airavata/Model/Data/Metadata/Types.php | 440 ++++++++ .../Airavata/Model/Data/Replica/Types.php | 1028 ++++++++++++++++++ .../Airavata/Model/Data/Resource/Types.php | 854 --------------- .../Airavata/Model/Data/Transfer/Types.php | 890 +++++++++++++++ app/libraries/CommonUtilities.php | 4 + app/routes.php | 6 + app/views/data/browse.blade.php | 35 + 15 files changed, 3313 insertions(+), 854 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/config/app.php ---------------------------------------------------------------------- diff --git a/app/config/app.php b/app/config/app.php index 27f995f..3e1abe2 100755 --- a/app/config/app.php +++ b/app/config/app.php @@ -123,6 +123,7 @@ return array( 'Illuminate\Workbench\WorkbenchServiceProvider', 'Wsis\WsisServiceProvider', 'Airavata\AiravataServiceProvider', + 'Airavata\DataManager\DataManagerServiceProvider', 'Teepluss\Theme\ThemeServiceProvider', 'GrahamCampbell\Markdown\MarkdownServiceProvider', ), @@ -193,6 +194,7 @@ return array( 'View' => 'Illuminate\Support\Facades\View', 'WSIS' => 'Wsis\Facades\Wsis', 'Airavata' => 'Airavata\Facades\Airavata', + 'DataManager' => 'Airavata\DataManager\Facades\DataManager', 'Theme' => 'Teepluss\Theme\Facades\Theme', 'Markdown' => 'GrahamCampbell\Markdown\Facades\Markdown', ), http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/config/pga_config.php ---------------------------------------------------------------------- diff --git a/app/config/pga_config.php b/app/config/pga_config.php new file mode 100644 index 0000000..cfdd6b0 --- /dev/null +++ b/app/config/pga_config.php @@ -0,0 +1,224 @@ +<?php +return array( + /** + * ***************************************************************** + * These are WSO2 Identity Server Related Configurations + * ***************************************************************** + */ + + 'wsis' => [ + + /** + * Admin Role Name + */ + 'admin-role-name' => 'Internal/everyone', + + /** + * Read only Admin Role Name + */ + 'read-only-admin-role-name' => 'admin-read-only', + + /** + * Gateway user role + */ + 'user-role-name' => 'airavata-user', + + /** + * Tenant Domain + */ + 'tenant-domain' => 'master.airavata', + + /** + * Tenant admin's username + */ + 'admin-username' => 'master', + + /** + * Tenant admin's password + */ + 'admin-password' => 'master', + + /** + * OAuth client key + */ + 'oauth-client-key' => 'O3iUdkkVYyHgzWPiVTQpY_tb96Ma', + + /** + * OAuth client secret + */ + 'oauth-client-secret' => '6Ck1jZoa2oRtrzodSqkUZ2iINkUa', + + /** + * Identity server domain + */ + 'server' => 'idp.scigap.org', + + /** + * Identity server url + */ + 'service-url' => 'https://idp.scigap.org:7443/', + + /** + * Enable HTTPS server verification + */ + 'verify-peer' => true, + + /** + * Path to the server certificate file + */ + 'cafile-path' => app_path() . '/resources/security/idp_scigap_org.pem', + + /** + * Allow self signed server certificates + */ + 'allow-self-signed-cert' => false + ], + + + /** + * ***************************************************************** + * These are Airavata Related Configurations + * ***************************************************************** + */ + 'airavata' => [ + + /** + * Airavata API server location. Use tls:// as the protocol to + * connect TLS enabled Airavata + */ + 'airavata-server' => 'gw77.iu.xsede.org', + + /** + * Airavata API server port + */ + 'airavata-port' => '8930', + + /** + * Airavata API server thrift communication timeout + */ + 'airavata-timeout' => '1000000', + + /** + * Data Manager CPI server host + */ + 'data-manager-server' => 'localhost', + + /** + * Data Manager CPI server port + */ + 'data-manager-port' => '8990', + + /** + * Data Manager CPI server thrift communication timeout + */ + 'data-manager-timeout' => '1000000', + + /** + * PGA Gateway ID + */ + 'gateway-id' => 'seagrid', + + /** + * Maximum size of a file which is allowed to upload to the server + */ + 'server-allowed-file-size' => 64, + + /** + * absolute path of the data dir + */ + 'experiment-data-absolute-path' => '/Library/WebServer/Documents/experimentData', + + /** + * username for the user for accessing the experiment data over ssh + */ + 'ssh-user' => 'root', + + /** + * Advanced experiments options + */ + 'advanced-experiment-options' => '', + + /** + * Default queue name + */ + 'queue-name' => 'long', + + /** + * Default node count + */ + 'node-count' => '1', + + /** + * Default total core count + */ + 'total-cpu-count' => '16', + + /** + * Default wall time limit + */ + 'wall-time-limit' => '30', + + /** + * Enable app-catalog cache + */ + 'enable-app-catalog-cache' => true, + + /** + * Life time of app catalog data cache in minutes + */ + 'app-catalog-cache-duration' => 5, + + /** + * Gateway data store resource id + */ + 'gateway-data-store-resource-id' => '' + ], + /** + * ***************************************************************** + * Portal Related Configurations + * ***************************************************************** + */ + 'portal' => [ + + /** + * Whether this portal is the super admin portal + */ + 'super-admin-portal' => true, + + /** + * Set the name of theme in use here + */ + 'theme' => 'base', + + /** + * Portal titles + */ + 'portal-title' => 'Airavata PHP Gateway', + + /** + * Email addresses of the portal admins. Portal admins well get email notifications for events + * such as new user creation + */ + 'admin-emails' => ['[email protected]','[email protected]'], + + /** + * Email account that the portal should login to send emails + */ + 'portal-email-username' => '[email protected]', + + /** + * Password for the portal's email account + */ + 'portal-email-password' => 'airavata12', + + /** + * SMTP server on which the portal should connect + */ + 'portal-smtp-server-host' => 'smtp.gmail.com', + + /** + * SMTP server port on which the portal should connect + */ + 'portal-smtp-server-port' => '587' + ] +); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/config/pga_config.php.template ---------------------------------------------------------------------- diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template index 07520a4..d95a1cb 100644 --- a/app/config/pga_config.php.template +++ b/app/config/pga_config.php.template @@ -99,6 +99,21 @@ return array( 'airavata-timeout' => '1000000', /** + * Data Manager CPI server host + */ + 'data-manager-server' => 'localhost', + + /** + * Data Manager CPI server port + */ + 'data-manager-port' => '8990', + + /** + * Data Manager CPI server thrift communication timeout + */ + 'data-manager-timeout' => '1000000', + + /** * PGA Gateway ID */ 'gateway-id' => 'default', http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/controllers/DataController.php ---------------------------------------------------------------------- diff --git a/app/controllers/DataController.php b/app/controllers/DataController.php new file mode 100755 index 0000000..285fb74 --- /dev/null +++ b/app/controllers/DataController.php @@ -0,0 +1,13 @@ +<?php + +class DataController extends BaseController { + + public function browseView() + { + $metadataModels = DataManager::searchMetadata("scnakandala", "default", "test query"); + return View::make('data/browse', array("metadataModels" => $metadataModels)); + } + +} + +?> http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/libraries/Airavata/Data/Manager/Cpi/DataManagerService.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Data/Manager/Cpi/DataManagerService.php b/app/libraries/Airavata/Data/Manager/Cpi/DataManagerService.php new file mode 100644 index 0000000..9c936a1 --- /dev/null +++ b/app/libraries/Airavata/Data/Manager/Cpi/DataManagerService.php @@ -0,0 +1,534 @@ +<?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; + } + +} + + http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/libraries/Airavata/Data/Manager/Cpi/Types.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Data/Manager/Cpi/Types.php b/app/libraries/Airavata/Data/Manager/Cpi/Types.php new file mode 100644 index 0000000..dc567dd --- /dev/null +++ b/app/libraries/Airavata/Data/Manager/Cpi/Types.php @@ -0,0 +1,28 @@ +<?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; + + +final class Constant extends \Thrift\Type\TConstant { + static protected $DM_CPI_VERSION; + + static protected function init_DM_CPI_VERSION() { + return "0.16.0"; + } +} + + http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/libraries/Airavata/Data/Manager/DataManagerServiceProvider.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Data/Manager/DataManagerServiceProvider.php b/app/libraries/Airavata/Data/Manager/DataManagerServiceProvider.php new file mode 100755 index 0000000..b2ae084 --- /dev/null +++ b/app/libraries/Airavata/Data/Manager/DataManagerServiceProvider.php @@ -0,0 +1,78 @@ +<?php namespace Airavata\DataManager; + +use Illuminate\Routing\UrlGenerator; +use Illuminate\Support\ServiceProvider; +use Illuminate\Support\Facades\Config; +use Airavata\Data\Manager\Cpi; +use Thrift\Transport\TSocket; +use Thrift\Protocol\TBinaryProtocol; +use Illuminate\Routing\Redirector; + +class DataManagerServiceProvider extends ServiceProvider { + + /** + * Indicates if loading of the provider is deferred. + * + * @var bool + */ + protected $defer = false; + + /** + * Bootstrap the application events. + * + * @return void + */ + public function boot() + { + $this->package('airavata/data-manager'); + } + + /** + * Register the service provider. + * + * @return void + */ + public function register() + { + //registering service provider + $this->app['data-manager'] = $this->app->share(function($app) + { + try{ + $transport = new TSocket(Config::get('pga_config.airavata')['data-manager-server'], Config::get('pga_config.airavata')['data-manager-port']); + $transport->setRecvTimeout(Config::get('pga_config.airavata')['data-manager-timeout']); + $transport->setSendTimeout(Config::get('pga_config.airavata')['data-manager-timeout']); + + $protocol = new TBinaryProtocol($transport); + $transport->open(); + + $client = new Cpi\DataManagerServiceClient($protocol); + + }catch (\Exception $ex){ + throw new \Exception("Unable to instantiate Data Manager Client", 0, $ex); + } + + if( is_object( $client)) + return $client; + else + throw new \Exception("Unable to instantiate Data Manager Client"); + }); + + //registering alias + $this->app->booting(function() + { + $loader = \Illuminate\Foundation\AliasLoader::getInstance(); + $loader->alias('DataManager', 'Airavata\DataManager\Facades\DataManager'); + }); + } + + /** + * Get the services provided by the provider. + * + * @return array + */ + public function provides() + { + return array('data-manager'); + } + +} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/libraries/Airavata/Data/Manager/Facades/DataManager.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Data/Manager/Facades/DataManager.php b/app/libraries/Airavata/Data/Manager/Facades/DataManager.php new file mode 100755 index 0000000..0dea04d --- /dev/null +++ b/app/libraries/Airavata/Data/Manager/Facades/DataManager.php @@ -0,0 +1,16 @@ +<?php + +namespace Airavata\DataManager\Facades; + +use Illuminate\Support\Facades\Facade; + +class DataManager extends Facade { + + /** + * Get the registered name of the component. + * + * @return string + */ + protected static function getFacadeAccessor() { return 'data-manager'; } + +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/libraries/Airavata/Model/Data/Metadata/Types.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Model/Data/Metadata/Types.php b/app/libraries/Airavata/Model/Data/Metadata/Types.php new file mode 100644 index 0000000..ccc9ede --- /dev/null +++ b/app/libraries/Airavata/Model/Data/Metadata/Types.php @@ -0,0 +1,440 @@ +<?php +namespace Airavata\Model\Data\Metadata; + +/** + * 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; + + +final class MetadataType { + const FILE = 0; + const COLLECTION = 1; + static public $__names = array( + 0 => 'FILE', + 1 => 'COLLECTION', + ); +} + +class MetadataModel { + static $_TSPEC; + + /** + * @var string + */ + public $metadataId = null; + /** + * @var string + */ + public $gatewayId = null; + /** + * @var string + */ + public $username = null; + /** + * @var double + */ + public $size = null; + /** + * @var string[] + */ + public $sharedUsers = null; + /** + * @var bool + */ + public $sharedPublic = null; + /** + * @var string + */ + public $userFriendlyName = null; + /** + * @var string + */ + public $userFriendlyDescription = null; + /** + * @var int + */ + public $metadataType = null; + /** + * @var string + */ + public $associatedEntityId = null; + /** + * @var array + */ + public $customInformation = null; + /** + * @var int + */ + public $creationTime = null; + /** + * @var int + */ + public $lastModifiedTime = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'metadataId', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'gatewayId', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'username', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'size', + 'type' => TType::DOUBLE, + ), + 5 => array( + 'var' => 'sharedUsers', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + 6 => array( + 'var' => 'sharedPublic', + 'type' => TType::BOOL, + ), + 7 => array( + 'var' => 'userFriendlyName', + 'type' => TType::STRING, + ), + 8 => array( + 'var' => 'userFriendlyDescription', + 'type' => TType::STRING, + ), + 9 => array( + 'var' => 'metadataType', + 'type' => TType::I32, + ), + 10 => array( + 'var' => 'associatedEntityId', + 'type' => TType::STRING, + ), + 11 => array( + 'var' => 'customInformation', + 'type' => TType::MAP, + 'ktype' => TType::STRING, + 'vtype' => TType::STRING, + 'key' => array( + 'type' => TType::STRING, + ), + 'val' => array( + 'type' => TType::STRING, + ), + ), + 12 => array( + 'var' => 'creationTime', + 'type' => TType::I64, + ), + 13 => array( + 'var' => 'lastModifiedTime', + 'type' => TType::I64, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['metadataId'])) { + $this->metadataId = $vals['metadataId']; + } + if (isset($vals['gatewayId'])) { + $this->gatewayId = $vals['gatewayId']; + } + if (isset($vals['username'])) { + $this->username = $vals['username']; + } + if (isset($vals['size'])) { + $this->size = $vals['size']; + } + if (isset($vals['sharedUsers'])) { + $this->sharedUsers = $vals['sharedUsers']; + } + if (isset($vals['sharedPublic'])) { + $this->sharedPublic = $vals['sharedPublic']; + } + if (isset($vals['userFriendlyName'])) { + $this->userFriendlyName = $vals['userFriendlyName']; + } + if (isset($vals['userFriendlyDescription'])) { + $this->userFriendlyDescription = $vals['userFriendlyDescription']; + } + if (isset($vals['metadataType'])) { + $this->metadataType = $vals['metadataType']; + } + if (isset($vals['associatedEntityId'])) { + $this->associatedEntityId = $vals['associatedEntityId']; + } + if (isset($vals['customInformation'])) { + $this->customInformation = $vals['customInformation']; + } + if (isset($vals['creationTime'])) { + $this->creationTime = $vals['creationTime']; + } + if (isset($vals['lastModifiedTime'])) { + $this->lastModifiedTime = $vals['lastModifiedTime']; + } + } + } + + public function getName() { + return 'MetadataModel'; + } + + 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->metadataId); + } 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->username); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::DOUBLE) { + $xfer += $input->readDouble($this->size); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::LST) { + $this->sharedUsers = array(); + $_size0 = 0; + $_etype3 = 0; + $xfer += $input->readListBegin($_etype3, $_size0); + for ($_i4 = 0; $_i4 < $_size0; ++$_i4) + { + $elem5 = null; + $xfer += $input->readString($elem5); + $this->sharedUsers []= $elem5; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->sharedPublic); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->userFriendlyName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 8: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->userFriendlyDescription); + } else { + $xfer += $input->skip($ftype); + } + break; + case 9: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->metadataType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 10: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->associatedEntityId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 11: + if ($ftype == TType::MAP) { + $this->customInformation = array(); + $_size6 = 0; + $_ktype7 = 0; + $_vtype8 = 0; + $xfer += $input->readMapBegin($_ktype7, $_vtype8, $_size6); + for ($_i10 = 0; $_i10 < $_size6; ++$_i10) + { + $key11 = ''; + $val12 = ''; + $xfer += $input->readString($key11); + $xfer += $input->readString($val12); + $this->customInformation[$key11] = $val12; + } + $xfer += $input->readMapEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 12: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->creationTime); + } else { + $xfer += $input->skip($ftype); + } + break; + case 13: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->lastModifiedTime); + } 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('MetadataModel'); + if ($this->metadataId !== null) { + $xfer += $output->writeFieldBegin('metadataId', TType::STRING, 1); + $xfer += $output->writeString($this->metadataId); + $xfer += $output->writeFieldEnd(); + } + if ($this->gatewayId !== null) { + $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2); + $xfer += $output->writeString($this->gatewayId); + $xfer += $output->writeFieldEnd(); + } + if ($this->username !== null) { + $xfer += $output->writeFieldBegin('username', TType::STRING, 3); + $xfer += $output->writeString($this->username); + $xfer += $output->writeFieldEnd(); + } + if ($this->size !== null) { + $xfer += $output->writeFieldBegin('size', TType::DOUBLE, 4); + $xfer += $output->writeDouble($this->size); + $xfer += $output->writeFieldEnd(); + } + if ($this->sharedUsers !== null) { + if (!is_array($this->sharedUsers)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sharedUsers', TType::LST, 5); + { + $output->writeListBegin(TType::STRING, count($this->sharedUsers)); + { + foreach ($this->sharedUsers as $iter13) + { + $xfer += $output->writeString($iter13); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->sharedPublic !== null) { + $xfer += $output->writeFieldBegin('sharedPublic', TType::BOOL, 6); + $xfer += $output->writeBool($this->sharedPublic); + $xfer += $output->writeFieldEnd(); + } + if ($this->userFriendlyName !== null) { + $xfer += $output->writeFieldBegin('userFriendlyName', TType::STRING, 7); + $xfer += $output->writeString($this->userFriendlyName); + $xfer += $output->writeFieldEnd(); + } + if ($this->userFriendlyDescription !== null) { + $xfer += $output->writeFieldBegin('userFriendlyDescription', TType::STRING, 8); + $xfer += $output->writeString($this->userFriendlyDescription); + $xfer += $output->writeFieldEnd(); + } + if ($this->metadataType !== null) { + $xfer += $output->writeFieldBegin('metadataType', TType::I32, 9); + $xfer += $output->writeI32($this->metadataType); + $xfer += $output->writeFieldEnd(); + } + if ($this->associatedEntityId !== null) { + $xfer += $output->writeFieldBegin('associatedEntityId', TType::STRING, 10); + $xfer += $output->writeString($this->associatedEntityId); + $xfer += $output->writeFieldEnd(); + } + if ($this->customInformation !== null) { + if (!is_array($this->customInformation)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('customInformation', TType::MAP, 11); + { + $output->writeMapBegin(TType::STRING, TType::STRING, count($this->customInformation)); + { + foreach ($this->customInformation as $kiter14 => $viter15) + { + $xfer += $output->writeString($kiter14); + $xfer += $output->writeString($viter15); + } + } + $output->writeMapEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->creationTime !== null) { + $xfer += $output->writeFieldBegin('creationTime', TType::I64, 12); + $xfer += $output->writeI64($this->creationTime); + $xfer += $output->writeFieldEnd(); + } + if ($this->lastModifiedTime !== null) { + $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 13); + $xfer += $output->writeI64($this->lastModifiedTime); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + + http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bca9259f/app/libraries/Airavata/Model/Data/Replica/Types.php ---------------------------------------------------------------------- diff --git a/app/libraries/Airavata/Model/Data/Replica/Types.php b/app/libraries/Airavata/Model/Data/Replica/Types.php new file mode 100644 index 0000000..38ee07f --- /dev/null +++ b/app/libraries/Airavata/Model/Data/Replica/Types.php @@ -0,0 +1,1028 @@ +<?php +namespace Airavata\Model\Data\Replica; + +/** + * 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; + + +final class FileModelType { + const FILE = 0; + const DIRECTORY = 1; + static public $__names = array( + 0 => 'FILE', + 1 => 'DIRECTORY', + ); +} + +final class StorageResourceType { + const GATEWAY_DATA_STORE = 0; + const BACKUP_GATEWAY_DATA_STORE = 1; + const COMPUTE_RESOURCE = 2; + const LONG_TERM_STORAGE_RESOURCE = 3; + const OTHER = 4; + static public $__names = array( + 0 => 'GATEWAY_DATA_STORE', + 1 => 'BACKUP_GATEWAY_DATA_STORE', + 2 => 'COMPUTE_RESOURCE', + 3 => 'LONG_TERM_STORAGE_RESOURCE', + 4 => 'OTHER', + ); +} + +final class ReplicaPersistentType { + const TRANSIENT = 0; + const PERSISTENT = 1; + static public $__names = array( + 0 => 'TRANSIENT', + 1 => 'PERSISTENT', + ); +} + +class FileCollectionModel { + static $_TSPEC; + + /** + * @var string + */ + public $collectionId = null; + /** + * @var string + */ + public $gatewayId = null; + /** + * @var string + */ + public $username = null; + /** + * @var string[] + */ + public $sharedUsers = null; + /** + * @var bool + */ + public $sharedPublic = null; + /** + * @var string + */ + public $collectionName = null; + /** + * @var string + */ + public $collectionDescription = null; + /** + * @var string[] + */ + public $fileIdList = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'collectionId', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'gatewayId', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'username', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'sharedUsers', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + 5 => array( + 'var' => 'sharedPublic', + 'type' => TType::BOOL, + ), + 6 => array( + 'var' => 'collectionName', + 'type' => TType::STRING, + ), + 7 => array( + 'var' => 'collectionDescription', + 'type' => TType::STRING, + ), + 8 => array( + 'var' => 'fileIdList', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['collectionId'])) { + $this->collectionId = $vals['collectionId']; + } + if (isset($vals['gatewayId'])) { + $this->gatewayId = $vals['gatewayId']; + } + if (isset($vals['username'])) { + $this->username = $vals['username']; + } + if (isset($vals['sharedUsers'])) { + $this->sharedUsers = $vals['sharedUsers']; + } + if (isset($vals['sharedPublic'])) { + $this->sharedPublic = $vals['sharedPublic']; + } + if (isset($vals['collectionName'])) { + $this->collectionName = $vals['collectionName']; + } + if (isset($vals['collectionDescription'])) { + $this->collectionDescription = $vals['collectionDescription']; + } + if (isset($vals['fileIdList'])) { + $this->fileIdList = $vals['fileIdList']; + } + } + } + + public function getName() { + return 'FileCollectionModel'; + } + + 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->collectionId); + } 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->username); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::LST) { + $this->sharedUsers = array(); + $_size0 = 0; + $_etype3 = 0; + $xfer += $input->readListBegin($_etype3, $_size0); + for ($_i4 = 0; $_i4 < $_size0; ++$_i4) + { + $elem5 = null; + $xfer += $input->readString($elem5); + $this->sharedUsers []= $elem5; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->sharedPublic); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->collectionName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->collectionDescription); + } else { + $xfer += $input->skip($ftype); + } + break; + case 8: + if ($ftype == TType::LST) { + $this->fileIdList = array(); + $_size6 = 0; + $_etype9 = 0; + $xfer += $input->readListBegin($_etype9, $_size6); + for ($_i10 = 0; $_i10 < $_size6; ++$_i10) + { + $elem11 = null; + $xfer += $input->readString($elem11); + $this->fileIdList []= $elem11; + } + $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('FileCollectionModel'); + if ($this->collectionId !== null) { + $xfer += $output->writeFieldBegin('collectionId', TType::STRING, 1); + $xfer += $output->writeString($this->collectionId); + $xfer += $output->writeFieldEnd(); + } + if ($this->gatewayId !== null) { + $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2); + $xfer += $output->writeString($this->gatewayId); + $xfer += $output->writeFieldEnd(); + } + if ($this->username !== null) { + $xfer += $output->writeFieldBegin('username', TType::STRING, 3); + $xfer += $output->writeString($this->username); + $xfer += $output->writeFieldEnd(); + } + if ($this->sharedUsers !== null) { + if (!is_array($this->sharedUsers)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sharedUsers', TType::LST, 4); + { + $output->writeListBegin(TType::STRING, count($this->sharedUsers)); + { + foreach ($this->sharedUsers as $iter12) + { + $xfer += $output->writeString($iter12); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->sharedPublic !== null) { + $xfer += $output->writeFieldBegin('sharedPublic', TType::BOOL, 5); + $xfer += $output->writeBool($this->sharedPublic); + $xfer += $output->writeFieldEnd(); + } + if ($this->collectionName !== null) { + $xfer += $output->writeFieldBegin('collectionName', TType::STRING, 6); + $xfer += $output->writeString($this->collectionName); + $xfer += $output->writeFieldEnd(); + } + if ($this->collectionDescription !== null) { + $xfer += $output->writeFieldBegin('collectionDescription', TType::STRING, 7); + $xfer += $output->writeString($this->collectionDescription); + $xfer += $output->writeFieldEnd(); + } + if ($this->fileIdList !== null) { + if (!is_array($this->fileIdList)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('fileIdList', TType::LST, 8); + { + $output->writeListBegin(TType::STRING, count($this->fileIdList)); + { + foreach ($this->fileIdList as $iter13) + { + $xfer += $output->writeString($iter13); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class FileModel { + static $_TSPEC; + + /** + * @var string + */ + public $fileId = null; + /** + * @var string + */ + public $gatewayId = null; + /** + * @var string + */ + public $username = null; + /** + * @var string[] + */ + public $sharedUsers = null; + /** + * @var bool + */ + public $sharedPublic = null; + /** + * @var string + */ + public $fileName = null; + /** + * @var string + */ + public $fileDescription = null; + /** + * @var string + */ + public $sha256Checksum = null; + /** + * @var int + */ + public $fileType = null; + /** + * @var int + */ + public $fileSize = null; + /** + * @var string + */ + public $dataType = null; + /** + * @var int + */ + public $creationTime = null; + /** + * @var int + */ + public $lastModifiedTime = null; + /** + * @var \Airavata\Model\Data\Replica\FileReplicaModel[] + */ + public $fileReplicas = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'fileId', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'gatewayId', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'username', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'sharedUsers', + 'type' => TType::LST, + 'etype' => TType::STRING, + 'elem' => array( + 'type' => TType::STRING, + ), + ), + 5 => array( + 'var' => 'sharedPublic', + 'type' => TType::BOOL, + ), + 6 => array( + 'var' => 'fileName', + 'type' => TType::STRING, + ), + 7 => array( + 'var' => 'fileDescription', + 'type' => TType::STRING, + ), + 8 => array( + 'var' => 'sha256Checksum', + 'type' => TType::STRING, + ), + 9 => array( + 'var' => 'fileType', + 'type' => TType::I32, + ), + 10 => array( + 'var' => 'fileSize', + 'type' => TType::I32, + ), + 11 => array( + 'var' => 'dataType', + 'type' => TType::STRING, + ), + 12 => array( + 'var' => 'creationTime', + 'type' => TType::I64, + ), + 13 => array( + 'var' => 'lastModifiedTime', + 'type' => TType::I64, + ), + 14 => array( + 'var' => 'fileReplicas', + 'type' => TType::LST, + 'etype' => TType::STRUCT, + 'elem' => array( + 'type' => TType::STRUCT, + 'class' => '\Airavata\Model\Data\Replica\FileReplicaModel', + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['fileId'])) { + $this->fileId = $vals['fileId']; + } + if (isset($vals['gatewayId'])) { + $this->gatewayId = $vals['gatewayId']; + } + if (isset($vals['username'])) { + $this->username = $vals['username']; + } + if (isset($vals['sharedUsers'])) { + $this->sharedUsers = $vals['sharedUsers']; + } + if (isset($vals['sharedPublic'])) { + $this->sharedPublic = $vals['sharedPublic']; + } + if (isset($vals['fileName'])) { + $this->fileName = $vals['fileName']; + } + if (isset($vals['fileDescription'])) { + $this->fileDescription = $vals['fileDescription']; + } + if (isset($vals['sha256Checksum'])) { + $this->sha256Checksum = $vals['sha256Checksum']; + } + if (isset($vals['fileType'])) { + $this->fileType = $vals['fileType']; + } + if (isset($vals['fileSize'])) { + $this->fileSize = $vals['fileSize']; + } + if (isset($vals['dataType'])) { + $this->dataType = $vals['dataType']; + } + if (isset($vals['creationTime'])) { + $this->creationTime = $vals['creationTime']; + } + if (isset($vals['lastModifiedTime'])) { + $this->lastModifiedTime = $vals['lastModifiedTime']; + } + if (isset($vals['fileReplicas'])) { + $this->fileReplicas = $vals['fileReplicas']; + } + } + } + + public function getName() { + return 'FileModel'; + } + + 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->fileId); + } 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->username); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::LST) { + $this->sharedUsers = array(); + $_size14 = 0; + $_etype17 = 0; + $xfer += $input->readListBegin($_etype17, $_size14); + for ($_i18 = 0; $_i18 < $_size14; ++$_i18) + { + $elem19 = null; + $xfer += $input->readString($elem19); + $this->sharedUsers []= $elem19; + } + $xfer += $input->readListEnd(); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::BOOL) { + $xfer += $input->readBool($this->sharedPublic); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->fileName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->fileDescription); + } else { + $xfer += $input->skip($ftype); + } + break; + case 8: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->sha256Checksum); + } else { + $xfer += $input->skip($ftype); + } + break; + case 9: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->fileType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 10: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->fileSize); + } else { + $xfer += $input->skip($ftype); + } + break; + case 11: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->dataType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 12: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->creationTime); + } else { + $xfer += $input->skip($ftype); + } + break; + case 13: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->lastModifiedTime); + } else { + $xfer += $input->skip($ftype); + } + break; + case 14: + if ($ftype == TType::LST) { + $this->fileReplicas = array(); + $_size20 = 0; + $_etype23 = 0; + $xfer += $input->readListBegin($_etype23, $_size20); + for ($_i24 = 0; $_i24 < $_size20; ++$_i24) + { + $elem25 = null; + $elem25 = new \Airavata\Model\Data\Replica\FileReplicaModel(); + $xfer += $elem25->read($input); + $this->fileReplicas []= $elem25; + } + $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('FileModel'); + if ($this->fileId !== null) { + $xfer += $output->writeFieldBegin('fileId', TType::STRING, 1); + $xfer += $output->writeString($this->fileId); + $xfer += $output->writeFieldEnd(); + } + if ($this->gatewayId !== null) { + $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 2); + $xfer += $output->writeString($this->gatewayId); + $xfer += $output->writeFieldEnd(); + } + if ($this->username !== null) { + $xfer += $output->writeFieldBegin('username', TType::STRING, 3); + $xfer += $output->writeString($this->username); + $xfer += $output->writeFieldEnd(); + } + if ($this->sharedUsers !== null) { + if (!is_array($this->sharedUsers)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sharedUsers', TType::LST, 4); + { + $output->writeListBegin(TType::STRING, count($this->sharedUsers)); + { + foreach ($this->sharedUsers as $iter26) + { + $xfer += $output->writeString($iter26); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + if ($this->sharedPublic !== null) { + $xfer += $output->writeFieldBegin('sharedPublic', TType::BOOL, 5); + $xfer += $output->writeBool($this->sharedPublic); + $xfer += $output->writeFieldEnd(); + } + if ($this->fileName !== null) { + $xfer += $output->writeFieldBegin('fileName', TType::STRING, 6); + $xfer += $output->writeString($this->fileName); + $xfer += $output->writeFieldEnd(); + } + if ($this->fileDescription !== null) { + $xfer += $output->writeFieldBegin('fileDescription', TType::STRING, 7); + $xfer += $output->writeString($this->fileDescription); + $xfer += $output->writeFieldEnd(); + } + if ($this->sha256Checksum !== null) { + $xfer += $output->writeFieldBegin('sha256Checksum', TType::STRING, 8); + $xfer += $output->writeString($this->sha256Checksum); + $xfer += $output->writeFieldEnd(); + } + if ($this->fileType !== null) { + $xfer += $output->writeFieldBegin('fileType', TType::I32, 9); + $xfer += $output->writeI32($this->fileType); + $xfer += $output->writeFieldEnd(); + } + if ($this->fileSize !== null) { + $xfer += $output->writeFieldBegin('fileSize', TType::I32, 10); + $xfer += $output->writeI32($this->fileSize); + $xfer += $output->writeFieldEnd(); + } + if ($this->dataType !== null) { + $xfer += $output->writeFieldBegin('dataType', TType::STRING, 11); + $xfer += $output->writeString($this->dataType); + $xfer += $output->writeFieldEnd(); + } + if ($this->creationTime !== null) { + $xfer += $output->writeFieldBegin('creationTime', TType::I64, 12); + $xfer += $output->writeI64($this->creationTime); + $xfer += $output->writeFieldEnd(); + } + if ($this->lastModifiedTime !== null) { + $xfer += $output->writeFieldBegin('lastModifiedTime', TType::I64, 13); + $xfer += $output->writeI64($this->lastModifiedTime); + $xfer += $output->writeFieldEnd(); + } + if ($this->fileReplicas !== null) { + if (!is_array($this->fileReplicas)) { + throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('fileReplicas', TType::LST, 14); + { + $output->writeListBegin(TType::STRUCT, count($this->fileReplicas)); + { + foreach ($this->fileReplicas as $iter27) + { + $xfer += $iter27->write($output); + } + } + $output->writeListEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class FileReplicaModel { + static $_TSPEC; + + /** + * @var string + */ + public $replicaName = null; + /** + * @var string + */ + public $replicaDescription = null; + /** + * @var string + */ + public $storageHostname = null; + /** + * @var string + */ + public $storageResourceId = null; + /** + * @var string + */ + public $filePath = null; + /** + * @var int + */ + public $creationTime = null; + /** + * @var int + */ + public $validUntilTime = null; + /** + * @var int + */ + public $storageResourceType = null; + /** + * @var int + */ + public $replicaPersistentType = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'replicaName', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'replicaDescription', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'storageHostname', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'storageResourceId', + 'type' => TType::STRING, + ), + 5 => array( + 'var' => 'filePath', + 'type' => TType::STRING, + ), + 6 => array( + 'var' => 'creationTime', + 'type' => TType::I64, + ), + 7 => array( + 'var' => 'validUntilTime', + 'type' => TType::I64, + ), + 8 => array( + 'var' => 'storageResourceType', + 'type' => TType::I32, + ), + 9 => array( + 'var' => 'replicaPersistentType', + 'type' => TType::I32, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['replicaName'])) { + $this->replicaName = $vals['replicaName']; + } + if (isset($vals['replicaDescription'])) { + $this->replicaDescription = $vals['replicaDescription']; + } + if (isset($vals['storageHostname'])) { + $this->storageHostname = $vals['storageHostname']; + } + if (isset($vals['storageResourceId'])) { + $this->storageResourceId = $vals['storageResourceId']; + } + if (isset($vals['filePath'])) { + $this->filePath = $vals['filePath']; + } + if (isset($vals['creationTime'])) { + $this->creationTime = $vals['creationTime']; + } + if (isset($vals['validUntilTime'])) { + $this->validUntilTime = $vals['validUntilTime']; + } + if (isset($vals['storageResourceType'])) { + $this->storageResourceType = $vals['storageResourceType']; + } + if (isset($vals['replicaPersistentType'])) { + $this->replicaPersistentType = $vals['replicaPersistentType']; + } + } + } + + public function getName() { + return 'FileReplicaModel'; + } + + 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->replicaName); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->replicaDescription); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->storageHostname); + } else { + $xfer += $input->skip($ftype); + } + break; + case 4: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->storageResourceId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 5: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->filePath); + } else { + $xfer += $input->skip($ftype); + } + break; + case 6: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->creationTime); + } else { + $xfer += $input->skip($ftype); + } + break; + case 7: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->validUntilTime); + } else { + $xfer += $input->skip($ftype); + } + break; + case 8: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->storageResourceType); + } else { + $xfer += $input->skip($ftype); + } + break; + case 9: + if ($ftype == TType::I32) { + $xfer += $input->readI32($this->replicaPersistentType); + } 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('FileReplicaModel'); + if ($this->replicaName !== null) { + $xfer += $output->writeFieldBegin('replicaName', TType::STRING, 1); + $xfer += $output->writeString($this->replicaName); + $xfer += $output->writeFieldEnd(); + } + if ($this->replicaDescription !== null) { + $xfer += $output->writeFieldBegin('replicaDescription', TType::STRING, 2); + $xfer += $output->writeString($this->replicaDescription); + $xfer += $output->writeFieldEnd(); + } + if ($this->storageHostname !== null) { + $xfer += $output->writeFieldBegin('storageHostname', TType::STRING, 3); + $xfer += $output->writeString($this->storageHostname); + $xfer += $output->writeFieldEnd(); + } + if ($this->storageResourceId !== null) { + $xfer += $output->writeFieldBegin('storageResourceId', TType::STRING, 4); + $xfer += $output->writeString($this->storageResourceId); + $xfer += $output->writeFieldEnd(); + } + if ($this->filePath !== null) { + $xfer += $output->writeFieldBegin('filePath', TType::STRING, 5); + $xfer += $output->writeString($this->filePath); + $xfer += $output->writeFieldEnd(); + } + if ($this->creationTime !== null) { + $xfer += $output->writeFieldBegin('creationTime', TType::I64, 6); + $xfer += $output->writeI64($this->creationTime); + $xfer += $output->writeFieldEnd(); + } + if ($this->validUntilTime !== null) { + $xfer += $output->writeFieldBegin('validUntilTime', TType::I64, 7); + $xfer += $output->writeI64($this->validUntilTime); + $xfer += $output->writeFieldEnd(); + } + if ($this->storageResourceType !== null) { + $xfer += $output->writeFieldBegin('storageResourceType', TType::I32, 8); + $xfer += $output->writeI32($this->storageResourceType); + $xfer += $output->writeFieldEnd(); + } + if ($this->replicaPersistentType !== null) { + $xfer += $output->writeFieldBegin('replicaPersistentType', TType::I32, 9); + $xfer += $output->writeI32($this->replicaPersistentType); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +
