airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sma...@apache.org
Subject [41/51] [partial] airavata-php-gateway git commit: importing PGA into new repo - details are discussed at AIRAVATA-1627
Date Thu, 12 Mar 2015 03:55:13 GMT
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/Airavata/Model/Workspace/Types.php
----------------------------------------------------------------------
diff --git a/app/libraries/Airavata/Model/Workspace/Types.php b/app/libraries/Airavata/Model/Workspace/Types.php
new file mode 100644
index 0000000..7ccd55c
--- /dev/null
+++ b/app/libraries/Airavata/Model/Workspace/Types.php
@@ -0,0 +1,608 @@
+<?php
+namespace Airavata\Model\Workspace;
+
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+use Thrift\Base\TBase;
+use Thrift\Type\TType;
+use Thrift\Type\TMessageType;
+use Thrift\Exception\TException;
+use Thrift\Exception\TProtocolException;
+use Thrift\Protocol\TProtocol;
+use Thrift\Protocol\TBinaryProtocolAccelerated;
+use Thrift\Exception\TApplicationException;
+
+
+class Group {
+  static $_TSPEC;
+
+  public $groupName = null;
+  public $description = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'groupName',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'description',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['groupName'])) {
+        $this->groupName = $vals['groupName'];
+      }
+      if (isset($vals['description'])) {
+        $this->description = $vals['description'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Group';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->groupName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->description);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Group');
+    if ($this->groupName !== null) {
+      $xfer += $output->writeFieldBegin('groupName', TType::STRING, 1);
+      $xfer += $output->writeString($this->groupName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->description !== null) {
+      $xfer += $output->writeFieldBegin('description', TType::STRING, 2);
+      $xfer += $output->writeString($this->description);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Project {
+  static $_TSPEC;
+
+  public $projectID = "DEFAULT";
+  public $owner = null;
+  public $name = null;
+  public $description = null;
+  public $creationTime = null;
+  public $sharedUsers = null;
+  public $sharedGroups = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'projectID',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'owner',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'name',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'description',
+          'type' => TType::STRING,
+          ),
+        5 => array(
+          'var' => 'creationTime',
+          'type' => TType::I64,
+          ),
+        6 => array(
+          'var' => 'sharedUsers',
+          'type' => TType::LST,
+          'etype' => TType::STRING,
+          'elem' => array(
+            'type' => TType::STRING,
+            ),
+          ),
+        7 => array(
+          'var' => 'sharedGroups',
+          'type' => TType::LST,
+          'etype' => TType::STRING,
+          'elem' => array(
+            'type' => TType::STRING,
+            ),
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['projectID'])) {
+        $this->projectID = $vals['projectID'];
+      }
+      if (isset($vals['owner'])) {
+        $this->owner = $vals['owner'];
+      }
+      if (isset($vals['name'])) {
+        $this->name = $vals['name'];
+      }
+      if (isset($vals['description'])) {
+        $this->description = $vals['description'];
+      }
+      if (isset($vals['creationTime'])) {
+        $this->creationTime = $vals['creationTime'];
+      }
+      if (isset($vals['sharedUsers'])) {
+        $this->sharedUsers = $vals['sharedUsers'];
+      }
+      if (isset($vals['sharedGroups'])) {
+        $this->sharedGroups = $vals['sharedGroups'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Project';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->projectID);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->owner);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->name);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->description);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->creationTime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 6:
+          if ($ftype == TType::LST) {
+            $this->sharedUsers = array();
+            $_size0 = 0;
+            $_etype3 = 0;
+            $xfer += $input->readListBegin($_etype3, $_size0);
+            for ($_i4 = 0; $_i4 < $_size0; ++$_i4)
+            {
+              $elem5 = null;
+              $xfer += $input->readString($elem5);
+              $this->sharedUsers []= $elem5;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 7:
+          if ($ftype == TType::LST) {
+            $this->sharedGroups = array();
+            $_size6 = 0;
+            $_etype9 = 0;
+            $xfer += $input->readListBegin($_etype9, $_size6);
+            for ($_i10 = 0; $_i10 < $_size6; ++$_i10)
+            {
+              $elem11 = null;
+              $xfer += $input->readString($elem11);
+              $this->sharedGroups []= $elem11;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Project');
+    if ($this->projectID !== null) {
+      $xfer += $output->writeFieldBegin('projectID', TType::STRING, 1);
+      $xfer += $output->writeString($this->projectID);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->owner !== null) {
+      $xfer += $output->writeFieldBegin('owner', TType::STRING, 2);
+      $xfer += $output->writeString($this->owner);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->name !== null) {
+      $xfer += $output->writeFieldBegin('name', TType::STRING, 3);
+      $xfer += $output->writeString($this->name);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->description !== null) {
+      $xfer += $output->writeFieldBegin('description', TType::STRING, 4);
+      $xfer += $output->writeString($this->description);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->creationTime !== null) {
+      $xfer += $output->writeFieldBegin('creationTime', TType::I64, 5);
+      $xfer += $output->writeI64($this->creationTime);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->sharedUsers !== null) {
+      if (!is_array($this->sharedUsers)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('sharedUsers', TType::LST, 6);
+      {
+        $output->writeListBegin(TType::STRING, count($this->sharedUsers));
+        {
+          foreach ($this->sharedUsers as $iter12)
+          {
+            $xfer += $output->writeString($iter12);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->sharedGroups !== null) {
+      if (!is_array($this->sharedGroups)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('sharedGroups', TType::LST, 7);
+      {
+        $output->writeListBegin(TType::STRING, count($this->sharedGroups));
+        {
+          foreach ($this->sharedGroups as $iter13)
+          {
+            $xfer += $output->writeString($iter13);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class User {
+  static $_TSPEC;
+
+  public $userName = null;
+  public $groupList = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'userName',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'groupList',
+          'type' => TType::LST,
+          'etype' => TType::STRUCT,
+          'elem' => array(
+            'type' => TType::STRUCT,
+            'class' => '\Airavata\Model\Workspace\Group',
+            ),
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['userName'])) {
+        $this->userName = $vals['userName'];
+      }
+      if (isset($vals['groupList'])) {
+        $this->groupList = $vals['groupList'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'User';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->userName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::LST) {
+            $this->groupList = array();
+            $_size14 = 0;
+            $_etype17 = 0;
+            $xfer += $input->readListBegin($_etype17, $_size14);
+            for ($_i18 = 0; $_i18 < $_size14; ++$_i18)
+            {
+              $elem19 = null;
+              $elem19 = new \Airavata\Model\Workspace\Group();
+              $xfer += $elem19->read($input);
+              $this->groupList []= $elem19;
+            }
+            $xfer += $input->readListEnd();
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('User');
+    if ($this->userName !== null) {
+      $xfer += $output->writeFieldBegin('userName', TType::STRING, 1);
+      $xfer += $output->writeString($this->userName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->groupList !== null) {
+      if (!is_array($this->groupList)) {
+        throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA);
+      }
+      $xfer += $output->writeFieldBegin('groupList', TType::LST, 2);
+      {
+        $output->writeListBegin(TType::STRUCT, count($this->groupList));
+        {
+          foreach ($this->groupList as $iter20)
+          {
+            $xfer += $iter20->write($output);
+          }
+        }
+        $output->writeListEnd();
+      }
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+class Gateway {
+  static $_TSPEC;
+
+  public $gatewayId = null;
+  public $gatewayName = null;
+  public $domain = null;
+  public $emailAddress = null;
+
+  public function __construct($vals=null) {
+    if (!isset(self::$_TSPEC)) {
+      self::$_TSPEC = array(
+        1 => array(
+          'var' => 'gatewayId',
+          'type' => TType::STRING,
+          ),
+        2 => array(
+          'var' => 'gatewayName',
+          'type' => TType::STRING,
+          ),
+        3 => array(
+          'var' => 'domain',
+          'type' => TType::STRING,
+          ),
+        4 => array(
+          'var' => 'emailAddress',
+          'type' => TType::STRING,
+          ),
+        );
+    }
+    if (is_array($vals)) {
+      if (isset($vals['gatewayId'])) {
+        $this->gatewayId = $vals['gatewayId'];
+      }
+      if (isset($vals['gatewayName'])) {
+        $this->gatewayName = $vals['gatewayName'];
+      }
+      if (isset($vals['domain'])) {
+        $this->domain = $vals['domain'];
+      }
+      if (isset($vals['emailAddress'])) {
+        $this->emailAddress = $vals['emailAddress'];
+      }
+    }
+  }
+
+  public function getName() {
+    return 'Gateway';
+  }
+
+  public function read($input)
+  {
+    $xfer = 0;
+    $fname = null;
+    $ftype = 0;
+    $fid = 0;
+    $xfer += $input->readStructBegin($fname);
+    while (true)
+    {
+      $xfer += $input->readFieldBegin($fname, $ftype, $fid);
+      if ($ftype == TType::STOP) {
+        break;
+      }
+      switch ($fid)
+      {
+        case 1:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 2:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->gatewayName);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 3:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->domain);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 4:
+          if ($ftype == TType::STRING) {
+            $xfer += $input->readString($this->emailAddress);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        default:
+          $xfer += $input->skip($ftype);
+          break;
+      }
+      $xfer += $input->readFieldEnd();
+    }
+    $xfer += $input->readStructEnd();
+    return $xfer;
+  }
+
+  public function write($output) {
+    $xfer = 0;
+    $xfer += $output->writeStructBegin('Gateway');
+    if ($this->gatewayId !== null) {
+      $xfer += $output->writeFieldBegin('gatewayId', TType::STRING, 1);
+      $xfer += $output->writeString($this->gatewayId);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->gatewayName !== null) {
+      $xfer += $output->writeFieldBegin('gatewayName', TType::STRING, 2);
+      $xfer += $output->writeString($this->gatewayName);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->domain !== null) {
+      $xfer += $output->writeFieldBegin('domain', TType::STRING, 3);
+      $xfer += $output->writeString($this->domain);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->emailAddress !== null) {
+      $xfer += $output->writeFieldBegin('emailAddress', TType::STRING, 4);
+      $xfer += $output->writeString($this->emailAddress);
+      $xfer += $output->writeFieldEnd();
+    }
+    $xfer += $output->writeFieldStop();
+    $xfer += $output->writeStructEnd();
+    return $xfer;
+  }
+
+}
+
+

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/AiravataClientFactory.php
----------------------------------------------------------------------
diff --git a/app/libraries/AiravataClientFactory.php b/app/libraries/AiravataClientFactory.php
new file mode 100755
index 0000000..c55a359
--- /dev/null
+++ b/app/libraries/AiravataClientFactory.php
@@ -0,0 +1,47 @@
+<?php
+
+namespace Airavata\Client;
+
+$GLOBALS['THRIFT_ROOT'] = 'Thrift/';
+//require_once $GLOBALS['THRIFT_ROOT'] . 'Thrift.php';
+/*
+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/TTransportException.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'] = 'Airavata/';
+require_once $GLOBALS['AIRAVATA_ROOT'] . 'API/Airavata.php';
+*/
+
+use Thrift\Protocol\TBinaryProtocol;
+use Thrift\Transport\TSocket;
+use Airavata\API\AiravataClient;
+
+class AiravataClientFactory
+{
+
+    private $airavataServerHost;
+    private $airavataServerPort;
+
+    public function __construct($options)
+    {
+        $this->airavataServerHost = isset($options['airavataServerHost']) ? $options['airavataServerHost'] : null;
+        $this->airavataServerPort = isset($options['airavataServerPort']) ? $options['airavataServerPort'] : null;
+    }
+
+    public function getAiravataClient()
+    {
+        $transport = new TSocket($this->airavataServerHost, $this->airavataServerPort);
+        $protocol = new TBinaryProtocol($transport);
+	$transport->open();
+        return new AiravataClient($protocol);
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/AppUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/AppUtilities.php b/app/libraries/AppUtilities.php
new file mode 100644
index 0000000..6e034c4
--- /dev/null
+++ b/app/libraries/AppUtilities.php
@@ -0,0 +1,230 @@
+<?php
+
+//Airavata classes - loaded from app/libraries/Airavata
+use Airavata\API\AiravataClient;
+
+use Airavata\Model\AppCatalog\AppInterface\DataType;
+use Airavata\Model\AppCatalog\AppInterface\InputDataObjectType;
+use Airavata\Model\AppCatalog\AppInterface\OutputDataObjectType;
+use Airavata\Model\AppCatalog\AppInterface\ApplicationInterfaceDescription;
+
+use Airavata\Model\Workspace\Project;
+
+use Airavata\Model\AppCatalog\AppDeployment\ApplicationModule;
+use Airavata\Model\AppCatalog\AppDeployment\ApplicationParallelismType;
+use Airavata\Model\AppCatalog\AppDeployment\ApplicationDeploymentDescription;
+use Airavata\Model\AppCatalog\AppDeployment\SetEnvPaths;
+
+//use Airavata\Model\AppCatalog\ComputeResource
+
+
+class AppUtilities{
+
+	public static function create_or_update_appModule( $inputs, $update = false){
+
+		$airavataclient = Session::get("airavataClient");
+
+		$appModule = new ApplicationModule( array(
+												"appModuleName" => $inputs["appModuleName"],
+												"appModuleVersion" => $inputs["appModuleVersion"],
+												"appModuleDescription" => $inputs["appModuleDescription"]
+										));
+		
+		if( $update)
+			return $airavataclient->updateApplicationModule( $inputs["appModuleId"], $appModule);
+		else
+			return $airavataclient->registerApplicationModule( Session::get("gateway_id"), $appModule);
+	}
+
+	public static function deleteAppModule( $appModuleId){
+
+		$airavataclient = Session::get("airavataClient");
+
+		return $airavataclient->deleteApplicationModule( $appModuleId);
+	}
+
+	public static function getAppInterfaceData(){
+
+		$airavataclient = Session::get("airavataClient");
+
+		$dataType = new DataType();
+		$modules = AppUtilities::getAllModules();
+		$appInterfaces = $airavataclient->getAllApplicationInterfaces( Session::get("gateway_id"));
+
+
+		$InputDataObjectType = new InputDataObjectType();
+
+		return array(
+						"appInterfaces" 	=> $appInterfaces,
+						"dataTypes" 		=> $dataType::$__names,
+						"modules"   		=> $modules
+						);
+	}
+
+	public static function create_or_update_appInterface( $appInterfaceValues, $update = false){
+		
+		$airavataclient = Session::get("airavataClient");
+		//var_dump( $appInterfaceValues); exit;
+		$appInterface = new ApplicationInterfaceDescription( array(
+																"applicationName" => $appInterfaceValues["applicationName"],
+																"applicationDescription" => $appInterfaceValues["applicationDescription"],
+																"applicationModules" => $appInterfaceValues["applicationModules"]
+															) ); 
+
+		if( isset( $appInterfaceValues["inputName"]))
+		{
+			foreach ($appInterfaceValues["inputName"] as $index => $name) {
+				$inputDataObjectType = new InputDataObjectType( array(
+																	"name" => $name,
+																	"value" => $appInterfaceValues["inputValue"][ $index],
+																	"type" => $appInterfaceValues["inputType"][ $index],
+																	"applicationArgument" => $appInterfaceValues["applicationArgumentInput"][$index],
+																	"standardInput" => $appInterfaceValues["standardInput"][ $index],
+																	"userFriendlyDescription" => $appInterfaceValues["userFriendlyDescription"][ $index],
+																	"metaData" => $appInterfaceValues["metaData"][ $index],
+																	"inputOrder" => intval( $appInterfaceValues["inputOrder"][ $index]),
+																	"dataStaged" => intval( $appInterfaceValues["dataStaged"][ $index]),
+																	"isRequired" => $appInterfaceValues["isRequiredInput"][ $index],
+																	"requiredToAddedToCommandLine" => $appInterfaceValues["requiredToAddedToCommandLineInput"][$index]
+																) );
+				$appInterface->applicationInputs[] = $inputDataObjectType;
+			}
+		}
+
+		if( isset( $appInterfaceValues["outputName"]))
+		{
+			foreach ( $appInterfaceValues["outputName"] as $index => $name) {
+				$outputDataObjectType = new OutputDataObjectType( array(
+																	"name" => $name,
+																	"value" => $appInterfaceValues["outputValue"][ $index],
+																	"type" => $appInterfaceValues["outputType"][ $index],
+																	"applicationArgument" => $appInterfaceValues["applicationArgumentOutput"][$index],
+																	"dataMovement" => intval( $appInterfaceValues["dataMovement"][ $index]),
+																	"location" => $appInterfaceValues["location"][ $index],
+																	"isRequired" => $appInterfaceValues["isRequiredOutput"][ $index],
+																	"requiredToAddedToCommandLine" => $appInterfaceValues["requiredToAddedToCommandLineOutput"][$index],
+																	"searchQuery" => $appInterfaceValues["searchQuery"][$index]
+																));
+				$appInterface->applicationOutputs[] = $outputDataObjectType;
+			}
+		}
+
+		//var_dump( $appInterface); exit;
+
+		if( $update)
+			$airavataclient->updateApplicationInterface( $appInterfaceValues["app-interface-id"], $appInterface);
+		else
+			$airavataclient->getApplicationInterface($airavataclient->registerApplicationInterface( $appInterface) );
+
+		//print_r( "App interface has been created.");
+	}
+
+	public static function deleteAppInterface( $appInterfaceId){
+
+		$airavataclient = Session::get("airavataClient");
+
+		return $airavataclient->deleteApplicationInterface( $appInterfaceId);
+	}
+
+
+	public static function getAppDeploymentData(){
+
+		$airavataclient = Session::get("airavataClient");
+
+		$appDeployments = $airavataclient->getAllApplicationDeployments( Session::get("gateway_id"));
+		//var_dump( $appDeployments); exit;
+		$computeResources = $airavataclient->getAllComputeResourceNames();
+		$modules = AppUtilities::getAllModules();
+		$apt = new ApplicationParallelismType();
+
+		return array( 
+						"appDeployments" 			  => $appDeployments,
+						"applicationParallelismTypes" => $apt::$__names,
+						"computeResources"            => $computeResources,
+						"modules"			          => $modules
+					);
+	}
+
+	public static function create_or_update_appDeployment( $inputs, $update = false){
+
+		$appDeploymentValues = $inputs;
+
+		$airavataclient = Session::get("airavataClient");
+
+		if( isset( $appDeploymentValues["moduleLoadCmds"]))
+			$appDeploymentValues["moduleLoadCmds"] = array_unique( array_filter( $appDeploymentValues["moduleLoadCmds"]));
+
+		if( isset( $appDeploymentValues["libraryPrependPathName"] )) 
+		{	
+			$libPrependPathNames = array_unique( array_filter( $appDeploymentValues["libraryPrependPathName"],"trim" ));
+		
+			foreach( $libPrependPathNames as $index => $prependName)
+			{
+				$envPath = new SetEnvPaths(array(
+												"name" => $prependName,
+												"value" => $appDeploymentValues["libraryPrependPathValue"][ $index]
+											));
+				$appDeploymentValues["libPrependPaths"][] = $envPath;
+			}
+		}
+
+		if( isset( $appDeploymentValues["libraryAppendPathName"] )) 
+		{
+			$libAppendPathNames = array_unique( array_filter( $appDeploymentValues["libraryAppendPathName"],"trim" ));
+			foreach( $libAppendPathNames as $index => $appendName)
+			{
+				$envPath = new SetEnvPaths(array(
+												"name" => $appendName,
+												"value" => $appDeploymentValues["libraryAppendPathValue"][ $index]
+											));
+				$appDeploymentValues["libAppendPaths"][] = $envPath;
+			}
+		}
+
+		if( isset( $appDeploymentValues["environmentName"] )) 
+		{
+			$environmentNames = array_unique( array_filter( $appDeploymentValues["environmentName"], "trim"));
+			foreach( $environmentNames as $index => $envName)
+			{
+				$envPath = new SetEnvPaths(array(
+												"name" => $envName,
+												"value" => $appDeploymentValues["environmentValue"][$index]
+											));
+				$appDeploymentValues["setEnvironment"][] = $envPath;
+			}
+		}
+		
+		if( isset( $appDeploymentValues["preJobCommand"] )) 
+		{
+			$appDeploymentValues["preJobCommands"] = array_unique( array_filter( $appDeploymentValues["preJobCommand"], "trim"));
+		}
+
+		if( isset( $appDeploymentValues["postJobCommand"] )) 
+		{
+			$appDeploymentValues["postJobCommands"] = array_unique( array_filter( $appDeploymentValues["postJobCommand"], "trim"));
+		}
+
+		//var_dump( $appDeploymentValues); exit;
+		$appDeployment = new ApplicationDeploymentDescription(  $appDeploymentValues);
+		if( $update)
+			$airavataclient->updateApplicationDeployment( $inputs["app-deployment-id"], $appDeployment);
+		else
+			$appDeploymentId = $airavataclient->registerApplicationDeployment( Session::get("gateway_id"), $appDeployment);
+
+		return;
+
+	}
+
+	public static function deleteAppDeployment( $appDeploymentId )
+	{
+
+		$airavataclient = Session::get("airavataClient");
+
+		return $airavataclient->deleteApplicationDeployment( $appDeploymentId);
+	}
+
+	public static function getAllModules(){
+		$airavataclient = Session::get("airavataClient");
+		return $airavataclient->getAllAppModules( Session::get("gateway_id"));
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/CRUtilities.php
----------------------------------------------------------------------
diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php
new file mode 100644
index 0000000..c24ce25
--- /dev/null
+++ b/app/libraries/CRUtilities.php
@@ -0,0 +1,445 @@
+<?php
+
+
+//Airavata classes - loaded from app/libraries/Airavata
+use Airavata\API\AiravataClient;
+
+//Compute Resource classes
+
+use Airavata\Model\AppCatalog\ComputeResource\FileSystems;
+use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionInterface;
+use Airavata\Model\AppCatalog\ComputeResource\JobSubmissionProtocol;
+use Airavata\Model\AppCatalog\ComputeResource\SecurityProtocol;
+use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManager;
+use Airavata\Model\AppCatalog\ComputeResource\ResourceJobManagerType;
+use Airavata\Model\AppCatalog\ComputeResource\JobManagerCommand;
+use Airavata\Model\AppCatalog\ComputeResource\DataMovementProtocol;
+use Airavata\Model\AppCatalog\ComputeResource\ComputeResourceDescription;
+use Airavata\Model\AppCatalog\ComputeResource\SSHJobSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\LOCALSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\UnicoreJobSubmission;
+use Airavata\Model\AppCatalog\ComputeResource\BatchQueue;
+use Airavata\Model\AppCatalog\ComputeResource\SCPDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\GridFTPDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\LOCALDataMovement;
+use Airavata\Model\AppCatalog\ComputeResource\UnicoreDataMovement;
+
+
+//Gateway Classes
+
+use Airavata\Model\AppCatalog\GatewayProfile\GatewayResourceProfile;
+use Airavata\Model\AppCatalog\GatewayProfile\ComputeResourcePreference;
+
+
+
+
+class CRUtilities{
+/**
+ * Basic utility functions
+ */
+
+//define('ROOT_DIR', __DIR__);
+
+/**
+ * Define configuration constants
+ */
+public static function register_or_update_compute_resource( $computeDescription, $update = false)
+{
+    $airavataclient = Session::get("airavataClient");
+    if( $update)
+    {
+        $computeResourceId = $computeDescription->computeResourceId;
+
+        if( $airavataclient->updateComputeResource( $computeResourceId, $computeDescription) )
+        {
+            $computeResource = $airavataclient->getComputeResource( $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 = $airavataclient->registerComputeResource( $cd);
+    }
+
+    $computeResource = $airavataclient->getComputeResource( $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();
+    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
+                );
+}
+
+
+public static function createQueueObject( $queue){
+    $queueObject = new BatchQueue( $queue); 
+    return $queueObject;
+}
+
+public static function deleteQueue( $computeResourceId, $queueName)
+{
+    $airavataclient = Session::get("airavataClient");
+    $airavataclient->deleteBatchQueue( $computeResourceId, $queueName);
+}
+
+
+/*
+ * Creating Job Submission Interface.
+*/
+
+public static function create_or_update_JSIObject( $inputs, $update = false){
+
+    $airavataclient = Session::get("airavataClient");
+    $computeResource = Utilities::get_compute_resource(  $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 = $airavataclient->getLocalJobSubmission( $jsiId);
+            $localSub = $airavataclient->updateResourceJobManager(  $jsiObject->resourceJobManager->resourceJobManagerId, $resourceManager);
+            //$localSub = $airavataclient->updateLocalSubmissionDetails( $jsiId, $localJobSubmission);
+        }
+        else        // create Local JSP
+        {
+            $localSub = $airavataclient->addLocalSubmissionDetails( $computeResource->computeResourceId, 0, $localJobSubmission);
+            return $localSub;
+        }
+        
+    }
+    else if( $inputs["jobSubmissionProtocol"] ==  JobSubmissionProtocol::SSH) /* 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"] )
+                                                    )
+                                                );
+        if( $update) //update Local JSP
+        {
+            $jsiObject = $airavataclient->getSSHJobSubmission( $jsiId);
+
+            //first update resource job manager
+            $rmjId = $jsiObject->resourceJobManager->resourceJobManagerId;
+            $airavataclient->updateResourceJobManager(  $rmjId, $resourceManager);
+            $jsiObject = $airavataclient->getSSHJobSubmission( $jsiId);
+
+            $jsiObject->securityProtocol = intval( $inputs["securityProtocol"] );
+            $jsiObject->alternativeSSHHostName = $inputs["alternativeSSHHostName"];
+            $jsiObject->sshPort = intval( $inputs["sshPort"] );
+            $jsiObject->resourceJobManager = $airavataclient->getresourceJobManager( $rmjId);
+            //var_dump( $jsiObject); exit;
+            //add updated resource job manager to ssh job submission object.
+            //$sshJobSubmission->resourceJobManager->resourceJobManagerId = $rmjId;
+            $localSub = $airavataclient->updateSSHJobSubmissionDetails( $jsiId, $jsiObject);
+        }
+        else
+        {
+            $sshSub = $airavataclient->addSSHJobSubmissionDetails( $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 = $airavataclient->getUnicoreJobSubmission( $jsiId);
+            $jsiObject->securityProtocol = intval( $inputs["securityProtocol"] );
+            $jsiObject->unicoreEndPointURL = $inputs["unicoreEndPointURL"];
+
+            $unicoreSub = $airavataclient->updateUnicoreJobSubmissionDetails( $jsiId, $jsiObject);
+        }
+        else
+        {
+            $unicoreSub = $airavataclient->addUNICOREJobSubmissionDetails( $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){
+    $airavataclient = Session::get("airavataClient");
+
+    $computeResource = Utilities::get_compute_resource(  $inputs["crId"] );
+    if( $inputs["dataMovementProtocol"] == DataMovementProtocol::LOCAL) /* LOCAL */
+    {
+        $localDataMovement = new LOCALDataMovement();
+        $localdmp = $airavataclient->addLocalDataMovementDetails( $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 = $airavataclient->updateSCPDataMovementDetails( $inputs["dmiId"], $scpDataMovement);
+        else
+            $scpdmp = $airavataclient->addSCPDataMovementDetails( $computeResource->computeResourceId, 0, $scpDataMovement);   
+   }
+    else if( $inputs["dataMovementProtocol"] == DataMovementProtocol::GridFTP) /* GridFTP */
+    {
+        $gridFTPDataMovement = new GridFTPDataMovement( array(
+                "securityProtocol" => $inputs["securityProtocol"],
+                "gridFTPEndPoints" => $inputs["gridFTPEndPoints"]
+            ));
+        if( $update)
+            $gridftpdmp = $airavataclient->updateGridFTPDataMovementDetails( $inputs["dmiId"], $gridFTPDataMovement);
+        else
+            $gridftpdmp = $airavataclient->addGridFTPDataMovementDetails( $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 = $airavataclient->updateUnicoreDataMovementDetails( $inputs["dmiId"], $unicoreDataMovement);
+        else
+            $unicoredmp = $airavataclient->addUnicoreDataMovementDetails( $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 getAllCRObjects( $onlyName = false){
+    $airavataclient = Session::get("airavataClient");
+    $crNames = $airavataclient->getAllComputeResourceNames();
+    if( $onlyName)
+        return $crNames;
+    else
+    {
+        $crObjects = array();
+        foreach( $crNames as $id => $crName)
+        {
+            $crObjects[] = $airavataclient->getComputeResource( $id);
+        }
+        return $crObjects;
+    }
+
+}
+
+public static function getBrowseCRData(){
+    $airavataclient = Session::get("airavataClient");
+	$appDeployments = $airavataclient->getAllApplicationDeployments( Session::get("gateway_id"));
+
+    return array( 'crObjects' => CRUtilities::getAllCRObjects(true),
+    			  'appDeployments' => $appDeployments 
+    			);
+}
+
+public static function getJobSubmissionDetails( $jobSubmissionInterfaceId, $jsp){
+    //jsp = job submission protocol type
+    $airavataclient = Session::get("airavataClient");
+    if( $jsp == JobSubmissionProtocol::LOCAL)
+        return $airavataclient->getLocalJobSubmission( $jobSubmissionInterfaceId);
+    else if( $jsp == JobSubmissionProtocol::SSH)
+        return $airavataclient->getSSHJobSubmission( $jobSubmissionInterfaceId);
+    else if( $jsp == JobSubmissionProtocol::UNICORE)
+        return $airavataclient->getUnicoreJobSubmission( $jobSubmissionInterfaceId);
+    else if( $jsp == JobSubmissionProtocol::CLOUD)
+        return $airavataclient->getCloudJobSubmission( $jobSubmissionInterfaceId);
+
+    //globus get function not present ??	
+}
+
+public static function getDataMovementDetails( $dataMovementInterfaceId, $dmi){
+    //jsp = job submission protocol type
+    $airavataclient = Session::get("airavataClient");
+    if( $dmi == DataMovementProtocol::LOCAL)
+        return $airavataclient->getLocalDataMovement( $dataMovementInterfaceId);
+    else if( $dmi == DataMovementProtocol::SCP)
+        return $airavataclient->getSCPDataMovement( $dataMovementInterfaceId);
+    else if( $dmi == DataMovementProtocol::GridFTP)
+        return $airavataclient->getGridFTPDataMovement( $dataMovementInterfaceId);
+    else if( $dmi == DataMovementProtocol::UNICORE_STORAGE_SERVICE)
+        return $airavataclient->getUnicoreDataMovement( $dataMovementInterfaceId);
+    /*
+    else if( $dmi == JobSubmissionProtocol::CLOUD)
+        return $airavataclient->getCloudJobSubmission( $dataMovementInterfaceId);
+    */
+
+    //globus get function not present ??
+}
+
+public static function deleteActions( $inputs){
+    $airavataclient = Session::get("airavataClient");
+    if( isset( $inputs["jsiId"]) )
+        if( $airavataclient->deleteJobSubmissionInterface( $inputs["crId"], $inputs["jsiId"]) )
+            return 1;
+        else
+            return 0;
+    else if( isset( $inputs["dmiId"]) )
+        if( $airavataclient->deleteDataMovementInterface( $inputs["crId"], $inputs["dmiId"]) )
+            return 1;
+        else 
+            return 0;
+    elseif( isset( $inputs["del-crId"]))
+    	if( $airavataclient->deleteComputeResource( $inputs["del-crId"] ) )
+    		return 1;
+    	else
+    		return 0;
+}
+
+public static function create_or_update_gateway_profile( $inputs, $update = false){
+    $airavataclient = Session::get("airavataClient");
+
+    $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 = $airavataclient->updateGatewayResourceProfile( $inputs["edit-gpId"], $gatewayProfile);
+    }
+    else
+        $gatewayProfileId = $airavataclient->registerGatewayResourceProfile( $gatewayProfile);
+}
+
+public static function getAllGatewayProfilesData(){
+    $airavataclient = Session::get("airavataClient");
+
+    $gateways = $airavataclient->getAllGateways();
+    $gatewayProfiles = $airavataclient->getAllGatewayComputeResources();
+    //$gatewayProfileIds = array("GatewayTest3_57726e98-313f-4e7c-87a5-18e69928afb5", "GatewayTest4_4fd9fb28-4ced-4149-bdbd-1f276077dad8");
+    foreach( $gateways as $key => $gw)
+    {
+        foreach( (array)$gatewayProfiles as $index => $gp)
+        {
+
+            if( $gw->gatewayId == $gp->gatewayID)
+            {
+                foreach( (array)$gp->computeResourcePreferences as $i => $crp)
+                {
+                    $gatewayProfiles[$index]->computeResourcePreferences[$i]->crDetails = $airavataclient->getComputeResource( $crp->computeResourceId);
+                }
+                $gateways[$key]->profile = $gatewayProfiles[$index];
+            }
+        }
+    }
+    //var_dump( $gatewayProfiles[0]->computeResourcePreferences[0]->crDetails); exit;
+    
+    return $gateways;
+}
+
+public static function add_or_update_CRP( $inputs){
+    $airavataclient = Session::get("airavataClient");
+
+    $computeResourcePreferences = new computeResourcePreference( $inputs);
+
+    //var_dump( $inputs); exit;
+    return $airavataclient->addGatewayComputeResourcePreference( $inputs["gatewayId"], $inputs["computeResourceId"], $computeResourcePreferences);
+
+}
+
+public static function deleteGP( $gpId){
+    $airavataclient = Session::get("airavataClient");
+
+    return $airavataclient->deleteGatewayResourceProfile( $gpId);
+}
+
+public static function deleteCR( $inputs){
+    $airavataclient = Session::get("airavataClient");
+
+    return $airavataclient->deleteGatewayComputeResourcePreference( $inputs["gpId"], $inputs["rem-crId"]);
+}
+
+}
+?>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/a325e292/app/libraries/UserStoreManager/UserStoreManager.php
----------------------------------------------------------------------
diff --git a/app/libraries/UserStoreManager/UserStoreManager.php b/app/libraries/UserStoreManager/UserStoreManager.php
new file mode 100755
index 0000000..9b8f9d8
--- /dev/null
+++ b/app/libraries/UserStoreManager/UserStoreManager.php
@@ -0,0 +1,202 @@
+<?php
+
+require_once 'UserStoreManager.stub.php';
+
+/**
+ * UsersStoreManager class
+ * 
+ * This class provide an easy to use interface for
+ * WSO2 IS 4.6.0 RemoteUserStoreManager service.
+ */
+class UserStoreManager {
+    /**
+     * @var RemoteUserManagerStub $serviceStub
+     * @access private
+     */
+    private $serviceStub;
+
+    public function __construct($server_url, $options) {
+        $this->serviceStub = new UserStoreManagerStub(
+                $server_url . "RemoteUserStoreManagerService?wsdl", $options
+        );
+    }
+    
+    /**
+     * Function to get the soap client
+     * 
+     * @return SoapClient
+     */
+    public function getSoapClient(){
+        return $this->serviceStub;
+    }
+    
+    /**
+     * Function to authenticate the user with RemoteUserStoreManager Service
+     * @param type $username
+     * @param type $password
+     */
+    public function authenticate($username, $password){
+        $parameters = new Authenticate();
+        $parameters->userName = $username;
+        $parameters->credential = $password;        
+        return $this->serviceStub->authenticate($parameters)->return;
+    }
+    
+    /**
+     * Function to add new user by providing username and password
+     * 
+     * @param type $userName
+     * @param type $password
+     */
+    public function addUser($userName, $password, $fullName){
+        $parameters = new AddUser();
+        $parameters->userName = $userName;
+        $parameters->credential = $password;
+        $parameters->claims = null;
+        $parameters->profileName = $fullName;
+        $parameters->requirePasswordChange = false;
+        $parameters->roleList = null;
+        $this->serviceStub->addUser($parameters);
+    }
+    /**
+     * Function to delete existing user by providing the username.
+     * 
+     * @param string $username
+     */
+    public function deleteUser($username){
+        $parameters = new DeleteUser();
+        $parameters->userName = $username;
+        $this->serviceStub->deleteUser($parameters);
+    }
+    
+    /**
+     * Function to check whether a role is existing 
+     *
+     * @param string $roleName 
+     * @return IsExistingRoleResponse
+     */
+    public function isExistingRole( $roleName) {
+        $parameters = new IsExistingRole();
+        $parameters->roleName = $roleName;
+        $this->serviceStub->isExistingRole( $parameters)->return;
+    }
+    /**
+     * Function to add new role by providing the role name.
+     * 
+     * @param string $roleName
+     */
+    public function addRole($roleName){
+        $paramerters = new AddRole();
+        $paramerters->roleName=$roleName;
+        $paramerters->userList=null;
+        $paramerters->permissions=null;
+        $this->serviceStub->addRole($paramerters);
+    }
+    
+    /**
+     * Function to delete an existing role
+     * 
+     * @param string $roleName
+     */
+    public function deleteRole($roleName){
+        $parameters = new DeleteRole();
+        $parameters->roleName = $roleName;
+        $this->serviceStub->deleteRole($parameters);
+    }
+    
+    /**
+     * Function to get a list of users
+     * 
+     * @return username list
+     */
+    public function listUsers(){
+        $parameters = new ListUsers();
+        $parameters->filter = "*";
+        $parameters->maxItemLimit = -1;
+        
+        return $this->serviceStub->listUsers($parameters)->return;
+    }
+
+     /**
+     * Function get user list
+     *
+     * @param GetUserList $parameters
+     * @return GetUserListResponse
+     */
+     public function getUserList(){
+        $parameters = new GetUserList();
+    }
+
+        
+    /**
+     * Function to check whether the given username already exists
+     * 
+     * @param string $username
+     * @return boolean
+     */
+    public function isExistingUser($username) {
+        $parameters = new IsExistingUser();
+        $parameters->userName = $username;
+        
+        return $this->serviceStub->isExistingUser($parameters)->return;
+    }
+
+    /**
+    * Function to get the list of all existing roles
+    *
+    * @return roles list
+    */
+    public function getRoleNames( $parameters = null){
+        $parameters = new GetRoleNames();
+        return $this->serviceStub->getRoleNames( $parameters)->return;
+    }
+
+    /**
+    * Function to get role of a user
+    *
+    * @return User Role
+    */
+    public function getRoleListOfUser( $username){
+        $parameters = new GetRoleListOfUser();
+        $parameters->userName = $username;
+        return $this->serviceStub->GetRoleListOfUser( $parameters)->return;
+    }
+
+    /**
+     * Function to get the user list of role
+     *
+     * @param GetUserListOfRole $parameters
+     * @return GetUserListOfRoleResponse
+     */
+    public function getUserListOfRole( $role){
+        $parameters = new GetUserListOfRole();
+        $paramerters->roleName = $role;
+        return $this->serviceStub->getUserListOfRole( $paramerters)->return;
+    }
+    
+    /**
+     * Function to update role list of user 
+     *
+     * @param UpdateRoleListOfUser $parameters
+     * @return void
+     */
+    public function updateRoleListOfUser( $username, $roles){
+        $parameters = new UpdateRoleListOfUser();
+        $parameters->userName = $username;
+        $parameters->deletedRoles = $roles["deleted"];
+        $parameters->newRoles = $roles["new"];
+        return $this->serviceStub->updateRoleListOfUser( $parameters);
+    }
+
+    /**
+     * Function to get the tenant id
+     *
+     * @param GetTenantId $parameters
+     * @return GetTenantIdResponse
+     */
+    public function getTenantId(){
+        $parameters = new GetTenantId();
+
+        return $this->serviceStub->getTenantId( $parameters);
+    }
+}


Mime
View raw message