public function editSubmit() { $this->beforeFilter('verifyeditadmin'); $tabName = ""; if (Input::get("sr-edit") == "resDesc") { $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_storage_resource($storageResourceDescription, true); $tabName = "#tab-desc"; } if (Input::get("sr-edit") == "dmp" || Input::get("sr-edit") == "edit-dmi") { $update = false; if (Input::get("sr-edit") == "edit-dmi") { $update = true; } $dataMovementInterface = SRUtilities::create_or_update_DMIObject(Input::all(), $update); $tabName = "#tab-dataMovement"; } else { if (Input::get("sr-edit") == "dmi-priority") { $inputs = Input::all(); $storageDescription = SRUtilities::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 = SRUtilities::register_or_update_storage_resource($storageDescription, true); return 1; //currently done by ajax. } } return Redirect::to("sr/edit?srId=" . Input::get("srId") . $tabName); }
public static function create_or_update_DMIObject($inputs, $update = false) { $storageResource = SRUtilities::get_storage_resource($inputs["srId"]); if ($inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) { $localDataMovement = new LOCALDataMovement(); $localdmp = Airavata::addLocalDataMovementDetails(Session::get('authz-token'), $storageResource->storageResourceId, DMType::STORAGE_RESOURCE, 0, $localDataMovement); } else { if ($inputs["dataMovementProtocol"] == DataMovementProtocol::SCP) { $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'), $storageResource->storageResourceId, DMType::STORAGE_RESOURCE, 0, $scpDataMovement); } } else { if ($inputs["dataMovementProtocol"] == DataMovementProtocol::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'), $storageResource->storageResourceId, DMType::STORAGE_RESOURCE, 0, $gridFTPDataMovement); } } else { if ($inputs["dataMovementProtocol"] == DataMovementProtocol::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'), $storageResource->storageResourceId, DMType::STORAGE_RESOURCE, 0, $unicoreDataMovement); } } else { 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."); } } } } }