You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by nd...@apache.org on 2015/11/19 22:27:52 UTC
[3/3] airavata-php-gateway git commit: storage resource updates in
progress.
storage resource updates in progress.
Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/cce42251
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/cce42251
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/cce42251
Branch: refs/heads/develop
Commit: cce4225183db0ada643e884119e0ed758ee295e5
Parents: e8ff6b1
Author: Nipurn Doshi <Nipurn Doshi>
Authored: Thu Nov 19 16:27:05 2015 -0500
Committer: Nipurn Doshi <Nipurn Doshi>
Committed: Thu Nov 19 16:27:05 2015 -0500
----------------------------------------------------------------------
app/controllers/DatastorageController.php | 251 -------
app/controllers/ResourceController.php | 2 +-
app/controllers/StorageresourceController.php | 238 ++++++
app/libraries/DSUtilities.php | 600 ---------------
app/libraries/SRUtilities.php | 564 ++++++++++++++
app/libraries/Wsis/Wsis.php | 2 -
app/routes.php | 22 +-
app/views/account/dashboard.blade.php | 6 +-
app/views/data-storage/browse.blade.php | 213 ------
app/views/data-storage/create.blade.php | 53 --
app/views/data-storage/edit.blade.php | 836 ---------------------
app/views/data-storage/view.blade.php | 379 ----------
app/views/partials/dashboard-block.blade.php | 6 +-
app/views/resource/browse.blade.php | 106 ++-
app/views/storage-resource/browse.blade.php | 165 ++++
app/views/storage-resource/create.blade.php | 43 ++
app/views/storage-resource/edit.blade.php | 809 ++++++++++++++++++++
app/views/storage-resource/view.blade.php | 379 ++++++++++
composer.bat | 1 +
public/js/script.js | 8 +
20 files changed, 2303 insertions(+), 2380 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/controllers/DatastorageController.php
----------------------------------------------------------------------
diff --git a/app/controllers/DatastorageController.php b/app/controllers/DatastorageController.php
deleted file mode 100644
index 80778d6..0000000
--- a/app/controllers/DatastorageController.php
+++ /dev/null
@@ -1,251 +0,0 @@
-<?php
-
-class DatastorageController extends BaseController
-{
-
- /**
- * Instantiate a new Compute Resource Controller Instance
- **/
-
- public function __construct()
- {
- $this->beforeFilter('verifyadmin');
- Session::put("nav-active", "data-storage");
-
- }
-
- public function createView()
- {
- $this->beforeFilter('verifyeditadmin');
- Session::put("admin-nav", "ds-create");
- return View::make("data-storage/create");
- }
-
- public function createSubmit()
- {
- $this->beforeFilter('verifyeditadmin');
- $hostAliases = Input::get("hostaliases");
- $ips = Input::get("ips");
- //Compute resource is by default enabled
- $computeDescription = array(
- "hostName" => trim(Input::get("hostname")),
- "hostAliases" => array_unique(array_filter($hostAliases)),
- "ipAddresses" => array_unique(array_filter($ips)),
- "resourceDescription" => Input::get("description"),
- "enabled" => true
- );
- $computeResource = DSUtilities::register_or_update_compute_resource($computeDescription);
-
- return Redirect::to("ds/edit?dsId=" . $computeResource->computeResourceId);
- }
-
- public function editView()
- {
- $this->beforeFilter('verifyeditadmin');
- $data = DSUtilities::getEditDSData();
- $computeResourceId = "";
- if (Input::has("dsId"))
- $computeResourceId = Input::get("dsId");
- else if (Session::has("dataStorage")) {
- $computeResource = Session::get("dataStorage");
- $computeResourceId = $computeResource->computeResourceId;
- }
-
- if ($computeResourceId != "") {
- $computeResource = DSUtilities::get_compute_resource($computeResourceId);
- $jobSubmissionInterfaces = array();
- $dataMovementInterfaces = array();
- $addedJSP = array();
- $addedDMI = array();
- //var_dump( $computeResource->jobSubmissionInterfaces); exit;
- if (count($computeResource->jobSubmissionInterfaces)) {
- foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
- $jobSubmissionInterfaces[] = DSUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, $JSI->jobSubmissionProtocol);
- $addedJSP[] = $JSI->jobSubmissionProtocol;
- }
- }
- //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit;
- if (count($computeResource->dataMovementInterfaces)) {
- foreach ($computeResource->dataMovementInterfaces as $DMI) {
- $dataMovementInterfaces[] = CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol);
- $addedDMI[] = $DMI->dataMovementProtocol;
- }
- }
-
- $data["computeResource"] = $computeResource;
- $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
- $data["dataMovementInterfaces"] = $dataMovementInterfaces;
- $data["addedJSP"] = $addedJSP;
- $data["addedDMI"] = $addedDMI;
- //var_dump($data["jobSubmissionInterfaces"]); exit;
- return View::make("resource/edit", $data);
- } else
- return View::make("resource/browse")->with("login-alert", "Unable to retrieve this Compute Resource. Please report this error to devs.");
-
- }
-
- public function editSubmit()
- {
- $this->beforeFilter('verifyeditadmin');
- $tabName = "";
- if (Input::get("cr-edit") == "resDesc") /* Modify compute Resource description */ {
- $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
- $computeDescription->hostName = trim(Input::get("hostname"));
- $computeDescription->hostAliases = array_unique(array_filter(Input::get("hostaliases")));
- $computeDescription->ipAddresses = array_unique(array_filter(Input::get("ips")));
- $computeDescription->resourceDescription = Input::get("description");
- $computeDescription->maxMemoryPerNode = Input::get("maxMemoryPerNode");
- //var_dump( $computeDescription); exit;
-
- $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
-
- $tabName = "#tab-desc";
- }
- if (Input::get("cr-edit") == "queue") /* Add / Modify a Queue */ {
- $queue = array("queueName" => Input::get("qname"),
- "queueDescription" => Input::get("qdesc"),
- "maxRunTime" => Input::get("qmaxruntime"),
- "maxNodes" => Input::get("qmaxnodes"),
- "maxProcessors" => Input::get("qmaxprocessors"),
- "maxJobsInQueue" => Input::get("qmaxjobsinqueue"),
- "maxMemory" => Input::get("qmaxmemoryinqueue")
- );
-
- $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
- $computeDescription->batchQueues[] = CRUtilities::createQueueObject($queue);
- $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
- //var_dump( $computeResource); exit;
- $tabName = "#tab-queues";
- } else if (Input::get("cr-edit") == "delete-queue") {
- CRUtilities::deleteQueue(Input::get("crId"), Input::get("queueName"));
- $tabName = "#tab-queues";
- } else if (Input::get("cr-edit") == "fileSystems") {
- $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
- $computeDescription->fileSystems = array_filter(Input::get("fileSystems"), "trim");
- $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
-
- $tabName = "#tab-filesystem";
- } else if (Input::get("cr-edit") == "jsp" || Input::get("cr-edit") == "edit-jsp") /* Add / Modify a Job Submission Interface */ {
- $update = false;
- if (Input::get("cr-edit") == "edit-jsp")
- $update = true;
-
- $jobSubmissionInterface = CRUtilities::create_or_update_JSIObject(Input::all(), $update);
-
- $tabName = "#tab-jobSubmission";
- } else if (Input::get("cr-edit") == "jsi-priority") {
- $inputs = Input::all();
- $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
- foreach ($computeDescription->jobSubmissionInterfaces as $index => $jsi) {
- foreach ($inputs["jsi-id"] as $idIndex => $jsiId) {
- if ($jsiId == $jsi->jobSubmissionInterfaceId) {
- $computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = $inputs["jsi-priority"][$idIndex];
- break;
- }
- }
- }
- $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
-
- return 1; //currently done by ajax.
- } else if (Input::get("cr-edit") == "dmp" || Input::get("cr-edit") == "edit-dmi") /* Add / Modify a Data Movement Interface */ {
- $update = false;
- if (Input::get("cr-edit") == "edit-dmi")
- $update = true;
- $dataMovementInterface = CRUtilities::create_or_update_DMIObject(Input::all(), $update);
-
- $tabName = "#tab-dataMovement";
- } else if (Input::get("cr-edit") == "dmi-priority") {
- $inputs = Input::all();
- $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
- foreach ($computeDescription->dataMovementInterfaces as $index => $dmi) {
- foreach ($inputs["dmi-id"] as $idIndex => $dmiId) {
- if ($dmiId == $dmi->dataMovementInterfaceId) {
- $computeDescription->dataMovementInterfaces[$index]->priorityOrder = $inputs["dmi-priority"][$idIndex];
- break;
- }
- }
- }
- $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
-
- return 1; //currently done by ajax.
- }
-
- return Redirect::to("cr/edit?crId=" . Input::get("crId") . $tabName);
- }
-
- public function viewView()
- {
- $data = CRUtilities::getEditCRData();
- $computeResourceId = "";
- if (Input::has("crId"))
- $computeResourceId = Input::get("crId");
- else if (Session::has("computeResource")) {
- $computeResource = Session::get("computeResource");
- $computeResourceId = $computeResource->computeResourceId;
- }
-
- if ($computeResourceId != "") {
- $computeResource = CRUtilities::get_compute_resource($computeResourceId);
- $jobSubmissionInterfaces = array();
- $dataMovementInterfaces = array();
- $addedJSP = array();
- $addedDMI = array();
- //var_dump( $computeResource->jobSubmissionInterfaces); exit;
- if (count($computeResource->jobSubmissionInterfaces)) {
- foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
- $jobSubmissionInterfaces[] = CRUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, $JSI->jobSubmissionProtocol);
- $addedJSP[] = $JSI->jobSubmissionProtocol;
- }
- }
- //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit;
- if (count($computeResource->dataMovementInterfaces)) {
- foreach ($computeResource->dataMovementInterfaces as $DMI) {
- $dataMovementInterfaces[] = CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol);
- $addedDMI[] = $DMI->dataMovementProtocol;
- }
- }
-
- $data["computeResource"] = $computeResource;
- $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
- $data["dataMovementInterfaces"] = $dataMovementInterfaces;
- $data["addedJSP"] = $addedJSP;
- $data["addedDMI"] = $addedDMI;
- //var_dump($data["jobSubmissionInterfaces"]); exit;
- return View::make("resource/view", $data);
- } else
- return View::make("resource/browse")->with("login-alert", "Unable to retrieve this Compute Resource. Please report this error to devs.");
-
- }
-
- public function deleteActions()
- {
- $this->beforeFilter('verifyeditadmin');
- $result = CRUtilities::deleteActions(Input::all());
- if (Input::has("jsiId")) {
- return Redirect::to("cr/edit?crId=" . Input::get("crId") . "#tab-jobSubmission")
- ->with("message", "Job Submission Interface was deleted successfully");
- }
- if (Input::has("dmiId")) {
- return Redirect::to("cr/edit?crId=" . Input::get("crId") . "#tab-dataMovement")
- ->with("message", "Data Movement Protocol was deleted successfully");
- } elseif (Input::has("del-crId")) {
- return Redirect::to("cr/browse")->with("message", "The Compute Resource has been successfully deleted.");
- } else
- return $result;
- }
-
- public function browseView()
- {
- $data = DSUtilities::getBrowseDSData(false);
- var_dump( $data); exit;
- $allDSRs = $data["dsObjects"];
-
- Session::put("admin-nav", "cr-browse");
- return View::make("resource/browse", array(
- "allDSRs" => $allDSRs
- ));
-
- }
-}
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/controllers/ResourceController.php
----------------------------------------------------------------------
diff --git a/app/controllers/ResourceController.php b/app/controllers/ResourceController.php
index 91530a2..4c658c0 100755
--- a/app/controllers/ResourceController.php
+++ b/app/controllers/ResourceController.php
@@ -9,6 +9,7 @@ class ResourceController extends BaseController
public function __construct()
{
+ print_r("test"); exit;
$this->beforeFilter('verifyadmin');
Session::put("nav-active", "compute-resource");
@@ -37,7 +38,6 @@ class ResourceController extends BaseController
public function editView()
{
-
$data = CRUtilities::getEditCRData();
$computeResourceId = "";
if (Input::has("crId"))
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/controllers/StorageresourceController.php
----------------------------------------------------------------------
diff --git a/app/controllers/StorageresourceController.php b/app/controllers/StorageresourceController.php
new file mode 100644
index 0000000..70ee281
--- /dev/null
+++ b/app/controllers/StorageresourceController.php
@@ -0,0 +1,238 @@
+<?php
+
+class StorageresourceController extends BaseController
+{
+
+ /**
+ * Instantiate a new Compute Resource Controller Instance
+ **/
+
+ public function __construct()
+ {
+ $this->beforeFilter('verifyadmin');
+ Session::put("nav-active", "storage-resource");
+
+ }
+
+ public function createView()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ Session::put("admin-nav", "sr-create");
+ $data = SRUtilities::getEditSRData();
+ return View::make("storage-resource/create", $data);
+ }
+
+ public function createSubmit()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ //Compute resource is by default enabled
+ $storageDescription = array(
+ "hostName" => trim(Input::get("hostname")),
+ "storageResourceDescription" => trim(Input::get("hostname")),
+ "enabled" => true
+ );
+ $storageResource = SRUtilities::register_or_update_storage_resource($storageDescription);
+
+ return Redirect::to("sr/edit?srId=" . $storageResource->storageResourceId);
+ }
+
+ public function editView()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $data = SRUtilities::getEditSRData();
+ $storageResourceId = "";
+ if (Input::has("srId"))
+ $storageResourceId = Input::get("srId");
+ else if (Session::has("storageResource")) {
+ $storageResource = Session::get("storageResource");
+ $storageResourceId = $storageResource->storageResourceId;
+ }
+ if ($storageResourceId != "") {
+ $storageResource = SRUtilities::get_storage_resource($storageResourceId);
+ $dataMovementInterfaces = array();
+ $addedDMI = array();
+ //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit;
+ if (count($storageResource->dataMovementInterfaces)) {
+ foreach ($storageResource->dataMovementInterfaces as $DMI) {
+ $dataMovementInterfaces[] = SRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol);
+ $addedDMI[] = $DMI->dataMovementProtocol;
+ }
+ }
+
+ $data["storageResource"] = $storageResource;
+ $data["dataMovementInterfaces"] = $dataMovementInterfaces;
+ $data["addedDMI"] = $addedDMI;
+ return View::make("resource/edit", $data);
+ } else{
+ Session::put("message", "Unable to retrieve this Storage Resource. Please try again later or submit a bug report using the link in the Help menu.");
+ return View::make("storage-resource/browse");
+ }
+
+ }
+
+ public function editSubmit()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $tabName = "";
+ if (Input::get("sr-edit") == "resDesc") /* Modify compute Resource description */ {
+ $storageResourceDescription = SRUtilities::get_storage_resource(Input::get("srId"));
+ $storageResourceDescription->hostName = trim(Input::get("hostname"));
+ $storageResourceDescription->resourceDescription = Input::get("description");
+ //var_dump( $computeDescription); exit;
+
+ $storageResource = SRUtilities::register_or_update_compute_resource($storageResourceDescription, true);
+
+ $tabName = "#tab-desc";
+ }
+ /*
+ if (Input::get("sr-edit") == "queue"){
+ $queue = array("queueName" => Input::get("qname"),
+ "queueDescription" => Input::get("qdesc"),
+ "maxRunTime" => Input::get("qmaxruntime"),
+ "maxNodes" => Input::get("qmaxnodes"),
+ "maxProcessors" => Input::get("qmaxprocessors"),
+ "maxJobsInQueue" => Input::get("qmaxjobsinqueue"),
+ "maxMemory" => Input::get("qmaxmemoryinqueue")
+ );
+
+ $storageResourceDescription = SRUtilities::get_storage_resource(Input::get("crId"));
+ $storageResourceDescription->batchQueues[] = CRUtilities::createQueueObject($queue);
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+ //var_dump( $computeResource); exit;
+ $tabName = "#tab-queues";
+ } else if (Input::get("cr-edit") == "delete-queue") {
+ CRUtilities::deleteQueue(Input::get("crId"), Input::get("queueName"));
+ $tabName = "#tab-queues";
+ } else if (Input::get("cr-edit") == "fileSystems") {
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ $computeDescription->fileSystems = array_filter(Input::get("fileSystems"), "trim");
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+ $tabName = "#tab-filesystem";
+ } else if (Input::get("cr-edit") == "jsp" || Input::get("cr-edit") == "edit-jsp") {
+ $update = false;
+ if (Input::get("cr-edit") == "edit-jsp")
+ $update = true;
+
+ $jobSubmissionInterface = CRUtilities::create_or_update_JSIObject(Input::all(), $update);
+
+ $tabName = "#tab-jobSubmission";
+ } else if (Input::get("cr-edit") == "jsi-priority") {
+ $inputs = Input::all();
+ $computeDescription = CRUtilities::get_compute_resource(Input::get("crId"));
+ foreach ($computeDescription->jobSubmissionInterfaces as $index => $jsi) {
+ foreach ($inputs["jsi-id"] as $idIndex => $jsiId) {
+ if ($jsiId == $jsi->jobSubmissionInterfaceId) {
+ $computeDescription->jobSubmissionInterfaces[$index]->priorityOrder = $inputs["jsi-priority"][$idIndex];
+ break;
+ }
+ }
+ }
+ $computeResource = CRUtilities::register_or_update_compute_resource($computeDescription, true);
+
+ return 1; //currently done by ajax.
+ } else
+ */
+ if (Input::get("cr-edit") == "dmp" || Input::get("cr-edit") == "edit-dmi") /* Add / Modify a Data Movement Interface */ {
+ $update = false;
+ if (Input::get("cr-edit") == "edit-dmi")
+ $update = true;
+ $dataMovementInterface = SRUtilities::create_or_update_DMIObject(Input::all(), $update);
+
+ $tabName = "#tab-dataMovement";
+ } else if (Input::get("cr-edit") == "dmi-priority") {
+ $inputs = Input::all();
+ $storageDescription = CRUtilities::get_storage_resource(Input::get("srId"));
+ foreach ($storageDescription->dataMovementInterfaces as $index => $dmi) {
+ foreach ($inputs["dmi-id"] as $idIndex => $dmiId) {
+ if ($dmiId == $dmi->dataMovementInterfaceId) {
+ $storageDescription->dataMovementInterfaces[$index]->priorityOrder = $inputs["dmi-priority"][$idIndex];
+ break;
+ }
+ }
+ }
+ $storageResource = CRUtilities::register_or_update_storage_resource($storageDescription, true);
+
+ return 1; //currently done by ajax.
+ }
+
+ return Redirect::to("se/edit?srId=" . Input::get("srId") . $tabName);
+ }
+
+ public function viewView()
+ {
+ $data = CRUtilities::getEditCRData();
+ $computeResourceId = "";
+ if (Input::has("crId"))
+ $computeResourceId = Input::get("crId");
+ else if (Session::has("computeResource")) {
+ $computeResource = Session::get("computeResource");
+ $computeResourceId = $computeResource->computeResourceId;
+ }
+
+ if ($computeResourceId != "") {
+ $computeResource = CRUtilities::get_compute_resource($computeResourceId);
+ $jobSubmissionInterfaces = array();
+ $dataMovementInterfaces = array();
+ $addedJSP = array();
+ $addedDMI = array();
+ //var_dump( $computeResource->jobSubmissionInterfaces); exit;
+ if (count($computeResource->jobSubmissionInterfaces)) {
+ foreach ($computeResource->jobSubmissionInterfaces as $JSI) {
+ $jobSubmissionInterfaces[] = CRUtilities::getJobSubmissionDetails($JSI->jobSubmissionInterfaceId, $JSI->jobSubmissionProtocol);
+ $addedJSP[] = $JSI->jobSubmissionProtocol;
+ }
+ }
+ //var_dump( CRUtilities::getJobSubmissionDetails( $data["computeResource"]->jobSubmissionInterfaces[0]->jobSubmissionInterfaceId, 1) ); exit;
+ if (count($computeResource->dataMovementInterfaces)) {
+ foreach ($computeResource->dataMovementInterfaces as $DMI) {
+ $dataMovementInterfaces[] = CRUtilities::getDataMovementDetails($DMI->dataMovementInterfaceId, $DMI->dataMovementProtocol);
+ $addedDMI[] = $DMI->dataMovementProtocol;
+ }
+ }
+
+ $data["computeResource"] = $computeResource;
+ $data["jobSubmissionInterfaces"] = $jobSubmissionInterfaces;
+ $data["dataMovementInterfaces"] = $dataMovementInterfaces;
+ $data["addedJSP"] = $addedJSP;
+ $data["addedDMI"] = $addedDMI;
+ //var_dump($data["jobSubmissionInterfaces"]); exit;
+ return View::make("resource/view", $data);
+ } else
+ return View::make("resource/browse")->with("login-alert", "Unable to retrieve this Compute Resource. Please report this error to devs.");
+
+ }
+
+ public function deleteActions()
+ {
+ $this->beforeFilter('verifyeditadmin');
+ $result = SRUtilities::deleteActions(Input::all());
+ /*
+ if (Input::has("jsiId")) {
+ return Redirect::to("cr/edit?crId=" . Input::get("crId") . "#tab-jobSubmission")
+ ->with("message", "Job Submission Interface was deleted successfully");
+ }
+ */
+ if (Input::has("dmiId")) {
+ return Redirect::to("sr/edit?crId=" . Input::get("crId") . "#tab-dataMovement")
+ ->with("message", "Data Movement Protocol was deleted successfully");
+ } elseif (Input::has("del-srId")) {
+ return Redirect::to("sr/browse")->with("message", "The Compute Resource has been successfully deleted.");
+ } else
+ return $result;
+ }
+
+ public function browseView()
+ {
+ $data = SRUtilities::getBrowseSRData(false);
+ $allSRs = $data["srObjects"];
+
+ Session::put("admin-nav", "cr-browse");
+ return View::make("storage-resource/browse", array(
+ "allSRs" => $allSRs
+ ));
+
+ }
+}
+
+?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/libraries/DSUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/DSUtilities.php b/app/libraries/DSUtilities.php
deleted file mode 100644
index aff29a1..0000000
--- a/app/libraries/DSUtilities.php
+++ /dev/null
@@ -1,600 +0,0 @@
-<?php
-
-
-//Airavata classes - loaded from app/libraries/Airavata
-//Compute Resource classes
-use Airavata\Model\AppCatalog\ComputeResource\BatchQueue;
-use Airavata\Model\AppCatalog\ComputeResource\ComputeResourceDescription;
-use Airavata\Model\AppCatalog\ComputeResource\DataMovementProtocol;
-use Airavata\Model\AppCatalog\ComputeResource\FileSystems;
-use Airavata\Model\AppCatalog\ComputeResource\GridFTPDataMovement;
-use Airavata\Model\AppCatalog\ComputeResource\JobManagerCommand;
-use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
-use Airavata\Model\AppCatalog\ComputeResource\LOCALDataMovement;
-use Airavata\Model\AppCatalog\ComputeResource\LOCALSubmission;
-use Airavata\Model\AppCatalog\ComputeResource\MonitorMode;
-use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManager;
-use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManagerType;
-use Airavata\Model\AppCatalog\ComputeResource\SCPDataMovement;
-use Airavata\Model\AppCatalog\ComputeResource\SecurityProtocol;
-use Airavata\Model\AppCatalog\ComputeResource\SSHJobSubmission;
-use Airavata\Model\AppCatalog\ComputeResource\UnicoreDataMovement;
-use Airavata\Model\AppCatalog\ComputeResource\UnicoreJobSubmission;
-use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
-use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
-
-//Gateway Classes
-
-
-class DSUtilities
-{
- /**
- * Basic utility functions
- */
-
-//define('ROOT_DIR', __DIR__);
-
- /**
- * Define configuration constants
- */
- public static function register_or_update_compute_resource($computeDescription, $update = false)
- {
- if ($update) {
- $computeResourceId = $computeDescription->computeResourceId;
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $computeResourceId)) {
- Cache::forget('CR-' . $computeResourceId);
- }
- }
-
- if (Airavata::updateComputeResource(Session::get('authz-token'), $computeResourceId, $computeDescription)) {
- $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
- return $computeResource;
- } else
- print_r("Something went wrong while updating!");
- exit;
- } else {
- /*
- $fileSystems = new FileSystems();
- foreach( $fileSystems as $fileSystem)
- $computeDescription["fileSystems"][$fileSystem] = "";
- */
- $cd = new ComputeResourceDescription($computeDescription);
- $computeResourceId = Airavata::registerComputeResource(Session::get('authz-token'), $cd);
- }
-
- $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
- return $computeResource;
-
- }
-
- /*
- * Getting data for Compute resource inputs
- */
-
- public static function getEditCRData()
- {
- $files = new FileSystems();
- $jsp = new JobSubmissionProtocol();
- $rjmt = new ResourceJobManagerType();
- $sp = new SecurityProtocol();
- $dmp = new DataMovementProtocol();
- $jmc = new JobManagerCommand();
- $mm = new MonitorMode();
- return array(
- "fileSystemsObject" => $files,
- "fileSystems" => $files::$__names,
- "jobSubmissionProtocolsObject" => $jsp,
- "jobSubmissionProtocols" => $jsp::$__names,
- "resourceJobManagerTypesObject" => $rjmt,
- "resourceJobManagerTypes" => $rjmt::$__names,
- "securityProtocolsObject" => $sp,
- "securityProtocols" => $sp::$__names,
- "dataMovementProtocolsObject" => $dmp,
- "dataMovementProtocols" => $dmp::$__names,
- "jobManagerCommands" => $jmc::$__names,
- "monitorModes" => $mm::$__names
- );
- }
-
-
- public static function createQueueObject($queue)
- {
- $queueObject = new BatchQueue($queue);
- return $queueObject;
- }
-
- public static function deleteQueue($computeResourceId, $queueName)
- {
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $computeResourceId)) {
- Cache::forget('CR-' . $computeResourceId);
- }
- }
- Airavata::deleteBatchQueue(Session::get('authz-token'), $computeResourceId, $queueName);
- }
-
-
- /*
- * Creating Job Submission Interface.
- */
-
- public static function create_or_update_JSIObject($inputs, $update = false)
- {
-
- $computeResource = CRUtilities::get_compute_resource($inputs["crId"]);
-
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $inputs["crId"])) {
- Cache::forget('CR-' . $inputs["crId"]);
- }
- }
-
- $jsiId = null;
- if (isset($inputs["jsiId"]))
- $jsiId = $inputs["jsiId"];
-
- if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::LOCAL) {
-
- //print_r( $jsiObject->resourceJobManager->resourceJobManagerId);
- $resourceManager = new ResourceJobManager(array(
- "resourceJobManagerType" => $inputs["resourceJobManagerType"],
- "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
- "jobManagerBinPath" => $inputs["jobManagerBinPath"],
- "jobManagerCommands" => $inputs["jobManagerCommands"]
- ));
-
- //$rmId = $jsiObject->resourceJobManager->resourceJobManagerId;
- //$rm = $airavataclient->updateResourceJobManager($rmId, $resourceManager);
- //print_r( $rm); exit;
- $localJobSubmission = new LOCALSubmission(array(
- "resourceJobManager" => $resourceManager
- )
- );
-
- if ($update) //update Local JSP
- {
- $jsiObject = Airavata::getLocalJobSubmission(Session::get('authz-token'), $jsiId);
- $localSub = Airavata::updateResourceJobManager(Session::get('authz-token'), $jsiObject->resourceJobManager->resourceJobManagerId, $resourceManager);
- //$localSub = $airavataclient->updateLocalSubmissionDetails( $jsiId, $localJobSubmission);
- } else // create Local JSP
- {
- $localSub = Airavata::addLocalSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localJobSubmission);
- return $localSub;
- }
-
- } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::SSH) {
- $resourceManager = new ResourceJobManager(array(
- "resourceJobManagerType" => $inputs["resourceJobManagerType"],
- "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
- "jobManagerBinPath" => $inputs["jobManagerBinPath"],
- "jobManagerCommands" => $inputs["jobManagerCommands"]
- ));
- $sshJobSubmission = new SSHJobSubmission(array
- (
- "securityProtocol" => intval($inputs["securityProtocol"]),
- "resourceJobManager" => $resourceManager,
- "alternativeSSHHostName" => $inputs["alternativeSSHHostName"],
- "sshPort" => intval($inputs["sshPort"]),
- "monitorMode" => MonitorMode::JOB_EMAIL_NOTIFICATION_MONITOR
- )
- );
- //var_dump( $sshJobSubmission); exit;
- if ($update) //update Local JSP
- {
- $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
-
- //first update resource job manager
- $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
- Airavata::updateResourceJobManager(Session::get('authz-token'), $rmjId, $resourceManager);
- $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
-
- $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
- $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
- $jsiObject->sshPort = intval($inputs["sshPort"]);
- $jsiObject->monitorMode = intval($inputs["monitorMode"]);
- $jsiObject->resourceJobManager = Airavata::getresourceJobManager(Session::get('authz-token'), $rmjId);
- //var_dump( $jsiObject); exit;
- //add updated resource job manager to ssh job submission object.
- //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
- $localSub = Airavata::updateSSHJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
- } else {
- $sshSub = Airavata::addSSHJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $sshJobSubmission);
- }
- return;
- } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::SSH_FORK) {
- $resourceManager = new ResourceJobManager(array(
- "resourceJobManagerType" => $inputs["resourceJobManagerType"],
- "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
- "jobManagerBinPath" => $inputs["jobManagerBinPath"],
- "jobManagerCommands" => $inputs["jobManagerCommands"]
- ));
- $sshJobSubmission = new SSHJobSubmission(array
- (
- "securityProtocol" => intval($inputs["securityProtocol"]),
- "resourceJobManager" => $resourceManager,
- "alternativeSSHHostName" => $inputs["alternativeSSHHostName"],
- "sshPort" => intval($inputs["sshPort"]),
- "monitorMode" => MonitorMode::FORK
- )
- );
- //var_dump( $sshJobSubmission); exit;
- if ($update) //update Local JSP
- {
- $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
-
- //first update resource job manager
- $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
- Airavata::updateResourceJobManager(Session::get('authz-token'), $rmjId, $resourceManager);
- $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
-
- $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
- $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
- $jsiObject->sshPort = intval($inputs["sshPort"]);
- $jsiObject->monitorMode = intval($inputs["monitorMode"]);
- $jsiObject->resourceJobManager = Airavata::getresourceJobManager(Session::get('authz-token'), $rmjId);
- //var_dump( $jsiObject); exit;
- //add updated resource job manager to ssh job submission object.
- //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
- $localSub = Airavata::updateSSHJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
- } else {
- $sshSub = Airavata::addSSHForkJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $sshJobSubmission);
- }
- return;
- } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::UNICORE) {
- $unicoreJobSubmission = new UnicoreJobSubmission(array
- (
- "securityProtocol" => intval($inputs["securityProtocol"]),
- "unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
- )
- );
- if ($update) {
- $jsiObject = Airavata::getUnicoreJobSubmission(Session::get('authz-token'), $jsiId);
- $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
- $jsiObject->unicoreEndPointURL = $inputs["unicoreEndPointURL"];
-
- $unicoreSub = Airavata::updateUnicoreJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
- } else {
- $unicoreSub = Airavata::addUNICOREJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreJobSubmission);
- }
- } else /* Globus does not work currently */ {
- print_r("Whoops! We haven't coded for this Job Submission Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
- }
- }
-
- /*
- * Creating Data Movement Interface Object.
- */
- public static function create_or_update_DMIObject($inputs, $update = false)
- {
-
- $computeResource = CRUtilities::get_compute_resource($inputs["crId"]);
-
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $inputs["crId"])) {
- Cache::forget('CR-' . $inputs["crId"]);
- }
- }
-
- if ($inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) /* LOCAL */ {
- $localDataMovement = new LOCALDataMovement();
- $localdmp = Airavata::addLocalDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localDataMovement);
-
- if ($localdmp)
- print_r("The Local Data Movement has been added. Edit UI for the Local Data Movement Interface is yet to be made.
- Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
- } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::SCP) /* SCP */ {
- //var_dump( $inputs); exit;
- $scpDataMovement = new SCPDataMovement(array(
- "securityProtocol" => intval($inputs["securityProtocol"]),
- "alternativeSCPHostName" => $inputs["alternativeSSHHostName"],
- "sshPort" => intval($inputs["sshPort"])
- )
-
- );
-
- if ($update)
- $scpdmp = Airavata::updateSCPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $scpDataMovement);
- else
- $scpdmp = Airavata::addSCPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $scpDataMovement);
- } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) /* GridFTP */ {
- $gridFTPDataMovement = new GridFTPDataMovement(array(
- "securityProtocol" => $inputs["securityProtocol"],
- "gridFTPEndPoints" => $inputs["gridFTPEndPoints"]
- ));
- if ($update)
- $gridftpdmp = Airavata::updateGridFTPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $gridFTPDataMovement);
- else
- $gridftpdmp = Airavata::addGridFTPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $gridFTPDataMovement);
- } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::UNICORE_STORAGE_SERVICE) /* Unicore Storage Service */ {
- $unicoreDataMovement = new UnicoreDataMovement(array
- (
- "securityProtocol" => intval($inputs["securityProtocol"]),
- "unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
- )
- );
- if ($update)
- $unicoredmp = Airavata::updateUnicoreDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $unicoreDataMovement);
- else
- $unicoredmp = Airavata::addUnicoreDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreDataMovement);
- } else /* other data movement protocols */ {
- print_r("Whoops! We haven't coded for this Data Movement Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
- }
- }
-
- public static function getAllDSObjects($onlyName = false)
- {
- $dsNames = Airavata::getAllStorageResourceNames(Session::get('authz-token'));
- if ($onlyName)
- return $dsNames;
- else {
- $dsObjects = array();
- foreach ($dsNames as $id => $dsName) {
- array_push($dsObjects, Airavata::getStorageResource(Session::get('authz-token'), $id));
- }
- return $dsObjects;
- }
-
- }
-
- public static function getBrowseDSData($onlyNames)
- { /*
- $appDeployments = Airavata::getAllApplicationDeployments(Session::get('authz-token'),
- Session::get("gateway_id"));
- */
- return array('crObjects' => DSUtilities::getAllDSObjects($onlyNames));
- }
-
- public static function getJobSubmissionDetails($jobSubmissionInterfaceId, $jsp)
- {
- //jsp = job submission protocol type
- if ($jsp == JobSubmissionProtocol::LOCAL)
- return Airavata::getLocalJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
- else if ($jsp == JobSubmissionProtocol::SSH || $jsp == JobSubmissionProtocol::SSH_FORK)
- return Airavata::getSSHJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
- else if ($jsp == JobSubmissionProtocol::UNICORE)
- return Airavata::getUnicoreJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
- else if ($jsp == JobSubmissionProtocol::CLOUD)
- return Airavata::getCloudJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
-
- //globus get function not present ??
- }
-
- public static function getDataMovementDetails($dataMovementInterfaceId, $dmi)
- {
- //jsp = job submission protocol type
- if ($dmi == DataMovementProtocol::LOCAL)
- return Airavata::getLocalDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
- else if ($dmi == DataMovementProtocol::SCP)
- return Airavata::getSCPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
- else if ($dmi == DataMovementProtocol::GridFTP)
- return Airavata::getGridFTPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
- else if ($dmi == DataMovementProtocol::UNICORE_STORAGE_SERVICE)
- return Airavata::getUnicoreDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
- /*
- else if( $dmi == JobSubmissionProtocol::CLOUD)
- return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
- */
-
- //globus get function not present ??
- }
-
- public static function deleteActions($inputs)
- {
- if (isset($inputs["crId"])) {
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $inputs["crId"])) {
- Cache::forget('CR-' . $inputs["crId"]);
- }
- }
- } elseif (isset($inputs["del-crId"])) {
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $inputs["del-crId"])) {
- Cache::forget('CR-' . $inputs["del-crId"]);
- }
- }
- }
-
- if (isset($inputs["jsiId"]))
- if (Airavata::deleteJobSubmissionInterface(Session::get('authz-token'), $inputs["crId"], $inputs["jsiId"]))
- return 1;
- else
- return 0;
- else if (isset($inputs["dmiId"]))
- if (Airavata::deleteDataMovementInterface(Session::get('authz-token'), $inputs["crId"], $inputs["dmiId"]))
- return 1;
- else
- return 0;
- elseif (isset($inputs["del-crId"]))
- if (Airavata::deleteComputeResource(Session::get('authz-token'), $inputs["del-crId"]))
- return 1;
- else
- return 0;
- }
-
- public static function create_or_update_gateway_profile($inputs, $update = false)
- {
-
- $computeResourcePreferences = array();
- if (isset($input["crPreferences"]))
- $computeResourcePreferences = $input["crPreferences"];
-
- $gatewayProfile = new GatewayResourceProfile(array(
- "gatewayName" => $inputs["gatewayName"],
- "gatewayDescription" => $inputs["gatewayDescription"],
- "computeResourcePreferences" => $computeResourcePreferences
- )
- );
-
- if ($update) {
- $gatewayProfile = new GatewayResourceProfile(array(
- "gatewayName" => $inputs["gatewayName"],
- "gatewayDescription" => $inputs["gatewayDescription"]
- )
- );
- $gatewayProfileId = Airavata::updateGatewayResourceProfile(Session::get('authz-token'), $inputs["edit-gpId"], $gatewayProfile);
- } else
- $gatewayProfileId = Airavata::registerGatewayResourceProfile(Session::get('authz-token'), $gatewayProfile);
- }
-
- public static function getAllGatewayProfilesData()
- {
-
- if (Session::has("scigap_admin"))
- $gateways = Airavata::getAllGateways(Session::get('authz-token'));
- else {
- $gateways[0] = Airavata::getGateway(Session::get('authz-token'), Session::get("gateway_id"));
- }
-
- $gatewayProfiles = Airavata::getAllGatewayResourceProfiles(Session::get('authz-token'));
- //var_dump( $gatewayProfiles); exit;
- //$gatewayProfileIds = array("GatewayTest3_57726e98-313f-4e7c-87a5-18e69928afb5", "GatewayTest4_4fd9fb28-4ced-4149-bdbd-1f276077dad8");
- foreach ($gateways as $key => $gw) {
- $gateways[$key]->profile = array();
- foreach ((array)$gatewayProfiles as $index => $gp) {
-
- if ($gw->gatewayId == $gp->gatewayID) {
- foreach ((array)$gp->computeResourcePreferences as $i => $crp) {
- $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = Airavata::getComputeResource(Session::get('authz-token'), $crp->computeResourceId);
- }
- $gateways[$key]->profile = $gatewayProfiles[$index];
- }
- }
- }
- //var_dump( $gatewayProfiles[0]->computeResourcePreferences[0]->crDetails); exit;
-
- return $gateways;
- }
-
- public static function updateGatewayProfile( $data){
- $gatewayResourceProfile = Airavata::getGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"]);
- $gatewayResourceProfile->credentialStoreToken = $data["cst"];
- return Airavata::updateGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"], $gatewayResourceProfile);
- }
-
- public static function add_or_update_CRP($inputs)
- {
- $computeResourcePreferences = new computeResourcePreference($inputs);
-
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $inputs["computeResourceId"])) {
- Cache::forget('CR-' . $inputs["computeResourceId"]);
- }
- }
-
- //var_dump( $inputs); exit;
- return Airavata::addGatewayComputeResourcePreference(Session::get('authz-token'), $inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
-
- }
-
- public static function deleteGP($gpId)
- {
- return Airavata::deleteGatewayResourceProfile(Session::get('authz-token'), $gpId);
- }
-
- public static function deleteCR($inputs)
- {
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- $id = $inputs["rem-crId"];
- if (Cache::has('CR-' . $id)) {
- Cache::forget('CR-' . $id);
- }
- }
-
- return Airavata::deleteGatewayComputeResourcePreference(Session::get('authz-token'), $inputs["gpId"], $inputs["rem-crId"]);
- }
-
- /**
- * Get the ComputeResourceDescription with the given ID
- * @param $id
- * @return null
- */
- public static function get_compute_resource($id)
- {
- $computeResource = null;
-
- try {
- if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
- if (Cache::has('CR-' . $id)) {
- return Cache::get('CR-' . $id);
- } else {
- $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $id);
- Cache::put('CR-' . $id, $computeResource, Config::get('pga_config.airavata')['app-catalog-cache-duration']);
- return $computeResource;
- }
- } else {
- return $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $id);
- }
-
- } catch (InvalidRequestException $ire) {
- CommonUtilities::print_error_message('<p>There was a problem getting the compute resource.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- } catch (AiravataClientException $ace) {
- CommonUtilities::print_error_message('<p>There was a problem getting the compute resource.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- } catch (AiravataSystemException $ase) {
- CommonUtilities::print_error_message('<p>There was a problem getting the compute resource.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
- }
-
-
- /**
- * Create a select input and populate it with compute resources
- * available for the given application ID
- * @param $applicationId
- * @param $resourceHostId
- */
- public static function create_compute_resources_select($applicationId, $resourceHostId)
- {
- return CRUtilities::get_available_app_interface_compute_resources($applicationId);
- }
-
- /**
- * Get a list of compute resources available for the given application ID
- * @param $id
- * @return null
- */
- public static function get_available_app_interface_compute_resources($id)
- {
- $computeResources = null;
-
- try {
- $computeResources = Airavata::getAvailableAppInterfaceComputeResources(Session::get('authz-token'), $id);
- } catch (InvalidRequestException $ire) {
- CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
- } catch (AiravataClientException $ace) {
- CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
- } catch (AiravataSystemException $ase) {
- CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
- Please try again later or submit a bug report using the link in the Help menu.</p>' .
- '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
- }
-
- return $computeResources;
- }
-
- /**
- * Get a list of all Data Storages available
- * @param null
- * @return
- **/
-
- public static function getAllDataStoragePreferences( $gateways){
- $dspArray = array();
- foreach( $gateways as $gateway){
- $dspArray[] = Airavata::getAllGatewayDataStoragePreferences( Session::get('authz-token'), $gateway->gatewayId);
- }
- return $dspArray;
- }
-
-}
-
-?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/libraries/SRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/SRUtilities.php b/app/libraries/SRUtilities.php
new file mode 100644
index 0000000..491eccf
--- /dev/null
+++ b/app/libraries/SRUtilities.php
@@ -0,0 +1,564 @@
+<?php
+
+
+//Airavata classes - loaded from app/libraries/Airavata
+//Compute Resource classes
+use Airavata\Model\AppCatalog\ComputeResource\DataMovementProtocol;
+use Airavata\Model\AppCatalog\StorageResource\StorageResourceDescription;
+use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
+use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
+
+//Gateway Classes
+
+
+class SRUtilities
+{
+ /**
+ * Basic utility functions
+ */
+
+//define('ROOT_DIR', __DIR__);
+
+ /**
+ * Define configuration constants
+ */
+ public static function register_or_update_storage_resource($storageResourceDesc, $update = false)
+ {
+ if ($update) {
+ $storageResourceId = $storageDescription->storageResourceId;
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $computeResourceId)) {
+ Cache::forget('CR-' . $computeResourceId);
+ }
+ }
+
+ if (Airavata::updateComputeResource(Session::get('authz-token'), $computeResourceId, $computeDescription)) {
+ $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $computeResourceId);
+ return $computeResource;
+ } else
+ print_r("Something went wrong while updating!");
+ exit;
+ } else {
+ $sr = new StorageResourceDescription( $storageResourceDesc);
+ $storageResourceId = Airavata::registerStorageResource(Session::get('authz-token'), $sr);
+ }
+ $storageResource = Airavata::getStorageResource(Session::get('authz-token'), $storageResourceId);
+ return $storageResource;
+
+ }
+
+ /*
+ * Getting data for Compute resource inputs
+ */
+
+ public static function getEditSRData()
+ {
+ $dmp = new DataMovementProtocol();
+ return array(
+ "dataMovementProtocolsObject" => $dmp,
+ "dataMovementProtocols" => $dmp::$__names
+ );
+ }
+
+
+ /*
+ public static function createQueueObject($queue)
+ {
+ $queueObject = new BatchQueue($queue);
+ return $queueObject;
+ }
+
+ public static function deleteQueue($computeResourceId, $queueName)
+ {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $computeResourceId)) {
+ Cache::forget('CR-' . $computeResourceId);
+ }
+ }
+ Airavata::deleteBatchQueue(Session::get('authz-token'), $computeResourceId, $queueName);
+ }
+
+ public static function create_or_update_JSIObject($inputs, $update = false)
+ {
+
+ $computeResource = CRUtilities::get_compute_resource($inputs["crId"]);
+
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["crId"])) {
+ Cache::forget('CR-' . $inputs["crId"]);
+ }
+ }
+
+ $jsiId = null;
+ if (isset($inputs["jsiId"]))
+ $jsiId = $inputs["jsiId"];
+
+ if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::LOCAL) {
+
+ //print_r( $jsiObject->resourceJobManager->resourceJobManagerId);
+ $resourceManager = new ResourceJobManager(array(
+ "resourceJobManagerType" => $inputs["resourceJobManagerType"],
+ "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
+ "jobManagerBinPath" => $inputs["jobManagerBinPath"],
+ "jobManagerCommands" => $inputs["jobManagerCommands"]
+ ));
+
+ //$rmId = $jsiObject->resourceJobManager->resourceJobManagerId;
+ //$rm = $airavataclient->updateResourceJobManager($rmId, $resourceManager);
+ //print_r( $rm); exit;
+ $localJobSubmission = new LOCALSubmission(array(
+ "resourceJobManager" => $resourceManager
+ )
+ );
+
+ if ($update) //update Local JSP
+ {
+ $jsiObject = Airavata::getLocalJobSubmission(Session::get('authz-token'), $jsiId);
+ $localSub = Airavata::updateResourceJobManager(Session::get('authz-token'), $jsiObject->resourceJobManager->resourceJobManagerId, $resourceManager);
+ //$localSub = $airavataclient->updateLocalSubmissionDetails( $jsiId, $localJobSubmission);
+ } else // create Local JSP
+ {
+ $localSub = Airavata::addLocalSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localJobSubmission);
+ return $localSub;
+ }
+
+ } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::SSH) {
+ $resourceManager = new ResourceJobManager(array(
+ "resourceJobManagerType" => $inputs["resourceJobManagerType"],
+ "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
+ "jobManagerBinPath" => $inputs["jobManagerBinPath"],
+ "jobManagerCommands" => $inputs["jobManagerCommands"]
+ ));
+ $sshJobSubmission = new SSHJobSubmission(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "resourceJobManager" => $resourceManager,
+ "alternativeSSHHostName" => $inputs["alternativeSSHHostName"],
+ "sshPort" => intval($inputs["sshPort"]),
+ "monitorMode" => MonitorMode::JOB_EMAIL_NOTIFICATION_MONITOR
+ )
+ );
+ //var_dump( $sshJobSubmission); exit;
+ if ($update) //update Local JSP
+ {
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ //first update resource job manager
+ $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
+ Airavata::updateResourceJobManager(Session::get('authz-token'), $rmjId, $resourceManager);
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+ $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
+ $jsiObject->sshPort = intval($inputs["sshPort"]);
+ $jsiObject->monitorMode = intval($inputs["monitorMode"]);
+ $jsiObject->resourceJobManager = Airavata::getresourceJobManager(Session::get('authz-token'), $rmjId);
+ //var_dump( $jsiObject); exit;
+ //add updated resource job manager to ssh job submission object.
+ //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
+ $localSub = Airavata::updateSSHJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+ } else {
+ $sshSub = Airavata::addSSHJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $sshJobSubmission);
+ }
+ return;
+ } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::SSH_FORK) {
+ $resourceManager = new ResourceJobManager(array(
+ "resourceJobManagerType" => $inputs["resourceJobManagerType"],
+ "pushMonitoringEndpoint" => $inputs["pushMonitoringEndpoint"],
+ "jobManagerBinPath" => $inputs["jobManagerBinPath"],
+ "jobManagerCommands" => $inputs["jobManagerCommands"]
+ ));
+ $sshJobSubmission = new SSHJobSubmission(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "resourceJobManager" => $resourceManager,
+ "alternativeSSHHostName" => $inputs["alternativeSSHHostName"],
+ "sshPort" => intval($inputs["sshPort"]),
+ "monitorMode" => MonitorMode::FORK
+ )
+ );
+ //var_dump( $sshJobSubmission); exit;
+ if ($update) //update Local JSP
+ {
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ //first update resource job manager
+ $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
+ Airavata::updateResourceJobManager(Session::get('authz-token'), $rmjId, $resourceManager);
+ $jsiObject = Airavata::getSSHJobSubmission(Session::get('authz-token'), $jsiId);
+
+ $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+ $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
+ $jsiObject->sshPort = intval($inputs["sshPort"]);
+ $jsiObject->monitorMode = intval($inputs["monitorMode"]);
+ $jsiObject->resourceJobManager = Airavata::getresourceJobManager(Session::get('authz-token'), $rmjId);
+ //var_dump( $jsiObject); exit;
+ //add updated resource job manager to ssh job submission object.
+ //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
+ $localSub = Airavata::updateSSHJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+ } else {
+ $sshSub = Airavata::addSSHForkJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $sshJobSubmission);
+ }
+ return;
+ } else if ($inputs["jobSubmissionProtocol"] == JobSubmissionProtocol::UNICORE) {
+ $unicoreJobSubmission = new UnicoreJobSubmission(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
+ )
+ );
+ if ($update) {
+ $jsiObject = Airavata::getUnicoreJobSubmission(Session::get('authz-token'), $jsiId);
+ $jsiObject->securityProtocol = intval($inputs["securityProtocol"]);
+ $jsiObject->unicoreEndPointURL = $inputs["unicoreEndPointURL"];
+
+ $unicoreSub = Airavata::updateUnicoreJobSubmissionDetails(Session::get('authz-token'), $jsiId, $jsiObject);
+ } else {
+ $unicoreSub = Airavata::addUNICOREJobSubmissionDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreJobSubmission);
+ }
+ } else {
+ print_r("Whoops! We haven't coded for this Job Submission Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
+ }
+ }
+ */
+
+ /*
+ * Creating Data Movement Interface Object.
+ */
+ public static function create_or_update_DMIObject($inputs, $update = false)
+ {
+
+ $computeResource = SRUtilities::get_compute_resource($inputs["srId"]);
+
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('SR-' . $inputs["srId"])) {
+ Cache::forget('SR-' . $inputs["srId"]);
+ }
+ }
+
+ if ($inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) /* LOCAL */ {
+ $localDataMovement = new LOCALDataMovement();
+ $localdmp = Airavata::addLocalDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $localDataMovement);
+
+ if ($localdmp)
+ print_r("The Local Data Movement has been added. Edit UI for the Local Data Movement Interface is yet to be made.
+ Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
+ } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::SCP) /* SCP */ {
+ //var_dump( $inputs); exit;
+ $scpDataMovement = new SCPDataMovement(array(
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "alternativeSCPHostName" => $inputs["alternativeSSHHostName"],
+ "sshPort" => intval($inputs["sshPort"])
+ )
+
+ );
+
+ if ($update)
+ $scpdmp = Airavata::updateSCPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $scpDataMovement);
+ else
+ $scpdmp = Airavata::addSCPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $scpDataMovement);
+ } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) /* GridFTP */ {
+ $gridFTPDataMovement = new GridFTPDataMovement(array(
+ "securityProtocol" => $inputs["securityProtocol"],
+ "gridFTPEndPoints" => $inputs["gridFTPEndPoints"]
+ ));
+ if ($update)
+ $gridftpdmp = Airavata::updateGridFTPDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $gridFTPDataMovement);
+ else
+ $gridftpdmp = Airavata::addGridFTPDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $gridFTPDataMovement);
+ } else if ($inputs["dataMovementProtocol"] == DataMovementProtocol::UNICORE_STORAGE_SERVICE) /* Unicore Storage Service */ {
+ $unicoreDataMovement = new UnicoreDataMovement(array
+ (
+ "securityProtocol" => intval($inputs["securityProtocol"]),
+ "unicoreEndPointURL" => $inputs["unicoreEndPointURL"]
+ )
+ );
+ if ($update)
+ $unicoredmp = Airavata::updateUnicoreDataMovementDetails(Session::get('authz-token'), $inputs["dmiId"], $unicoreDataMovement);
+ else
+ $unicoredmp = Airavata::addUnicoreDataMovementDetails(Session::get('authz-token'), $computeResource->computeResourceId, 0, $unicoreDataMovement);
+ } else /* other data movement protocols */ {
+ print_r("Whoops! We haven't coded for this Data Movement Protocol yet. Still working on it. Please click <a href='" . URL::to('/') . "/cr/edit'>here</a> to go back to edit page for compute resource.");
+ }
+ }
+
+ public static function getAllSRObjects($onlyName = false)
+ {
+ $srNames = Airavata::getAllStorageResourceNames(Session::get('authz-token'));
+
+ if ($onlyName)
+ return $srNames;
+ else {
+ $srObjects = array();
+ foreach ($srNames as $id => $srName) {
+ array_push($srObjects, Airavata::getStorageResource(Session::get('authz-token'), $id));
+ }
+ return $srObjects;
+ }
+
+ }
+
+ public static function getBrowseSRData($onlyNames)
+ { /*
+ $appDeployments = Airavata::getAllApplicationDeployments(Session::get('authz-token'),
+ Session::get("gateway_id"));
+ */
+ return array('srObjects' => SRUtilities::getAllSRObjects($onlyNames) );
+ }
+
+ public static function getJobSubmissionDetails($jobSubmissionInterfaceId, $jsp)
+ {
+ //jsp = job submission protocol type
+ if ($jsp == JobSubmissionProtocol::LOCAL)
+ return Airavata::getLocalJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+ else if ($jsp == JobSubmissionProtocol::SSH || $jsp == JobSubmissionProtocol::SSH_FORK)
+ return Airavata::getSSHJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+ else if ($jsp == JobSubmissionProtocol::UNICORE)
+ return Airavata::getUnicoreJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+ else if ($jsp == JobSubmissionProtocol::CLOUD)
+ return Airavata::getCloudJobSubmission(Session::get('authz-token'), $jobSubmissionInterfaceId);
+
+ //globus get function not present ??
+ }
+
+ public static function getDataMovementDetails($dataMovementInterfaceId, $dmi)
+ {
+ //jsp = job submission protocol type
+ if ($dmi == DataMovementProtocol::LOCAL)
+ return Airavata::getLocalDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
+ else if ($dmi == DataMovementProtocol::SCP)
+ return Airavata::getSCPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
+ else if ($dmi == DataMovementProtocol::GridFTP)
+ return Airavata::getGridFTPDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
+ else if ($dmi == DataMovementProtocol::UNICORE_STORAGE_SERVICE)
+ return Airavata::getUnicoreDataMovement(Session::get('authz-token'), $dataMovementInterfaceId);
+ /*
+ else if( $dmi == JobSubmissionProtocol::CLOUD)
+ return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
+ */
+
+ //globus get function not present ??
+ }
+
+ public static function deleteActions($inputs)
+ {
+ if (isset($inputs["crId"])) {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["crId"])) {
+ Cache::forget('CR-' . $inputs["crId"]);
+ }
+ }
+ } elseif (isset($inputs["del-crId"])) {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["del-crId"])) {
+ Cache::forget('CR-' . $inputs["del-crId"]);
+ }
+ }
+ }
+
+ if (isset($inputs["jsiId"]))
+ if (Airavata::deleteJobSubmissionInterface(Session::get('authz-token'), $inputs["crId"], $inputs["jsiId"]))
+ return 1;
+ else
+ return 0;
+ else if (isset($inputs["dmiId"]))
+ if (Airavata::deleteDataMovementInterface(Session::get('authz-token'), $inputs["crId"], $inputs["dmiId"]))
+ return 1;
+ else
+ return 0;
+ elseif (isset($inputs["del-crId"]))
+ if (Airavata::deleteComputeResource(Session::get('authz-token'), $inputs["del-crId"]))
+ return 1;
+ else
+ return 0;
+ }
+
+ public static function create_or_update_gateway_profile($inputs, $update = false)
+ {
+
+ $computeResourcePreferences = array();
+ if (isset($input["crPreferences"]))
+ $computeResourcePreferences = $input["crPreferences"];
+
+ $gatewayProfile = new GatewayResourceProfile(array(
+ "gatewayName" => $inputs["gatewayName"],
+ "gatewayDescription" => $inputs["gatewayDescription"],
+ "computeResourcePreferences" => $computeResourcePreferences
+ )
+ );
+
+ if ($update) {
+ $gatewayProfile = new GatewayResourceProfile(array(
+ "gatewayName" => $inputs["gatewayName"],
+ "gatewayDescription" => $inputs["gatewayDescription"]
+ )
+ );
+ $gatewayProfileId = Airavata::updateGatewayResourceProfile(Session::get('authz-token'), $inputs["edit-gpId"], $gatewayProfile);
+ } else
+ $gatewayProfileId = Airavata::registerGatewayResourceProfile(Session::get('authz-token'), $gatewayProfile);
+ }
+
+ public static function getAllGatewayProfilesData()
+ {
+
+ if (Session::has("scigap_admin"))
+ $gateways = Airavata::getAllGateways(Session::get('authz-token'));
+ else {
+ $gateways[0] = Airavata::getGateway(Session::get('authz-token'), Session::get("gateway_id"));
+ }
+
+ $gatewayProfiles = Airavata::getAllGatewayResourceProfiles(Session::get('authz-token'));
+ //var_dump( $gatewayProfiles); exit;
+ //$gatewayProfileIds = array("GatewayTest3_57726e98-313f-4e7c-87a5-18e69928afb5", "GatewayTest4_4fd9fb28-4ced-4149-bdbd-1f276077dad8");
+ foreach ($gateways as $key => $gw) {
+ $gateways[$key]->profile = array();
+ foreach ((array)$gatewayProfiles as $index => $gp) {
+
+ if ($gw->gatewayId == $gp->gatewayID) {
+ foreach ((array)$gp->computeResourcePreferences as $i => $crp) {
+ $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = Airavata::getComputeResource(Session::get('authz-token'), $crp->computeResourceId);
+ }
+ $gateways[$key]->profile = $gatewayProfiles[$index];
+ }
+ }
+ }
+ //var_dump( $gatewayProfiles[0]->computeResourcePreferences[0]->crDetails); exit;
+
+ return $gateways;
+ }
+
+ public static function updateGatewayProfile( $data){
+ $gatewayResourceProfile = Airavata::getGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"]);
+ $gatewayResourceProfile->credentialStoreToken = $data["cst"];
+ return Airavata::updateGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"], $gatewayResourceProfile);
+ }
+
+ public static function add_or_update_CRP($inputs)
+ {
+ $computeResourcePreferences = new computeResourcePreference($inputs);
+
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $inputs["computeResourceId"])) {
+ Cache::forget('CR-' . $inputs["computeResourceId"]);
+ }
+ }
+
+ //var_dump( $inputs); exit;
+ return Airavata::addGatewayComputeResourcePreference(Session::get('authz-token'), $inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
+
+ }
+
+ public static function deleteGP($gpId)
+ {
+ return Airavata::deleteGatewayResourceProfile(Session::get('authz-token'), $gpId);
+ }
+
+ public static function deleteCR($inputs)
+ {
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ $id = $inputs["rem-crId"];
+ if (Cache::has('CR-' . $id)) {
+ Cache::forget('CR-' . $id);
+ }
+ }
+
+ return Airavata::deleteGatewayComputeResourcePreference(Session::get('authz-token'), $inputs["gpId"], $inputs["rem-crId"]);
+ }
+
+ /**
+ * Get the ComputeResourceDescription with the given ID
+ * @param $id
+ * @return null
+ */
+ public static function get_storage_resource($id)
+ {
+ $computeResource = null;
+ try {
+ /*
+ if (Config::get('pga_config.airavata')['enable-app-catalog-cache']) {
+ if (Cache::has('CR-' . $id)) {
+ return Cache::get('CR-' . $id);
+ } else {
+ $computeResource = Airavata::getComputeResource(Session::get('authz-token'), $id);
+ Cache::put('CR-' . $id, $computeResource, Config::get('pga_config.airavata')['app-catalog-cache-duration']);
+ return $computeResource;
+ }
+ } else {
+ */
+ return Airavata::getStorageResource(Session::get('authz-token'), $id);
+ /*
+ }
+ */
+
+ } catch (InvalidRequestException $ire) {
+ CommonUtilities::print_error_message('<p>There was a problem getting the storage resource.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
+ } catch (AiravataClientException $ace) {
+ CommonUtilities::print_error_message('<p>There was a problem getting the storage resource.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
+ } catch (AiravataSystemException $ase) {
+ CommonUtilities::print_error_message('<p>There was a problem getting the storage resource.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
+ }
+ }
+
+
+ /**
+ * Create a select input and populate it with compute resources
+ * available for the given application ID
+ * @param $applicationId
+ * @param $resourceHostId
+ */
+ public static function create_compute_resources_select($applicationId, $resourceHostId)
+ {
+ return CRUtilities::get_available_app_interface_compute_resources($applicationId);
+ }
+
+ /**
+ * Get a list of compute resources available for the given application ID
+ * @param $id
+ * @return null
+ */
+ public static function get_available_app_interface_compute_resources($id)
+ {
+ $computeResources = null;
+
+ try {
+ $computeResources = Airavata::getAvailableAppInterfaceComputeResources(Session::get('authz-token'), $id);
+ } catch (InvalidRequestException $ire) {
+ CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
+ } catch (AiravataClientException $ace) {
+ CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
+ } catch (AiravataSystemException $ase) {
+ CommonUtilities::print_error_message('<p>There was a problem getting compute resources.
+ Please try again later or submit a bug report using the link in the Help menu.</p>' .
+ '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
+ }
+
+ return $computeResources;
+ }
+
+ /**
+ * Get a list of all Data Storages available
+ * @param null
+ * @return
+ **/
+
+ public static function getAllDataStoragePreferences( $gateways){
+ $srpArray = array();
+ foreach( $gateways as $gateway){
+ $srpArray[] = Airavata::getAllGatewayDataStoragePreferences( Session::get('authz-token'), $gateway->gatewayId);
+ }
+ return $srpArray;
+ }
+
+}
+
+?>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/libraries/Wsis/Wsis.php
----------------------------------------------------------------------
diff --git a/app/libraries/Wsis/Wsis.php b/app/libraries/Wsis/Wsis.php
index 57693b5..69c0e2f 100755
--- a/app/libraries/Wsis/Wsis.php
+++ b/app/libraries/Wsis/Wsis.php
@@ -94,10 +94,8 @@ class Wsis {
try {
$this->userStoreManager = new UserStoreManager($service_url, $parameters);
$this->tenantManager = new TenantManager($service_url, $parameters);
- /*
$this->userProfileManager = new UserProfileManager($service_url, $parameters);
$this->userInfoRecoveryManager = new UserInformationRecoveryManager($service_url, $parameters);
- */
$this->oauthManger = new OAuthManager(Config::get('pga_config.wsis')['service-url'], $verify_peer, $cafile_path);
} catch (Exception $ex) {
throw new Exception("Unable to instantiate WSO2 IS client", 0, $ex);
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/routes.php
----------------------------------------------------------------------
diff --git a/app/routes.php b/app/routes.php
index 59bdf38..41f06ff 100755
--- a/app/routes.php
+++ b/app/routes.php
@@ -122,27 +122,27 @@ Route::post("cr/delete-cr", "ComputeResourceController@deleteActions");
* Data Storage Resources Routes
*/
-Route::get("ds/create", function () {
- return Redirect::to("cr/create/step1");
+Route::get("sr/create", function () {
+ return Redirect::to("sr/create/step1");
});
-Route::get("ds/create", "DatastorageController@createView");
+Route::get("sr/create", "StorageResourceController@createView");
-Route::post("ds/create", "DatastorageController@createSubmit");
+Route::post("sr/create", "StorageResourceController@createSubmit");
-Route::get("ds/edit", "DatastorageController@editView");
+Route::get("sr/edit", "StorageResourceController@editView");
-Route::post("ds/edit", "DatastorageController@editSubmit");
+Route::post("sr/edit", "StorageResourceController@editSubmit");
-Route::get("ds/view", "DatastorageController@viewView");
+Route::get("sr/view", "StorageResourceController@viewView");
-Route::get("ds/browse", "DatastorageController@browseView");
+Route::get("sr/browse", "StorageResourceController@browseView");
-Route::post("ds/delete-jsi", "DatastorageController@deleteActions");
+Route::post("sr/delete-jsi", "StorageResourceController@deleteActions");
-Route::post("ds/delete-dmi", "DatastorageController@deleteActions");
+Route::post("sr/delete-dmi", "StorageResourceController@deleteActions");
-Route::post("ds/delete-cr", "DatastorageController@deleteActions");
+Route::post("sr/delete-cr", "StorageResourceController@deleteActions");
/*
* Application Catalog Routes
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cce42251/app/views/account/dashboard.blade.php
----------------------------------------------------------------------
diff --git a/app/views/account/dashboard.blade.php b/app/views/account/dashboard.blade.php
index e3cf0a7..482e678 100644
--- a/app/views/account/dashboard.blade.php
+++ b/app/views/account/dashboard.blade.php
@@ -94,7 +94,7 @@
<div class="row well">
- <h3>Manage Computing and Data Storage Services and Preferences for your Gateway</h3>
+ <h3>Manage Computing and Storage Resouces and Preferences for your Gateway</h3>
<a href="{{URL::to('/')}}/cr/browse">
<div class=" col-md-4 well">
@@ -118,13 +118,13 @@
</div>
</a>
- <a href="{{URL::to('/')}}/ds/browse">
+ <a href="{{URL::to('/')}}/sr/browse">
<div class=" col-md-4 well">
<div class="col-md-12">
<span class="glyphicon glyphicon-folder-open console-icon"></span>
</div>
<div class="col-md-12">
- <h4>Browse Data Storage Resources</h4>
+ <h4>Browse Storage Resources</h4>
</div>
</div>
</a>