http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php index 3e8db10..bdb70e4 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php @@ -212,9 +212,7 @@ class ComputeResourcePreference { class GatewayResourceProfile { static $_TSPEC; - public $gatewayID = "DO_NOT_SET_AT_CLIENTS"; - public $gatewayName = null; - public $gatewayDescription = null; + public $gatewayID = null; public $computeResourcePreferences = null; public function __construct($vals=null) { @@ -225,14 +223,6 @@ class GatewayResourceProfile { 'type' => TType::STRING, ), 2 => array( - 'var' => 'gatewayName', - 'type' => TType::STRING, - ), - 3 => array( - 'var' => 'gatewayDescription', - 'type' => TType::STRING, - ), - 4 => array( 'var' => 'computeResourcePreferences', 'type' => TType::LST, 'etype' => TType::STRUCT, @@ -247,12 +237,6 @@ class GatewayResourceProfile { if (isset($vals['gatewayID'])) { $this->gatewayID = $vals['gatewayID']; } - if (isset($vals['gatewayName'])) { - $this->gatewayName = $vals['gatewayName']; - } - if (isset($vals['gatewayDescription'])) { - $this->gatewayDescription = $vals['gatewayDescription']; - } if (isset($vals['computeResourcePreferences'])) { $this->computeResourcePreferences = $vals['computeResourcePreferences']; } @@ -286,20 +270,6 @@ class GatewayResourceProfile { } 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->gatewayDescription); - } else { - $xfer += $input->skip($ftype); - } - break; - case 4: if ($ftype == TType::LST) { $this->computeResourcePreferences = array(); $_size0 = 0; @@ -335,21 +305,11 @@ class GatewayResourceProfile { $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->gatewayDescription !== null) { - $xfer += $output->writeFieldBegin('gatewayDescription', TType::STRING, 3); - $xfer += $output->writeString($this->gatewayDescription); - $xfer += $output->writeFieldEnd(); - } if ($this->computeResourcePreferences !== null) { if (!is_array($this->computeResourcePreferences)) { throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); } - $xfer += $output->writeFieldBegin('computeResourcePreferences', TType::LST, 4); + $xfer += $output->writeFieldBegin('computeResourcePreferences', TType::LST, 2); { $output->writeListBegin(TType::STRUCT, count($this->computeResourcePreferences)); { @@ -369,6 +329,4 @@ class GatewayResourceProfile { } -$GLOBALS['gatewayResourceProfileModel_CONSTANTS']['DEFAULT_ID'] = "DO_NOT_SET_AT_CLIENTS"; -
http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Workspace/Types.php ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Workspace/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Workspace/Types.php index 673414d..7ccd55c 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Workspace/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/Workspace/Types.php @@ -476,8 +476,10 @@ class User { class Gateway { static $_TSPEC; - public $gatewayId = "DO_NOT_SET_AT_CLIENTS"; - public $name = null; + public $gatewayId = null; + public $gatewayName = null; + public $domain = null; + public $emailAddress = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -487,7 +489,15 @@ class Gateway { 'type' => TType::STRING, ), 2 => array( - 'var' => 'name', + 'var' => 'gatewayName', + 'type' => TType::STRING, + ), + 3 => array( + 'var' => 'domain', + 'type' => TType::STRING, + ), + 4 => array( + 'var' => 'emailAddress', 'type' => TType::STRING, ), ); @@ -496,8 +506,14 @@ class Gateway { if (isset($vals['gatewayId'])) { $this->gatewayId = $vals['gatewayId']; } - if (isset($vals['name'])) { - $this->name = $vals['name']; + if (isset($vals['gatewayName'])) { + $this->gatewayName = $vals['gatewayName']; + } + if (isset($vals['domain'])) { + $this->domain = $vals['domain']; + } + if (isset($vals['emailAddress'])) { + $this->emailAddress = $vals['emailAddress']; } } } @@ -530,7 +546,21 @@ class Gateway { break; case 2: if ($ftype == TType::STRING) { - $xfer += $input->readString($this->name); + $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); } @@ -553,9 +583,19 @@ class Gateway { $xfer += $output->writeString($this->gatewayId); $xfer += $output->writeFieldEnd(); } - if ($this->name !== null) { - $xfer += $output->writeFieldBegin('name', TType::STRING, 2); - $xfer += $output->writeString($this->name); + 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(); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java index 5496cc6..f5a79de 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/RegisterSampleData.java @@ -89,7 +89,6 @@ public class RegisterSampleData { createComputeResourcePreference(localhostId, "Sample", false, null, null, null, sampleScriptDir + "/.."); GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile(); gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY); - gatewayResourceProfile.setGatewayName(DEFAULT_GATEWAY); gatewayResourceProfile.addToComputeResourcePreferences(localhostResourcePreference); airavataClient.registerGatewayResourceProfile(gatewayResourceProfile); } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java index 3cebeb5..d046710 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterOGCEUS3Application.java @@ -248,7 +248,7 @@ public class RegisterOGCEUS3Application { // "/mnt/glusterfs/work/"); GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile(); - gatewayResourceProfile.setGatewayName(DEFAULT_GATEWAY); + gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY); gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences); gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences); // gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java index acc5b7c..c311dde 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java @@ -1213,7 +1213,6 @@ public class RegisterSampleApplications { GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile(); gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY); - gatewayResourceProfile.setGatewayName(DEFAULT_GATEWAY); gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences); gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences); gatewayResourceProfile.addToComputeResourcePreferences(bigRedResourcePreferences); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java index a0fcba3..8567c74 100644 --- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java +++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterUS3Application.java @@ -246,7 +246,7 @@ public class RegisterUS3Application { "/mnt/glusterfs/work/"); GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile(); - gatewayResourceProfile.setGatewayName(DEFAULT_GATEWAY); + gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY); gatewayResourceProfile.addToComputeResourcePreferences(stampedeResourcePreferences); gatewayResourceProfile.addToComputeResourcePreferences(trestlesResourcePreferences); gatewayResourceProfile.addToComputeResourcePreferences(lonestarResourcePreferences); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayResourceProfile.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayResourceProfile.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayResourceProfile.java index 33a7477..fccc2be 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayResourceProfile.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayResourceProfile.java @@ -70,9 +70,7 @@ import org.slf4j.LoggerFactory; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GatewayResourceProfile"); private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayID", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField GATEWAY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayName", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField GATEWAY_DESCRIPTION_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayDescription", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField COMPUTE_RESOURCE_PREFERENCES_FIELD_DESC = new org.apache.thrift.protocol.TField("computeResourcePreferences", org.apache.thrift.protocol.TType.LIST, (short)4); + private static final org.apache.thrift.protocol.TField COMPUTE_RESOURCE_PREFERENCES_FIELD_DESC = new org.apache.thrift.protocol.TField("computeResourcePreferences", org.apache.thrift.protocol.TType.LIST, (short)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -81,16 +79,12 @@ import org.slf4j.LoggerFactory; } private String gatewayID; // required - private String gatewayName; // required - private String gatewayDescription; // optional private List<ComputeResourcePreference> computeResourcePreferences; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { GATEWAY_ID((short)1, "gatewayID"), - GATEWAY_NAME((short)2, "gatewayName"), - GATEWAY_DESCRIPTION((short)3, "gatewayDescription"), - COMPUTE_RESOURCE_PREFERENCES((short)4, "computeResourcePreferences"); + COMPUTE_RESOURCE_PREFERENCES((short)2, "computeResourcePreferences"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -107,11 +101,7 @@ import org.slf4j.LoggerFactory; switch(fieldId) { case 1: // GATEWAY_ID return GATEWAY_ID; - case 2: // GATEWAY_NAME - return GATEWAY_NAME; - case 3: // GATEWAY_DESCRIPTION - return GATEWAY_DESCRIPTION; - case 4: // COMPUTE_RESOURCE_PREFERENCES + case 2: // COMPUTE_RESOURCE_PREFERENCES return COMPUTE_RESOURCE_PREFERENCES; default: return null; @@ -153,16 +143,12 @@ import org.slf4j.LoggerFactory; } // isset id assignments - private _Fields optionals[] = {_Fields.GATEWAY_DESCRIPTION,_Fields.COMPUTE_RESOURCE_PREFERENCES}; + private _Fields optionals[] = {_Fields.COMPUTE_RESOURCE_PREFERENCES}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayID", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.GATEWAY_NAME, new org.apache.thrift.meta_data.FieldMetaData("gatewayName", org.apache.thrift.TFieldRequirementType.REQUIRED, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.GATEWAY_DESCRIPTION, new org.apache.thrift.meta_data.FieldMetaData("gatewayDescription", org.apache.thrift.TFieldRequirementType.OPTIONAL, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.COMPUTE_RESOURCE_PREFERENCES, new org.apache.thrift.meta_data.FieldMetaData("computeResourcePreferences", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ComputeResourcePreference.class)))); @@ -171,17 +157,13 @@ import org.slf4j.LoggerFactory; } public GatewayResourceProfile() { - this.gatewayID = "DO_NOT_SET_AT_CLIENTS"; - } public GatewayResourceProfile( - String gatewayID, - String gatewayName) + String gatewayID) { this(); this.gatewayID = gatewayID; - this.gatewayName = gatewayName; } /** @@ -191,12 +173,6 @@ import org.slf4j.LoggerFactory; if (other.isSetGatewayID()) { this.gatewayID = other.gatewayID; } - if (other.isSetGatewayName()) { - this.gatewayName = other.gatewayName; - } - if (other.isSetGatewayDescription()) { - this.gatewayDescription = other.gatewayDescription; - } if (other.isSetComputeResourcePreferences()) { List<ComputeResourcePreference> __this__computeResourcePreferences = new ArrayList<ComputeResourcePreference>(other.computeResourcePreferences.size()); for (ComputeResourcePreference other_element : other.computeResourcePreferences) { @@ -212,10 +188,7 @@ import org.slf4j.LoggerFactory; @Override public void clear() { - this.gatewayID = "DO_NOT_SET_AT_CLIENTS"; - - this.gatewayName = null; - this.gatewayDescription = null; + this.gatewayID = null; this.computeResourcePreferences = null; } @@ -242,52 +215,6 @@ import org.slf4j.LoggerFactory; } } - public String getGatewayName() { - return this.gatewayName; - } - - public void setGatewayName(String gatewayName) { - this.gatewayName = gatewayName; - } - - public void unsetGatewayName() { - this.gatewayName = null; - } - - /** Returns true if field gatewayName is set (has been assigned a value) and false otherwise */ - public boolean isSetGatewayName() { - return this.gatewayName != null; - } - - public void setGatewayNameIsSet(boolean value) { - if (!value) { - this.gatewayName = null; - } - } - - public String getGatewayDescription() { - return this.gatewayDescription; - } - - public void setGatewayDescription(String gatewayDescription) { - this.gatewayDescription = gatewayDescription; - } - - public void unsetGatewayDescription() { - this.gatewayDescription = null; - } - - /** Returns true if field gatewayDescription is set (has been assigned a value) and false otherwise */ - public boolean isSetGatewayDescription() { - return this.gatewayDescription != null; - } - - public void setGatewayDescriptionIsSet(boolean value) { - if (!value) { - this.gatewayDescription = null; - } - } - public int getComputeResourcePreferencesSize() { return (this.computeResourcePreferences == null) ? 0 : this.computeResourcePreferences.size(); } @@ -336,22 +263,6 @@ import org.slf4j.LoggerFactory; } break; - case GATEWAY_NAME: - if (value == null) { - unsetGatewayName(); - } else { - setGatewayName((String)value); - } - break; - - case GATEWAY_DESCRIPTION: - if (value == null) { - unsetGatewayDescription(); - } else { - setGatewayDescription((String)value); - } - break; - case COMPUTE_RESOURCE_PREFERENCES: if (value == null) { unsetComputeResourcePreferences(); @@ -368,12 +279,6 @@ import org.slf4j.LoggerFactory; case GATEWAY_ID: return getGatewayID(); - case GATEWAY_NAME: - return getGatewayName(); - - case GATEWAY_DESCRIPTION: - return getGatewayDescription(); - case COMPUTE_RESOURCE_PREFERENCES: return getComputeResourcePreferences(); @@ -390,10 +295,6 @@ import org.slf4j.LoggerFactory; switch (field) { case GATEWAY_ID: return isSetGatewayID(); - case GATEWAY_NAME: - return isSetGatewayName(); - case GATEWAY_DESCRIPTION: - return isSetGatewayDescription(); case COMPUTE_RESOURCE_PREFERENCES: return isSetComputeResourcePreferences(); } @@ -422,24 +323,6 @@ import org.slf4j.LoggerFactory; return false; } - boolean this_present_gatewayName = true && this.isSetGatewayName(); - boolean that_present_gatewayName = true && that.isSetGatewayName(); - if (this_present_gatewayName || that_present_gatewayName) { - if (!(this_present_gatewayName && that_present_gatewayName)) - return false; - if (!this.gatewayName.equals(that.gatewayName)) - return false; - } - - boolean this_present_gatewayDescription = true && this.isSetGatewayDescription(); - boolean that_present_gatewayDescription = true && that.isSetGatewayDescription(); - if (this_present_gatewayDescription || that_present_gatewayDescription) { - if (!(this_present_gatewayDescription && that_present_gatewayDescription)) - return false; - if (!this.gatewayDescription.equals(that.gatewayDescription)) - return false; - } - boolean this_present_computeResourcePreferences = true && this.isSetComputeResourcePreferences(); boolean that_present_computeResourcePreferences = true && that.isSetComputeResourcePreferences(); if (this_present_computeResourcePreferences || that_present_computeResourcePreferences) { @@ -475,26 +358,6 @@ import org.slf4j.LoggerFactory; return lastComparison; } } - lastComparison = Boolean.valueOf(isSetGatewayName()).compareTo(other.isSetGatewayName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetGatewayName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayName, other.gatewayName); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetGatewayDescription()).compareTo(other.isSetGatewayDescription()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetGatewayDescription()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayDescription, other.gatewayDescription); - if (lastComparison != 0) { - return lastComparison; - } - } lastComparison = Boolean.valueOf(isSetComputeResourcePreferences()).compareTo(other.isSetComputeResourcePreferences()); if (lastComparison != 0) { return lastComparison; @@ -532,24 +395,6 @@ import org.slf4j.LoggerFactory; sb.append(this.gatewayID); } first = false; - if (!first) sb.append(", "); - sb.append("gatewayName:"); - if (this.gatewayName == null) { - sb.append("null"); - } else { - sb.append(this.gatewayName); - } - first = false; - if (isSetGatewayDescription()) { - if (!first) sb.append(", "); - sb.append("gatewayDescription:"); - if (this.gatewayDescription == null) { - sb.append("null"); - } else { - sb.append(this.gatewayDescription); - } - first = false; - } if (isSetComputeResourcePreferences()) { if (!first) sb.append(", "); sb.append("computeResourcePreferences:"); @@ -570,10 +415,6 @@ import org.slf4j.LoggerFactory; throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayID' is unset! Struct:" + toString()); } - if (!isSetGatewayName()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayName' is unset! Struct:" + toString()); - } - // check for sub-struct validity } @@ -619,23 +460,7 @@ import org.slf4j.LoggerFactory; org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // GATEWAY_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.gatewayName = iprot.readString(); - struct.setGatewayNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 3: // GATEWAY_DESCRIPTION - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.gatewayDescription = iprot.readString(); - struct.setGatewayDescriptionIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // COMPUTE_RESOURCE_PREFERENCES + case 2: // COMPUTE_RESOURCE_PREFERENCES if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { org.apache.thrift.protocol.TList _list0 = iprot.readListBegin(); @@ -672,18 +497,6 @@ import org.slf4j.LoggerFactory; oprot.writeString(struct.gatewayID); oprot.writeFieldEnd(); } - if (struct.gatewayName != null) { - oprot.writeFieldBegin(GATEWAY_NAME_FIELD_DESC); - oprot.writeString(struct.gatewayName); - oprot.writeFieldEnd(); - } - if (struct.gatewayDescription != null) { - if (struct.isSetGatewayDescription()) { - oprot.writeFieldBegin(GATEWAY_DESCRIPTION_FIELD_DESC); - oprot.writeString(struct.gatewayDescription); - oprot.writeFieldEnd(); - } - } if (struct.computeResourcePreferences != null) { if (struct.isSetComputeResourcePreferences()) { oprot.writeFieldBegin(COMPUTE_RESOURCE_PREFERENCES_FIELD_DESC); @@ -716,18 +529,11 @@ import org.slf4j.LoggerFactory; public void write(org.apache.thrift.protocol.TProtocol prot, GatewayResourceProfile struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.gatewayID); - oprot.writeString(struct.gatewayName); BitSet optionals = new BitSet(); - if (struct.isSetGatewayDescription()) { - optionals.set(0); - } if (struct.isSetComputeResourcePreferences()) { - optionals.set(1); - } - oprot.writeBitSet(optionals, 2); - if (struct.isSetGatewayDescription()) { - oprot.writeString(struct.gatewayDescription); + optionals.set(0); } + oprot.writeBitSet(optionals, 1); if (struct.isSetComputeResourcePreferences()) { { oprot.writeI32(struct.computeResourcePreferences.size()); @@ -744,14 +550,8 @@ import org.slf4j.LoggerFactory; TTupleProtocol iprot = (TTupleProtocol) prot; struct.gatewayID = iprot.readString(); struct.setGatewayIDIsSet(true); - struct.gatewayName = iprot.readString(); - struct.setGatewayNameIsSet(true); - BitSet incoming = iprot.readBitSet(2); + BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { - struct.gatewayDescription = iprot.readString(); - struct.setGatewayDescriptionIsSet(true); - } - if (incoming.get(1)) { { org.apache.thrift.protocol.TList _list5 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); struct.computeResourcePreferences = new ArrayList<ComputeResourcePreference>(_list5.size); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java ---------------------------------------------------------------------- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java index 63d35d6..118b958 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/workspace/Gateway.java @@ -53,7 +53,9 @@ import org.slf4j.LoggerFactory; private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("Gateway"); private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField GATEWAY_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayName", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField DOMAIN_FIELD_DESC = new org.apache.thrift.protocol.TField("domain", org.apache.thrift.protocol.TType.STRING, (short)3); + private static final org.apache.thrift.protocol.TField EMAIL_ADDRESS_FIELD_DESC = new org.apache.thrift.protocol.TField("emailAddress", org.apache.thrift.protocol.TType.STRING, (short)4); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -62,12 +64,16 @@ import org.slf4j.LoggerFactory; } private String gatewayId; // required - private String name; // required + private String gatewayName; // optional + private String domain; // optional + private String emailAddress; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ @SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum { GATEWAY_ID((short)1, "gatewayId"), - NAME((short)2, "name"); + GATEWAY_NAME((short)2, "gatewayName"), + DOMAIN((short)3, "domain"), + EMAIL_ADDRESS((short)4, "emailAddress"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -84,8 +90,12 @@ import org.slf4j.LoggerFactory; switch(fieldId) { case 1: // GATEWAY_ID return GATEWAY_ID; - case 2: // NAME - return NAME; + case 2: // GATEWAY_NAME + return GATEWAY_NAME; + case 3: // DOMAIN + return DOMAIN; + case 4: // EMAIL_ADDRESS + return EMAIL_ADDRESS; default: return null; } @@ -126,29 +136,30 @@ import org.slf4j.LoggerFactory; } // isset id assignments + private _Fields optionals[] = {_Fields.GATEWAY_NAME,_Fields.DOMAIN,_Fields.EMAIL_ADDRESS}; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.NAME, new org.apache.thrift.meta_data.FieldMetaData("name", org.apache.thrift.TFieldRequirementType.REQUIRED, + tmpMap.put(_Fields.GATEWAY_NAME, new org.apache.thrift.meta_data.FieldMetaData("gatewayName", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.DOMAIN, new org.apache.thrift.meta_data.FieldMetaData("domain", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.EMAIL_ADDRESS, new org.apache.thrift.meta_data.FieldMetaData("emailAddress", org.apache.thrift.TFieldRequirementType.OPTIONAL, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(Gateway.class, metaDataMap); } public Gateway() { - this.gatewayId = "DO_NOT_SET_AT_CLIENTS"; - } public Gateway( - String gatewayId, - String name) + String gatewayId) { this(); this.gatewayId = gatewayId; - this.name = name; } /** @@ -158,8 +169,14 @@ import org.slf4j.LoggerFactory; if (other.isSetGatewayId()) { this.gatewayId = other.gatewayId; } - if (other.isSetName()) { - this.name = other.name; + if (other.isSetGatewayName()) { + this.gatewayName = other.gatewayName; + } + if (other.isSetDomain()) { + this.domain = other.domain; + } + if (other.isSetEmailAddress()) { + this.emailAddress = other.emailAddress; } } @@ -169,9 +186,10 @@ import org.slf4j.LoggerFactory; @Override public void clear() { - this.gatewayId = "DO_NOT_SET_AT_CLIENTS"; - - this.name = null; + this.gatewayId = null; + this.gatewayName = null; + this.domain = null; + this.emailAddress = null; } public String getGatewayId() { @@ -197,26 +215,72 @@ import org.slf4j.LoggerFactory; } } - public String getName() { - return this.name; + public String getGatewayName() { + return this.gatewayName; + } + + public void setGatewayName(String gatewayName) { + this.gatewayName = gatewayName; + } + + public void unsetGatewayName() { + this.gatewayName = null; + } + + /** Returns true if field gatewayName is set (has been assigned a value) and false otherwise */ + public boolean isSetGatewayName() { + return this.gatewayName != null; + } + + public void setGatewayNameIsSet(boolean value) { + if (!value) { + this.gatewayName = null; + } + } + + public String getDomain() { + return this.domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public void unsetDomain() { + this.domain = null; + } + + /** Returns true if field domain is set (has been assigned a value) and false otherwise */ + public boolean isSetDomain() { + return this.domain != null; + } + + public void setDomainIsSet(boolean value) { + if (!value) { + this.domain = null; + } + } + + public String getEmailAddress() { + return this.emailAddress; } - public void setName(String name) { - this.name = name; + public void setEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; } - public void unsetName() { - this.name = null; + public void unsetEmailAddress() { + this.emailAddress = null; } - /** Returns true if field name is set (has been assigned a value) and false otherwise */ - public boolean isSetName() { - return this.name != null; + /** Returns true if field emailAddress is set (has been assigned a value) and false otherwise */ + public boolean isSetEmailAddress() { + return this.emailAddress != null; } - public void setNameIsSet(boolean value) { + public void setEmailAddressIsSet(boolean value) { if (!value) { - this.name = null; + this.emailAddress = null; } } @@ -230,11 +294,27 @@ import org.slf4j.LoggerFactory; } break; - case NAME: + case GATEWAY_NAME: + if (value == null) { + unsetGatewayName(); + } else { + setGatewayName((String)value); + } + break; + + case DOMAIN: + if (value == null) { + unsetDomain(); + } else { + setDomain((String)value); + } + break; + + case EMAIL_ADDRESS: if (value == null) { - unsetName(); + unsetEmailAddress(); } else { - setName((String)value); + setEmailAddress((String)value); } break; @@ -246,8 +326,14 @@ import org.slf4j.LoggerFactory; case GATEWAY_ID: return getGatewayId(); - case NAME: - return getName(); + case GATEWAY_NAME: + return getGatewayName(); + + case DOMAIN: + return getDomain(); + + case EMAIL_ADDRESS: + return getEmailAddress(); } throw new IllegalStateException(); @@ -262,8 +348,12 @@ import org.slf4j.LoggerFactory; switch (field) { case GATEWAY_ID: return isSetGatewayId(); - case NAME: - return isSetName(); + case GATEWAY_NAME: + return isSetGatewayName(); + case DOMAIN: + return isSetDomain(); + case EMAIL_ADDRESS: + return isSetEmailAddress(); } throw new IllegalStateException(); } @@ -290,12 +380,30 @@ import org.slf4j.LoggerFactory; return false; } - boolean this_present_name = true && this.isSetName(); - boolean that_present_name = true && that.isSetName(); - if (this_present_name || that_present_name) { - if (!(this_present_name && that_present_name)) + boolean this_present_gatewayName = true && this.isSetGatewayName(); + boolean that_present_gatewayName = true && that.isSetGatewayName(); + if (this_present_gatewayName || that_present_gatewayName) { + if (!(this_present_gatewayName && that_present_gatewayName)) return false; - if (!this.name.equals(that.name)) + if (!this.gatewayName.equals(that.gatewayName)) + return false; + } + + boolean this_present_domain = true && this.isSetDomain(); + boolean that_present_domain = true && that.isSetDomain(); + if (this_present_domain || that_present_domain) { + if (!(this_present_domain && that_present_domain)) + return false; + if (!this.domain.equals(that.domain)) + return false; + } + + boolean this_present_emailAddress = true && this.isSetEmailAddress(); + boolean that_present_emailAddress = true && that.isSetEmailAddress(); + if (this_present_emailAddress || that_present_emailAddress) { + if (!(this_present_emailAddress && that_present_emailAddress)) + return false; + if (!this.emailAddress.equals(that.emailAddress)) return false; } @@ -325,12 +433,32 @@ import org.slf4j.LoggerFactory; return lastComparison; } } - lastComparison = Boolean.valueOf(isSetName()).compareTo(other.isSetName()); + lastComparison = Boolean.valueOf(isSetGatewayName()).compareTo(other.isSetGatewayName()); if (lastComparison != 0) { return lastComparison; } - if (isSetName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.name, other.name); + if (isSetGatewayName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayName, other.gatewayName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetDomain()).compareTo(other.isSetDomain()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetDomain()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.domain, other.domain); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetEmailAddress()).compareTo(other.isSetEmailAddress()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetEmailAddress()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.emailAddress, other.emailAddress); if (lastComparison != 0) { return lastComparison; } @@ -362,14 +490,36 @@ import org.slf4j.LoggerFactory; sb.append(this.gatewayId); } first = false; - if (!first) sb.append(", "); - sb.append("name:"); - if (this.name == null) { - sb.append("null"); - } else { - sb.append(this.name); + if (isSetGatewayName()) { + if (!first) sb.append(", "); + sb.append("gatewayName:"); + if (this.gatewayName == null) { + sb.append("null"); + } else { + sb.append(this.gatewayName); + } + first = false; + } + if (isSetDomain()) { + if (!first) sb.append(", "); + sb.append("domain:"); + if (this.domain == null) { + sb.append("null"); + } else { + sb.append(this.domain); + } + first = false; + } + if (isSetEmailAddress()) { + if (!first) sb.append(", "); + sb.append("emailAddress:"); + if (this.emailAddress == null) { + sb.append("null"); + } else { + sb.append(this.emailAddress); + } + first = false; } - first = false; sb.append(")"); return sb.toString(); } @@ -380,10 +530,6 @@ import org.slf4j.LoggerFactory; throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' is unset! Struct:" + toString()); } - if (!isSetName()) { - throw new org.apache.thrift.protocol.TProtocolException("Required field 'name' is unset! Struct:" + toString()); - } - // check for sub-struct validity } @@ -429,10 +575,26 @@ import org.slf4j.LoggerFactory; org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // NAME + case 2: // GATEWAY_NAME if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.name = iprot.readString(); - struct.setNameIsSet(true); + struct.gatewayName = iprot.readString(); + struct.setGatewayNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // DOMAIN + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.domain = iprot.readString(); + struct.setDomainIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // EMAIL_ADDRESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.emailAddress = iprot.readString(); + struct.setEmailAddressIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -455,10 +617,26 @@ import org.slf4j.LoggerFactory; oprot.writeString(struct.gatewayId); oprot.writeFieldEnd(); } - if (struct.name != null) { - oprot.writeFieldBegin(NAME_FIELD_DESC); - oprot.writeString(struct.name); - oprot.writeFieldEnd(); + if (struct.gatewayName != null) { + if (struct.isSetGatewayName()) { + oprot.writeFieldBegin(GATEWAY_NAME_FIELD_DESC); + oprot.writeString(struct.gatewayName); + oprot.writeFieldEnd(); + } + } + if (struct.domain != null) { + if (struct.isSetDomain()) { + oprot.writeFieldBegin(DOMAIN_FIELD_DESC); + oprot.writeString(struct.domain); + oprot.writeFieldEnd(); + } + } + if (struct.emailAddress != null) { + if (struct.isSetEmailAddress()) { + oprot.writeFieldBegin(EMAIL_ADDRESS_FIELD_DESC); + oprot.writeString(struct.emailAddress); + oprot.writeFieldEnd(); + } } oprot.writeFieldStop(); oprot.writeStructEnd(); @@ -478,7 +656,26 @@ import org.slf4j.LoggerFactory; public void write(org.apache.thrift.protocol.TProtocol prot, Gateway struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeString(struct.gatewayId); - oprot.writeString(struct.name); + BitSet optionals = new BitSet(); + if (struct.isSetGatewayName()) { + optionals.set(0); + } + if (struct.isSetDomain()) { + optionals.set(1); + } + if (struct.isSetEmailAddress()) { + optionals.set(2); + } + oprot.writeBitSet(optionals, 3); + if (struct.isSetGatewayName()) { + oprot.writeString(struct.gatewayName); + } + if (struct.isSetDomain()) { + oprot.writeString(struct.domain); + } + if (struct.isSetEmailAddress()) { + oprot.writeString(struct.emailAddress); + } } @Override @@ -486,8 +683,19 @@ import org.slf4j.LoggerFactory; TTupleProtocol iprot = (TTupleProtocol) prot; struct.gatewayId = iprot.readString(); struct.setGatewayIdIsSet(true); - struct.name = iprot.readString(); - struct.setNameIsSet(true); + BitSet incoming = iprot.readBitSet(3); + if (incoming.get(0)) { + struct.gatewayName = iprot.readString(); + struct.setGatewayNameIsSet(true); + } + if (incoming.get(1)) { + struct.domain = iprot.readString(); + struct.setDomainIsSet(true); + } + if (incoming.get(2)) { + struct.emailAddress = iprot.readString(); + struct.setEmailAddressIsSet(true); + } } } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/thrift-interface-descriptions/airavataAPI.thrift ---------------------------------------------------------------------- diff --git a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift index 6710a76..83a1fc4 100644 --- a/airavata-api/thrift-interface-descriptions/airavataAPI.thrift +++ b/airavata-api/thrift-interface-descriptions/airavataAPI.thrift @@ -70,7 +70,37 @@ service Airavata { throws (1: airavataErrors.InvalidRequestException ire, 2: airavataErrors.AiravataClientException ace, 3: airavataErrors.AiravataSystemException ase) - + + string addGateway(1: required workspaceModel.Gateway gateway) + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + + void updateGateway(1: required string gatewayId, 2: required workspaceModel.Gateway updatedGateway) + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + + workspaceModel.Gateway getGateway(1: required string gatewayId) + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + + bool deleteGateway(1: required string gatewayId) + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + + list<workspaceModel.Gateway> getAllGateways() + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + + bool isGatewayExist(1: required string gatewayId) + throws (1: airavataErrors.InvalidRequestException ire, + 2: airavataErrors.AiravataClientException ace, + 3: airavataErrors.AiravataSystemException ase) + /** * Create a Project * http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift ---------------------------------------------------------------------- diff --git a/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift b/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift index 3839890..83c808c 100644 --- a/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift +++ b/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift @@ -23,8 +23,6 @@ namespace php Airavata.Model.AppCatalog.GatewayProfile namespace cpp apache.airavata.model.appcatalog.gatewayprofile include "computeResourceModel.thrift" -const string DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS" - /** * Gateway specific preferences for a Computer Resource * @@ -80,8 +78,6 @@ struct ComputeResourcePreference { * */ struct GatewayResourceProfile { - 1: required string gatewayID = DEFAULT_ID, - 2: required string gatewayName, - 3: optional string gatewayDescription, - 4: optional list<ComputeResourcePreference> computeResourcePreferences + 1: required string gatewayID, + 2: optional list<ComputeResourcePreference> computeResourcePreferences } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/airavata-api/thrift-interface-descriptions/workspaceModel.thrift ---------------------------------------------------------------------- diff --git a/airavata-api/thrift-interface-descriptions/workspaceModel.thrift b/airavata-api/thrift-interface-descriptions/workspaceModel.thrift index 4b0da09..fd75985 100644 --- a/airavata-api/thrift-interface-descriptions/workspaceModel.thrift +++ b/airavata-api/thrift-interface-descriptions/workspaceModel.thrift @@ -55,6 +55,8 @@ struct User { } struct Gateway { - 1: required string gatewayId = experimentModel.DEFAULT_ID - 2: required string name, + 1: required string gatewayId, + 2: optional string gatewayName, + 3: optional string domain, + 4: optional string emailAddress } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java index c3a3a62..9b4836c 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java @@ -21,27 +21,21 @@ package org.apache.aiaravata.application.catalog.data.impl; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.airavata.appcatalog.cpi.AppCatalogException; import org.airavata.appcatalog.cpi.GwyResourceProfile; -import org.apache.aiaravata.application.catalog.data.model.GatewayProfile; -import org.apache.aiaravata.application.catalog.data.resources.AbstractResource; -import org.apache.aiaravata.application.catalog.data.resources.ComputeHostPreferenceResource; -import org.apache.aiaravata.application.catalog.data.resources.ComputeResourceResource; -import org.apache.aiaravata.application.catalog.data.resources.GatewayProfileResource; -import org.apache.aiaravata.application.catalog.data.resources.Resource; +import org.apache.aiaravata.application.catalog.data.resources.*; import org.apache.aiaravata.application.catalog.data.util.AppCatalogThriftConversion; -import org.apache.aiaravata.application.catalog.data.util.AppCatalogUtils; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; import org.apache.airavata.model.appcatalog.gatewayprofile.gatewayResourceProfileModelConstants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + public class GwyResourceProfileImpl implements GwyResourceProfile { private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileImpl.class); @@ -49,15 +43,11 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { public String addGatewayResourceProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException { try { GatewayProfileResource profileResource = new GatewayProfileResource(); - profileResource.setGatewayName(gatewayProfile.getGatewayName()); if (!gatewayProfile.getGatewayID().equals("") && !gatewayProfile.getGatewayID().equals(gatewayResourceProfileModelConstants.DEFAULT_ID)){ profileResource.setGatewayID(gatewayProfile.getGatewayID()); - }else { - profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName())); } - profileResource.setGatewayDesc(gatewayProfile.getGatewayDescription()); + profileResource.setGatewayID(gatewayProfile.getGatewayID()); profileResource.save(); - gatewayProfile.setGatewayID(profileResource.getGatewayID()); List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences(); if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){ for (ComputeResourcePreference preference : computeResourcePreferences ){ @@ -94,8 +84,6 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { try { GatewayProfileResource profileResource = new GatewayProfileResource(); GatewayProfileResource existingGP = (GatewayProfileResource)profileResource.get(gatewayId); - existingGP.setGatewayName(updatedProfile.getGatewayName()); - existingGP.setGatewayDesc(updatedProfile.getGatewayDescription()); existingGP.save(); List<ComputeResourcePreference> computeResourcePreferences = updatedProfile.getComputeResourcePreferences(); @@ -225,7 +213,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException { try { GatewayProfileResource profileResource = new GatewayProfileResource(); - List<Resource> resourceList = profileResource.get(AbstractResource.GatewayProfileConstants.GATEWAY_NAME, gatewayName); + List<Resource> resourceList = profileResource.get(AbstractResource.GatewayProfileConstants.GATEWAY_ID, gatewayName); List<String> gatewayIds = new ArrayList<String>(); if (resourceList != null && !resourceList.isEmpty()){ for (Resource resource : resourceList){ http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java index 0bcb096..a771393 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/model/GatewayProfile.java @@ -34,10 +34,6 @@ public class GatewayProfile implements Serializable { @Id @Column(name = "GATEWAY_ID") private String gatewayID; - @Column(name = "GATEWAY_NAME") - private String gatewayName; - @Column(name = "GATEWAY_DESC") - private String gatewayDesc; @Column(name = "CREATION_TIME") private Timestamp creationTime; @@ -69,19 +65,4 @@ public class GatewayProfile implements Serializable { this.gatewayID = gatewayID; } - public String getGatewayName() { - return gatewayName; - } - - public void setGatewayName(String gatewayName) { - this.gatewayName = gatewayName; - } - - public String getGatewayDesc() { - return gatewayDesc; - } - - public void setGatewayDesc(String gatewayDesc) { - this.gatewayDesc = gatewayDesc; - } } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java index cd6e28c..9b6913a 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/AbstractResource.java @@ -261,7 +261,6 @@ public abstract class AbstractResource implements Resource { public final class GatewayProfileConstants { public static final String GATEWAY_ID = "gatewayID"; - public static final String GATEWAY_NAME = "gatewayName"; public static final String GATEWAY_DESC = "gatewayDesc"; } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java index 0168d90..84a90ec 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/resources/GatewayProfileResource.java @@ -39,8 +39,6 @@ public class GatewayProfileResource extends AbstractResource { private final static Logger logger = LoggerFactory.getLogger(GatewayProfileResource.class); private String gatewayID; - private String gatewayName; - private String gatewayDesc; private Timestamp createdTime; private Timestamp updatedTime; @@ -133,8 +131,8 @@ public class GatewayProfileResource extends AbstractResource { gatewayProfileResources.add(gatewayProfileResource); } } - } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_NAME)) { - generator.setParameter(GatewayProfileConstants.GATEWAY_NAME, value); + } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) { + generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value); q = generator.selectQuery(em); results = q.getResultList(); if (results.size() != 0) { @@ -225,8 +223,8 @@ public class GatewayProfileResource extends AbstractResource { gatewayProfileResourceIDs.add(gatewayProfile.getGatewayID()); } } - } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_NAME)) { - generator.setParameter(GatewayProfileConstants.GATEWAY_NAME, value); + } else if (fieldName.equals(GatewayProfileConstants.GATEWAY_ID)) { + generator.setParameter(GatewayProfileConstants.GATEWAY_ID, value); q = generator.selectQuery(em); results = q.getResultList(); if (results.size() != 0) { @@ -267,15 +265,11 @@ public class GatewayProfileResource extends AbstractResource { em = AppCatalogJPAUtils.getEntityManager(); em.getTransaction().begin(); if (existingGatewayProfile != null) { - existingGatewayProfile.setGatewayDesc(gatewayDesc); - existingGatewayProfile.setGatewayName(gatewayName); existingGatewayProfile.setUpdateTime(AiravataUtils.getCurrentTimestamp()); em.merge(existingGatewayProfile); } else { GatewayProfile gatewayProfile = new GatewayProfile(); gatewayProfile.setGatewayID(gatewayID); - gatewayProfile.setGatewayName(gatewayName); - gatewayProfile.setGatewayDesc(gatewayDesc); gatewayProfile.setCreationTime(AiravataUtils.getCurrentTimestamp()); em.persist(gatewayProfile); } @@ -321,20 +315,4 @@ public class GatewayProfileResource extends AbstractResource { public void setGatewayID(String gatewayID) { this.gatewayID = gatewayID; } - - public String getGatewayName() { - return gatewayName; - } - - public void setGatewayName(String gatewayName) { - this.gatewayName = gatewayName; - } - - public String getGatewayDesc() { - return gatewayDesc; - } - - public void setGatewayDesc(String gatewayDesc) { - this.gatewayDesc = gatewayDesc; - } } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java index 6f8777b..81c2df1 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogJPAUtils.java @@ -850,8 +850,6 @@ public class AppCatalogJPAUtils { GatewayProfileResource resource = new GatewayProfileResource(); if (o != null) { resource.setGatewayID(o.getGatewayID()); - resource.setGatewayName(o.getGatewayName()); - resource.setGatewayDesc(o.getGatewayDesc()); resource.setCreatedTime(o.getCreationTime()); if (o.getUpdateTime() != null){ resource.setUpdatedTime(o.getUpdateTime()); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java index 904c215..7bbd587 100644 --- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java +++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/util/AppCatalogThriftConversion.java @@ -765,8 +765,6 @@ public class AppCatalogThriftConversion { public static GatewayResourceProfile getGatewayResourceProfile(GatewayProfileResource gw, List<ComputeResourcePreference> preferences){ GatewayResourceProfile gatewayProfile = new GatewayResourceProfile(); gatewayProfile.setGatewayID(gw.getGatewayID()); - gatewayProfile.setGatewayDescription(gw.getGatewayDesc()); - gatewayProfile.setGatewayName(gw.getGatewayName()); gatewayProfile.setComputeResourcePreferences(preferences); return gatewayProfile; } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql index 0ca4551..c366bc2 100644 --- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql +++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-derby.sql @@ -309,8 +309,6 @@ CREATE TABLE APPLICATION_OUTPUT CREATE TABLE GATEWAY_PROFILE ( GATEWAY_ID VARCHAR(255), - GATEWAY_NAME VARCHAR(255), - GATEWAY_DESC VARCHAR(255), CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', PRIMARY KEY(GATEWAY_ID) http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql index 9dbf5d9..304175a 100644 --- a/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql +++ b/modules/app-catalog/app-catalog-data/src/main/resources/appcatalog-mysql.sql @@ -309,9 +309,7 @@ CREATE TABLE APPLICATION_OUTPUT CREATE TABLE GATEWAY_PROFILE ( GATEWAY_ID VARCHAR(255), - GATEWAY_NAME VARCHAR(255), - GATEWAY_DESC VARCHAR(255), - CREATION_TIME TIMESTAMP DEFAULT NOW(), + CREATION_TIME TIMESTAMP DEFAULT NOW(), UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' , PRIMARY KEY(GATEWAY_ID) ); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java index 5e3563d..02b4a01 100644 --- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java +++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/GatewayProfileTest.java @@ -71,8 +71,6 @@ public class GatewayProfileTest { public void gatewayProfileTest() throws Exception { GwyResourceProfile gatewayProfile = appcatalog.getGatewayProfile(); GatewayResourceProfile gf = new GatewayResourceProfile(); - gf.setGatewayName("test"); - gf.setGatewayDescription("test gateway"); ComputeResource computeRs = appcatalog.getComputeResource(); ComputeResourceDescription cm1 = new ComputeResourceDescription(); cm1.setHostName("localhost"); @@ -106,12 +104,13 @@ public class GatewayProfileTest { list.add(preference1); list.add(preference2); gf.setComputeResourcePreferences(list); + gf.setGatewayID("testGateway"); String gwId = gatewayProfile.addGatewayResourceProfile(gf); GatewayResourceProfile retrievedProfile = null; if (gatewayProfile.isGatewayResourceProfileExists(gwId)){ retrievedProfile = gatewayProfile.getGatewayProfile(gwId); - System.out.println("************ gateway name ************** :" + retrievedProfile.getGatewayName()); + System.out.println("************ gateway id ************** :" + retrievedProfile.getGatewayID()); } List<ComputeResourcePreference> preferences = gatewayProfile.getAllComputeResourcePreferences(gwId); System.out.println("compute preferences size : " + preferences.size()); http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql ---------------------------------------------------------------------- diff --git a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql b/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql index 0ca4551..c366bc2 100644 --- a/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql +++ b/modules/app-catalog/app-catalog-data/src/test/resources/appcatalog-derby.sql @@ -309,8 +309,6 @@ CREATE TABLE APPLICATION_OUTPUT CREATE TABLE GATEWAY_PROFILE ( GATEWAY_ID VARCHAR(255), - GATEWAY_NAME VARCHAR(255), - GATEWAY_DESC VARCHAR(255), CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP, UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00', PRIMARY KEY(GATEWAY_ID) http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java ---------------------------------------------------------------------- diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java index 2d833de..2823202 100644 --- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java +++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java @@ -114,7 +114,7 @@ public class DocumentCreatorNew { null, null); gatewayResourceProfile = new GatewayResourceProfile(); // gatewayResourceProfile.setGatewayID("default"); - gatewayResourceProfile.setGatewayName(ClientSettings.getSetting("default.registry.gateway", "php_reference_gateway")); + gatewayResourceProfile.setGatewayID(ClientSettings.getSetting("default.registry.gateway", "php_reference_gateway")); gatewayResourceProfile.addToComputeResourcePreferences(computeResourcePreference); String gatewayId = client.registerGatewayResourceProfile(gatewayResourceProfile); gatewayResourceProfile.setGatewayID(gatewayId); @@ -132,7 +132,7 @@ public class DocumentCreatorNew { if (gatewayResourceProfile == null) { gatewayResourceProfile = new GatewayResourceProfile(); // gatewayResourceProfile.setGatewayID("default"); - gatewayResourceProfile.setGatewayName("default"); + gatewayResourceProfile.setGatewayID("default"); gatewayResourceProfile.setGatewayID(client.registerGatewayResourceProfile(gatewayResourceProfile)); } // } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java index 9eeaa3c..ac59ce8 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/ResourceUtils.java @@ -235,6 +235,39 @@ public class ResourceUtils { } + public static List<Resource> getAllGateways() throws RegistryException{ + List<Resource> resourceList = new ArrayList<Resource>(); + EntityManager em = null; + try { + em = getEntityManager(); + em.getTransaction().begin(); + QueryGenerator generator = new QueryGenerator(AbstractResource.GATEWAY); + Query q = generator.selectQuery(em); + List results = q.getResultList(); + if (results.size() != 0) { + for (Object result : results) { + Gateway gateway = (Gateway) result; + GatewayResource gatewayResource = + (GatewayResource) Utils.getResource(ResourceType.GATEWAY, gateway); + resourceList.add(gatewayResource); + } + } + em.getTransaction().commit(); + em.close(); + }catch (Exception e){ + logger.error(e.getMessage(), e); + throw new RegistryException(e); + }finally { + if (em != null && em.isOpen()){ + if (em.getTransaction().isActive()){ + em.getTransaction().rollback(); + } + em.close(); + } + } + return resourceList; + } + /** * @param gatewayId * @return http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java index 035258e..d38b5df 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java @@ -23,11 +23,21 @@ package org.apache.airavata.persistance.registry.jpa.impl; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; +import org.apache.airavata.model.workspace.Gateway; +import org.apache.airavata.persistance.registry.jpa.Resource; import org.apache.airavata.persistance.registry.jpa.ResourceUtils; import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource; +import org.apache.airavata.persistance.registry.jpa.utils.ThriftDataModelConversion; import org.apache.airavata.registry.cpi.RegistryException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; public class GatewayRegistry { + + private final static Logger logger = LoggerFactory.getLogger(GatewayRegistry.class); public GatewayResource getDefaultGateway () throws ApplicationSettingsException, RegistryException { return (GatewayResource)ResourceUtils.getGateway(ServerSettings.getDefaultUserGateway()); } @@ -36,4 +46,70 @@ public class GatewayRegistry { return (GatewayResource)ResourceUtils.getGateway(gatewayName); } + public String addGateway (Gateway gateway) throws RegistryException{ + try { + GatewayResource resource = (GatewayResource)ResourceUtils.createGateway(gateway.getGatewayId()); + resource.setGatewayName(gateway.getGatewayName()); + resource.setEmailAddress(gateway.getEmailAddress()); + resource.setDomain(gateway.getDomain()); + resource.save(); + return gateway.getGatewayId(); + }catch (RegistryException e){ + logger.error("Error while saving gateway to registry", e); + throw new RegistryException(e); + } + } + + public void updateGateway (String gatewayId, Gateway updatedGateway) throws RegistryException{ + try { + GatewayResource existingGateway = (GatewayResource)ResourceUtils.getGateway(gatewayId); + existingGateway.setGatewayName(updatedGateway.getGatewayName()); + existingGateway.setEmailAddress(updatedGateway.getEmailAddress()); + existingGateway.setDomain(updatedGateway.getDomain()); + existingGateway.save(); + }catch (RegistryException e){ + logger.error("Error while updating gateway to registry", e); + throw new RegistryException(e); + } + } + + public Gateway getGateway (String gatewayId) throws RegistryException{ + try { + GatewayResource resource = (GatewayResource)ResourceUtils.getGateway(gatewayId); + return ThriftDataModelConversion.getGateway(resource); + }catch (RegistryException e){ + logger.error("Error while getting gateway", e); + throw new RegistryException(e); + } + } + + public boolean isGatewayExist (String gatewayId) throws RegistryException{ + try { + return ResourceUtils.isGatewayExist(gatewayId); + }catch (RegistryException e){ + logger.error("Error while checking gateway exists", e); + throw new RegistryException(e); + } + } + + public boolean removeGateway (String gatewayId) throws RegistryException{ + try { + return ResourceUtils.removeGateway(gatewayId); + }catch (Exception e){ + logger.error("Error while removing the gateway", e); + throw new RegistryException(e); + } + } + + public List<Gateway> getAllGateways () throws RegistryException { + List<Gateway> gatewayList = new ArrayList<Gateway>(); + try { + List<Resource> allGateways = ResourceUtils.getAllGateways(); + return ThriftDataModelConversion.getAllGateways(allGateways); + }catch (Exception e){ + logger.error("Error while getting all the gateways", e); + throw new RegistryException(e); + } + } + } http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java index a8d4dbf..d09c0e9 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java @@ -24,6 +24,7 @@ package org.apache.airavata.persistance.registry.jpa.impl; import org.apache.airavata.common.exception.ApplicationSettingsException; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; +import org.apache.airavata.model.workspace.Gateway; import org.apache.airavata.model.workspace.Project; import org.apache.airavata.model.workspace.experiment.*; import org.apache.airavata.persistance.registry.jpa.ResourceUtils; @@ -43,6 +44,7 @@ public class RegistryImpl implements Registry { private final static Logger logger = LoggerFactory.getLogger(RegistryImpl.class); private ExperimentRegistry experimentRegistry = null; private ProjectRegistry projectRegistry = null; + private GatewayRegistry gatewayRegistry = null; public RegistryImpl() throws RegistryException{ try { @@ -62,6 +64,7 @@ public class RegistryImpl implements Registry { } experimentRegistry = new ExperimentRegistry(gatewayResource, user); projectRegistry = new ProjectRegistry(gatewayResource, user); + gatewayRegistry = new GatewayRegistry(); } catch (ApplicationSettingsException e) { logger.error("Unable to read airavata server properties..", e); throw new RegistryException("Unable to read airavata server properties..", e); @@ -104,6 +107,8 @@ public class RegistryImpl implements Registry { return projectRegistry.addProject((Project)newObjectToAdd); case EXPERIMENT: return experimentRegistry.addExperiment((Experiment) newObjectToAdd); + case GATEWAY: + return gatewayRegistry.addGateway((Gateway)newObjectToAdd); default: logger.error("Unsupported top level type..", new UnsupportedOperationException()); throw new UnsupportedOperationException(); @@ -197,6 +202,8 @@ public class RegistryImpl implements Registry { case PROJECT: projectRegistry.updateProject((Project)newObjectToUpdate, (String)identifier); break; + case GATEWAY: + gatewayRegistry.updateGateway((String)identifier, (Gateway)newObjectToUpdate); case EXPERIMENT: experimentRegistry.updateExperiment((Experiment) newObjectToUpdate, (String) identifier); break; @@ -315,6 +322,8 @@ public class RegistryImpl implements Registry { switch (dataType) { case PROJECT: return projectRegistry.getProject((String)identifier); + case GATEWAY: + return gatewayRegistry.getGateway((String)identifier); case EXPERIMENT: return experimentRegistry.getExperiment((String) identifier, null); case EXPERIMENT_CONFIGURATION_DATA: @@ -384,6 +393,12 @@ public class RegistryImpl implements Registry { result.add(project); } return result; + case GATEWAY: + List<Gateway> allGateways = gatewayRegistry.getAllGateways(); + for (Gateway gateway : allGateways){ + result.add(gateway); + } + return result; case EXPERIMENT: List<Experiment> experimentList = experimentRegistry.getExperimentList(fieldName, value); for (Experiment experiment : experimentList) { @@ -550,6 +565,9 @@ public class RegistryImpl implements Registry { case PROJECT: projectRegistry.removeProject((String)identifier); break; + case GATEWAY: + gatewayRegistry.removeGateway((String)identifier); + break; case EXPERIMENT: experimentRegistry.removeExperiment((String) identifier); break; @@ -606,6 +624,8 @@ public class RegistryImpl implements Registry { switch (dataType) { case PROJECT: return projectRegistry.isProjectExist((String)identifier); + case GATEWAY: + return gatewayRegistry.isGatewayExist((String)identifier); case EXPERIMENT: return experimentRegistry.isExperimentExist((String) identifier); case EXPERIMENT_CONFIGURATION_DATA: http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java index b48bec8..7aec17e 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/utils/ThriftDataModelConversion.java @@ -26,6 +26,7 @@ import java.util.List; import org.apache.airavata.common.utils.StringUtil; import org.apache.airavata.model.appcatalog.appinterface.*; +import org.apache.airavata.model.workspace.Gateway; import org.apache.airavata.model.workspace.Project; import org.apache.airavata.model.workspace.experiment.ActionableGroup; import org.apache.airavata.model.workspace.experiment.AdvancedInputDataHandling; @@ -54,6 +55,7 @@ import org.apache.airavata.model.workspace.experiment.UserConfigurationData; import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; import org.apache.airavata.model.workspace.experiment.WorkflowNodeState; import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus; +import org.apache.airavata.persistance.registry.jpa.Resource; import org.apache.airavata.persistance.registry.jpa.ResourceType; import org.apache.airavata.persistance.registry.jpa.resources.*; import org.apache.airavata.registry.cpi.RegistryException; @@ -86,6 +88,23 @@ public class ThriftDataModelConversion { return null; } + public static Gateway getGateway (GatewayResource resource){ + Gateway gateway = new Gateway(); + gateway.setGatewayId(resource.getGatewayId()); + gateway.setGatewayName(resource.getGatewayName()); + gateway.setDomain(resource.getDomain()); + gateway.setEmailAddress(resource.getEmailAddress()); + return gateway; + } + + public static List<Gateway> getAllGateways (List<Resource> gatewayList){ + List<Gateway> gateways = new ArrayList<Gateway>(); + for (Resource resource : gatewayList){ + gateways.add(getGateway((GatewayResource)resource)); + } + return gateways; + } + public static Experiment getExperiment(ExperimentResource experimentResource) throws RegistryException { if (experimentResource != null){ http://git-wip-us.apache.org/repos/asf/airavata/blob/658e5e9e/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ParentDataType.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ParentDataType.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ParentDataType.java index 2c727f2..c91622d 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ParentDataType.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/ParentDataType.java @@ -24,7 +24,8 @@ public enum ParentDataType { GROUP, USER, PROJECT, - EXPERIMENT + EXPERIMENT, + GATEWAY }
