You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2014/07/07 06:30:29 UTC

[1/2] Disambiguating GatewayProfile from GatewayResourceProfile. App Catalog deals with later, while admin API will have to deal with former - AIRAVATA-1228

Repository: airavata
Updated Branches:
  refs/heads/master f7008b97c -> e085880b5


http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/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
new file mode 100644
index 0000000..cf4eb4f
--- /dev/null
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
@@ -0,0 +1,192 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.aiaravata.application.catalog.data.impl;
+
+import org.airavata.appcatalog.cpi.AppCatalogException;
+import org.airavata.appcatalog.cpi.GwyResourceProfile;
+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.computeresource.DataMovementProtocol;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+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);
+
+    @Override
+    public String addGatewayProfile(org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException {
+        try {
+            GatewayProfileResource profileResource = new GatewayProfileResource();
+            profileResource.setGatewayName(gatewayProfile.getGatewayName());
+            profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName()));
+            profileResource.setGatewayDesc(gatewayProfile.getGatewayDescription());
+            profileResource.save();
+            gatewayProfile.setGatewayID(profileResource.getGatewayID());
+            List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
+            if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
+                for (ComputeResourcePreference preference : computeResourcePreferences ){
+                    ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
+                    resource.setGatewayProfile(profileResource);
+                    resource.setResourceId(preference.getComputeResourceId());
+                    ComputeResourceResource computeHostResource = new ComputeResourceResource();
+                    resource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
+                    resource.setGatewayId(profileResource.getGatewayID());
+                    resource.setOverrideByAiravata(preference.isOverridebyAiravata());
+                    resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol());
+                    resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol());
+                    resource.setBatchQueue(preference.getPreferredBatchQueue());
+                    resource.setProjectNumber(preference.getAllocationProjectNumber());
+                    resource.setScratchLocation(preference.getScratchLocation());
+                    resource.save();
+                }
+            }
+            return profileResource.getGatewayID();
+        }catch (Exception e) {
+            logger.error("Error while saving gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public void updateGatewayProfile(String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException {
+        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();
+            if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
+                for (ComputeResourcePreference preference : computeResourcePreferences ){
+                    ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
+                    Map<String, String> ids = new HashMap<String, String>();
+                    ids.put(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+                    ids.put(AbstractResource.ComputeResourcePreferenceConstants.RESOURCE_ID, preference.getComputeResourceId());
+                    ComputeHostPreferenceResource existingPreferenceResource = (ComputeHostPreferenceResource)resource.get(ids);
+
+                    existingPreferenceResource.setGatewayProfile(existingGP);
+                    existingPreferenceResource.setResourceId(preference.getComputeResourceId());
+                    ComputeResourceResource computeHostResource = new ComputeResourceResource();
+                    existingPreferenceResource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
+                    existingPreferenceResource.setGatewayId(gatewayId);
+                    existingPreferenceResource.setOverrideByAiravata(preference.isOverridebyAiravata());
+                    existingPreferenceResource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol());
+                    existingPreferenceResource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol());
+                    existingPreferenceResource.setBatchQueue(preference.getPreferredBatchQueue());
+                    existingPreferenceResource.setProjectNumber(preference.getAllocationProjectNumber());
+                    existingPreferenceResource.setScratchLocation(preference.getScratchLocation());
+                    existingPreferenceResource.save();
+                }
+            }
+        }catch (Exception e) {
+            logger.error("Error while updating gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile getGatewayProfile(String gatewayId) throws AppCatalogException {
+        try {
+            GatewayProfileResource resource = new GatewayProfileResource();
+            GatewayProfileResource gwresource = (GatewayProfileResource)resource.get(gatewayId);
+            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
+            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+            List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
+            return AppCatalogThriftConversion.getGatewayResourceProfile(gwresource, computeResourcePreferences);
+        }catch (Exception e) {
+            logger.error("Error while retrieving gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+
+    @Override
+    public JobSubmissionProtocol getPreferedJobSubmissionProtocol(String gatewayId, String hostId) throws AppCatalogException{
+        try {
+            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
+            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+            if (computePrefList != null && !computePrefList.isEmpty()){
+                for (Resource pref : computePrefList){
+                    ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource)pref;
+                    if (preferenceResource.getResourceId().equals(hostId)){
+                        return JobSubmissionProtocol.valueOf(preferenceResource.getPreferredJobProtocol());
+                    }
+                }
+            }
+        }catch (Exception e) {
+            logger.error("Error while retrieving job submission protocol for given host and gateway...", e);
+            throw new AppCatalogException(e);
+        }
+        return null;
+    }
+
+    @Override
+    public DataMovementProtocol getPreferedDMProtocol(String gatewayId, String hostId) throws AppCatalogException{
+        try {
+            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
+            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
+            if (computePrefList != null && !computePrefList.isEmpty()){
+                for (Resource pref : computePrefList){
+                    ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource)pref;
+                    if (preferenceResource.getResourceId().equals(hostId)){
+                        return DataMovementProtocol.valueOf(preferenceResource.getPreferedDMProtocol());
+                    }
+                }
+            }
+        }catch (Exception e) {
+            logger.error("Error while retrieving data movement protocol for given host and gateway...", e);
+            throw new AppCatalogException(e);
+        }
+        return null;
+    }
+
+
+    @Override
+    public boolean removeGatewayProfile(String gatewayId) throws AppCatalogException {
+       try {
+           GatewayProfileResource resource = new GatewayProfileResource();
+           resource.remove(gatewayId);
+           return true;
+       }catch (Exception e) {
+           logger.error("Error while deleting gateway profile...", e);
+           throw new AppCatalogException(e);
+       }
+    }
+
+    @Override
+    public boolean isGatewayProfileExists(String gatewayId) throws AppCatalogException {
+        try {
+            GatewayProfileResource resource = new GatewayProfileResource();
+            return resource.isExists(gatewayId);
+        }catch (Exception e) {
+            logger.error("Error while retrieving gateway profile...", e);
+            throw new AppCatalogException(e);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/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 553221f..d15293e 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
@@ -85,7 +85,7 @@ import org.apache.airavata.model.appcatalog.computeresource.SCPDataMovement;
 import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission;
 import org.apache.airavata.model.appcatalog.computeresource.SecurityProtocol;
 import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayProfile;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
 
 public class AppCatalogThriftConversion {
     public static ComputeResourceResource getComputeHostResource (ComputeResourceDescription description){
@@ -679,8 +679,8 @@ public class AppCatalogThriftConversion {
         return preferences;
     }
 
-    public static GatewayProfile getGatewayProfile (GatewayProfileResource gw, List<ComputeResourcePreference> preferences){
-        GatewayProfile gatewayProfile = new GatewayProfile();
+    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());

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/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 1bd5fe5..2557d36 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
@@ -24,7 +24,6 @@ package org.apache.airavata.persistance.registry.jpa.utils;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayProfile;
 import org.apache.airavata.model.workspace.Project;
 import org.apache.airavata.model.workspace.experiment.ActionableGroup;
 import org.apache.airavata.model.workspace.experiment.AdvancedInputDataHandling;


[2/2] git commit: Disambiguating GatewayProfile from GatewayResourceProfile. App Catalog deals with later, while admin API will have to deal with former - AIRAVATA-1228

Posted by sm...@apache.org.
Disambiguating GatewayProfile from GatewayResourceProfile. App Catalog deals with later, while admin API will have to deal with former - AIRAVATA-1228


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e085880b
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e085880b
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e085880b

Branch: refs/heads/master
Commit: e085880b5b1691eb4b38bd02e96d8b9a5df7bf59
Parents: f7008b9
Author: Suresh Marru <sm...@apache.org>
Authored: Mon Jul 7 00:30:22 2014 -0400
Committer: Suresh Marru <sm...@apache.org>
Committed: Mon Jul 7 00:30:22 2014 -0400

----------------------------------------------------------------------
 .../Model/AppCatalog/GatewayProfile/Types.php   |   6 +-
 .../gatewayprofile/GatewayProfile.java          | 771 -------------------
 .../gatewayprofile/GatewayResourceProfile.java  | 771 +++++++++++++++++++
 .../gatewayProfileModelConstants.java           |  55 --
 .../gatewayResourceProfileModel.thrift          |   2 +-
 .../client/tools/DocumentCreatorNew.java        |  10 +-
 .../client/tools/DocumentCreatorUtils.java      |   9 +-
 .../org/airavata/appcatalog/cpi/AppCatalog.java |   2 +-
 .../org/airavata/appcatalog/cpi/GProfile.java   |  60 --
 .../appcatalog/cpi/GwyResourceProfile.java      |  60 ++
 .../catalog/data/impl/AppCatalogImpl.java       |  12 +-
 .../catalog/data/impl/GatewayProfileImpl.java   | 193 -----
 .../data/impl/GwyResourceProfileImpl.java       | 192 +++++
 .../data/util/AppCatalogThriftConversion.java   |   6 +-
 .../jpa/utils/ThriftDataModelConversion.java    |   1 -
 15 files changed, 1042 insertions(+), 1108 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/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 d6afdc6..faf2b05 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
@@ -209,7 +209,7 @@ class ComputeResourcePreference {
 
 }
 
-class GatewayProfile {
+class GatewayResourceProfile {
   static $_TSPEC;
 
   public $gatewayID = "DO_NOT_SET_AT_CLIENTS";
@@ -260,7 +260,7 @@ class GatewayProfile {
   }
 
   public function getName() {
-    return 'GatewayProfile';
+    return 'GatewayResourceProfile';
   }
 
   public function read($input)
@@ -329,7 +329,7 @@ class GatewayProfile {
 
   public function write($output) {
     $xfer = 0;
-    $xfer += $output->writeStructBegin('GatewayProfile');
+    $xfer += $output->writeStructBegin('GatewayResourceProfile');
     if ($this->gatewayID !== null) {
       $xfer += $output->writeFieldBegin('gatewayID', TType::STRING, 1);
       $xfer += $output->writeString($this->gatewayID);

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayProfile.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayProfile.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayProfile.java
deleted file mode 100644
index 04e5ec8..0000000
--- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayProfile.java
+++ /dev/null
@@ -1,771 +0,0 @@
-    /*
-     * Licensed to the Apache Software Foundation (ASF) under one or more
-     * contributor license agreements.  See the NOTICE file distributed with
-     * this work for additional information regarding copyright ownership.
-     * The ASF licenses this file to You under the Apache License, Version 2.0
-     * (the "License"); you may not use this file except in compliance with
-     * the License.  You may obtain a copy of the License at
-     *
-     *     http://www.apache.org/licenses/LICENSE-2.0
-     *
-     * Unless required by applicable law or agreed to in writing, software
-     * distributed under the License is distributed on an "AS IS" BASIS,
-     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     * See the License for the specific language governing permissions and
-     * limitations under the License.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.model.appcatalog.gatewayprofile;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Gateway Resource Profile
- * 
- * gatewayID:
- *   Unique identifier for the gateway assigned by Airavata. Corelate this to Airavata Admin API Gateway Registration.
- * 
- * gatewayName:
- *   Name of the Gateway.
- * 
- * gatewayDescription:
- *  A user friendly description of the gateway.
- * 
- * computeResourcePreferences:
- *  List of resource preferences for each of the registered compute resources.
- * 
- * 
- */
-@SuppressWarnings("all") public class GatewayProfile implements org.apache.thrift.TBase<GatewayProfile, GatewayProfile._Fields>, java.io.Serializable, Cloneable, Comparable<GatewayProfile> {
-  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("GatewayProfile");
-
-  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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
-  static {
-    schemes.put(StandardScheme.class, new GatewayProfileStandardSchemeFactory());
-    schemes.put(TupleScheme.class, new GatewayProfileTupleSchemeFactory());
-  }
-
-  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");
-
-    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
-
-    static {
-      for (_Fields field : EnumSet.allOf(_Fields.class)) {
-        byName.put(field.getFieldName(), field);
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, or null if its not found.
-     */
-    public static _Fields findByThriftId(int fieldId) {
-      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
-          return COMPUTE_RESOURCE_PREFERENCES;
-        default:
-          return null;
-      }
-    }
-
-    /**
-     * Find the _Fields constant that matches fieldId, throwing an exception
-     * if it is not found.
-     */
-    public static _Fields findByThriftIdOrThrow(int fieldId) {
-      _Fields fields = findByThriftId(fieldId);
-      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
-      return fields;
-    }
-
-    /**
-     * Find the _Fields constant that matches name, or null if its not found.
-     */
-    public static _Fields findByName(String name) {
-      return byName.get(name);
-    }
-
-    private final short _thriftId;
-    private final String _fieldName;
-
-    _Fields(short thriftId, String fieldName) {
-      _thriftId = thriftId;
-      _fieldName = fieldName;
-    }
-
-    public short getThriftFieldId() {
-      return _thriftId;
-    }
-
-    public String getFieldName() {
-      return _fieldName;
-    }
-  }
-
-  // isset id assignments
-  private _Fields optionals[] = {_Fields.GATEWAY_DESCRIPTION,_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))));
-    metaDataMap = Collections.unmodifiableMap(tmpMap);
-    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GatewayProfile.class, metaDataMap);
-  }
-
-  public GatewayProfile() {
-    this.gatewayID = "DO_NOT_SET_AT_CLIENTS";
-
-  }
-
-  public GatewayProfile(
-    String gatewayID,
-    String gatewayName)
-  {
-    this();
-    this.gatewayID = gatewayID;
-    this.gatewayName = gatewayName;
-  }
-
-  /**
-   * Performs a deep copy on <i>other</i>.
-   */
-  public GatewayProfile(GatewayProfile other) {
-    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) {
-        __this__computeResourcePreferences.add(new ComputeResourcePreference(other_element));
-      }
-      this.computeResourcePreferences = __this__computeResourcePreferences;
-    }
-  }
-
-  public GatewayProfile deepCopy() {
-    return new GatewayProfile(this);
-  }
-
-  @Override
-  public void clear() {
-    this.gatewayID = "DO_NOT_SET_AT_CLIENTS";
-
-    this.gatewayName = null;
-    this.gatewayDescription = null;
-    this.computeResourcePreferences = null;
-  }
-
-  public String getGatewayID() {
-    return this.gatewayID;
-  }
-
-  public void setGatewayID(String gatewayID) {
-    this.gatewayID = gatewayID;
-  }
-
-  public void unsetGatewayID() {
-    this.gatewayID = null;
-  }
-
-  /** Returns true if field gatewayID is set (has been assigned a value) and false otherwise */
-  public boolean isSetGatewayID() {
-    return this.gatewayID != null;
-  }
-
-  public void setGatewayIDIsSet(boolean value) {
-    if (!value) {
-      this.gatewayID = null;
-    }
-  }
-
-  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();
-  }
-
-  public java.util.Iterator<ComputeResourcePreference> getComputeResourcePreferencesIterator() {
-    return (this.computeResourcePreferences == null) ? null : this.computeResourcePreferences.iterator();
-  }
-
-  public void addToComputeResourcePreferences(ComputeResourcePreference elem) {
-    if (this.computeResourcePreferences == null) {
-      this.computeResourcePreferences = new ArrayList<ComputeResourcePreference>();
-    }
-    this.computeResourcePreferences.add(elem);
-  }
-
-  public List<ComputeResourcePreference> getComputeResourcePreferences() {
-    return this.computeResourcePreferences;
-  }
-
-  public void setComputeResourcePreferences(List<ComputeResourcePreference> computeResourcePreferences) {
-    this.computeResourcePreferences = computeResourcePreferences;
-  }
-
-  public void unsetComputeResourcePreferences() {
-    this.computeResourcePreferences = null;
-  }
-
-  /** Returns true if field computeResourcePreferences is set (has been assigned a value) and false otherwise */
-  public boolean isSetComputeResourcePreferences() {
-    return this.computeResourcePreferences != null;
-  }
-
-  public void setComputeResourcePreferencesIsSet(boolean value) {
-    if (!value) {
-      this.computeResourcePreferences = null;
-    }
-  }
-
-  public void setFieldValue(_Fields field, Object value) {
-    switch (field) {
-    case GATEWAY_ID:
-      if (value == null) {
-        unsetGatewayID();
-      } else {
-        setGatewayID((String)value);
-      }
-      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();
-      } else {
-        setComputeResourcePreferences((List<ComputeResourcePreference>)value);
-      }
-      break;
-
-    }
-  }
-
-  public Object getFieldValue(_Fields field) {
-    switch (field) {
-    case GATEWAY_ID:
-      return getGatewayID();
-
-    case GATEWAY_NAME:
-      return getGatewayName();
-
-    case GATEWAY_DESCRIPTION:
-      return getGatewayDescription();
-
-    case COMPUTE_RESOURCE_PREFERENCES:
-      return getComputeResourcePreferences();
-
-    }
-    throw new IllegalStateException();
-  }
-
-  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
-  public boolean isSet(_Fields field) {
-    if (field == null) {
-      throw new IllegalArgumentException();
-    }
-
-    switch (field) {
-    case GATEWAY_ID:
-      return isSetGatewayID();
-    case GATEWAY_NAME:
-      return isSetGatewayName();
-    case GATEWAY_DESCRIPTION:
-      return isSetGatewayDescription();
-    case COMPUTE_RESOURCE_PREFERENCES:
-      return isSetComputeResourcePreferences();
-    }
-    throw new IllegalStateException();
-  }
-
-  @Override
-  public boolean equals(Object that) {
-    if (that == null)
-      return false;
-    if (that instanceof GatewayProfile)
-      return this.equals((GatewayProfile)that);
-    return false;
-  }
-
-  public boolean equals(GatewayProfile that) {
-    if (that == null)
-      return false;
-
-    boolean this_present_gatewayID = true && this.isSetGatewayID();
-    boolean that_present_gatewayID = true && that.isSetGatewayID();
-    if (this_present_gatewayID || that_present_gatewayID) {
-      if (!(this_present_gatewayID && that_present_gatewayID))
-        return false;
-      if (!this.gatewayID.equals(that.gatewayID))
-        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) {
-      if (!(this_present_computeResourcePreferences && that_present_computeResourcePreferences))
-        return false;
-      if (!this.computeResourcePreferences.equals(that.computeResourcePreferences))
-        return false;
-    }
-
-    return true;
-  }
-
-  @Override
-  public int hashCode() {
-    return 0;
-  }
-
-  @Override
-  public int compareTo(GatewayProfile other) {
-    if (!getClass().equals(other.getClass())) {
-      return getClass().getName().compareTo(other.getClass().getName());
-    }
-
-    int lastComparison = 0;
-
-    lastComparison = Boolean.valueOf(isSetGatewayID()).compareTo(other.isSetGatewayID());
-    if (lastComparison != 0) {
-      return lastComparison;
-    }
-    if (isSetGatewayID()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayID, other.gatewayID);
-      if (lastComparison != 0) {
-        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;
-    }
-    if (isSetComputeResourcePreferences()) {
-      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.computeResourcePreferences, other.computeResourcePreferences);
-      if (lastComparison != 0) {
-        return lastComparison;
-      }
-    }
-    return 0;
-  }
-
-  public _Fields fieldForId(int fieldId) {
-    return _Fields.findByThriftId(fieldId);
-  }
-
-  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
-    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
-  }
-
-  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
-    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
-  }
-
-  @Override
-  public String toString() {
-    StringBuilder sb = new StringBuilder("GatewayProfile(");
-    boolean first = true;
-
-    sb.append("gatewayID:");
-    if (this.gatewayID == null) {
-      sb.append("null");
-    } else {
-      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:");
-      if (this.computeResourcePreferences == null) {
-        sb.append("null");
-      } else {
-        sb.append(this.computeResourcePreferences);
-      }
-      first = false;
-    }
-    sb.append(")");
-    return sb.toString();
-  }
-
-  public void validate() throws org.apache.thrift.TException {
-    // check for required fields
-    if (!isSetGatewayID()) {
-      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
-  }
-
-  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
-    try {
-      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
-    try {
-      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
-    } catch (org.apache.thrift.TException te) {
-      throw new java.io.IOException(te);
-    }
-  }
-
-  private static class GatewayProfileStandardSchemeFactory implements SchemeFactory {
-    public GatewayProfileStandardScheme getScheme() {
-      return new GatewayProfileStandardScheme();
-    }
-  }
-
-  private static class GatewayProfileStandardScheme extends StandardScheme<GatewayProfile> {
-
-    public void read(org.apache.thrift.protocol.TProtocol iprot, GatewayProfile struct) throws org.apache.thrift.TException {
-      org.apache.thrift.protocol.TField schemeField;
-      iprot.readStructBegin();
-      while (true)
-      {
-        schemeField = iprot.readFieldBegin();
-        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
-          break;
-        }
-        switch (schemeField.id) {
-          case 1: // GATEWAY_ID
-            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
-              struct.gatewayID = iprot.readString();
-              struct.setGatewayIDIsSet(true);
-            } else { 
-              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
-            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
-              {
-                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
-                struct.computeResourcePreferences = new ArrayList<ComputeResourcePreference>(_list0.size);
-                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
-                {
-                  ComputeResourcePreference _elem2;
-                  _elem2 = new ComputeResourcePreference();
-                  _elem2.read(iprot);
-                  struct.computeResourcePreferences.add(_elem2);
-                }
-                iprot.readListEnd();
-              }
-              struct.setComputeResourcePreferencesIsSet(true);
-            } else { 
-              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-            }
-            break;
-          default:
-            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
-        }
-        iprot.readFieldEnd();
-      }
-      iprot.readStructEnd();
-      struct.validate();
-    }
-
-    public void write(org.apache.thrift.protocol.TProtocol oprot, GatewayProfile struct) throws org.apache.thrift.TException {
-      struct.validate();
-
-      oprot.writeStructBegin(STRUCT_DESC);
-      if (struct.gatewayID != null) {
-        oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
-        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);
-          {
-            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.computeResourcePreferences.size()));
-            for (ComputeResourcePreference _iter3 : struct.computeResourcePreferences)
-            {
-              _iter3.write(oprot);
-            }
-            oprot.writeListEnd();
-          }
-          oprot.writeFieldEnd();
-        }
-      }
-      oprot.writeFieldStop();
-      oprot.writeStructEnd();
-    }
-
-  }
-
-  private static class GatewayProfileTupleSchemeFactory implements SchemeFactory {
-    public GatewayProfileTupleScheme getScheme() {
-      return new GatewayProfileTupleScheme();
-    }
-  }
-
-  private static class GatewayProfileTupleScheme extends TupleScheme<GatewayProfile> {
-
-    @Override
-    public void write(org.apache.thrift.protocol.TProtocol prot, GatewayProfile 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);
-      }
-      if (struct.isSetComputeResourcePreferences()) {
-        {
-          oprot.writeI32(struct.computeResourcePreferences.size());
-          for (ComputeResourcePreference _iter4 : struct.computeResourcePreferences)
-          {
-            _iter4.write(oprot);
-          }
-        }
-      }
-    }
-
-    @Override
-    public void read(org.apache.thrift.protocol.TProtocol prot, GatewayProfile struct) throws org.apache.thrift.TException {
-      TTupleProtocol iprot = (TTupleProtocol) prot;
-      struct.gatewayID = iprot.readString();
-      struct.setGatewayIDIsSet(true);
-      struct.gatewayName = iprot.readString();
-      struct.setGatewayNameIsSet(true);
-      BitSet incoming = iprot.readBitSet(2);
-      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);
-          for (int _i6 = 0; _i6 < _list5.size; ++_i6)
-          {
-            ComputeResourcePreference _elem7;
-            _elem7 = new ComputeResourcePreference();
-            _elem7.read(iprot);
-            struct.computeResourcePreferences.add(_elem7);
-          }
-        }
-        struct.setComputeResourcePreferencesIsSet(true);
-      }
-    }
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/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
new file mode 100644
index 0000000..30b02ab
--- /dev/null
+++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/GatewayResourceProfile.java
@@ -0,0 +1,771 @@
+    /*
+     * Licensed to the Apache Software Foundation (ASF) under one or more
+     * contributor license agreements.  See the NOTICE file distributed with
+     * this work for additional information regarding copyright ownership.
+     * The ASF licenses this file to You under the Apache License, Version 2.0
+     * (the "License"); you may not use this file except in compliance with
+     * the License.  You may obtain a copy of the License at
+     *
+     *     http://www.apache.org/licenses/LICENSE-2.0
+     *
+     * Unless required by applicable law or agreed to in writing, software
+     * distributed under the License is distributed on an "AS IS" BASIS,
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     * See the License for the specific language governing permissions and
+     * limitations under the License.
+     */
+/**
+ * Autogenerated by Thrift Compiler (0.9.1)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.airavata.model.appcatalog.gatewayprofile;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import org.apache.thrift.async.AsyncMethodCallback;
+import org.apache.thrift.server.AbstractNonblockingServer.*;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Gateway Resource Profile
+ * 
+ * gatewayID:
+ *   Unique identifier for the gateway assigned by Airavata. Corelate this to Airavata Admin API Gateway Registration.
+ * 
+ * gatewayName:
+ *   Name of the Gateway.
+ * 
+ * gatewayDescription:
+ *  A user friendly description of the gateway.
+ * 
+ * computeResourcePreferences:
+ *  List of resource preferences for each of the registered compute resources.
+ * 
+ * 
+ */
+@SuppressWarnings("all") public class GatewayResourceProfile implements org.apache.thrift.TBase<GatewayResourceProfile, GatewayResourceProfile._Fields>, java.io.Serializable, Cloneable, Comparable<GatewayResourceProfile> {
+  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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new GatewayResourceProfileStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new GatewayResourceProfileTupleSchemeFactory());
+  }
+
+  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");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      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
+          return COMPUTE_RESOURCE_PREFERENCES;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  private _Fields optionals[] = {_Fields.GATEWAY_DESCRIPTION,_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))));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(GatewayResourceProfile.class, metaDataMap);
+  }
+
+  public GatewayResourceProfile() {
+    this.gatewayID = "DO_NOT_SET_AT_CLIENTS";
+
+  }
+
+  public GatewayResourceProfile(
+    String gatewayID,
+    String gatewayName)
+  {
+    this();
+    this.gatewayID = gatewayID;
+    this.gatewayName = gatewayName;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public GatewayResourceProfile(GatewayResourceProfile other) {
+    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) {
+        __this__computeResourcePreferences.add(new ComputeResourcePreference(other_element));
+      }
+      this.computeResourcePreferences = __this__computeResourcePreferences;
+    }
+  }
+
+  public GatewayResourceProfile deepCopy() {
+    return new GatewayResourceProfile(this);
+  }
+
+  @Override
+  public void clear() {
+    this.gatewayID = "DO_NOT_SET_AT_CLIENTS";
+
+    this.gatewayName = null;
+    this.gatewayDescription = null;
+    this.computeResourcePreferences = null;
+  }
+
+  public String getGatewayID() {
+    return this.gatewayID;
+  }
+
+  public void setGatewayID(String gatewayID) {
+    this.gatewayID = gatewayID;
+  }
+
+  public void unsetGatewayID() {
+    this.gatewayID = null;
+  }
+
+  /** Returns true if field gatewayID is set (has been assigned a value) and false otherwise */
+  public boolean isSetGatewayID() {
+    return this.gatewayID != null;
+  }
+
+  public void setGatewayIDIsSet(boolean value) {
+    if (!value) {
+      this.gatewayID = null;
+    }
+  }
+
+  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();
+  }
+
+  public java.util.Iterator<ComputeResourcePreference> getComputeResourcePreferencesIterator() {
+    return (this.computeResourcePreferences == null) ? null : this.computeResourcePreferences.iterator();
+  }
+
+  public void addToComputeResourcePreferences(ComputeResourcePreference elem) {
+    if (this.computeResourcePreferences == null) {
+      this.computeResourcePreferences = new ArrayList<ComputeResourcePreference>();
+    }
+    this.computeResourcePreferences.add(elem);
+  }
+
+  public List<ComputeResourcePreference> getComputeResourcePreferences() {
+    return this.computeResourcePreferences;
+  }
+
+  public void setComputeResourcePreferences(List<ComputeResourcePreference> computeResourcePreferences) {
+    this.computeResourcePreferences = computeResourcePreferences;
+  }
+
+  public void unsetComputeResourcePreferences() {
+    this.computeResourcePreferences = null;
+  }
+
+  /** Returns true if field computeResourcePreferences is set (has been assigned a value) and false otherwise */
+  public boolean isSetComputeResourcePreferences() {
+    return this.computeResourcePreferences != null;
+  }
+
+  public void setComputeResourcePreferencesIsSet(boolean value) {
+    if (!value) {
+      this.computeResourcePreferences = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case GATEWAY_ID:
+      if (value == null) {
+        unsetGatewayID();
+      } else {
+        setGatewayID((String)value);
+      }
+      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();
+      } else {
+        setComputeResourcePreferences((List<ComputeResourcePreference>)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case GATEWAY_ID:
+      return getGatewayID();
+
+    case GATEWAY_NAME:
+      return getGatewayName();
+
+    case GATEWAY_DESCRIPTION:
+      return getGatewayDescription();
+
+    case COMPUTE_RESOURCE_PREFERENCES:
+      return getComputeResourcePreferences();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case GATEWAY_ID:
+      return isSetGatewayID();
+    case GATEWAY_NAME:
+      return isSetGatewayName();
+    case GATEWAY_DESCRIPTION:
+      return isSetGatewayDescription();
+    case COMPUTE_RESOURCE_PREFERENCES:
+      return isSetComputeResourcePreferences();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof GatewayResourceProfile)
+      return this.equals((GatewayResourceProfile)that);
+    return false;
+  }
+
+  public boolean equals(GatewayResourceProfile that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_gatewayID = true && this.isSetGatewayID();
+    boolean that_present_gatewayID = true && that.isSetGatewayID();
+    if (this_present_gatewayID || that_present_gatewayID) {
+      if (!(this_present_gatewayID && that_present_gatewayID))
+        return false;
+      if (!this.gatewayID.equals(that.gatewayID))
+        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) {
+      if (!(this_present_computeResourcePreferences && that_present_computeResourcePreferences))
+        return false;
+      if (!this.computeResourcePreferences.equals(that.computeResourcePreferences))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  @Override
+  public int compareTo(GatewayResourceProfile other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+
+    lastComparison = Boolean.valueOf(isSetGatewayID()).compareTo(other.isSetGatewayID());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetGatewayID()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gatewayID, other.gatewayID);
+      if (lastComparison != 0) {
+        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;
+    }
+    if (isSetComputeResourcePreferences()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.computeResourcePreferences, other.computeResourcePreferences);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("GatewayResourceProfile(");
+    boolean first = true;
+
+    sb.append("gatewayID:");
+    if (this.gatewayID == null) {
+      sb.append("null");
+    } else {
+      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:");
+      if (this.computeResourcePreferences == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.computeResourcePreferences);
+      }
+      first = false;
+    }
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    if (!isSetGatewayID()) {
+      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
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class GatewayResourceProfileStandardSchemeFactory implements SchemeFactory {
+    public GatewayResourceProfileStandardScheme getScheme() {
+      return new GatewayResourceProfileStandardScheme();
+    }
+  }
+
+  private static class GatewayResourceProfileStandardScheme extends StandardScheme<GatewayResourceProfile> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, GatewayResourceProfile struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // GATEWAY_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.gatewayID = iprot.readString();
+              struct.setGatewayIDIsSet(true);
+            } else { 
+              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
+            if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
+              {
+                org.apache.thrift.protocol.TList _list0 = iprot.readListBegin();
+                struct.computeResourcePreferences = new ArrayList<ComputeResourcePreference>(_list0.size);
+                for (int _i1 = 0; _i1 < _list0.size; ++_i1)
+                {
+                  ComputeResourcePreference _elem2;
+                  _elem2 = new ComputeResourcePreference();
+                  _elem2.read(iprot);
+                  struct.computeResourcePreferences.add(_elem2);
+                }
+                iprot.readListEnd();
+              }
+              struct.setComputeResourcePreferencesIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, GatewayResourceProfile struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.gatewayID != null) {
+        oprot.writeFieldBegin(GATEWAY_ID_FIELD_DESC);
+        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);
+          {
+            oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.computeResourcePreferences.size()));
+            for (ComputeResourcePreference _iter3 : struct.computeResourcePreferences)
+            {
+              _iter3.write(oprot);
+            }
+            oprot.writeListEnd();
+          }
+          oprot.writeFieldEnd();
+        }
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class GatewayResourceProfileTupleSchemeFactory implements SchemeFactory {
+    public GatewayResourceProfileTupleScheme getScheme() {
+      return new GatewayResourceProfileTupleScheme();
+    }
+  }
+
+  private static class GatewayResourceProfileTupleScheme extends TupleScheme<GatewayResourceProfile> {
+
+    @Override
+    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);
+      }
+      if (struct.isSetComputeResourcePreferences()) {
+        {
+          oprot.writeI32(struct.computeResourcePreferences.size());
+          for (ComputeResourcePreference _iter4 : struct.computeResourcePreferences)
+          {
+            _iter4.write(oprot);
+          }
+        }
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, GatewayResourceProfile struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      struct.gatewayID = iprot.readString();
+      struct.setGatewayIDIsSet(true);
+      struct.gatewayName = iprot.readString();
+      struct.setGatewayNameIsSet(true);
+      BitSet incoming = iprot.readBitSet(2);
+      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);
+          for (int _i6 = 0; _i6 < _list5.size; ++_i6)
+          {
+            ComputeResourcePreference _elem7;
+            _elem7 = new ComputeResourcePreference();
+            _elem7.read(iprot);
+            struct.computeResourcePreferences.add(_elem7);
+          }
+        }
+        struct.setComputeResourcePreferencesIsSet(true);
+      }
+    }
+  }
+
+}
+

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/gatewayProfileModelConstants.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/gatewayProfileModelConstants.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/gatewayProfileModelConstants.java
deleted file mode 100644
index 87f1f9a..0000000
--- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/gatewayProfileModelConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-    /*
-     * Licensed to the Apache Software Foundation (ASF) under one or more
-     * contributor license agreements.  See the NOTICE file distributed with
-     * this work for additional information regarding copyright ownership.
-     * The ASF licenses this file to You under the Apache License, Version 2.0
-     * (the "License"); you may not use this file except in compliance with
-     * the License.  You may obtain a copy of the License at
-     *
-     *     http://www.apache.org/licenses/LICENSE-2.0
-     *
-     * Unless required by applicable law or agreed to in writing, software
-     * distributed under the License is distributed on an "AS IS" BASIS,
-     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     * See the License for the specific language governing permissions and
-     * limitations under the License.
-     */
-/**
- * Autogenerated by Thrift Compiler (0.9.1)
- *
- * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
- *  @generated
- */
-package org.apache.airavata.model.appcatalog.gatewayprofile;
-
-import org.apache.thrift.scheme.IScheme;
-import org.apache.thrift.scheme.SchemeFactory;
-import org.apache.thrift.scheme.StandardScheme;
-
-import org.apache.thrift.scheme.TupleScheme;
-import org.apache.thrift.protocol.TTupleProtocol;
-import org.apache.thrift.protocol.TProtocolException;
-import org.apache.thrift.EncodingUtils;
-import org.apache.thrift.TException;
-import org.apache.thrift.async.AsyncMethodCallback;
-import org.apache.thrift.server.AbstractNonblockingServer.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.EnumMap;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.EnumSet;
-import java.util.Collections;
-import java.util.BitSet;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("all") public class gatewayProfileModelConstants {
-
-  public static final String DEFAULT_ID = "DO_NOT_SET_AT_CLIENTS";
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/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 3eae31a..c64d121 100644
--- a/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift
+++ b/airavata-api/thrift-interface-descriptions/gatewayResourceProfileModel.thrift
@@ -77,7 +77,7 @@ struct ComputeResourcePreference {
  *
  *
 */
-struct GatewayProfile {
+struct GatewayResourceProfile {
     1: required string gatewayID = DEFAULT_ID,
     2: required string gatewayName,
     3: optional string gatewayDescription,

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
index b81a22a..b616324 100644
--- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorNew.java
@@ -23,12 +23,8 @@ package org.apache.airavata.client.tools;
 import java.util.Arrays;
 import java.util.HashSet;
 
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationDeployment;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.airavata.appcatalog.cpi.GProfile;
+import org.airavata.appcatalog.cpi.*;
+import org.airavata.appcatalog.cpi.GwyResourceProfile;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
@@ -58,7 +54,7 @@ public class DocumentCreatorNew {
 	private ComputeResource computeResource;
 	private ApplicationInterface applicationInterface;
 	private ApplicationDeployment applicationDeployment;
-	private GProfile gatewayProfile;
+	private GwyResourceProfile gatewayProfile;
 	
     public DocumentCreatorNew(AppCatalog appcatalog) throws AppCatalogException {
         this.appcatalog = appcatalog;

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorUtils.java
----------------------------------------------------------------------
diff --git a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorUtils.java b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorUtils.java
index ba328da..19d1a01 100644
--- a/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorUtils.java
+++ b/modules/airavata-client/src/main/java/org/apache/airavata/client/tools/DocumentCreatorUtils.java
@@ -25,7 +25,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.GProfile;
+import org.airavata.appcatalog.cpi.GwyResourceProfile;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule;
 import org.apache.airavata.model.appcatalog.appdeployment.ApplicationParallelismType;
@@ -40,16 +40,15 @@ import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtoco
 import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager;
 import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType;
 import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayProfile;
 
 public class DocumentCreatorUtils {
 
-	public static void addNewComputeResourcePreference(GProfile gatewayProfile,
+	public static void addNewComputeResourcePreference(GwyResourceProfile gatewayProfile,
 			String gatewayID, String computeResourceId, String scratchLocation,
 			String allocationProjectNumber, boolean overridebyAiravata,
 			String preferredBatchQueue, String preferredJobSubmissionProtocol,
 			String preferredDataMovementProtocol) throws AppCatalogException {
-		GatewayProfile profile = null;
+        org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile profile = null;
 		boolean gatewayProfileExists=true;
 		try {
 			profile=gatewayProfile.getGatewayProfile(gatewayID);
@@ -57,7 +56,7 @@ public class DocumentCreatorUtils {
 			e.printStackTrace();
 		}
 		if (profile==null){
-			profile= new GatewayProfile();
+			profile= new org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile();
 			gatewayProfileExists=false;
 		}
 		profile.setGatewayID(gatewayID);

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
index 74cc56e..4c6d387 100644
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/AppCatalog.java
@@ -24,5 +24,5 @@ public interface AppCatalog {
      * @return Gateway profile interface
      * @throws AppCatalogException
      */
-    GProfile getGatewayProfile() throws AppCatalogException;
+    GwyResourceProfile getGatewayProfile() throws AppCatalogException;
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GProfile.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GProfile.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GProfile.java
deleted file mode 100644
index 696b643..0000000
--- a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GProfile.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.airavata.appcatalog.cpi;
-
-import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol;
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayProfile;
-
-public interface GProfile {
-    /**
-     * This method will add a gateway profile
-     * @param gatewayProfile gateway profile
-     * @return gateway id
-     */
-    String addGatewayProfile (GatewayProfile gatewayProfile) throws AppCatalogException;
-
-    /**
-     * This method will update a gateway profile
-     * @param gatewayId unique gateway id
-     * @param updatedProfile updated profile
-     */
-    void updateGatewayProfile (String gatewayId, GatewayProfile updatedProfile) throws AppCatalogException;
-
-    /**
-     *
-     * @param gatewayId
-     * @return
-     */
-    GatewayProfile getGatewayProfile (String gatewayId) throws AppCatalogException;
-
-    /**
-     *
-     * @param gatewayId
-     * @param hostId
-     * @return
-     */
-    JobSubmissionProtocol getPreferedJobSubmissionProtocol (String gatewayId, String hostId) throws AppCatalogException;
-
-    /**
-     *
-     * @param gatewayId
-     * @param hostId
-     * @return
-     */
-    DataMovementProtocol getPreferedDMProtocol (String gatewayId, String hostId) throws AppCatalogException;
-
-
-    /**
-     * This method will remove a gateway profile
-     * @param gatewayId unique gateway id
-     * @return true or false
-     */
-    boolean removeGatewayProfile (String gatewayId) throws AppCatalogException;
-
-    /**
-     * This method will check whether gateway profile exists
-     * @param gatewayId unique gateway id
-     * @return true or false
-     */
-    boolean isGatewayProfileExists (String gatewayId) throws AppCatalogException;
-
-}

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
new file mode 100644
index 0000000..c3b42e4
--- /dev/null
+++ b/modules/app-catalog/app-catalog-cpi/src/main/java/org/airavata/appcatalog/cpi/GwyResourceProfile.java
@@ -0,0 +1,60 @@
+package org.airavata.appcatalog.cpi;
+
+import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol;
+import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+
+public interface GwyResourceProfile {
+    /**
+     * This method will add a gateway profile
+     * @param gatewayProfile gateway profile
+     * @return gateway id
+     */
+    String addGatewayProfile (org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile gatewayProfile) throws AppCatalogException;
+
+    /**
+     * This method will update a gateway profile
+     * @param gatewayId unique gateway id
+     * @param updatedProfile updated profile
+     */
+    void updateGatewayProfile (String gatewayId, org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile updatedProfile) throws AppCatalogException;
+
+    /**
+     *
+     * @param gatewayId
+     * @return
+     */
+    org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile getGatewayProfile (String gatewayId) throws AppCatalogException;
+
+    /**
+     *
+     * @param gatewayId
+     * @param hostId
+     * @return
+     */
+    JobSubmissionProtocol getPreferedJobSubmissionProtocol (String gatewayId, String hostId) throws AppCatalogException;
+
+    /**
+     *
+     * @param gatewayId
+     * @param hostId
+     * @return
+     */
+    DataMovementProtocol getPreferedDMProtocol (String gatewayId, String hostId) throws AppCatalogException;
+
+
+    /**
+     * This method will remove a gateway profile
+     * @param gatewayId unique gateway id
+     * @return true or false
+     */
+    boolean removeGatewayProfile (String gatewayId) throws AppCatalogException;
+
+    /**
+     * This method will check whether gateway profile exists
+     * @param gatewayId unique gateway id
+     * @return true or false
+     */
+    boolean isGatewayProfileExists (String gatewayId) throws AppCatalogException;
+
+}

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
index efa61a8..c2806a2 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/AppCatalogImpl.java
@@ -21,12 +21,8 @@
 
 package org.apache.aiaravata.application.catalog.data.impl;
 
-import org.airavata.appcatalog.cpi.AppCatalog;
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.ApplicationDeployment;
-import org.airavata.appcatalog.cpi.ApplicationInterface;
-import org.airavata.appcatalog.cpi.ComputeResource;
-import org.airavata.appcatalog.cpi.GProfile;
+import org.airavata.appcatalog.cpi.*;
+import org.airavata.appcatalog.cpi.GwyResourceProfile;
 
 public class AppCatalogImpl implements AppCatalog {
     @Override
@@ -45,7 +41,7 @@ public class AppCatalogImpl implements AppCatalog {
     }
 
 	@Override
-	public GProfile getGatewayProfile() throws AppCatalogException {
-		return new GatewayProfileImpl();
+	public GwyResourceProfile getGatewayProfile() throws AppCatalogException {
+		return new GwyResourceProfileImpl();
 	}
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/e085880b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GatewayProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GatewayProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GatewayProfileImpl.java
deleted file mode 100644
index 03c92a3..0000000
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GatewayProfileImpl.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.aiaravata.application.catalog.data.impl;
-
-import org.airavata.appcatalog.cpi.AppCatalogException;
-import org.airavata.appcatalog.cpi.GProfile;
-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.computeresource.DataMovementProtocol;
-import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol;
-import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
-import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayProfile;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GatewayProfileImpl implements GProfile {
-    private final static Logger logger = LoggerFactory.getLogger(GatewayProfileImpl.class);
-
-    @Override
-    public String addGatewayProfile(GatewayProfile gatewayProfile) throws AppCatalogException {
-        try {
-            GatewayProfileResource profileResource = new GatewayProfileResource();
-            profileResource.setGatewayName(gatewayProfile.getGatewayName());
-            profileResource.setGatewayID(AppCatalogUtils.getID(gatewayProfile.getGatewayName()));
-            profileResource.setGatewayDesc(gatewayProfile.getGatewayDescription());
-            profileResource.save();
-            gatewayProfile.setGatewayID(profileResource.getGatewayID());
-            List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
-            if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
-                for (ComputeResourcePreference preference : computeResourcePreferences ){
-                    ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
-                    resource.setGatewayProfile(profileResource);
-                    resource.setResourceId(preference.getComputeResourceId());
-                    ComputeResourceResource computeHostResource = new ComputeResourceResource();
-                    resource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
-                    resource.setGatewayId(profileResource.getGatewayID());
-                    resource.setOverrideByAiravata(preference.isOverridebyAiravata());
-                    resource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol());
-                    resource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol());
-                    resource.setBatchQueue(preference.getPreferredBatchQueue());
-                    resource.setProjectNumber(preference.getAllocationProjectNumber());
-                    resource.setScratchLocation(preference.getScratchLocation());
-                    resource.save();
-                }
-            }
-            return profileResource.getGatewayID();
-        }catch (Exception e) {
-            logger.error("Error while saving gateway profile...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-
-    @Override
-    public void updateGatewayProfile(String gatewayId, GatewayProfile updatedProfile) throws AppCatalogException {
-        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();
-            if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
-                for (ComputeResourcePreference preference : computeResourcePreferences ){
-                    ComputeHostPreferenceResource resource = new ComputeHostPreferenceResource();
-                    Map<String, String> ids = new HashMap<String, String>();
-                    ids.put(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
-                    ids.put(AbstractResource.ComputeResourcePreferenceConstants.RESOURCE_ID, preference.getComputeResourceId());
-                    ComputeHostPreferenceResource existingPreferenceResource = (ComputeHostPreferenceResource)resource.get(ids);
-
-                    existingPreferenceResource.setGatewayProfile(existingGP);
-                    existingPreferenceResource.setResourceId(preference.getComputeResourceId());
-                    ComputeResourceResource computeHostResource = new ComputeResourceResource();
-                    existingPreferenceResource.setComputeHostResource((ComputeResourceResource)computeHostResource.get(preference.getComputeResourceId()));
-                    existingPreferenceResource.setGatewayId(gatewayId);
-                    existingPreferenceResource.setOverrideByAiravata(preference.isOverridebyAiravata());
-                    existingPreferenceResource.setPreferredJobProtocol(preference.getPreferredJobSubmissionProtocol());
-                    existingPreferenceResource.setPreferedDMProtocol(preference.getPreferredDataMovementProtocol());
-                    existingPreferenceResource.setBatchQueue(preference.getPreferredBatchQueue());
-                    existingPreferenceResource.setProjectNumber(preference.getAllocationProjectNumber());
-                    existingPreferenceResource.setScratchLocation(preference.getScratchLocation());
-                    existingPreferenceResource.save();
-                }
-            }
-        }catch (Exception e) {
-            logger.error("Error while updating gateway profile...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-
-    @Override
-    public GatewayProfile getGatewayProfile(String gatewayId) throws AppCatalogException {
-        try {
-            GatewayProfileResource resource = new GatewayProfileResource();
-            GatewayProfileResource gwresource = (GatewayProfileResource)resource.get(gatewayId);
-            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
-            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
-            List<ComputeResourcePreference> computeResourcePreferences = AppCatalogThriftConversion.getComputeResourcePreferences(computePrefList);
-            return AppCatalogThriftConversion.getGatewayProfile(gwresource, computeResourcePreferences);
-        }catch (Exception e) {
-            logger.error("Error while retrieving gateway profile...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-
-    @Override
-    public JobSubmissionProtocol getPreferedJobSubmissionProtocol(String gatewayId, String hostId) throws AppCatalogException{
-        try {
-            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
-            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
-            if (computePrefList != null && !computePrefList.isEmpty()){
-                for (Resource pref : computePrefList){
-                    ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource)pref;
-                    if (preferenceResource.getResourceId().equals(hostId)){
-                        return JobSubmissionProtocol.valueOf(preferenceResource.getPreferredJobProtocol());
-                    }
-                }
-            }
-        }catch (Exception e) {
-            logger.error("Error while retrieving job submission protocol for given host and gateway...", e);
-            throw new AppCatalogException(e);
-        }
-        return null;
-    }
-
-    @Override
-    public DataMovementProtocol getPreferedDMProtocol(String gatewayId, String hostId) throws AppCatalogException{
-        try {
-            ComputeHostPreferenceResource prefResource = new ComputeHostPreferenceResource();
-            List<Resource> computePrefList = prefResource.get(AbstractResource.ComputeResourcePreferenceConstants.GATEWAY_ID, gatewayId);
-            if (computePrefList != null && !computePrefList.isEmpty()){
-                for (Resource pref : computePrefList){
-                    ComputeHostPreferenceResource preferenceResource = (ComputeHostPreferenceResource)pref;
-                    if (preferenceResource.getResourceId().equals(hostId)){
-                        return DataMovementProtocol.valueOf(preferenceResource.getPreferedDMProtocol());
-                    }
-                }
-            }
-        }catch (Exception e) {
-            logger.error("Error while retrieving data movement protocol for given host and gateway...", e);
-            throw new AppCatalogException(e);
-        }
-        return null;
-    }
-
-
-    @Override
-    public boolean removeGatewayProfile(String gatewayId) throws AppCatalogException {
-       try {
-           GatewayProfileResource resource = new GatewayProfileResource();
-           resource.remove(gatewayId);
-           return true;
-       }catch (Exception e) {
-           logger.error("Error while deleting gateway profile...", e);
-           throw new AppCatalogException(e);
-       }
-    }
-
-    @Override
-    public boolean isGatewayProfileExists(String gatewayId) throws AppCatalogException {
-        try {
-            GatewayProfileResource resource = new GatewayProfileResource();
-            return resource.isExists(gatewayId);
-        }catch (Exception e) {
-            logger.error("Error while retrieving gateway profile...", e);
-            throw new AppCatalogException(e);
-        }
-    }
-}