public static function addGateway($input)
 {
     $gateway = new Gateway();
     $gateway->gatewayId = $input["gatewayName"];
     $gateway->domain = $input["domain"];
     $gateway->gatewayName = $input["gatewayName"];
     $gateway->emailAddress = $input["admin-email"];
     return Airavata::addGateway($gateway);
 }
public static function deleteCR( $inputs){
    return Airavata::deleteGatewayComputeResourcePreference( $inputs["gpId"], $inputs["rem-crId"]);
}
 /**
  * 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;
 }
<?php

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    $authzToken = new Airavata\Model\Security\AuthzToken();
    $authzToken->accessToken = "emptyToken";
    $apiVersion = Airavata::getAPIVersion($authzToken);
    if (empty($apiVersion)) {
        return View::make("server-down");
    } else {
        Session::put('authz-token', $authzToken);
    }
});
App::after(function ($request, $response) {
    //
    // Test commit.
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
 public static function remove_ssh_token($token)
 {
     try {
         return Airavata::deleteSSHPubKey(Session::get('authz-token'), $token, Session::get("gateway_id"));
     } catch (InvalidRequestException $ire) {
         CommonUtilities::print_error_message('p>Error in creating SSH Handshake. You might have to enable TLS in pga_config. </p>' . '<p>InvalidRequestException: ' . $ire->getMessage() . '</p>');
     } catch (AiravataClientException $ace) {
         CommonUtilities::print_error_message('<p>Error in creating SSH Handshake. You might have to enable TLS in pga_config.  </p>' . '<p>Airavata Client Exception: ' . $ace->getMessage() . '</p>');
     } catch (AiravataSystemException $ase) {
         CommonUtilities::print_error_message('p>Error in creating SSH Handshake. You might have to enable TLS in pga_config.  </p>' . '<p>Airavata System Exception: ' . $ase->getMessage() . '</p>');
     }
 }
<?php

/*
|--------------------------------------------------------------------------
| Application & Route Filters
|--------------------------------------------------------------------------
|
| Below you will find the "before" and "after" events for the application
| which may be used to do any work before or after a request into your
| application. Here you may also register your custom route filters.
|
*/
App::before(function ($request) {
    $apiVersion = Airavata::getAPIVersion();
    if (empty($apiVersion)) {
        return View::make("server-down");
    }
});
App::after(function ($request, $response) {
    //
    // Test commit.
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
 /**
  * Method to get experiment execution statistics object
  * @param $fromTime
  * @param $toTime
  * @return \Airavata\Model\Workspace\Experiment\ExperimentStatistics
  */
 public static function get_experiment_execution_statistics($fromTime, $toTime)
 {
     return Airavata::getExperimentStatistics(Config::get('pga_config.airavata')['gateway-id'], $fromTime, $toTime);
 }
 /**
  * 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;
 }
/**
 * Get results of the user's search of experiments
 * @return array|null
 */
public static function get_expsearch_results( $inputs)
{
    $experiments = array();

    try
    {
        switch ( $inputs["search-key"])
        {
            case 'experiment-name':
                $experiments = Airavata::searchExperimentsByName(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
                break;
            case 'experiment-description':
                $experiments = Airavata::searchExperimentsByDesc(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
                break;
            case 'application':
                $experiments = Airavata::searchExperimentsByApplication(Session::get('gateway_id'), Session::get('username'), $inputs["search-value"]);
                break;
            case 'creation-time':
                $experiments = Airavata::searchExperimentsByCreationTime(Session::get('gateway_id'), Session::get('username'), strtotime( $inputs["from-date"])*1000, strtotime( $inputs["to-date"])*1000 );
                break;
            case '':
        }
    }
    catch (InvalidRequestException $ire)
    {
        Utilities::print_error_message('InvalidRequestException!<br><br>' . $ire->getMessage());
    }
    catch (AiravataClientException $ace)
    {
        Utilities::print_error_message('AiravataClientException!<br><br>' . $ace->getMessage());
    }
    catch (AiravataSystemException $ase)
    {
        if ($ase->airavataErrorType == 2) // 2 = INTERNAL_ERROR
        {
            Utilities::print_info_message('<p>You have not created any experiments yet, so no results will be returned!</p>
                                <p>Click <a href="create_experiment.php">here</a> to create an experiment, or
                                <a href="create_project.php">here</a> to create a new project.</p>');
        }
        else
        {
            Utilities::print_error_message('There was a problem with Airavata. Please try again later or report a bug using the link in the Help menu.');
            //print_error_message('AiravataSystemException!<br><br>' . $ase->airavataErrorType . ': ' . $ase->getMessage());
        }
    }
    catch (TTransportException $tte)
    {
        Utilities::print_error_message('TTransportException!<br><br>' . $tte->getMessage());
    }

    //get values of all experiments
    $expContainer = array();
    $expNum = 0;
    foreach( $experiments as $experiment)
    {
        $expValue = Utilities::get_experiment_values( $experiment, Utilities::get_project($experiment->projectID), true );
        $expContainer[$expNum]['experiment'] = $experiment;
        if( $expValue["experimentStatusString"] == "FAILED")
            $expValue["editable"] = false;
        $expContainer[$expNum]['expValue'] = $expValue;
        $expNum++;
    }

    return $expContainer;
}
 /**
  * Get a list of the outputs for the application with the given ID
  * @param $id
  * @return null
  */
 public static function get_application_outputs($id)
 {
     $outputs = null;
     try {
         $outputs = Airavata::getApplicationOutputs(Session::get('authz-token'), $id);
     } catch (InvalidRequestException $ire) {
         CommonUtilities::print_error_message('<p>There was a problem getting application outputs.
         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 application outputs.
         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 application outputs.
         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 $outputs;
 }
	public static function getAllModules(){
		return Airavata::getAllAppModules( Session::get("gateway_id"));
	}
public static function getQueueDatafromResourceId( $crId){
    $resourceObject = Airavata::getComputeResource( $crId);
    return $resourceObject->batchQueues;
}