Repository: airavata Updated Branches: refs/heads/master cf945f01a -> d1d3fae86
Updating PHP Samples - AIRAVATA-1274 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/d1d3fae8 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/d1d3fae8 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/d1d3fae8 Branch: refs/heads/master Commit: d1d3fae860faf508db8a01c6e54118384082aaa9 Parents: cf945f0 Author: Suresh Marru <[email protected]> Authored: Tue Jul 8 12:33:26 2014 -0400 Committer: Suresh Marru <[email protected]> Committed: Tue Jul 8 12:33:26 2014 -0400 ---------------------------------------------------------------------- .../conf/airavata-client-properties.ini | 18 +++++ .../airavata-client-properties.ini | 18 ----- .../resources/php-cli-samples/createProject.php | 42 +++-------- .../resources/php-cli-samples/getAPIVersion.php | 37 ++-------- .../php-cli-samples/getAiravataClient.php | 10 ++- .../getAllApplicationInterfaceNames.php | 50 +++++++++++++ .../resources/php-cli-samples/getAppModule.php | 44 +++--------- .../php-cli-samples/getApplicationInputs.php | 60 ++++++++++++++++ .../php-cli-samples/getApplicationOutputs.php | 60 ++++++++++++++++ ...getAvailableAppInterfaceComputeResources.php | 60 ++++++++++++++++ .../php-cli-samples/getExperimentOutputs.php | 35 --------- .../php-cli-samples/registerAppDeployment.php | 74 ++++++++++++++++++++ .../php-cli-samples/registerAppInterface.php | 66 +++++++++++++++++ .../php-cli-samples/registerAppModule.php | 49 +++---------- .../php-cli-samples/registerComputeResource.php | 68 ++++++++++++++++++ 15 files changed, 497 insertions(+), 194 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini new file mode 100644 index 0000000..ddf6f32 --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/conf/airavata-client-properties.ini @@ -0,0 +1,18 @@ +; The is the configuration file with properties needed by Airavata Clients. +; Key properties specify location of Airavata Services, Ports and Such. + +; library path to Thrift Libraries +THRIFT_LIB_DIR = "../lib/Thrift/" + +; library of thrift generated Airavata API PHP Stubs +AIRAVATA_PHP_STUBS_DIR = "../lib/Airavata/" + +; Host which runs the Airavata Server +;AIRAVATA_SERVER = "gw111.iu.xsede.org" +AIRAVATA_SERVER = "localhost" + +; Airavata Server thrift port +AIRAVATA_PORT = 8930 + +; Time out value to give enough breathing room for client to get synchronous responses back +AIRAVATA_TIMEOUT = 5000 http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/airavata-client-properties.ini ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/airavata-client-properties.ini b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/airavata-client-properties.ini deleted file mode 100644 index ddf6f32..0000000 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/airavata-client-properties.ini +++ /dev/null @@ -1,18 +0,0 @@ -; The is the configuration file with properties needed by Airavata Clients. -; Key properties specify location of Airavata Services, Ports and Such. - -; library path to Thrift Libraries -THRIFT_LIB_DIR = "../lib/Thrift/" - -; library of thrift generated Airavata API PHP Stubs -AIRAVATA_PHP_STUBS_DIR = "../lib/Airavata/" - -; Host which runs the Airavata Server -;AIRAVATA_SERVER = "gw111.iu.xsede.org" -AIRAVATA_SERVER = "localhost" - -; Airavata Server thrift port -AIRAVATA_PORT = 8930 - -; Time out value to give enough breathing room for client to get synchronous responses back -AIRAVATA_TIMEOUT = 5000 http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php index daa6da5..88e11e6 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/createProject.php @@ -1,42 +1,18 @@ <?php -namespace Airavata\Client\Samples; - -$airavataconfig = parse_ini_file("airavata-client-properties.ini"); - -$GLOBALS['THRIFT_ROOT'] = $airavataconfig['THRIFT_LIB_DIR']; -require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.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'] . 'Exception/TException.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'] = $airavataconfig['AIRAVATA_PHP_STUBS_DIR']; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; use Airavata\API\Error\AiravataClientException; use Airavata\API\Error\AiravataSystemException; use Airavata\API\Error\InvalidRequestException; -use Airavata\Client\AiravataClientFactory; -use Thrift\Protocol\TBinaryProtocol; -use Thrift\Transport\TBufferedTransport; -use Thrift\Transport\TSocket; -use Airavata\API\AiravataClient; -use Airavata\Model\Workspace\Project; -include 'getAiravataClient.php'; -global $airavataclient; -global $transport; +use Airavata\Model\Workspace\Project; try { http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAPIVersion.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAPIVersion.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAPIVersion.php index d52f110..d359172 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAPIVersion.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAPIVersion.php @@ -1,37 +1,10 @@ <?php -namespace Airavata\Client\Samples; - -$airavataconfig = parse_ini_file("airavata-client-properties.ini"); - -$GLOBALS['THRIFT_ROOT'] = $airavataconfig['THRIFT_LIB_DIR']; -require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.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'] . 'Exception/TException.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'] = $airavataconfig['AIRAVATA_PHP_STUBS_DIR']; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; - -use Airavata\API\Error\AiravataClientException; -use Airavata\API\Error\AiravataSystemException; -use Airavata\API\Error\InvalidRequestException; -use Airavata\Client\AiravataClientFactory; -use Thrift\Protocol\TBinaryProtocol; -use Thrift\Transport\TBufferedTransport; -use Thrift\Transport\TSocket; -use Airavata\API\AiravataClient; +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ include 'getAiravataClient.php'; global $airavataclient; global $transport; http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAiravataClient.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAiravataClient.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAiravataClient.php index 2a39752..8a82060 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAiravataClient.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAiravataClient.php @@ -1,7 +1,7 @@ <?php namespace Airavata\Client\Samples; -$airavataconfig = parse_ini_file("airavata-client-properties.ini"); +$airavataconfig = parse_ini_file("../conf/airavata-client-properties.ini"); $GLOBALS['THRIFT_ROOT'] = $airavataconfig['THRIFT_LIB_DIR']; require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.php'; @@ -9,6 +9,7 @@ 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'] . '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'; @@ -20,8 +21,13 @@ require_once $GLOBALS['THRIFT_ROOT'] . 'StringFunc/Core.php'; $GLOBALS['AIRAVATA_ROOT'] = $airavataconfig['AIRAVATA_PHP_STUBS_DIR']; require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php'; require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/ComputeResource/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/AppDeployment/Types.php'; +require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/AppInterface/Types.php'; use Airavata\API\Error\AiravataClientException; use Airavata\API\Error\AiravataSystemException; http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllApplicationInterfaceNames.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllApplicationInterfaceNames.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllApplicationInterfaceNames.php new file mode 100755 index 0000000..5066082 --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAllApplicationInterfaceNames.php @@ -0,0 +1,50 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Thrift\Exception\TTransportException; + +try +{ + + $appInterfaceNameIdList = $airavataclient->getAllApplicationInterfaceNames(); + + if ($appInterfaceNameIdList) + { + var_dump($appInterfaceNameIdList); + } + else + { + echo "\n Failed to fetch application interface names. \n"; + } +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> + http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAppModule.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAppModule.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAppModule.php index 746de5d..e28dbac 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAppModule.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAppModule.php @@ -1,43 +1,19 @@ <?php -namespace Airavata\Client\Samples; - -$airavataconfig = parse_ini_file("airavata-client-properties.ini"); - -$GLOBALS['THRIFT_ROOT'] = $airavataconfig['THRIFT_LIB_DIR']; -require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.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'] . 'Exception/TException.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'] = $airavataconfig['AIRAVATA_PHP_STUBS_DIR']; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/AppDeployment/Types.php'; +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; use Airavata\API\Error\AiravataClientException; use Airavata\API\Error\AiravataSystemException; -use Airavata\API\Error\ExperimentNotFoundException; use Airavata\API\Error\InvalidRequestException; -use Airavata\Client\AiravataClientFactory; -use Airavata\Model\Workspace\Experiment\ExperimentState; use Thrift\Exception\TTransportException; -use Thrift\Protocol\TBinaryProtocol; -use Thrift\Transport\TBufferedTransport; -use Thrift\Transport\TSocket; -use Airavata\API\AiravataClient; -include 'getAiravataClient.php'; -global $airavataclient; -global $transport; +use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule; if (count($argv) < 2) { @@ -63,7 +39,7 @@ function get_appModule($appModuleId) try { - return $airavataclient->getApplicationDeployment($appModuleId); + return $airavataclient->getApplicationModule($appModuleId); } catch (InvalidRequestException $ire) { http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php new file mode 100755 index 0000000..b490d7b --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationInputs.php @@ -0,0 +1,60 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Thrift\Exception\TTransportException; + +try +{ + + if ($argc < 1) + { + echo 'php getApplicationInputs.php <appInterfaceId>'; + } + else { + + $appInterfaceId = $argv[1]; + + $appInputs = $airavataclient->getApplicationInputs($appInterfaceId); + + if ($appInputs) { + var_dump($appInputs); + } else { + echo "\n Failed to fetch application interface Inputs. \n"; + } +} +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (TTransportException $tte) +{ + echo 'TTransportException!<br><br>' . $tte->getMessage(); +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> + http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php new file mode 100755 index 0000000..b8b569f --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getApplicationOutputs.php @@ -0,0 +1,60 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Thrift\Exception\TTransportException; + +try +{ + + if ($argc < 1) + { + echo 'php getApplicationOutputs.php <appInterfaceId>'; + } + else { + + $appInterfaceId = $argv[1]; + + $appOutputs = $airavataclient->getApplicationOutputs($appInterfaceId); + + if ($appOutputs) { + var_dump($appOutputs); + } else { + echo "\n Failed to fetch application interface Outputs. \n"; + } +} +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (TTransportException $tte) +{ + echo 'TTransportException!<br><br>' . $tte->getMessage(); +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> + http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAvailableAppInterfaceComputeResources.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAvailableAppInterfaceComputeResources.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAvailableAppInterfaceComputeResources.php new file mode 100755 index 0000000..aa604fa --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getAvailableAppInterfaceComputeResources.php @@ -0,0 +1,60 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; +use Thrift\Exception\TTransportException; + +try +{ + + if ($argc < 1) + { + echo 'php getAvailableAppInterfaceComputeResources.php <appInterfaceId>'; + } + else { + + $appInterfaceId = $argv[1]; + + $appInterfaceComputeResources = $airavataclient->getAvailableAppInterfaceComputeResources($appInterfaceId); + + if ($appInterfaceComputeResources) { + var_dump($appInterfaceComputeResources); + } else { + echo "\n Failed to fetch application interface compute resources. \n"; + } +} +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (TTransportException $tte) +{ + echo 'TTransportException!<br><br>' . $tte->getMessage(); +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> + http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php index 3e9f557..b822092 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/getExperimentOutputs.php @@ -1,46 +1,15 @@ <?php -namespace Airavata\Client\Samples; - -$airavataconfig = parse_ini_file("airavata-client-properties.ini"); - -$GLOBALS['THRIFT_ROOT'] = $airavataconfig['THRIFT_LIB_DIR']; -require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.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'] . 'Exception/TException.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'] = $airavataconfig['AIRAVATA_PHP_STUBS_DIR']; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/Workspace/Experiment/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; use Airavata\API\Error\AiravataClientException; use Airavata\API\Error\AiravataSystemException; use Airavata\API\Error\ExperimentNotFoundException; use Airavata\API\Error\InvalidRequestException; -use Airavata\Client\AiravataClientFactory; -use Airavata\Model\Workspace\Experiment\ExperimentState; use Thrift\Exception\TTransportException; -use Thrift\Protocol\TBinaryProtocol; -use Thrift\Transport\TBufferedTransport; -use Thrift\Transport\TSocket; -use Airavata\API\AiravataClient; include 'getAiravataClient.php'; global $airavataclient; global $transport; - if ($argc != 2) { exit("php getExperimentOutputs.php <experiment_id> \n"); @@ -58,10 +27,6 @@ foreach ($outputs as $output) var_dump($outputs); - - - - $transport->close(); http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppDeployment.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppDeployment.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppDeployment.php new file mode 100755 index 0000000..4872faf --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppDeployment.php @@ -0,0 +1,74 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; + +use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule; +use Airavata\Model\AppCatalog\AppDeployment\ApplicationDeploymentDescription; + +try +{ + if ($argc != 4) + { + echo 'php registerAppDeployment.php <appModuleId> <computeHostId> <executablePath>'; + } + else + { + $appModuleId = $argv[1]; + $computeHostId = $argv[2]; + $executablePath = $argv[3]; + + $appDeployment = new ApplicationDeploymentDescription(); + $appDeployment->appModuleId = $appModuleId; + $appDeployment->computeHostId = $computeHostId; + $appDeployment->executablePath = $executablePath; + + + + $appDeploymentId = $airavataclient->registerApplicationDeployment($appDeployment); + + if ($appDeploymentId) + { + var_dump($appDeployment); + echo "Application Deployment $appDeploymentId is registered! \n "; + } + else + { + echo "Failed to register application deployment. \n"; + } + } +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (TTransportException $tte) +{ + echo 'TTransportException!<br><br>' . $tte->getMessage(); +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> + http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppInterface.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppInterface.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppInterface.php new file mode 100755 index 0000000..6f74b53 --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppInterface.php @@ -0,0 +1,66 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; + +use Airavata\Model\AppCatalog\AppInterface\ApplicationInterfaceDescription; + +try +{ + if ($argc != 4) + { + echo 'php registerAppInterface.php <appName> <appDescription> <appModuleId>'; + } + else + { + $appName = $argv[1]; + $appDescription = $argv[2]; + $appModuleId = $argv[3]; + + $appInterface = new ApplicationInterfaceDescription(); + $appInterface->applicationName = $appName; + $appInterface->applicationDesription = $appDescription; + + $appInterfaceId = $airavataclient->registerApplicationInterface($appInterface); + + if ($appInterfaceId) + { + var_dump($appInterface); + echo "\n Application Interface $appInterfaceId is registered! \n "; + } + else + { + echo "\n Failed to register application interface. \n"; + } + } +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> + http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppModule.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppModule.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppModule.php index b3ed27a..b6007ab 100755 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppModule.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerAppModule.php @@ -1,49 +1,18 @@ <?php -namespace Airavata\Client\Samples; - -$airavataconfig = parse_ini_file("airavata-client-properties.ini"); - -$GLOBALS['THRIFT_ROOT'] = $airavataconfig['THRIFT_LIB_DIR']; -require_once $GLOBALS['THRIFT_ROOT'] . 'Transport/TTransport.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'] . 'Exception/TException.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'] = $airavataconfig['AIRAVATA_PHP_STUBS_DIR']; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Error/Types.php'; -require_once $GLOBALS['AIRAVATA_ROOT'] . 'Model/AppCatalog/AppDeployment/Types.php'; - +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; use Airavata\API\Error\AiravataClientException; use Airavata\API\Error\AiravataSystemException; use Airavata\API\Error\InvalidRequestException; -use Airavata\Client\AiravataClientFactory; -use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule; -use Thrift\Protocol\TBinaryProtocol; -use Thrift\Transport\TBufferedTransport; -use Thrift\Transport\TSocket; -use Airavata\API\AiravataClient; - -use Airavata\Model\Workspace\Project; -use Airavata\Model\Workspace\Experiment\Experiment; -use Airavata\Model\Workspace\Experiment\DataObjectType; -use Airavata\Model\Workspace\Experiment\UserConfigurationData; -use Airavata\Model\Workspace\Experiment\ComputationalResourceScheduling; -use Airavata\Model\Workspace\Experiment\DataType; -include 'getAiravataClient.php'; -global $airavataclient; -global $transport; +use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule; try { http://git-wip-us.apache.org/repos/asf/airavata/blob/d1d3fae8/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerComputeResource.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerComputeResource.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerComputeResource.php new file mode 100755 index 0000000..a561b70 --- /dev/null +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/php-cli-samples/registerComputeResource.php @@ -0,0 +1,68 @@ +<?php +/** + * Bundle all thrift and Airavata stubs into a include file. This is simple but not so elegant way. + * Contributions welcome to improve writing PHP Client Samples. + * + */ +include 'getAiravataClient.php'; +global $airavataclient; +global $transport; + +use Airavata\API\Error\AiravataClientException; +use Airavata\API\Error\AiravataSystemException; +use Airavata\API\Error\InvalidRequestException; + +use Airavata\Model\AppCatalog\ComputeResource\ComputeResourceDescription; + +try +{ + if ($argc != 3) + { + echo 'php registerComputeResource.php <hostName> <resourceDescription>'; + } + else + { + $hostName = $argv[1]; + $resourceDescription = $argv[2]; + + $computeResource = new ComputeResourceDescription(); + $computeResource->hostName = $hostName; + $computeResource->resourceDescription = $resourceDescription; + + + + + $computeResourceId = $airavataclient->registerComputeResource($computeResource); + + if ($computeResourceId) + { + var_dump($computeResource); + echo "\n Compute Resource $computeResourceId is registered! \n "; + } + else + { + echo "\n Failed to register compute resource description. \n"; + } + } +} +catch (InvalidRequestException $ire) +{ + print 'InvalidRequestException: ' . $ire->getMessage()."\n"; +} +catch (AiravataClientException $ace) +{ + print 'Airavata System Exception: ' . $ace->getMessage()."\n"; +} +catch (AiravataSystemException $ase) +{ + print 'Airavata System Exception: ' . $ase->getMessage()."\n"; +} +catch (\Exception $e) +{ + echo 'Exception!<br><br>' . $e->getMessage(); +} + +$transport->close(); + +?> +
