adding PHP client for multiplexing AIRAVATA-1632
Project: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/commit/165a5113 Tree: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/tree/165a5113 Diff: http://git-wip-us.apache.org/repos/asf/airavata-sandbox/diff/165a5113 Branch: refs/heads/master Commit: 165a5113dc5c37c44c87d2b7347d0a12a4b8c19c Parents: e33bf99 Author: Suresh Marru <[email protected]> Authored: Wed Mar 18 14:07:20 2015 -0400 Committer: Suresh Marru <[email protected]> Committed: Wed Mar 18 14:07:20 2015 -0400 ---------------------------------------------------------------------- .../mock-airavata-api-client.iml | 22 - .../mock-airavata-php-sdk.iml | 13 + .../mock-airavata-api-php-stubs/pom.xml | 27 + .../src/main/resources/createAiravataClient.php | 70 ++ .../Credentials/CredentialManagementService.php | 729 ++++++++++++++++++ .../lib/Airavata/API/Credentials/Types.php | 20 + .../GatewayManagementService.php | 449 +++++++++++ .../Airavata/API/GatewayManagement/Types.php | 20 + .../main/resources/lib/Thrift/Base/TBase.php | 380 +++++++++ .../Thrift/ClassLoader/ThriftClassLoader.php | 210 +++++ .../Thrift/Exception/TApplicationException.php | 76 ++ .../lib/Thrift/Exception/TException.php | 383 +++++++++ .../lib/Thrift/Exception/TProtocolException.php | 50 ++ .../Thrift/Exception/TTransportException.php | 40 + .../Thrift/Factory/TBinaryProtocolFactory.php | 45 ++ .../Thrift/Factory/TCompactProtocolFactory.php | 40 + .../lib/Thrift/Factory/TJSONProtocolFactory.php | 40 + .../lib/Thrift/Factory/TProtocolFactory.php | 36 + .../lib/Thrift/Factory/TStringFuncFactory.php | 66 ++ .../lib/Thrift/Factory/TTransportFactory.php | 18 + .../lib/Thrift/Protocol/JSON/BaseContext.php | 39 + .../lib/Thrift/Protocol/JSON/ListContext.php | 54 ++ .../Thrift/Protocol/JSON/LookaheadReader.php | 57 ++ .../lib/Thrift/Protocol/JSON/PairContext.php | 64 ++ .../lib/Thrift/Protocol/TBinaryProtocol.php | 453 +++++++++++ .../Protocol/TBinaryProtocolAccelerated.php | 65 ++ .../lib/Thrift/Protocol/TCompactProtocol.php | 753 ++++++++++++++++++ .../lib/Thrift/Protocol/TJSONProtocol.php | 769 +++++++++++++++++++ .../Thrift/Protocol/TMultiplexedProtocol.php | 85 ++ .../resources/lib/Thrift/Protocol/TProtocol.php | 352 +++++++++ .../lib/Thrift/Protocol/TProtocolDecorator.php | 284 +++++++ .../lib/Thrift/Serializer/TBinarySerializer.php | 84 ++ .../lib/Thrift/Server/TForkingServer.php | 120 +++ .../resources/lib/Thrift/Server/TServer.php | 100 +++ .../lib/Thrift/Server/TServerSocket.php | 102 +++ .../lib/Thrift/Server/TServerTransport.php | 56 ++ .../lib/Thrift/Server/TSimpleServer.php | 58 ++ .../resources/lib/Thrift/StringFunc/Core.php | 40 + .../lib/Thrift/StringFunc/Mbstring.php | 46 ++ .../lib/Thrift/StringFunc/TStringFunc.php | 28 + .../lib/Thrift/TMultiplexedProcessor.php | 143 ++++ .../lib/Thrift/Transport/TBufferedTransport.php | 181 +++++ .../lib/Thrift/Transport/TCurlClient.php | 231 ++++++ .../lib/Thrift/Transport/TFramedTransport.php | 193 +++++ .../lib/Thrift/Transport/THttpClient.php | 229 ++++++ .../lib/Thrift/Transport/TMemoryBuffer.php | 95 +++ .../lib/Thrift/Transport/TNullTransport.php | 51 ++ .../lib/Thrift/Transport/TPhpStream.php | 123 +++ .../resources/lib/Thrift/Transport/TSocket.php | 337 ++++++++ .../lib/Thrift/Transport/TSocketPool.php | 300 ++++++++ .../lib/Thrift/Transport/TTransport.php | 95 +++ .../resources/lib/Thrift/Type/TConstant.php | 50 ++ .../resources/lib/Thrift/Type/TMessageType.php | 34 + .../main/resources/lib/Thrift/Type/TType.php | 47 ++ .../generate-thrift-stubs.sh | 56 +- airavata-mock-multiplexed-api/pom.xml | 1 + 56 files changed, 8459 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml b/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml deleted file mode 100644 index 3c58000..0000000 --- a/airavata-mock-multiplexed-api/mock-airavata-api-client/mock-airavata-api-client.iml +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> - <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> - <output url="file://$MODULE_DIR$/target/classes" /> - <output-test url="file://$MODULE_DIR$/target/test-classes" /> - <content url="file://$MODULE_DIR$"> - <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> - <excludeFolder url="file://$MODULE_DIR$/target" /> - </content> - <orderEntry type="inheritedJdk" /> - <orderEntry type="sourceFolder" forTests="false" /> - <orderEntry type="module" module-name="mock-airavata-api-stubs" /> - <orderEntry type="library" name="Maven: org.apache.thrift:libthrift:0.9.2" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.10" level="project" /> - <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.2.5" level="project" /> - <orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" /> - <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" /> - <orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.2.4" level="project" /> - <orderEntry type="library" name="Maven: org.slf4j:slf4j-log4j12:1.7.10" level="project" /> - <orderEntry type="library" name="Maven: log4j:log4j:1.2.16" level="project" /> - </component> -</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/mock-airavata-php-sdk.iml ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/mock-airavata-php-sdk.iml b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/mock-airavata-php-sdk.iml new file mode 100644 index 0000000..2ff16b5 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/mock-airavata-php-sdk.iml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> + <output url="file://$MODULE_DIR$/target/classes" /> + <output-test url="file://$MODULE_DIR$/target/test-classes" /> + <content url="file://$MODULE_DIR$"> + <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> + <excludeFolder url="file://$MODULE_DIR$/target" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + </component> +</module> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/pom.xml ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/pom.xml b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/pom.xml new file mode 100644 index 0000000..7f7387f --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/pom.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file + distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under + the Apache License, Version 2.0 (theà "License"); you may not use this file except in compliance with the License. You may + obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to + in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF + ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under + the License. --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <artifactId>mock-airavata-api</artifactId> + <groupId>org.apache.airavata</groupId> + <version>0.15-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <name>Airavata Generated Stubs Skeltons</name> + <artifactId>mock-airavata-php-sdk</artifactId> + <packaging>jar</packaging> + <url>http://airavata.apache.org/</url> + +</project> http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/createAiravataClient.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/createAiravataClient.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/createAiravataClient.php new file mode 100644 index 0000000..ea4ff45 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/createAiravataClient.php @@ -0,0 +1,70 @@ +<?php +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache V2 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +namespace Airavata\Client\Samples; + + +$GLOBALS['THRIFT_ROOT'] = 'lib/Thrift/'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TBufferedTransport.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TSocket.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocol.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TBinaryProtocol.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TProtocolDecorator.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Protocol/TMultiplexedProtocol.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TException.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TTransportException.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TApplicationException.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Exception/TProtocolException.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Base/TBase.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TType.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Type/TMessageType.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'Factory/TStringFuncFactory.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/TStringFunc.php'; +require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php'; + +$GLOBALS['AIRAVATA_ROOT'] = 'lib/Airavata/'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Credentials/CredentialManagementService.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/GatewayManagement/GatewayManagementService.php'; + +use Airavata\API\Credentials\CredentialManagementServiceClient; +use Airavata\API\GatewayManagement\GatewayManagementServiceClient; +use Thrift\Protocol\TBinaryProtocol; +use Thrift\Protocol\TMultiplexedProtocol; +use Thrift\Transport\TBufferedTransport; +use Thrift\Transport\TSocket; + +$socket = new TSocket('localhost', 9190); +$transport = new TBufferedTransport($socket); +$transport->open(); + +$credentialprotocol = new TMultiplexedProtocol(new TBinaryProtocol($transport), "CredentialManagementService"); +$credentialManagementClient = new CredentialManagementServiceClient($credentialprotocol); + +$gatewayprotocol = new TMultiplexedProtocol(new TBinaryProtocol($transport), "GatewayManagementService"); +$gatewayManagementClient = new GatewayManagementServiceClient($gatewayprotocol); + + +echo 'Test SSH Key is ' . $credentialManagementClient->generateAndRegisterSSHKeys('testgateway','testuser'); + +echo 'Test Gateay Name is ' . $gatewayManagementClient->getGatewayName('test'); + +?> http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/CredentialManagementService.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/CredentialManagementService.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/CredentialManagementService.php new file mode 100644 index 0000000..96b29ad --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/CredentialManagementService.php @@ -0,0 +1,729 @@ +<?php +namespace Airavata\API\Credentials; +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +use Thrift\Base\TBase; +use Thrift\Type\TType; +use Thrift\Type\TMessageType; +use Thrift\Exception\TException; +use Thrift\Exception\TProtocolException; +use Thrift\Protocol\TProtocol; +use Thrift\Protocol\TBinaryProtocolAccelerated; +use Thrift\Exception\TApplicationException; + + +interface CredentialManagementServiceIf { + /** + * Generate and Register SSH Key Pair with Airavata Credential Store. + * + * @param gatewayId + * The identifier for the requested gateway. + * + * @param userName + * The User for which the credential should be registered. For community accounts, this user is the name of the + * community user name. For computational resources, this user name need not be the same user name on resoruces. + * + * @return airavataCredStoreToken + * An SSH Key pair is generated and stored in the credential store and associated with users or community account + * belonging to a gateway. + * + * + * + * @param string $gatewayId + * @param string $userName + * @return string + */ + public function generateAndRegisterSSHKeys($gatewayId, $userName); + /** + * @param string $airavataCredStoreToken + * @return string + */ + public function getSSHPubKey($airavataCredStoreToken); + /** + * @param string $userName + * @return array + */ + public function getAllUserSSHPubKeys($userName); +} + +class CredentialManagementServiceClient implements \Airavata\API\Credentials\CredentialManagementServiceIf { + 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 generateAndRegisterSSHKeys($gatewayId, $userName) + { + $this->send_generateAndRegisterSSHKeys($gatewayId, $userName); + return $this->recv_generateAndRegisterSSHKeys(); + } + + public function send_generateAndRegisterSSHKeys($gatewayId, $userName) + { + $args = new \Airavata\API\Credentials\CredentialManagementService_generateAndRegisterSSHKeys_args(); + $args->gatewayId = $gatewayId; + $args->userName = $userName; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'generateAndRegisterSSHKeys', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('generateAndRegisterSSHKeys', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_generateAndRegisterSSHKeys() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Credentials\CredentialManagementService_generateAndRegisterSSHKeys_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\API\Credentials\CredentialManagementService_generateAndRegisterSSHKeys_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("generateAndRegisterSSHKeys failed: unknown result"); + } + + public function getSSHPubKey($airavataCredStoreToken) + { + $this->send_getSSHPubKey($airavataCredStoreToken); + return $this->recv_getSSHPubKey(); + } + + public function send_getSSHPubKey($airavataCredStoreToken) + { + $args = new \Airavata\API\Credentials\CredentialManagementService_getSSHPubKey_args(); + $args->airavataCredStoreToken = $airavataCredStoreToken; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'getSSHPubKey', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('getSSHPubKey', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_getSSHPubKey() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Credentials\CredentialManagementService_getSSHPubKey_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\API\Credentials\CredentialManagementService_getSSHPubKey_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("getSSHPubKey failed: unknown result"); + } + + public function getAllUserSSHPubKeys($userName) + { + $this->send_getAllUserSSHPubKeys($userName); + return $this->recv_getAllUserSSHPubKeys(); + } + + public function send_getAllUserSSHPubKeys($userName) + { + $args = new \Airavata\API\Credentials\CredentialManagementService_getAllUserSSHPubKeys_args(); + $args->userName = $userName; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'getAllUserSSHPubKeys', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('getAllUserSSHPubKeys', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_getAllUserSSHPubKeys() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\Credentials\CredentialManagementService_getAllUserSSHPubKeys_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\API\Credentials\CredentialManagementService_getAllUserSSHPubKeys_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("getAllUserSSHPubKeys failed: unknown result"); + } + +} + +// HELPER FUNCTIONS AND STRUCTURES + +class CredentialManagementService_generateAndRegisterSSHKeys_args { + static $_TSPEC; + + /** + * @var string + */ + public $gatewayId = null; + /** + * @var string + */ + public $userName = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'gatewayId', + 'type' => TType::STRING, + ), + 2 => array( + 'var' => 'userName', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['gatewayId'])) { + $this->gatewayId = $vals['gatewayId']; + } + if (isset($vals['userName'])) { + $this->userName = $vals['userName']; + } + } + } + + public function getName() { + return 'CredentialManagementService_generateAndRegisterSSHKeys_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->gatewayId); + } else { + $xfer += $input->skip($ftype); + } + break; + case 2: + if ($ftype == TType::STRING) { + $xfer += $input->readString($this->userName); + } 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('CredentialManagementService_generateAndRegisterSSHKeys_args'); + if ($this->gatewayId !== null) { + $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 1); + $xfer += $output->writeString($this->gatewayId); + $xfer += $output->writeFieldEnd(); + } + if ($this->userName !== null) { + $xfer += $output->writeFieldBegin('userName', TType::STRING, 2); + $xfer += $output->writeString($this->userName); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class CredentialManagementService_generateAndRegisterSSHKeys_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 'CredentialManagementService_generateAndRegisterSSHKeys_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('CredentialManagementService_generateAndRegisterSSHKeys_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 CredentialManagementService_getSSHPubKey_args { + static $_TSPEC; + + /** + * @var string + */ + public $airavataCredStoreToken = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'airavataCredStoreToken', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['airavataCredStoreToken'])) { + $this->airavataCredStoreToken = $vals['airavataCredStoreToken']; + } + } + } + + public function getName() { + return 'CredentialManagementService_getSSHPubKey_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->airavataCredStoreToken); + } 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('CredentialManagementService_getSSHPubKey_args'); + if ($this->airavataCredStoreToken !== null) { + $xfer += $output->writeFieldBegin('airavataCredStoreToken', TType::STRING, 1); + $xfer += $output->writeString($this->airavataCredStoreToken); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class CredentialManagementService_getSSHPubKey_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 'CredentialManagementService_getSSHPubKey_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('CredentialManagementService_getSSHPubKey_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 CredentialManagementService_getAllUserSSHPubKeys_args { + static $_TSPEC; + + /** + * @var string + */ + public $userName = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'userName', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['userName'])) { + $this->userName = $vals['userName']; + } + } + } + + public function getName() { + return 'CredentialManagementService_getAllUserSSHPubKeys_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; + default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + return $xfer; + } + + public function write($output) { + $xfer = 0; + $xfer += $output->writeStructBegin('CredentialManagementService_getAllUserSSHPubKeys_args'); + if ($this->userName !== null) { + $xfer += $output->writeFieldBegin('userName', TType::STRING, 1); + $xfer += $output->writeString($this->userName); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class CredentialManagementService_getAllUserSSHPubKeys_result { + static $_TSPEC; + + /** + * @var array + */ + public $success = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 0 => array( + 'var' => 'success', + 'type' => TType::MAP, + 'ktype' => TType::STRING, + 'vtype' => TType::STRING, + 'key' => array( + 'type' => TType::STRING, + ), + 'val' => array( + 'type' => TType::STRING, + ), + ), + ); + } + if (is_array($vals)) { + if (isset($vals['success'])) { + $this->success = $vals['success']; + } + } + } + + public function getName() { + return 'CredentialManagementService_getAllUserSSHPubKeys_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::MAP) { + $this->success = array(); + $_size0 = 0; + $_ktype1 = 0; + $_vtype2 = 0; + $xfer += $input->readMapBegin($_ktype1, $_vtype2, $_size0); + for ($_i4 = 0; $_i4 < $_size0; ++$_i4) + { + $key5 = ''; + $val6 = ''; + $xfer += $input->readString($key5); + $xfer += $input->readString($val6); + $this->success[$key5] = $val6; + } + $xfer += $input->readMapEnd(); + } 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('CredentialManagementService_getAllUserSSHPubKeys_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::MAP, 0); + { + $output->writeMapBegin(TType::STRING, TType::STRING, count($this->success)); + { + foreach ($this->success as $kiter7 => $viter8) + { + $xfer += $output->writeString($kiter7); + $xfer += $output->writeString($viter8); + } + } + $output->writeMapEnd(); + } + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/Types.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/Types.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/Types.php new file mode 100644 index 0000000..f7fae77 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/Credentials/Types.php @@ -0,0 +1,20 @@ +<?php +namespace Airavata\API\Credentials; + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +use Thrift\Base\TBase; +use Thrift\Type\TType; +use Thrift\Type\TMessageType; +use Thrift\Exception\TException; +use Thrift\Exception\TProtocolException; +use Thrift\Protocol\TProtocol; +use Thrift\Protocol\TBinaryProtocolAccelerated; +use Thrift\Exception\TApplicationException; + + + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/GatewayManagementService.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/GatewayManagementService.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/GatewayManagementService.php new file mode 100644 index 0000000..03ebfad --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/GatewayManagementService.php @@ -0,0 +1,449 @@ +<?php +namespace Airavata\API\GatewayManagement; +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +use Thrift\Base\TBase; +use Thrift\Type\TType; +use Thrift\Type\TMessageType; +use Thrift\Exception\TException; +use Thrift\Exception\TProtocolException; +use Thrift\Protocol\TProtocol; +use Thrift\Protocol\TBinaryProtocolAccelerated; +use Thrift\Exception\TApplicationException; + + +interface GatewayManagementServiceIf { + /** + * @param string $gatewayName + * @return string + */ + public function registerGateway($gatewayName); + /** + * @param string $gatewayId + * @return string + */ + public function getGatewayName($gatewayId); +} + +class GatewayManagementServiceClient implements \Airavata\API\GatewayManagement\GatewayManagementServiceIf { + 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 registerGateway($gatewayName) + { + $this->send_registerGateway($gatewayName); + return $this->recv_registerGateway(); + } + + public function send_registerGateway($gatewayName) + { + $args = new \Airavata\API\GatewayManagement\GatewayManagementService_registerGateway_args(); + $args->gatewayName = $gatewayName; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'registerGateway', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('registerGateway', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_registerGateway() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\GatewayManagement\GatewayManagementService_registerGateway_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\API\GatewayManagement\GatewayManagementService_registerGateway_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("registerGateway failed: unknown result"); + } + + public function getGatewayName($gatewayId) + { + $this->send_getGatewayName($gatewayId); + return $this->recv_getGatewayName(); + } + + public function send_getGatewayName($gatewayId) + { + $args = new \Airavata\API\GatewayManagement\GatewayManagementService_getGatewayName_args(); + $args->gatewayId = $gatewayId; + $bin_accel = ($this->output_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_write_binary'); + if ($bin_accel) + { + thrift_protocol_write_binary($this->output_, 'getGatewayName', TMessageType::CALL, $args, $this->seqid_, $this->output_->isStrictWrite()); + } + else + { + $this->output_->writeMessageBegin('getGatewayName', TMessageType::CALL, $this->seqid_); + $args->write($this->output_); + $this->output_->writeMessageEnd(); + $this->output_->getTransport()->flush(); + } + } + + public function recv_getGatewayName() + { + $bin_accel = ($this->input_ instanceof TBinaryProtocolAccelerated) && function_exists('thrift_protocol_read_binary'); + if ($bin_accel) $result = thrift_protocol_read_binary($this->input_, '\Airavata\API\GatewayManagement\GatewayManagementService_getGatewayName_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\API\GatewayManagement\GatewayManagementService_getGatewayName_result(); + $result->read($this->input_); + $this->input_->readMessageEnd(); + } + if ($result->success !== null) { + return $result->success; + } + throw new \Exception("getGatewayName failed: unknown result"); + } + +} + +// HELPER FUNCTIONS AND STRUCTURES + +class GatewayManagementService_registerGateway_args { + static $_TSPEC; + + /** + * @var string + */ + public $gatewayName = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'gatewayName', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['gatewayName'])) { + $this->gatewayName = $vals['gatewayName']; + } + } + } + + public function getName() { + return 'GatewayManagementService_registerGateway_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->gatewayName); + } 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('GatewayManagementService_registerGateway_args'); + if ($this->gatewayName !== null) { + $xfer += $output->writeFieldBegin('gatewayName', TType::STRING, 1); + $xfer += $output->writeString($this->gatewayName); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class GatewayManagementService_registerGateway_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 'GatewayManagementService_registerGateway_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('GatewayManagementService_registerGateway_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 GatewayManagementService_getGatewayName_args { + static $_TSPEC; + + /** + * @var string + */ + public $gatewayId = null; + + public function __construct($vals=null) { + if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( + 1 => array( + 'var' => 'gatewayId', + 'type' => TType::STRING, + ), + ); + } + if (is_array($vals)) { + if (isset($vals['gatewayId'])) { + $this->gatewayId = $vals['gatewayId']; + } + } + } + + public function getName() { + return 'GatewayManagementService_getGatewayName_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->gatewayId); + } 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('GatewayManagementService_getGatewayName_args'); + if ($this->gatewayId !== null) { + $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 1); + $xfer += $output->writeString($this->gatewayId); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + return $xfer; + } + +} + +class GatewayManagementService_getGatewayName_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 'GatewayManagementService_getGatewayName_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('GatewayManagementService_getGatewayName_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; + } + +} + + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/Types.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/Types.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/Types.php new file mode 100644 index 0000000..bf1404e --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Airavata/API/GatewayManagement/Types.php @@ -0,0 +1,20 @@ +<?php +namespace Airavata\API\GatewayManagement; + +/** + * Autogenerated by Thrift Compiler (0.9.2) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +use Thrift\Base\TBase; +use Thrift\Type\TType; +use Thrift\Type\TMessageType; +use Thrift\Exception\TException; +use Thrift\Exception\TProtocolException; +use Thrift\Protocol\TProtocol; +use Thrift\Protocol\TBinaryProtocolAccelerated; +use Thrift\Exception\TApplicationException; + + + http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Base/TBase.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Base/TBase.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Base/TBase.php new file mode 100755 index 0000000..4195f75 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Base/TBase.php @@ -0,0 +1,380 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * @package thrift + */ + +namespace Thrift\Base; + +use Thrift\Type\TType; + +/** + * Base class from which other Thrift structs extend. This is so that we can + * cut back on the size of the generated code which is turning out to have a + * nontrivial cost just to load thanks to the wondrously abysmal implementation + * of PHP. Note that code is intentionally duplicated in here to avoid making + * function calls for every field or member of a container.. + */ +abstract class TBase +{ + static $tmethod = array(TType::BOOL => 'Bool', + TType::BYTE => 'Byte', + TType::I16 => 'I16', + TType::I32 => 'I32', + TType::I64 => 'I64', + TType::DOUBLE => 'Double', + TType::STRING => 'String'); + + abstract public function read($input); + + abstract public function write($output); + + public function __construct($spec=null, $vals=null) + { + if (is_array($spec) && is_array($vals)) { + foreach ($spec as $fid => $fspec) { + $var = $fspec['var']; + if (isset($vals[$var])) { + $this->$var = $vals[$var]; + } + } + } + } + + public function __wakeup() + { + $this->__construct(get_object_vars($this)); + } + + private function _readMap(&$var, $spec, $input) + { + $xfer = 0; + $ktype = $spec['ktype']; + $vtype = $spec['vtype']; + $kread = $vread = null; + if (isset(TBase::$tmethod[$ktype])) { + $kread = 'read'.TBase::$tmethod[$ktype]; + } else { + $kspec = $spec['key']; + } + if (isset(TBase::$tmethod[$vtype])) { + $vread = 'read'.TBase::$tmethod[$vtype]; + } else { + $vspec = $spec['val']; + } + $var = array(); + $_ktype = $_vtype = $size = 0; + $xfer += $input->readMapBegin($_ktype, $_vtype, $size); + for ($i = 0; $i < $size; ++$i) { + $key = $val = null; + if ($kread !== null) { + $xfer += $input->$kread($key); + } else { + switch ($ktype) { + case TType::STRUCT: + $class = $kspec['class']; + $key = new $class(); + $xfer += $key->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($key, $kspec, $input); + break; + case TType::LST: + $xfer += $this->_readList($key, $kspec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($key, $kspec, $input, true); + break; + } + } + if ($vread !== null) { + $xfer += $input->$vread($val); + } else { + switch ($vtype) { + case TType::STRUCT: + $class = $vspec['class']; + $val = new $class(); + $xfer += $val->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($val, $vspec, $input); + break; + case TType::LST: + $xfer += $this->_readList($val, $vspec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($val, $vspec, $input, true); + break; + } + } + $var[$key] = $val; + } + $xfer += $input->readMapEnd(); + + return $xfer; + } + + private function _readList(&$var, $spec, $input, $set=false) + { + $xfer = 0; + $etype = $spec['etype']; + $eread = $vread = null; + if (isset(TBase::$tmethod[$etype])) { + $eread = 'read'.TBase::$tmethod[$etype]; + } else { + $espec = $spec['elem']; + } + $var = array(); + $_etype = $size = 0; + if ($set) { + $xfer += $input->readSetBegin($_etype, $size); + } else { + $xfer += $input->readListBegin($_etype, $size); + } + for ($i = 0; $i < $size; ++$i) { + $elem = null; + if ($eread !== null) { + $xfer += $input->$eread($elem); + } else { + $espec = $spec['elem']; + switch ($etype) { + case TType::STRUCT: + $class = $espec['class']; + $elem = new $class(); + $xfer += $elem->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($elem, $espec, $input); + break; + case TType::LST: + $xfer += $this->_readList($elem, $espec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($elem, $espec, $input, true); + break; + } + } + if ($set) { + $var[$elem] = true; + } else { + $var []= $elem; + } + } + if ($set) { + $xfer += $input->readSetEnd(); + } else { + $xfer += $input->readListEnd(); + } + + return $xfer; + } + + protected function _read($class, $spec, $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; + } + if (isset($spec[$fid])) { + $fspec = $spec[$fid]; + $var = $fspec['var']; + if ($ftype == $fspec['type']) { + $xfer = 0; + if (isset(TBase::$tmethod[$ftype])) { + $func = 'read'.TBase::$tmethod[$ftype]; + $xfer += $input->$func($this->$var); + } else { + switch ($ftype) { + case TType::STRUCT: + $class = $fspec['class']; + $this->$var = new $class(); + $xfer += $this->$var->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($this->$var, $fspec, $input); + break; + case TType::LST: + $xfer += $this->_readList($this->$var, $fspec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($this->$var, $fspec, $input, true); + break; + } + } + } else { + $xfer += $input->skip($ftype); + } + } else { + $xfer += $input->skip($ftype); + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + + return $xfer; + } + + private function _writeMap($var, $spec, $output) + { + $xfer = 0; + $ktype = $spec['ktype']; + $vtype = $spec['vtype']; + $kwrite = $vwrite = null; + if (isset(TBase::$tmethod[$ktype])) { + $kwrite = 'write'.TBase::$tmethod[$ktype]; + } else { + $kspec = $spec['key']; + } + if (isset(TBase::$tmethod[$vtype])) { + $vwrite = 'write'.TBase::$tmethod[$vtype]; + } else { + $vspec = $spec['val']; + } + $xfer += $output->writeMapBegin($ktype, $vtype, count($var)); + foreach ($var as $key => $val) { + if (isset($kwrite)) { + $xfer += $output->$kwrite($key); + } else { + switch ($ktype) { + case TType::STRUCT: + $xfer += $key->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($key, $kspec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($key, $kspec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($key, $kspec, $output, true); + break; + } + } + if (isset($vwrite)) { + $xfer += $output->$vwrite($val); + } else { + switch ($vtype) { + case TType::STRUCT: + $xfer += $val->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($val, $vspec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($val, $vspec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($val, $vspec, $output, true); + break; + } + } + } + $xfer += $output->writeMapEnd(); + + return $xfer; + } + + private function _writeList($var, $spec, $output, $set=false) + { + $xfer = 0; + $etype = $spec['etype']; + $ewrite = null; + if (isset(TBase::$tmethod[$etype])) { + $ewrite = 'write'.TBase::$tmethod[$etype]; + } else { + $espec = $spec['elem']; + } + if ($set) { + $xfer += $output->writeSetBegin($etype, count($var)); + } else { + $xfer += $output->writeListBegin($etype, count($var)); + } + foreach ($var as $key => $val) { + $elem = $set ? $key : $val; + if (isset($ewrite)) { + $xfer += $output->$ewrite($elem); + } else { + switch ($etype) { + case TType::STRUCT: + $xfer += $elem->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($elem, $espec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($elem, $espec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($elem, $espec, $output, true); + break; + } + } + } + if ($set) { + $xfer += $output->writeSetEnd(); + } else { + $xfer += $output->writeListEnd(); + } + + return $xfer; + } + + protected function _write($class, $spec, $output) + { + $xfer = 0; + $xfer += $output->writeStructBegin($class); + foreach ($spec as $fid => $fspec) { + $var = $fspec['var']; + if ($this->$var !== null) { + $ftype = $fspec['type']; + $xfer += $output->writeFieldBegin($var, $ftype, $fid); + if (isset(TBase::$tmethod[$ftype])) { + $func = 'write'.TBase::$tmethod[$ftype]; + $xfer += $output->$func($this->$var); + } else { + switch ($ftype) { + case TType::STRUCT: + $xfer += $this->$var->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($this->$var, $fspec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($this->$var, $fspec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($this->$var, $fspec, $output, true); + break; + } + } + $xfer += $output->writeFieldEnd(); + } + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + + return $xfer; + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/ClassLoader/ThriftClassLoader.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/ClassLoader/ThriftClassLoader.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/ClassLoader/ThriftClassLoader.php new file mode 100755 index 0000000..67575ce --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/ClassLoader/ThriftClassLoader.php @@ -0,0 +1,210 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * ClassLoader to load Thrift library and definitions + * Inspired from UniversalClassLoader from Symfony 2 + * + * @package thrift.classloader + */ + +namespace Thrift\ClassLoader; + +class ThriftClassLoader +{ + /** + * Namespaces path + * @var array + */ + protected $namespaces = array(); + + /** + * Thrift definition paths + * @var type + */ + protected $definitions = array(); + + /** + * Do we use APC cache ? + * @var boolean + */ + protected $apc = false; + + /** + * APC Cache prefix + * @var string + */ + protected $apc_prefix; + + /** + * Set autoloader to use APC cache + * @param boolean $apc + * @param string $apc_prefix + */ + public function __construct($apc = false, $apc_prefix = null) + { + $this->apc = $apc; + $this->apc_prefix = $apc_prefix; + } + + /** + * Registers a namespace. + * + * @param string $namespace The namespace + * @param array|string $paths The location(s) of the namespace + */ + public function registerNamespace($namespace, $paths) + { + $this->namespaces[$namespace] = (array) $paths; + } + + /** + * Registers a Thrift definition namespace. + * + * @param string $namespace The definition namespace + * @param array|string $paths The location(s) of the definition namespace + */ + public function registerDefinition($namespace, $paths) + { + $this->definitions[$namespace] = (array) $paths; + } + + /** + * Registers this instance as an autoloader. + * + * @param Boolean $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Loads the given class, definition or interface. + * + * @param string $class The name of the class + */ + public function loadClass($class) + { + if ( + (true === $this->apc && ($file = $this->findFileInApc($class))) or + ($file = $this->findFile($class)) + ) + { + require_once $file; + } + } + + /** + * Loads the given class or interface in APC. + * @param string $class The name of the class + * @return string + */ + protected function findFileInApc($class) + { + if (false === $file = apc_fetch($this->apc_prefix.$class)) { + apc_store($this->apc_prefix.$class, $file = $this->findFile($class)); + } + + return $file; + } + + /** + * Find class in namespaces or definitions directories + * @param string $class + * @return string + */ + public function findFile($class) + { + // Remove first backslash + if ('\\' == $class[0]) { + $class = substr($class, 1); + } + + if (false !== $pos = strrpos($class, '\\')) { + // Namespaced class name + $namespace = substr($class, 0, $pos); + + // Iterate in normal namespaces + foreach ($this->namespaces as $ns => $dirs) { + //Don't interfere with other autoloaders + if (0 !== strpos($namespace, $ns)) { + continue; + } + + foreach ($dirs as $dir) { + $className = substr($class, $pos + 1); + + $file = $dir.DIRECTORY_SEPARATOR. + str_replace('\\', DIRECTORY_SEPARATOR, $namespace). + DIRECTORY_SEPARATOR. + $className.'.php'; + + if (file_exists($file)) { + return $file; + } + } + } + + // Iterate in Thrift namespaces + + // Remove first part of namespace + $m = explode('\\', $class); + + // Ignore wrong call + if (count($m) <= 1) { + return; + } + + $class = array_pop($m); + $namespace = implode('\\', $m); + + foreach ($this->definitions as $ns => $dirs) { + //Don't interfere with other autoloaders + if (0 !== strpos($namespace, $ns)) { + continue; + } + + foreach ($dirs as $dir) { + /** + * Available in service: Interface, Client, Processor, Rest + * And every service methods (_.+) + */ + if( + 0 === preg_match('#(.+)(if|client|processor|rest)$#i', $class, $n) and + 0 === preg_match('#(.+)_[a-z0-9]+_(args|result)$#i', $class, $n) + ) + { + $className = 'Types'; + } else { + $className = $n[1]; + } + + $file = $dir.DIRECTORY_SEPARATOR . + str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . + DIRECTORY_SEPARATOR . + $className . '.php'; + + if (file_exists($file)) { + return $file; + } + } + } + } + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TApplicationException.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TApplicationException.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TApplicationException.php new file mode 100755 index 0000000..b1689fc --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TApplicationException.php @@ -0,0 +1,76 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * @package thrift + */ + +namespace Thrift\Exception; + +use Thrift\Type\TType; + +class TApplicationException extends TException +{ + static $_TSPEC = + array(1 => array('var' => 'message', + 'type' => TType::STRING), + 2 => array('var' => 'code', + 'type' => TType::I32)); + + const UNKNOWN = 0; + const UNKNOWN_METHOD = 1; + const INVALID_MESSAGE_TYPE = 2; + const WRONG_METHOD_NAME = 3; + const BAD_SEQUENCE_ID = 4; + const MISSING_RESULT = 5; + const INTERNAL_ERROR = 6; + const PROTOCOL_ERROR = 7; + const INVALID_TRANSFORM = 8; + const INVALID_PROTOCOL = 9; + const UNSUPPORTED_CLIENT_TYPE = 10; + + public function __construct($message=null, $code=0) + { + parent::__construct($message, $code); + } + + public function read($output) + { + return $this->_read('TApplicationException', self::$_TSPEC, $output); + } + + public function write($output) + { + $xfer = 0; + $xfer += $output->writeStructBegin('TApplicationException'); + if ($message = $this->getMessage()) { + $xfer += $output->writeFieldBegin('message', TType::STRING, 1); + $xfer += $output->writeString($message); + $xfer += $output->writeFieldEnd(); + } + if ($code = $this->getCode()) { + $xfer += $output->writeFieldBegin('type', TType::I32, 2); + $xfer += $output->writeI32($code); + $xfer += $output->writeFieldEnd(); + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + + return $xfer; + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TException.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TException.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TException.php new file mode 100755 index 0000000..5c06843 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TException.php @@ -0,0 +1,383 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * @package thrift + */ + +namespace Thrift\Exception; + +use Thrift\Type\TType; +use Thrift\Base\TBase; + +/** + * NOTE(mcslee): This currently contains a ton of duplicated code from TBase + * because we need to save CPU cycles and this is not yet in an extension. + * Ideally we'd multiply-inherit TException from both Exception and Base, but + * that's not possible in PHP and there are no modules either, so for now we + * apologetically take a trip to HackTown. + * + * Can be called with standard Exception constructor (message, code) or with + * Thrift Base object constructor (spec, vals). + * + * @param mixed $p1 Message (string) or type-spec (array) + * @param mixed $p2 Code (integer) or values (array) + */ +class TException extends \Exception +{ + public function __construct($p1=null, $p2=0) + { + if (is_array($p1) && is_array($p2)) { + $spec = $p1; + $vals = $p2; + foreach ($spec as $fid => $fspec) { + $var = $fspec['var']; + if (isset($vals[$var])) { + $this->$var = $vals[$var]; + } + } + } else { + parent::__construct($p1, $p2); + } + } + + static $tmethod = array(TType::BOOL => 'Bool', + TType::BYTE => 'Byte', + TType::I16 => 'I16', + TType::I32 => 'I32', + TType::I64 => 'I64', + TType::DOUBLE => 'Double', + TType::STRING => 'String'); + + private function _readMap(&$var, $spec, $input) + { + $xfer = 0; + $ktype = $spec['ktype']; + $vtype = $spec['vtype']; + $kread = $vread = null; + if (isset(TBase::$tmethod[$ktype])) { + $kread = 'read'.TBase::$tmethod[$ktype]; + } else { + $kspec = $spec['key']; + } + if (isset(TBase::$tmethod[$vtype])) { + $vread = 'read'.TBase::$tmethod[$vtype]; + } else { + $vspec = $spec['val']; + } + $var = array(); + $_ktype = $_vtype = $size = 0; + $xfer += $input->readMapBegin($_ktype, $_vtype, $size); + for ($i = 0; $i < $size; ++$i) { + $key = $val = null; + if ($kread !== null) { + $xfer += $input->$kread($key); + } else { + switch ($ktype) { + case TType::STRUCT: + $class = $kspec['class']; + $key = new $class(); + $xfer += $key->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($key, $kspec, $input); + break; + case TType::LST: + $xfer += $this->_readList($key, $kspec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($key, $kspec, $input, true); + break; + } + } + if ($vread !== null) { + $xfer += $input->$vread($val); + } else { + switch ($vtype) { + case TType::STRUCT: + $class = $vspec['class']; + $val = new $class(); + $xfer += $val->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($val, $vspec, $input); + break; + case TType::LST: + $xfer += $this->_readList($val, $vspec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($val, $vspec, $input, true); + break; + } + } + $var[$key] = $val; + } + $xfer += $input->readMapEnd(); + + return $xfer; + } + + private function _readList(&$var, $spec, $input, $set=false) + { + $xfer = 0; + $etype = $spec['etype']; + $eread = $vread = null; + if (isset(TBase::$tmethod[$etype])) { + $eread = 'read'.TBase::$tmethod[$etype]; + } else { + $espec = $spec['elem']; + } + $var = array(); + $_etype = $size = 0; + if ($set) { + $xfer += $input->readSetBegin($_etype, $size); + } else { + $xfer += $input->readListBegin($_etype, $size); + } + for ($i = 0; $i < $size; ++$i) { + $elem = null; + if ($eread !== null) { + $xfer += $input->$eread($elem); + } else { + $espec = $spec['elem']; + switch ($etype) { + case TType::STRUCT: + $class = $espec['class']; + $elem = new $class(); + $xfer += $elem->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($elem, $espec, $input); + break; + case TType::LST: + $xfer += $this->_readList($elem, $espec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($elem, $espec, $input, true); + break; + } + } + if ($set) { + $var[$elem] = true; + } else { + $var []= $elem; + } + } + if ($set) { + $xfer += $input->readSetEnd(); + } else { + $xfer += $input->readListEnd(); + } + + return $xfer; + } + + protected function _read($class, $spec, $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; + } + if (isset($spec[$fid])) { + $fspec = $spec[$fid]; + $var = $fspec['var']; + if ($ftype == $fspec['type']) { + $xfer = 0; + if (isset(TBase::$tmethod[$ftype])) { + $func = 'read'.TBase::$tmethod[$ftype]; + $xfer += $input->$func($this->$var); + } else { + switch ($ftype) { + case TType::STRUCT: + $class = $fspec['class']; + $this->$var = new $class(); + $xfer += $this->$var->read($input); + break; + case TType::MAP: + $xfer += $this->_readMap($this->$var, $fspec, $input); + break; + case TType::LST: + $xfer += $this->_readList($this->$var, $fspec, $input, false); + break; + case TType::SET: + $xfer += $this->_readList($this->$var, $fspec, $input, true); + break; + } + } + } else { + $xfer += $input->skip($ftype); + } + } else { + $xfer += $input->skip($ftype); + } + $xfer += $input->readFieldEnd(); + } + $xfer += $input->readStructEnd(); + + return $xfer; + } + + private function _writeMap($var, $spec, $output) + { + $xfer = 0; + $ktype = $spec['ktype']; + $vtype = $spec['vtype']; + $kwrite = $vwrite = null; + if (isset(TBase::$tmethod[$ktype])) { + $kwrite = 'write'.TBase::$tmethod[$ktype]; + } else { + $kspec = $spec['key']; + } + if (isset(TBase::$tmethod[$vtype])) { + $vwrite = 'write'.TBase::$tmethod[$vtype]; + } else { + $vspec = $spec['val']; + } + $xfer += $output->writeMapBegin($ktype, $vtype, count($var)); + foreach ($var as $key => $val) { + if (isset($kwrite)) { + $xfer += $output->$kwrite($key); + } else { + switch ($ktype) { + case TType::STRUCT: + $xfer += $key->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($key, $kspec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($key, $kspec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($key, $kspec, $output, true); + break; + } + } + if (isset($vwrite)) { + $xfer += $output->$vwrite($val); + } else { + switch ($vtype) { + case TType::STRUCT: + $xfer += $val->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($val, $vspec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($val, $vspec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($val, $vspec, $output, true); + break; + } + } + } + $xfer += $output->writeMapEnd(); + + return $xfer; + } + + private function _writeList($var, $spec, $output, $set=false) + { + $xfer = 0; + $etype = $spec['etype']; + $ewrite = null; + if (isset(TBase::$tmethod[$etype])) { + $ewrite = 'write'.TBase::$tmethod[$etype]; + } else { + $espec = $spec['elem']; + } + if ($set) { + $xfer += $output->writeSetBegin($etype, count($var)); + } else { + $xfer += $output->writeListBegin($etype, count($var)); + } + foreach ($var as $key => $val) { + $elem = $set ? $key : $val; + if (isset($ewrite)) { + $xfer += $output->$ewrite($elem); + } else { + switch ($etype) { + case TType::STRUCT: + $xfer += $elem->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($elem, $espec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($elem, $espec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($elem, $espec, $output, true); + break; + } + } + } + if ($set) { + $xfer += $output->writeSetEnd(); + } else { + $xfer += $output->writeListEnd(); + } + + return $xfer; + } + + protected function _write($class, $spec, $output) + { + $xfer = 0; + $xfer += $output->writeStructBegin($class); + foreach ($spec as $fid => $fspec) { + $var = $fspec['var']; + if ($this->$var !== null) { + $ftype = $fspec['type']; + $xfer += $output->writeFieldBegin($var, $ftype, $fid); + if (isset(TBase::$tmethod[$ftype])) { + $func = 'write'.TBase::$tmethod[$ftype]; + $xfer += $output->$func($this->$var); + } else { + switch ($ftype) { + case TType::STRUCT: + $xfer += $this->$var->write($output); + break; + case TType::MAP: + $xfer += $this->_writeMap($this->$var, $fspec, $output); + break; + case TType::LST: + $xfer += $this->_writeList($this->$var, $fspec, $output, false); + break; + case TType::SET: + $xfer += $this->_writeList($this->$var, $fspec, $output, true); + break; + } + } + $xfer += $output->writeFieldEnd(); + } + } + $xfer += $output->writeFieldStop(); + $xfer += $output->writeStructEnd(); + + return $xfer; + } + +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TProtocolException.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TProtocolException.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TProtocolException.php new file mode 100755 index 0000000..ba7135c --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TProtocolException.php @@ -0,0 +1,50 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * @package thrift.protocol + * @author: rmarin ([email protected]) + */ + +namespace Thrift\Exception; + +/** + * Protocol module. Contains all the types and definitions needed to implement + * a protocol encoder/decoder. + * + * @package thrift.protocol + */ + +/** + * Protocol exceptions + */ +class TProtocolException extends TException +{ + const UNKNOWN = 0; + const INVALID_DATA = 1; + const NEGATIVE_SIZE = 2; + const SIZE_LIMIT = 3; + const BAD_VERSION = 4; + const NOT_IMPLEMENTED = 5; + const DEPTH_LIMIT = 6; + + public function __construct($message=null, $code=0) + { + parent::__construct($message, $code); + } +} http://git-wip-us.apache.org/repos/asf/airavata-sandbox/blob/165a5113/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TTransportException.php ---------------------------------------------------------------------- diff --git a/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TTransportException.php b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TTransportException.php new file mode 100755 index 0000000..0074467 --- /dev/null +++ b/airavata-mock-multiplexed-api/mock-airavata-api-php-stubs/src/main/resources/lib/Thrift/Exception/TTransportException.php @@ -0,0 +1,40 @@ +<?php +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + * @package thrift.transport + */ + +namespace Thrift\Exception; + +/** + * Transport exceptions + */ +class TTransportException extends TException +{ + const UNKNOWN = 0; + const NOT_OPEN = 1; + const ALREADY_OPEN = 2; + const TIMED_OUT = 3; + const END_OF_FILE = 4; + + public function __construct($message=null, $code=0) + { + parent::__construct($message, $code); + } +}
