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 2017/12/22 18:35:57 UTC

[airavata] branch registry-refactoring updated (78826ec -> 502650a)

This is an automated email from the ASF dual-hosted git repository.

smarru pushed a change to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git.


    from 78826ec  Removing user profile changes from registry refactoring branch
     new a4acd74  Added GatewayResourceProfile Repository
     new 034b41a  Adding repositories for ComputePref and StoragePref
     new 667cf6a  Changes to RegistryServiceHandler
     new 17c25b4  Adding JPA Utils and Tests
     new c974220  Reverting unrelated changes
     new 502650a  Adding CPI dependency

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 modules/registry-refactoring/pom.xml               |  15 ++
 .../ComputeResourcePreferenceEntity.java           |   2 +-
 .../appcatalog/ComputeResourcePreferencePK.java    |  14 +-
 .../entities/appcatalog/GatewayProfileEntity.java  |  15 +-
 ...nceEntity.java => StoragePreferenceEntity.java} |  12 +-
 ...ePreferencePK.java => StoragePreferencePK.java} |   8 +-
 .../AppCatAbstractRepository.java}                 |  60 ++++++--
 .../appcatalog/ComputeResourceRepository.java      |  14 ++
 .../appcatalog/GwyResourceProfileRepository.java   | 156 +++++++++++++++++++++
 .../appcatalog/StoragePrefRepository.java          |  13 ++
 .../airavata/registry/core/utils/DBConstants.java  |  15 ++
 .../core/utils/JPAUtil/AppCatalogJPAUtils.java     |  67 +++++++++
 .../registry/core/utils/QueryConstants.java        |  10 ++
 .../src/main/resources/META-INF/persistence.xml    |   6 +-
 .../src/main/resources/appcatalog-derby.sql        |   0
 .../src/main/resources/appcatalog-mysql.sql        |   0
 .../repositories/GatewayProfileRepositoryTest.java |  69 +++++++++
 .../core/repositories}/util/Initialize.java        |   2 +-
 .../registry-server/registry-api-service/pom.xml   |   5 +
 .../api/service/handler/RegistryServerHandler.java | 110 +++++++--------
 20 files changed, 490 insertions(+), 103 deletions(-)
 rename modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/{DataStoragePreferenceEntity.java => StoragePreferenceEntity.java} (87%)
 rename modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/{DataStoragePreferencePK.java => StoragePreferencePK.java} (90%)
 copy modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/{AbstractRepository.java => appcatalog/AppCatAbstractRepository.java} (60%)
 create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java
 create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
 create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java
 create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
 create mode 100644 modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtil/AppCatalogJPAUtils.java
 copy modules/{registry/registry-core => registry-refactoring}/src/main/resources/appcatalog-derby.sql (100%)
 copy modules/{registry/registry-core => registry-refactoring}/src/main/resources/appcatalog-mysql.sql (100%)
 create mode 100644 modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/GatewayProfileRepositoryTest.java
 copy modules/{registry/registry-core/src/test/java/org/apache/airavata/app/catalog => registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories}/util/Initialize.java (99%)

-- 
To stop receiving notification emails like this one, please contact
['"commits@airavata.apache.org" <co...@airavata.apache.org>'].

[airavata] 04/06: Adding JPA Utils and Tests

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 17c25b44b5cd3fe87fb31158b1daf326d0879be5
Author: Sachin Kariyattin <sa...@gmail.com>
AuthorDate: Thu Dec 21 14:44:47 2017 -0500

    Adding JPA Utils and Tests
---
 modules/registry-refactoring/pom.xml               |   5 +
 .../appcatalog/ComputeResourcePreferencePK.java    |  14 +-
 .../appcatalog/AppCatAbstractRepository.java       | 132 +++++
 .../appcatalog/ComputeResourceRepository.java      |   6 +-
 .../appcatalog/GwyResourceProfileRepository.java   |  38 +-
 .../appcatalog/StoragePrefRepository.java          |   2 +-
 .../airavata/registry/core/utils/DBConstants.java  |   2 +
 .../core/utils/JPAUtil/AppCatalogJPAUtils.java     |  67 +++
 .../registry/core/utils/QueryConstants.java        |  10 +-
 .../src/main/resources/META-INF/persistence.xml    |   2 +-
 .../src/main/resources/appcatalog-derby.sql        | 583 +++++++++++++++++++++
 .../src/main/resources/appcatalog-mysql.sql        | 579 ++++++++++++++++++++
 .../repositories/GatewayProfileRepositoryTest.java |  69 +++
 .../core/repositories/util/Initialize.java         | 318 +++++++++++
 14 files changed, 1787 insertions(+), 40 deletions(-)

diff --git a/modules/registry-refactoring/pom.xml b/modules/registry-refactoring/pom.xml
index 7f1180a..b1cc56c 100644
--- a/modules/registry-refactoring/pom.xml
+++ b/modules/registry-refactoring/pom.xml
@@ -74,6 +74,11 @@
             <artifactId>airavata-commons</artifactId>
             <version>0.17-SNAPSHOT</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-server-configuration</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferencePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferencePK.java
index 7cfba0c..f94cd65 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferencePK.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferencePK.java
@@ -36,7 +36,7 @@ public class ComputeResourcePreferencePK implements Serializable {
     private String gatewayId;
 
     @Column(name = "RESOURCE_ID", insertable = false, updatable = false)
-    private String resourceId;
+    private String computeResourceId;
 
     public ComputeResourcePreferencePK() {
     }
@@ -49,12 +49,12 @@ public class ComputeResourcePreferencePK implements Serializable {
         this.gatewayId = gatewayId;
     }
 
-    public String getResourceId() {
-        return resourceId;
+    public String getComputeResourceId() {
+        return computeResourceId;
     }
 
-    public void setResourceId(String resourceId) {
-        this.resourceId = resourceId;
+    public void setComputeResourceId(String computeResourceId) {
+        this.computeResourceId = computeResourceId;
     }
 
     public boolean equals(Object other) {
@@ -67,14 +67,14 @@ public class ComputeResourcePreferencePK implements Serializable {
         ComputeResourcePreferencePK castOther = (ComputeResourcePreferencePK) other;
         return
                 this.gatewayId.equals(castOther.gatewayId)
-                        && this.resourceId.equals(castOther.resourceId);
+                        && this.computeResourceId.equals(castOther.computeResourceId);
     }
 
     public int hashCode() {
         final int prime = 31;
         int hash = 17;
         hash = hash * prime + this.gatewayId.hashCode();
-        hash = hash * prime + this.resourceId.hashCode();
+        hash = hash * prime + this.computeResourceId.hashCode();
 
         return hash;
     }
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/AppCatAbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/AppCatAbstractRepository.java
new file mode 100644
index 0000000..f4b91e0
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/AppCatAbstractRepository.java
@@ -0,0 +1,132 @@
+/*
+ *
+ * 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.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.registry.core.utils.Committer;
+import org.apache.airavata.registry.core.utils.DBConstants;
+import org.apache.airavata.registry.core.utils.JPAUtil.AppCatalogJPAUtils;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+public abstract class AppCatAbstractRepository<T, E, Id> {
+    private final static Logger logger = LoggerFactory.getLogger(AppCatAbstractRepository.class);
+
+    private Class<T> thriftGenericClass;
+    private Class<E> dbEntityGenericClass;
+
+    public AppCatAbstractRepository(Class<T> thriftGenericClass, Class<E> dbEntityGenericClass) {
+        this.thriftGenericClass = thriftGenericClass;
+        this.dbEntityGenericClass = dbEntityGenericClass;
+    }
+
+    public T create(T t) {
+        return update(t);
+    }
+
+    public T update(T t) {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        E entity = mapper.map(t, dbEntityGenericClass);
+        E persistedCopy = execute(entityManager -> entityManager.merge(entity));
+        return mapper.map(persistedCopy, thriftGenericClass);
+    }
+
+    public boolean delete(Id id) {
+        execute(entityManager -> {
+            E entity = entityManager.find(dbEntityGenericClass, id);
+            entityManager.remove(entity);
+            return entity;
+        });
+        return true;
+    }
+
+    public T get(Id id) {
+        E entity = execute(entityManager -> entityManager
+                .find(dbEntityGenericClass, id));
+        if(entity == null)
+            return null;
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        return mapper.map(entity, thriftGenericClass);
+    }
+
+    public List<T> select(String query, int offset) {
+        List resultSet = (List) execute(entityManager -> entityManager.createQuery(query).setFirstResult(offset)
+                .getResultList());
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public List<T> select(String query, int limit, int offset, Map<String, Object> queryParams) {
+        int newLimit = limit < 0 ? DBConstants.SELECT_MAX_ROWS: limit;
+
+        List resultSet = (List) execute(entityManager -> {
+            Query jpaQuery = entityManager.createQuery(query);
+
+            for (Map.Entry<String, Object> entry : queryParams.entrySet()) {
+
+                jpaQuery.setParameter(entry.getKey(), entry.getValue());
+            }
+
+            return jpaQuery.setFirstResult(offset).setMaxResults(newLimit).getResultList();
+
+        });
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        List<T> gatewayList = new ArrayList<>();
+        resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
+        return gatewayList;
+    }
+
+    public boolean isExists(Id id) {
+        return get(id) != null;
+    }
+
+    public <R> R execute(Committer<EntityManager, R> committer){
+        EntityManager entityManager = null;
+        try {
+            entityManager = AppCatalogJPAUtils.getEntityManager();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        try {
+            entityManager.getTransaction().begin();
+            R r = committer.commit(entityManager);
+            entityManager.getTransaction().commit();
+            return  r;
+        }finally {
+            if (entityManager != null && entityManager.isOpen()) {
+                if (entityManager.getTransaction().isActive()) {
+                    entityManager.getTransaction().rollback();
+                }
+                entityManager.close();
+            }
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java
index 6add69f..0a4136c 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java
@@ -2,13 +2,13 @@ package org.apache.airavata.registry.core.repositories.appcatalog;
 
 import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferenceEntity;
 import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferencePK;
 import org.apache.airavata.registry.core.repositories.AbstractRepository;
 
-public class ComputeResourceRepository extends AbstractRepository<ComputeResourcePreference, ComputeResourceEntity, ComputeResourcePreferencePK> {
+public class ComputeResourceRepository extends AppCatAbstractRepository<ComputeResourcePreference, ComputeResourcePreferenceEntity, ComputeResourcePreferencePK> {
 
     public ComputeResourceRepository() {
-        super(ComputeResourcePreference.class, ComputeResourceEntity.class);
+        super(ComputeResourcePreference.class, ComputeResourcePreferenceEntity.class);
     }
-
 }
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
index 7003201..fb3d4a7 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
@@ -7,9 +7,7 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
 import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferencePK;
 import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferencePK;
 import org.apache.airavata.registry.core.entities.appcatalog.GatewayProfileEntity;
-import org.apache.airavata.registry.core.repositories.AbstractRepository;
 import org.apache.airavata.registry.core.utils.DBConstants;
-import org.apache.airavata.registry.core.utils.JPAUtils;
 import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
 import org.apache.airavata.registry.core.utils.QueryConstants;
 import org.dozer.Mapper;
@@ -21,7 +19,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-public class GwyResourceProfileRepository extends AbstractRepository<GatewayResourceProfile, GatewayProfileEntity, String>{
+public class GwyResourceProfileRepository extends AppCatAbstractRepository<GatewayResourceProfile, GatewayProfileEntity, String>{
 
     private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileRepository.class);
 
@@ -30,15 +28,21 @@ public class GwyResourceProfileRepository extends AbstractRepository<GatewayReso
     }
 
     public String addGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
-            return updateGatewayResourceProfile(gatewayResourceProfile);
+
+        return updateGatewayResourceProfile(gatewayResourceProfile);
     }
 
     public String updateGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
         String gatewayId = gatewayResourceProfile.getGatewayID();
         Mapper mapper = ObjectMapperSingleton.getInstance();
         GatewayProfileEntity gatewayProfileEntity = mapper.map(gatewayResourceProfile, GatewayProfileEntity.class);
-        gatewayProfileEntity.setUpdateTime(AiravataUtils.getCurrentTimestamp());
-        GatewayProfileEntity persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(gatewayProfileEntity));
+        if (get(gatewayId) != null) {
+            gatewayProfileEntity.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+        }
+        else {
+            gatewayProfileEntity.setCreationTime(AiravataUtils.getCurrentTimestamp());
+        }
+        GatewayProfileEntity persistedCopy = execute(entityManager -> entityManager.merge(gatewayProfileEntity));
 
         List<ComputeResourcePreference> computeResourcePreferences = gatewayResourceProfile.getComputeResourcePreferences();
         if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()) {
@@ -57,41 +61,29 @@ public class GwyResourceProfileRepository extends AbstractRepository<GatewayReso
     }
 
     public GatewayResourceProfile getGatewayProfile(String gatewayId) {
-        GatewayResourceProfile gatewayResourceProfile = (new GwyResourceProfileRepository()).getGatewayProfile(gatewayId);
+        GatewayResourceProfile gatewayResourceProfile = get(gatewayId);
         gatewayResourceProfile.setComputeResourcePreferences(getAllComputeResourcePreferences(gatewayId));
         gatewayResourceProfile.setStoragePreferences(getAllStoragePreferences(gatewayId));
         return gatewayResourceProfile;
     }
 
- /*   public boolean removeGatewayResourceProfile(String gatewayId) {
-        //return delete(gatewayId);
-    }
-
-    public boolean isGatewayResourceProfileExists(String gatewayId) {
-        //return isExists(gatewayId);
-    }*/
-
-    /*public List<String> getGatewayProfileIds(String gatewayName) {
-        // TODO - Not used anywhere (dev list??)
-    }*/
-
     public List<GatewayResourceProfile> getAllGatewayProfiles() {
 
         List<GatewayResourceProfile> gwyResourceProfileList = new ArrayList<GatewayResourceProfile>();
-        List<GatewayResourceProfile> gatewayResourceProfileList = select(QueryConstants.FIND_ALL_GATEWAY_PROFILES,-1, 0);
+        List<GatewayResourceProfile> gatewayResourceProfileList = select(QueryConstants.FIND_ALL_GATEWAY_PROFILES, 0);
         if (gatewayResourceProfileList != null && !gatewayResourceProfileList.isEmpty()) {
             for (GatewayResourceProfile gatewayResourceProfile: gatewayResourceProfileList) {
                 gatewayResourceProfile.setComputeResourcePreferences(getAllComputeResourcePreferences(gatewayResourceProfile.getGatewayID()));
                 gatewayResourceProfile.setStoragePreferences(getAllStoragePreferences(gatewayResourceProfile.getGatewayID()));
             }
         }
-        return gwyResourceProfileList;
+        return gatewayResourceProfileList;
     }
 
     public boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) {
         ComputeResourcePreferencePK computeResourcePreferencePK = new ComputeResourcePreferencePK();
         computeResourcePreferencePK.setGatewayId(gatewayId);
-        computeResourcePreferencePK.setResourceId(preferenceId);
+        computeResourcePreferencePK.setComputeResourceId(preferenceId);
         (new ComputeResourceRepository()).delete(computeResourcePreferencePK);
         return true;
     }
@@ -107,7 +99,7 @@ public class GwyResourceProfileRepository extends AbstractRepository<GatewayReso
     public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) {
         ComputeResourcePreferencePK computeResourcePreferencePK = new ComputeResourcePreferencePK();
         computeResourcePreferencePK.setGatewayId(gatewayId);
-        computeResourcePreferencePK.setResourceId(hostId);
+        computeResourcePreferencePK.setComputeResourceId(hostId);
         return (new ComputeResourceRepository()).get(computeResourcePreferencePK);
     }
 
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java
index d5b054a..423cd2b 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java
@@ -5,7 +5,7 @@ import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferenceEn
 import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferencePK;
 import org.apache.airavata.registry.core.repositories.AbstractRepository;
 
-public class StoragePrefRepository extends AbstractRepository<StoragePreference, StoragePreferenceEntity, StoragePreferencePK> {
+public class StoragePrefRepository extends AppCatAbstractRepository<StoragePreference, StoragePreferenceEntity, StoragePreferencePK> {
 
     public StoragePrefRepository() {
         super(StoragePreference.class, StoragePreferenceEntity.class);
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
index 752b556..bdd3cb4 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
@@ -2,6 +2,8 @@ package org.apache.airavata.registry.core.utils;
 
 public class DBConstants {
 
+    public static int SELECT_MAX_ROWS = 1000;
+
     public static class ComputeResourcePreference {
         public static final String GATEWAY_ID = "gatewayId";
     }
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtil/AppCatalogJPAUtils.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtil/AppCatalogJPAUtils.java
new file mode 100644
index 0000000..c42de64
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/JPAUtil/AppCatalogJPAUtils.java
@@ -0,0 +1,67 @@
+package org.apache.airavata.registry.core.utils.JPAUtil;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.registry.core.utils.Committer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.persistence.*;
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppCatalogJPAUtils {
+
+    private final static Logger logger = LoggerFactory.getLogger(AppCatalogJPAUtils.class);
+    private static final String PERSISTENCE_UNIT_NAME = "appcatalog_data";
+    private static final String APPCATALOG_JDBC_DRIVER = "appcatalog.jdbc.driver";
+    private static final String APPCATALOG_JDBC_URL = "appcatalog.jdbc.url";
+    private static final String APPCATALOG_JDBC_USER = "appcatalog.jdbc.user";
+    private static final String APPCATALOG_JDBC_PWD = "appcatalog.jdbc.password";
+    private static final String APPCATALOG_VALIDATION_QUERY = "appcatalog.validationQuery";
+    @PersistenceUnit(unitName = "appcatalog_data")
+    protected static EntityManagerFactory factory;
+    @PersistenceContext(unitName = "appcatalog_data")
+    private static EntityManager appCatEntityManager;
+
+    public static EntityManager getEntityManager() throws ApplicationSettingsException {
+        if (factory == null) {
+            String connectionProperties = "DriverClassName=" + readServerProperties(APPCATALOG_JDBC_DRIVER) + "," +
+                    "Url=" + readServerProperties(APPCATALOG_JDBC_URL) + "?autoReconnect=true," +
+                    "Username=" + readServerProperties(APPCATALOG_JDBC_USER) + "," +
+                    "Password=" + readServerProperties(APPCATALOG_JDBC_PWD) +
+                    ",validationQuery=" + readServerProperties(APPCATALOG_VALIDATION_QUERY);
+            System.out.println(connectionProperties);
+            Map<String, String> properties = new HashMap<String, String>();
+            properties.put("openjpa.ConnectionDriverName", "org.apache.commons.dbcp.BasicDataSource");
+            properties.put("openjpa.ConnectionProperties", connectionProperties);
+            properties.put("openjpa.DynamicEnhancementAgent", "true");
+            properties.put("openjpa.RuntimeUnenhancedClasses", "unsupported");
+            properties.put("openjpa.RemoteCommitProvider", "sjvm");
+            properties.put("openjpa.Log", "DefaultLevel=INFO, Runtime=INFO, Tool=INFO, SQL=INFO");
+            properties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
+            properties.put("openjpa.jdbc.QuerySQLCache", "false");
+            properties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72, PrintParameters=true, MaxActive=10, MaxIdle=5, MinIdle=2, MaxWait=31536000,  autoReconnect=true");
+            factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, properties);
+        }
+        // clear cache at entitymangerfactory level
+        if (factory.getCache() != null) {
+            factory.getCache().evictAll();
+        }
+        appCatEntityManager = factory.createEntityManager();
+        // clear the entitymanager cache
+        if (appCatEntityManager != null) {
+            appCatEntityManager.clear();
+        }
+        return appCatEntityManager;
+    }
+
+    private static String readServerProperties(String propertyName) throws ApplicationSettingsException {
+        try {
+            return ServerSettings.getSetting(propertyName);
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read airavata-server.properties...", e);
+            throw new ApplicationSettingsException("Unable to read airavata-server.properties...");
+        }
+    }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
index 244f9d6..7802c84 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
@@ -15,9 +15,9 @@ public interface QueryConstants {
     String FIND_ALL_USER_PROFILES_BY_GATEWAY_ID = "SELECT u FROM UserProfileEntity u " +
             "where u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
 
-    String FIND_ALL_GATEWAY_PROFILES = "SELECT G FROM " + GatewayProfileEntity.class.getSimpleName() + "G";
-    String FIND_ALL_COMPUTE_RESOURCE_PREFERENCES = "SELECT DISTINCT CR FROM " + ComputeResourcePreferenceEntity.class.getSimpleName() + "CR " +
-            "WHERE CR.gatewayId LIKE : " + DBConstants.ComputeResourcePreference.GATEWAY_ID;
-    String FIND_ALL_STORAGE_RESOURCE_PREFERENCES = "SELECT DISTINCT S FROM " + StoragePreferenceEntity.class.getSimpleName() + "S " +
-            "WHERE S.gatewayId LIKE : " + DBConstants.StorageResourcePreference.GATEWAY_ID;
+    String FIND_ALL_GATEWAY_PROFILES = "SELECT G FROM " + GatewayProfileEntity.class.getSimpleName() + " G";
+    String FIND_ALL_COMPUTE_RESOURCE_PREFERENCES = "SELECT DISTINCT CR FROM " + ComputeResourcePreferenceEntity.class.getSimpleName() + " CR " +
+            "WHERE CR.id.gatewayId LIKE : " + DBConstants.ComputeResourcePreference.GATEWAY_ID;
+    String FIND_ALL_STORAGE_RESOURCE_PREFERENCES = "SELECT DISTINCT S FROM " + StoragePreferenceEntity.class.getSimpleName() + " S " +
+            "WHERE S.id.gatewayId LIKE : " + DBConstants.StorageResourcePreference.GATEWAY_ID;
 }
diff --git a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
index 645165d..7f0297f 100644
--- a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
@@ -20,7 +20,7 @@
  *
 * -->
 <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
-    <persistence-unit name="airavata_catalog">
+    <persistence-unit name="appcatalog_data">
         <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
         <class>org.apache.airavata.registry.core.entities.workspacecatalog.GatewayEntity</class>
         <class>org.apache.airavata.registry.core.entities.workspacecatalog.UserProfileEntity</class>
diff --git a/modules/registry-refactoring/src/main/resources/appcatalog-derby.sql b/modules/registry-refactoring/src/main/resources/appcatalog-derby.sql
new file mode 100644
index 0000000..db9e261
--- /dev/null
+++ b/modules/registry-refactoring/src/main/resources/appcatalog-derby.sql
@@ -0,0 +1,583 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+CREATE TABLE COMPUTE_RESOURCE
+(
+        RESOURCE_ID VARCHAR (255) NOT NULL,
+        HOST_NAME VARCHAR (255) NOT NULL,
+        RESOURCE_DESCRIPTION VARCHAR (255),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        MAX_MEMORY_NODE INTEGER,
+        CPUS_PER_NODE INTEGER,
+        DEFAULT_NODE_COUNT INTEGER,
+        DEFAULT_CPU_COUNT INTEGER,
+        DEFAULT_WALLTIME INTEGER,
+        ENABLED SMALLINT,
+        GATEWAY_USAGE_REPORTING SMALLINT,
+        GATEWAY_USAGE_MODULE_LOAD_CMD VARCHAR(500),
+        GATEWAY_USAGE_EXECUTABLE VARCHAR(255),
+        PRIMARY KEY (RESOURCE_ID)
+);
+
+CREATE TABLE HOST_ALIAS
+(
+         RESOURCE_ID VARCHAR(255),
+         ALIAS VARCHAR(255),
+         PRIMARY KEY(RESOURCE_ID,ALIAS),
+         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE HOST_IPADDRESS
+(
+         RESOURCE_ID VARCHAR(255),
+         IP_ADDRESS VARCHAR(255),
+         PRIMARY KEY(RESOURCE_ID,IP_ADDRESS),
+         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GSISSH_SUBMISSION
+(
+         SUBMISSION_ID VARCHAR(255),
+         RESOURCE_JOB_MANAGER VARCHAR(255),
+         SSH_PORT INTEGER,
+         INSTALLED_PATH VARCHAR(255),
+         MONITOR_MODE VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID)
+);
+
+CREATE TABLE GSISSH_EXPORT
+(
+         SUBMISSION_ID VARCHAR(255),
+         EXPORT VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID, EXPORT),
+         FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
+);
+
+
+
+CREATE TABLE GLOBUS_SUBMISSION
+(
+         SUBMISSION_ID VARCHAR(255),
+         RESOURCE_JOB_MANAGER VARCHAR(255),
+         SECURITY_PROTOCAL VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID)
+);
+
+CREATE TABLE UNICORE_SUBMISSION
+(
+         SUBMISSION_ID VARCHAR(255),
+         SECURITY_PROTOCAL VARCHAR(255),
+         UNICORE_ENDPOINT_URL VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID)
+);
+
+CREATE TABLE UNICORE_DATAMOVEMENT
+(
+         DATAMOVEMENT_ID VARCHAR(255),
+         SECURITY_PROTOCAL VARCHAR(255),
+         UNICORE_ENDPOINT_URL VARCHAR(255),
+         PRIMARY KEY(DATAMOVEMENT_ID)
+);
+
+
+CREATE TABLE GLOBUS_GK_ENDPOINT
+(
+         SUBMISSION_ID VARCHAR(255),
+         ENDPOINT VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID, ENDPOINT),
+         FOREIGN KEY (SUBMISSION_ID) REFERENCES GLOBUS_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE RESOURCE_JOB_MANAGER
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        PUSH_MONITORING_ENDPOINT VARCHAR (255),
+        JOB_MANAGER_BIN_PATH VARCHAR (255),
+        RESOURCE_JOB_MANAGER_TYPE VARCHAR (255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (RESOURCE_JOB_MANAGER_ID)
+);
+
+
+
+CREATE TABLE SSH_JOB_SUBMISSION
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+        ALTERNATIVE_SSH_HOSTNAME VARCHAR (255),
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        SSH_PORT INTEGER,
+        MONITOR_MODE VARCHAR (255),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)
+);
+
+CREATE TABLE SCP_DATA_MOVEMENT
+(
+        QUEUE_DESCRIPTION VARCHAR (255),
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        ALTERNATIVE_SCP_HOSTNAME VARCHAR (255),
+        SSH_PORT INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
+);
+
+CREATE TABLE GRIDFTP_DATA_MOVEMENT
+(
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
+);
+
+CREATE TABLE GRIDFTP_ENDPOINT
+(
+        ENDPOINT VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID,ENDPOINT),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        FOREIGN KEY (DATA_MOVEMENT_INTERFACE_ID) REFERENCES GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID) ON DELETE CASCADE
+);
+
+--CREATE TABLE JOB_SUBMISSION_PROTOCOL
+--(
+--         RESOURCE_ID VARCHAR(255),
+--         SUBMISSION_ID VARCHAR(255),
+--         JOB_TYPE VARCHAR(255),
+--         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+--         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+--         PRIMARY KEY(RESOURCE_ID,SUBMISSION_ID,JOB_TYPE),
+--         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+--);
+--
+--CREATE TABLE DATA_MOVEMENT_PROTOCOL
+--(
+--         RESOURCE_ID VARCHAR(255),
+--         DATA_MOVE_ID VARCHAR(255),
+--         DATA_MOVE_TYPE VARCHAR(255),
+--         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+--         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+--         PRIMARY KEY(RESOURCE_ID,DATA_MOVE_ID,DATA_MOVE_TYPE),
+--         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+--);
+
+CREATE TABLE APPLICATION_MODULE
+(
+         MODULE_ID VARCHAR(255),
+         MODULE_NAME VARCHAR(255),
+         MODULE_VERSION VARCHAR(255),
+         MODULE_DESC VARCHAR(500),
+         GATEWAY_ID VARCHAR (255),
+         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+         PRIMARY KEY(MODULE_ID)
+);
+
+CREATE TABLE APPLICATION_DEPLOYMENT
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         APP_MODULE_ID VARCHAR(255),
+         COMPUTE_HOSTID VARCHAR(255),
+         EXECUTABLE_PATH VARCHAR(255),
+	       PARALLELISM VARCHAR(255),
+         APPLICATION_DESC VARCHAR(255),
+         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+         GATEWAY_ID VARCHAR(255),
+         DEFAULT_QUEUE_NAME VARCHAR(255),
+         DEFAULT_NODE_COUNT INTEGER,
+         DEFAULT_CPU_COUNT INTEGER,
+         DEFAULT_WALLTIME INTEGER,
+         EDITABLE_BY_USER BOOLEAN,
+         PRIMARY KEY(DEPLOYMENT_ID),
+         FOREIGN KEY (COMPUTE_HOSTID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE,
+         FOREIGN KEY (APP_MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE MODULE_LOAD_CMD
+(
+        CMD VARCHAR (255) NOT NULL,
+        APP_DEPLOYMENT_ID VARCHAR (255) NOT NULL,
+        PRIMARY KEY (APP_DEPLOYMENT_ID,CMD),
+        FOREIGN KEY (APP_DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE PREJOB_COMMAND
+(
+         APPDEPLOYMENT_ID VARCHAR(255),
+         COMMAND VARCHAR(255),
+         PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+         FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE POSTJOB_COMMAND
+(
+         APPDEPLOYMENT_ID VARCHAR(255),
+         COMMAND VARCHAR(255),
+         PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+         FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LIBRARY_PREPAND_PATH
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         NAME VARCHAR(255),
+         VALUE VARCHAR(255),
+         PRIMARY KEY(DEPLOYMENT_ID, NAME),
+         FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LIBRARY_APEND_PATH
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         NAME VARCHAR(255),
+         VALUE VARCHAR(255),
+         PRIMARY KEY(DEPLOYMENT_ID, NAME),
+         FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APP_ENVIRONMENT
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         NAME VARCHAR(255),
+         VALUE VARCHAR(255),
+         PRIMARY KEY(DEPLOYMENT_ID, NAME),
+         FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INTERFACE
+(
+         INTERFACE_ID VARCHAR(255),
+         APPLICATION_NAME VARCHAR(255),
+         APPLICATION_DESCRIPTION VARCHAR(500),
+         GATEWAY_ID VARCHAR(255),
+         ARCHIVE_WORKING_DIRECTORY SMALLINT,
+         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+         PRIMARY KEY(INTERFACE_ID)
+);
+
+CREATE TABLE APP_MODULE_MAPPING
+(
+         INTERFACE_ID VARCHAR(255),
+         MODULE_ID VARCHAR(255),
+         PRIMARY KEY(INTERFACE_ID, MODULE_ID),
+         FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE,
+         FOREIGN KEY (MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INPUT
+(
+         INTERFACE_ID VARCHAR(255),
+         INPUT_KEY VARCHAR(255),
+         INPUT_VALUE VARCHAR(255),
+         DATA_TYPE VARCHAR(255),
+         METADATA VARCHAR(255),
+         APP_ARGUMENT VARCHAR(255),
+         STANDARD_INPUT SMALLINT,
+         INPUT_ORDER INTEGER,
+         IS_REQUIRED SMALLINT,
+         REQUIRED_TO_COMMANDLINE SMALLINT,
+         DATA_STAGED SMALLINT,
+         USER_FRIENDLY_DESC VARCHAR(255),
+  IS_READ_ONLY SMALLINT,
+         PRIMARY KEY(INTERFACE_ID,INPUT_KEY),
+         FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_OUTPUT
+(
+         INTERFACE_ID VARCHAR(255),
+         OUTPUT_KEY VARCHAR(255),
+         OUTPUT_VALUE VARCHAR(255),
+         DATA_TYPE VARCHAR(255),
+         IS_REQUIRED SMALLINT,
+         REQUIRED_TO_COMMANDLINE SMALLINT,
+         DATA_MOVEMENT SMALLINT,
+         DATA_NAME_LOCATION VARCHAR(255),
+         SEARCH_QUERY VARCHAR(255),
+         APP_ARGUMENT VARCHAR(255),
+         OUTPUT_STREAMING SMALLINT,
+         PRIMARY KEY(INTERFACE_ID,OUTPUT_KEY),
+         FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GATEWAY_PROFILE
+(
+         GATEWAY_ID VARCHAR(255),
+         CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+         CS_TOKEN VARCHAR (255),
+         IDENTITY_SERVER_TENANT VARCHAR (255),
+         IDENTITY_SERVER_PWD_CRED_TOKEN VARCHAR (255),
+         PRIMARY KEY(GATEWAY_ID)
+);
+
+CREATE TABLE COMPUTE_RESOURCE_PREFERENCE
+(
+        GATEWAY_ID VARCHAR(255),
+        RESOURCE_ID VARCHAR(255),
+        OVERRIDE_BY_AIRAVATA SMALLINT,
+        PREFERED_JOB_SUB_PROTOCOL VARCHAR(255),
+        PREFERED_DATA_MOVE_PROTOCOL VARCHAR(255),
+        PREFERED_BATCH_QUEUE VARCHAR(255),
+        SCRATCH_LOCATION VARCHAR(255),
+        ALLOCATION_PROJECT_NUMBER VARCHAR(255),
+        LOGIN_USERNAME VARCHAR(255),
+        RESOURCE_CS_TOKEN VARCHAR(255),
+        USAGE_REPORTING_GATEWAY_ID VARCHAR(255),
+        QUALITY_OF_SERVICE VARCHAR(255),
+        RESERVATION VARCHAR (255),
+        RESERVATION_START_TIME timestamp,
+        RESERVATION_END_TIME timestamp,
+        SSH_ACCOUNT_PROVISIONER VARCHAR(255),
+        SSH_ACCOUNT_PROVISIONER_ADDITIONAL_INFO VARCHAR(1000),
+        PRIMARY KEY(GATEWAY_ID,RESOURCE_ID),
+        FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE,
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG
+(
+        GATEWAY_ID VARCHAR(255),
+        RESOURCE_ID VARCHAR(255),
+        CONFIG_NAME VARCHAR(255),
+        CONFIG_VALUE VARCHAR(255),
+        PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME),
+        FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE BATCH_QUEUE
+(
+        COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL,
+        MAX_RUNTIME INTEGER,
+        MAX_JOB_IN_QUEUE INTEGER,
+        QUEUE_DESCRIPTION VARCHAR(255),
+        QUEUE_NAME VARCHAR(255) NOT NULL,
+        MAX_PROCESSORS INTEGER,
+        MAX_NODES INTEGER,
+        MAX_MEMORY INTEGER,
+        CPU_PER_NODE INTEGER,
+        DEFAULT_NODE_COUNT INTEGER,
+        DEFAULT_CPU_COUNT INTEGER,
+        DEFAULT_WALLTIME INTEGER,
+        QUEUE_SPECIFIC_MACROS VARCHAR(255),
+        IS_DEFAULT_QUEUE BOOLEAN,
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMPUTE_RESOURCE_FILE_SYSTEM
+(
+        COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        PATH VARCHAR (255),
+        FILE_SYSTEM VARCHAR (255) NOT NULL,
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,FILE_SYSTEM),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+  );
+
+CREATE TABLE JOB_SUBMISSION_INTERFACE
+(
+        JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+        COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        JOB_SUBMISSION_PROTOCOL VARCHAR (255) NOT NULL,
+        PRIORITY_ORDER INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,JOB_SUBMISSION_INTERFACE_ID),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+ 
+CREATE TABLE DATA_MOVEMENT_INTERFACE
+(
+        COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        PRIORITY_ORDER INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE STORAGE_RESOURCE
+(
+        STORAGE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        HOST_NAME VARCHAR (255) NOT NULL,
+        DESCRIPTION VARCHAR (255),
+        ENABLED SMALLINT ,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (STORAGE_RESOURCE_ID)
+);
+
+CREATE TABLE STORAGE_INTERFACE
+(
+        STORAGE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
+        PRIORITY_ORDER INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (STORAGE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
+        FOREIGN KEY (STORAGE_RESOURCE_ID) REFERENCES STORAGE_RESOURCE(STORAGE_RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_MANAGER_COMMAND
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        COMMAND_TYPE VARCHAR (255) NOT NULL,
+        COMMAND VARCHAR (255),
+        PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE PARALLELISM_COMMAND
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        COMMAND_TYPE VARCHAR (255) NOT NULL,
+        COMMAND VARCHAR (255),
+        PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LOCAL_SUBMISSION
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)
+);
+
+CREATE TABLE STORAGE_PREFERENCE
+(
+        GATEWAY_ID VARCHAR(255),
+        STORAGE_RESOURCE_ID VARCHAR(255),
+        LOGIN_USERNAME VARCHAR(255),
+        FS_ROOT_LOCATION VARCHAR(255),
+        RESOURCE_CS_TOKEN VARCHAR(255),
+        PRIMARY KEY(GATEWAY_ID,STORAGE_RESOURCE_ID),
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LOCAL_DATA_MOVEMENT
+(
+	     DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+	     PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
+);
+
+CREATE TABLE WORKFLOW
+(
+        WF_TEMPLATE_ID VARCHAR (255) NOT NULL,
+        WF_NAME VARCHAR (255) NOT NULL,
+        GRAPH CLOB,
+        OWNER VARCHAR(255),
+        GATEWAY_ID VARCHAR(255),
+        CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        IMAGE BLOB,
+        PRIMARY KEY (WF_TEMPLATE_ID)
+);
+
+CREATE TABLE WORKFLOW_INPUT
+(
+         WF_TEMPLATE_ID VARCHAR(255),
+         INPUT_KEY VARCHAR(255),
+         INPUT_VALUE CLOB,
+         DATA_TYPE VARCHAR(255),
+         METADATA VARCHAR(255),
+         APP_ARGUMENT VARCHAR(255),
+         STANDARD_INPUT SMALLINT,
+         USER_FRIENDLY_DESC VARCHAR(255),
+         PRIMARY KEY(WF_TEMPLATE_ID,INPUT_KEY),
+         FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_OUTPUT
+(
+         WF_TEMPLATE_ID VARCHAR(255),
+         OUTPUT_KEY VARCHAR(255),
+         OUTPUT_VALUE CLOB,
+         DATA_TYPE VARCHAR(255),
+         PRIMARY KEY(WF_TEMPLATE_ID,OUTPUT_KEY),
+         FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE USER_RESOURCE_PROFILE (
+  USER_ID varchar(255) NOT NULL,
+  CREATION_TIME TIMESTAMP DEFAULT NULL,
+  CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_PWD_CRED_TOKEN varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_TENANT varchar(255) DEFAULT NULL,
+  UPDATE_TIME TIMESTAMP DEFAULT NULL,
+  PRIMARY KEY (USER_ID,GATEWAY_ID)
+);
+
+CREATE TABLE USER_STORAGE_PREFERENCE (
+  STORAGE_RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  FS_ROOT_LOCATION varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  PRIMARY KEY (STORAGE_RESOURCE_ID,USER_ID,GATEWAY_ID)
+);
+
+CREATE TABLE USER_COMPUTE_RESOURCE_PREFERENCE (
+  RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  PREFERED_BATCH_QUEUE varchar(255) DEFAULT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  ALLOCATION_PROJECT_NUMBER varchar(255) DEFAULT NULL,
+  QUALITY_OF_SERVICE varchar(255) DEFAULT NULL,
+  RESERVATION varchar(255) DEFAULT NULL,
+  RESERVATION_END_TIME TIMESTAMP DEFAULT NULL,
+  RESERVATION_START_TIME TIMESTAMP DEFAULT NULL,
+  SCRATCH_LOCATION varchar(255) DEFAULT NULL,
+  VALIDATED SMALLINT NOT NULL DEFAULT 0,
+  PRIMARY KEY (RESOURCE_ID,USER_ID,GATEWAY_ID)
+);
+
+CREATE TABLE CONFIGURATION
+(
+        CONFIG_KEY VARCHAR(255),
+        CONFIG_VAL VARCHAR(255),
+        PRIMARY KEY(CONFIG_KEY, CONFIG_VAL)
+);
+
+INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.16');
+
+
+
diff --git a/modules/registry-refactoring/src/main/resources/appcatalog-mysql.sql b/modules/registry-refactoring/src/main/resources/appcatalog-mysql.sql
new file mode 100644
index 0000000..3664a63
--- /dev/null
+++ b/modules/registry-refactoring/src/main/resources/appcatalog-mysql.sql
@@ -0,0 +1,579 @@
+/*
+ *
+ * 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.
+ *
+ */
+CREATE TABLE COMPUTE_RESOURCE
+(
+          RESOURCE_ID VARCHAR (255) NOT NULL,
+          HOST_NAME VARCHAR (255) NOT NULL,
+          RESOURCE_DESCRIPTION VARCHAR (255),
+          CREATION_TIME TIMESTAMP DEFAULT NOW(),
+          UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+          MAX_MEMORY_NODE INTEGER,
+          CPUS_PER_NODE INTEGER,
+          DEFAULT_NODE_COUNT INTEGER,
+          DEFAULT_CPU_COUNT INTEGER,
+          DEFAULT_WALLTIME INTEGER,
+          ENABLED SMALLINT,
+          GATEWAY_USAGE_REPORTING SMALLINT,
+          GATEWAY_USAGE_MODULE_LOAD_CMD VARCHAR(500),
+          GATEWAY_USAGE_EXECUTABLE VARCHAR(255),
+          PRIMARY KEY (RESOURCE_ID)
+);
+
+CREATE TABLE HOST_ALIAS
+(
+         RESOURCE_ID VARCHAR(255),
+         ALIAS VARCHAR(255),
+         PRIMARY KEY(RESOURCE_ID,ALIAS),
+         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE HOST_IPADDRESS
+(
+         RESOURCE_ID VARCHAR(255),
+         IP_ADDRESS VARCHAR(255),
+         PRIMARY KEY(RESOURCE_ID,IP_ADDRESS),
+         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GSISSH_SUBMISSION
+(
+         SUBMISSION_ID VARCHAR(255),
+         RESOURCE_JOB_MANAGER VARCHAR(255),
+         SSH_PORT INTEGER,
+         INSTALLED_PATH VARCHAR(255),
+         MONITOR_MODE VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID)
+);
+
+CREATE TABLE GSISSH_EXPORT
+(
+         SUBMISSION_ID VARCHAR(255),
+         EXPORT VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID, EXPORT),
+         FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GSISSH_PREJOBCOMMAND
+(
+         SUBMISSION_ID VARCHAR(255),
+         COMMAND VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID, COMMAND),
+         FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GSISSH_POSTJOBCOMMAND
+(
+         SUBMISSION_ID VARCHAR(255),
+         COMMAND VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID, COMMAND),
+         FOREIGN KEY (SUBMISSION_ID) REFERENCES GSISSH_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GLOBUS_SUBMISSION
+(
+         SUBMISSION_ID VARCHAR(255),
+         RESOURCE_JOB_MANAGER VARCHAR(255),
+         SECURITY_PROTOCAL VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID)
+);
+CREATE TABLE UNICORE_SUBMISSION
+(
+         SUBMISSION_ID VARCHAR(255),
+         SECURITY_PROTOCAL VARCHAR(255),
+         UNICORE_ENDPOINT_URL VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID)
+);
+
+CREATE TABLE UNICORE_DATAMOVEMENT
+(
+         DATAMOVEMENT_ID VARCHAR(255),
+         SECURITY_PROTOCAL VARCHAR(255),
+         UNICORE_ENDPOINT_URL VARCHAR(255),
+         PRIMARY KEY(DATAMOVEMENT_ID)
+);
+
+CREATE TABLE GLOBUS_GK_ENDPOINT
+(
+         SUBMISSION_ID VARCHAR(255),
+         ENDPOINT VARCHAR(255),
+         PRIMARY KEY(SUBMISSION_ID, ENDPOINT),
+         FOREIGN KEY (SUBMISSION_ID) REFERENCES GLOBUS_SUBMISSION(SUBMISSION_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE RESOURCE_JOB_MANAGER
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        PUSH_MONITORING_ENDPOINT VARCHAR (255),
+        JOB_MANAGER_BIN_PATH VARCHAR (255),
+        RESOURCE_JOB_MANAGER_TYPE VARCHAR (255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (RESOURCE_JOB_MANAGER_ID)
+);
+
+CREATE TABLE SSH_JOB_SUBMISSION
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+        ALTERNATIVE_SSH_HOSTNAME VARCHAR (255),
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        SSH_PORT INTEGER,
+        MONITOR_MODE VARCHAR (255),
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+        PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)
+);
+
+
+CREATE TABLE SCP_DATA_MOVEMENT
+(
+        QUEUE_DESCRIPTION VARCHAR (255),
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        ALTERNATIVE_SCP_HOSTNAME VARCHAR (255),
+        SSH_PORT INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
+);
+
+CREATE TABLE GRIDFTP_DATA_MOVEMENT
+(
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
+);
+
+CREATE TABLE GRIDFTP_ENDPOINT
+(
+        ENDPOINT VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID,ENDPOINT),
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+        FOREIGN KEY (DATA_MOVEMENT_INTERFACE_ID) REFERENCES GRIDFTP_DATA_MOVEMENT(DATA_MOVEMENT_INTERFACE_ID) ON DELETE CASCADE
+);
+
+--CREATE TABLE JOB_SUBMISSION_PROTOCOL
+--(
+--         RESOURCE_ID VARCHAR(255),
+--         SUBMISSION_ID VARCHAR(255),
+--         JOB_TYPE VARCHAR(255),
+--         PRIMARY KEY(RESOURCE_ID,SUBMISSION_ID,JOB_TYPE),
+--         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+--);
+--
+--CREATE TABLE DATA_MOVEMENT_PROTOCOL
+--(
+--         RESOURCE_ID VARCHAR(255),
+--         DATA_MOVE_ID VARCHAR(255),
+--         DATA_MOVE_TYPE VARCHAR(255),
+--         PRIMARY KEY(RESOURCE_ID,DATA_MOVE_ID,DATA_MOVE_TYPE),
+--         FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+--);
+
+CREATE TABLE APPLICATION_MODULE
+(
+         MODULE_ID VARCHAR(255),
+         MODULE_NAME VARCHAR(255),
+         MODULE_VERSION VARCHAR(255),
+         MODULE_DESC VARCHAR(500),
+         GATEWAY_ID VARCHAR (255),
+	       CREATION_TIME TIMESTAMP DEFAULT NOW(),
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+         PRIMARY KEY(MODULE_ID)
+);
+
+CREATE TABLE APPLICATION_DEPLOYMENT
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         APP_MODULE_ID VARCHAR(255),
+         COMPUTE_HOSTID VARCHAR(255),
+         EXECUTABLE_PATH VARCHAR(255),
+	       PARALLELISM VARCHAR(255),
+         APPLICATION_DESC VARCHAR(255),
+         ENV_MODULE_LOAD_CMD VARCHAR(255),
+	       CREATION_TIME TIMESTAMP DEFAULT NOW(),
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+         GATEWAY_ID VARCHAR(255),
+         DEFAULT_QUEUE_NAME VARCHAR(255),
+         DEFAULT_NODE_COUNT INTEGER,
+         DEFAULT_CPU_COUNT INTEGER,
+         DEFAULT_WALLTIME INTEGER,
+         EDITABLE_BY_USER TINYINT(1),
+         PRIMARY KEY(DEPLOYMENT_ID),
+         FOREIGN KEY (COMPUTE_HOSTID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE,
+         FOREIGN KEY (APP_MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LIBRARY_PREPAND_PATH
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         NAME VARCHAR(255),
+         VALUE VARCHAR(255),
+         PRIMARY KEY(DEPLOYMENT_ID, NAME),
+         FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LIBRARY_APEND_PATH
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         NAME VARCHAR(255),
+         VALUE VARCHAR(255),
+         PRIMARY KEY(DEPLOYMENT_ID, NAME),
+         FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APP_ENVIRONMENT
+(
+         DEPLOYMENT_ID VARCHAR(255),
+         NAME VARCHAR(255),
+         VALUE VARCHAR(255),
+         PRIMARY KEY(DEPLOYMENT_ID, NAME),
+         FOREIGN KEY (DEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE PREJOB_COMMAND
+(
+         APPDEPLOYMENT_ID VARCHAR(255),
+         COMMAND VARCHAR(255),
+         PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+         FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE POSTJOB_COMMAND
+(
+         APPDEPLOYMENT_ID VARCHAR(255),
+         COMMAND VARCHAR(255),
+         PRIMARY KEY(APPDEPLOYMENT_ID, COMMAND),
+         FOREIGN KEY (APPDEPLOYMENT_ID) REFERENCES APPLICATION_DEPLOYMENT(DEPLOYMENT_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INTERFACE
+(
+         INTERFACE_ID VARCHAR(255),
+         APPLICATION_NAME VARCHAR(255),
+         APPLICATION_DESCRIPTION VARCHAR(500),
+         GATEWAY_ID VARCHAR(255),
+         ARCHIVE_WORKING_DIRECTORY SMALLINT,
+	       CREATION_TIME TIMESTAMP DEFAULT NOW(),
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+         PRIMARY KEY(INTERFACE_ID)
+);
+
+CREATE TABLE APP_MODULE_MAPPING
+(
+         INTERFACE_ID VARCHAR(255),
+         MODULE_ID VARCHAR(255),
+         PRIMARY KEY(INTERFACE_ID, MODULE_ID),
+         FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE,
+         FOREIGN KEY (MODULE_ID) REFERENCES APPLICATION_MODULE(MODULE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_INPUT
+(
+         INTERFACE_ID VARCHAR(255),
+         INPUT_KEY VARCHAR(255),
+         INPUT_VALUE VARCHAR(255),
+         DATA_TYPE VARCHAR(255),
+         METADATA VARCHAR(255),
+         APP_ARGUMENT VARCHAR(255),
+         STANDARD_INPUT SMALLINT,
+         USER_FRIENDLY_DESC VARCHAR(255),
+         INPUT_ORDER INTEGER,
+         IS_REQUIRED SMALLINT,
+         REQUIRED_TO_COMMANDLINE SMALLINT,
+         DATA_STAGED SMALLINT,
+         IS_READ_ONLY SMALLINT,
+         PRIMARY KEY(INTERFACE_ID,INPUT_KEY),
+         FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE APPLICATION_OUTPUT
+(
+         INTERFACE_ID VARCHAR(255),
+         OUTPUT_KEY VARCHAR(255),
+         OUTPUT_VALUE VARCHAR(255),
+         DATA_TYPE VARCHAR(255),
+         IS_REQUIRED SMALLINT,
+         REQUIRED_TO_COMMANDLINE SMALLINT,
+         DATA_MOVEMENT SMALLINT,
+         DATA_NAME_LOCATION VARCHAR(255),
+         SEARCH_QUERY VARCHAR(255),
+         APP_ARGUMENT VARCHAR(255),
+         OUTPUT_STREAMING SMALLINT,
+         PRIMARY KEY(INTERFACE_ID,OUTPUT_KEY),
+         FOREIGN KEY (INTERFACE_ID) REFERENCES APPLICATION_INTERFACE(INTERFACE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE GATEWAY_PROFILE
+(
+         GATEWAY_ID VARCHAR(255),
+	       CREATION_TIME TIMESTAMP DEFAULT NOW(),
+         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
+         CS_TOKEN VARCHAR (255),
+         IDENTITY_SERVER_TENANT VARCHAR (255),
+         IDENTITY_SERVER_PWD_CRED_TOKEN VARCHAR (255),
+         PRIMARY KEY(GATEWAY_ID)
+);
+
+CREATE TABLE COMPUTE_RESOURCE_PREFERENCE
+(
+        GATEWAY_ID VARCHAR(255),
+        RESOURCE_ID VARCHAR(255),
+        OVERRIDE_BY_AIRAVATA SMALLINT,
+        PREFERED_JOB_SUB_PROTOCOL VARCHAR(255),
+        PREFERED_DATA_MOVE_PROTOCOL VARCHAR(255),
+        PREFERED_BATCH_QUEUE VARCHAR(255),
+        SCRATCH_LOCATION VARCHAR(255),
+        ALLOCATION_PROJECT_NUMBER VARCHAR(255),
+        LOGIN_USERNAME VARCHAR(255),
+        RESOURCE_CS_TOKEN VARCHAR(255),
+        USAGE_REPORTING_GATEWAY_ID VARCHAR(255),
+        QUALITY_OF_SERVICE VARCHAR(255),
+        RESERVATION VARCHAR (255),
+        RESERVATION_START_TIME timestamp,
+        RESERVATION_END_TIME timestamp,
+        SSH_ACCOUNT_PROVISIONER VARCHAR(255),
+        SSH_ACCOUNT_PROVISIONER_ADDITIONAL_INFO VARCHAR(1000),
+        PRIMARY KEY(GATEWAY_ID,RESOURCE_ID),
+        FOREIGN KEY (RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE,
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG
+(
+        GATEWAY_ID VARCHAR(255),
+        RESOURCE_ID VARCHAR(255),
+        CONFIG_NAME VARCHAR(255),
+        CONFIG_VALUE VARCHAR(255),
+        PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME),
+        FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+CREATE TABLE BATCH_QUEUE
+(
+        COMPUTE_RESOURCE_ID VARCHAR(255) NOT NULL,
+        MAX_RUNTIME INTEGER,
+        MAX_JOB_IN_QUEUE INTEGER,
+        QUEUE_DESCRIPTION VARCHAR(255),
+        QUEUE_NAME VARCHAR(255) NOT NULL,
+        MAX_PROCESSORS INTEGER,
+        MAX_NODES INTEGER,
+        MAX_MEMORY INTEGER,
+        CPU_PER_NODE INTEGER,
+        DEFAULT_NODE_COUNT INTEGER,
+        DEFAULT_CPU_COUNT INTEGER,
+        DEFAULT_WALLTIME INTEGER,
+        QUEUE_SPECIFIC_MACROS VARCHAR(255),
+        IS_DEFAULT_QUEUE TINYINT(1),
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,QUEUE_NAME),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE COMPUTE_RESOURCE_FILE_SYSTEM
+(
+        COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        PATH VARCHAR (255),
+        FILE_SYSTEM VARCHAR (255) NOT NULL,
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,FILE_SYSTEM),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_SUBMISSION_INTERFACE
+(
+        JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+        COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        JOB_SUBMISSION_PROTOCOL VARCHAR (255) NOT NULL,
+        PRIORITY_ORDER INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,JOB_SUBMISSION_INTERFACE_ID),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+ 
+CREATE TABLE DATA_MOVEMENT_INTERFACE
+(
+        COMPUTE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        PRIORITY_ORDER INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (COMPUTE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
+        FOREIGN KEY (COMPUTE_RESOURCE_ID) REFERENCES COMPUTE_RESOURCE(RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE STORAGE_RESOURCE
+(
+        STORAGE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        HOST_NAME VARCHAR (255) NOT NULL,
+        DESCRIPTION VARCHAR (255),
+        ENABLED SMALLINT,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (STORAGE_RESOURCE_ID)
+);
+
+CREATE TABLE STORAGE_INTERFACE
+(
+        STORAGE_RESOURCE_ID VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_PROTOCOL VARCHAR (255) NOT NULL,
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        PRIORITY_ORDER INTEGER,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (STORAGE_RESOURCE_ID,DATA_MOVEMENT_INTERFACE_ID),
+        FOREIGN KEY (STORAGE_RESOURCE_ID) REFERENCES STORAGE_RESOURCE(STORAGE_RESOURCE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE JOB_MANAGER_COMMAND
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        COMMAND_TYPE VARCHAR (255) NOT NULL,
+        COMMAND VARCHAR (255),
+        PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE PARALLELISM_COMMAND
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        COMMAND_TYPE VARCHAR (255) NOT NULL,
+        COMMAND VARCHAR (255),
+        PRIMARY KEY (RESOURCE_JOB_MANAGER_ID,COMMAND_TYPE),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE LOCAL_SUBMISSION
+(
+        RESOURCE_JOB_MANAGER_ID VARCHAR (255) NOT NULL,
+        JOB_SUBMISSION_INTERFACE_ID VARCHAR (255) NOT NULL,
+        SECURITY_PROTOCOL VARCHAR (255) NOT NULL,
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        PRIMARY KEY (JOB_SUBMISSION_INTERFACE_ID),
+        FOREIGN KEY (RESOURCE_JOB_MANAGER_ID) REFERENCES RESOURCE_JOB_MANAGER(RESOURCE_JOB_MANAGER_ID)
+);
+
+CREATE TABLE LOCAL_DATA_MOVEMENT
+(
+        DATA_MOVEMENT_INTERFACE_ID VARCHAR (255) NOT NULL,
+        PRIMARY KEY (DATA_MOVEMENT_INTERFACE_ID)
+);
+
+CREATE TABLE DATA_STORAGE_PREFERENCE
+(
+        GATEWAY_ID VARCHAR(255),
+        STORAGE_RESOURCE_ID VARCHAR(255),
+        LOGIN_USERNAME VARCHAR(255),
+        FS_ROOT_LOCATION VARCHAR(255),
+        RESOURCE_CS_TOKEN VARCHAR(255),
+        PRIMARY KEY(GATEWAY_ID,STORAGE_RESOURCE_ID),
+        FOREIGN KEY (GATEWAY_ID) REFERENCES GATEWAY_PROFILE(GATEWAY_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW
+(
+        WF_TEMPLATE_ID VARCHAR (255) NOT NULL,
+        WF_NAME VARCHAR (255) NOT NULL,
+        GRAPH LONGTEXT,
+        OWNER VARCHAR(255),
+        CREATION_TIME TIMESTAMP DEFAULT NOW(),
+        UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
+        IMAGE BLOB,
+        PRIMARY KEY (WF_TEMPLATE_ID)
+);
+
+CREATE TABLE WORKFLOW_INPUT
+(
+         WF_TEMPLATE_ID VARCHAR(255),
+         INPUT_KEY VARCHAR(255),
+         INPUT_VALUE LONGTEXT,
+         DATA_TYPE VARCHAR(255),
+         METADATA VARCHAR(255),
+         APP_ARGUMENT VARCHAR(255),
+         STANDARD_INPUT SMALLINT,
+         USER_FRIENDLY_DESC VARCHAR(255),
+         PRIMARY KEY(WF_TEMPLATE_ID,INPUT_KEY),
+         FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE WORKFLOW_OUTPUT
+(
+         WF_TEMPLATE_ID VARCHAR(255),
+         OUTPUT_KEY VARCHAR(255),
+         OUTPUT_VALUE LONGTEXT,
+         DATA_TYPE VARCHAR(255),
+         PRIMARY KEY(WF_TEMPLATE_ID,OUTPUT_KEY),
+         FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
+);
+
+CREATE TABLE USER_RESOURCE_PROFILE (
+  USER_ID varchar(255) NOT NULL,
+  CREATION_TIME datetime DEFAULT NULL,
+  CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_PWD_CRED_TOKEN varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_TENANT varchar(255) DEFAULT NULL,
+  UPDATE_TIME datetime DEFAULT NULL,
+  PRIMARY KEY (USER_ID,GATEWAY_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE USER_STORAGE_PREFERENCE (
+  STORAGE_RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  FS_ROOT_LOCATION varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  PRIMARY KEY (STORAGE_RESOURCE_ID,USER_ID,GATEWAY_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE USER_COMPUTE_RESOURCE_PREFERENCE (
+  RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  PREFERED_BATCH_QUEUE varchar(255) DEFAULT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  ALLOCATION_PROJECT_NUMBER varchar(255) DEFAULT NULL,
+  QUALITY_OF_SERVICE varchar(255) DEFAULT NULL,
+  RESERVATION varchar(255) DEFAULT NULL,
+  RESERVATION_END_TIME datetime DEFAULT NULL,
+  RESERVATION_START_TIME datetime DEFAULT NULL,
+  SCRATCH_LOCATION varchar(255) NOT NULL DEFAULT NULL,
+  VALIDATED TINYINT(1) DEFAULT 0,
+  PRIMARY KEY (RESOURCE_ID,USER_ID,GATEWAY_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE CONFIGURATION
+(
+          CONFIG_KEY VARCHAR(255),
+          CONFIG_VAL VARCHAR(255),
+          PRIMARY KEY(CONFIG_KEY, CONFIG_VAL)
+);
+
+INSERT INTO CONFIGURATION (CONFIG_KEY, CONFIG_VAL) VALUES('app_catalog_version', '0.16');
+
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/GatewayProfileRepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/GatewayProfileRepositoryTest.java
new file mode 100644
index 0000000..5eec2e0
--- /dev/null
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/GatewayProfileRepositoryTest.java
@@ -0,0 +1,69 @@
+package org.apache.airavata.registry.core.repositories;
+
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.registry.core.repositories.appcatalog.GwyResourceProfileRepository;
+import org.apache.airavata.registry.core.repositories.util.Initialize;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+import static org.junit.Assert.assertTrue;
+
+public class GatewayProfileRepositoryTest {
+
+    private static Initialize initialize;
+    private GwyResourceProfileRepository gwyResourceProfileRepository;
+    private static final Logger logger = LoggerFactory.getLogger(GatewayProfileRepositoryTest.class);
+
+    @Before
+    public void setUp() {
+        try {
+            initialize = new Initialize("appcatalog-derby.sql");
+            initialize.initializeDB();
+            gwyResourceProfileRepository = new GwyResourceProfileRepository();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        System.out.println("********** TEAR DOWN ************");
+        initialize.stopDerbyServer();
+    }
+
+    @Test
+    public void gatewayProfileRepositorytest() {
+        GatewayResourceProfile gf = new GatewayResourceProfile();
+        gf.setGatewayID("testGateway");
+        gf.setCredentialStoreToken("testCredential");
+        gf.setIdentityServerPwdCredToken("pwdCredential");
+        gf.setIdentityServerTenant("testTenant");
+
+        GatewayResourceProfile gf1 = new GatewayResourceProfile();
+        gf1.setGatewayID("testGateway1");
+        gf1.setCredentialStoreToken("testCredential");
+        gf1.setIdentityServerPwdCredToken("pwdCredential");
+        gf1.setIdentityServerTenant("testTenant");
+
+        String gwId = gwyResourceProfileRepository.addGatewayResourceProfile(gf);
+        GatewayResourceProfile retrievedProfile = null;
+        if (gwyResourceProfileRepository.isExists(gwId)){
+            retrievedProfile = gwyResourceProfileRepository.getGatewayProfile(gwId);
+            System.out.println("************ gateway id ************** :" + retrievedProfile.getGatewayID());
+            assertTrue("Retrieved gateway id matched", retrievedProfile.getGatewayID().equals("testGateway"));
+            assertTrue(retrievedProfile.getCredentialStoreToken().equals("testCredential"));
+            assertTrue(retrievedProfile.getIdentityServerPwdCredToken().equals("pwdCredential"));
+            assertTrue(retrievedProfile.getIdentityServerTenant().equals("testTenant"));
+        }
+
+        gwyResourceProfileRepository.addGatewayResourceProfile(gf1);
+        List<GatewayResourceProfile> getGatewayResourceList = gwyResourceProfileRepository.getAllGatewayProfiles();
+        assertTrue(getGatewayResourceList.size() == 2);
+    }
+
+}
diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/util/Initialize.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/util/Initialize.java
new file mode 100644
index 0000000..8581cb7
--- /dev/null
+++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/util/Initialize.java
@@ -0,0 +1,318 @@
+/**
+ *
+ * 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.airavata.registry.core.repositories.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.derby.drda.NetworkServerControl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.URI;
+import java.sql.*;
+import java.util.StringTokenizer;
+
+public class Initialize {
+    private static final Logger logger = LoggerFactory.getLogger(Initialize.class);
+    public static final String DERBY_SERVER_MODE_SYS_PROPERTY = "derby.drda.startNetworkServer";
+    public  String scriptName = "appcatalog-derby.sql";
+    private NetworkServerControl server;
+    private static final String delimiter = ";";
+    public static final String COMPUTE_RESOURCE_TABLE = "COMPUTE_RESOURCE";
+    private String jdbcUrl = null;
+    private String jdbcDriver = null;
+    private String jdbcUser = null;
+    private String jdbcPassword = null;
+
+    public Initialize(String scriptName) {
+        this.scriptName = scriptName;
+    }
+
+    public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
+        if (suffix.length() > buffer.length()) {
+            return false;
+        }
+        // this loop is done on purpose to avoid memory allocation performance
+        // problems on various JDKs
+        // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
+        // implementation is ok though does allocation/copying
+        // StringBuffer.toString().endsWith() does massive memory
+        // allocation/copying on JDK 1.5
+        // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
+        int endIndex = suffix.length() - 1;
+        int bufferIndex = buffer.length() - 1;
+        while (endIndex >= 0) {
+            if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
+                return false;
+            }
+            bufferIndex--;
+            endIndex--;
+        }
+        return true;
+    }
+
+    private static boolean isServerStarted(NetworkServerControl server, int ntries)
+    {
+        for (int i = 1; i <= ntries; i ++)
+        {
+            try {
+                Thread.sleep(500);
+                server.ping();
+                return true;
+            }
+            catch (Exception e) {
+                if (i == ntries)
+                    return false;
+            }
+        }
+        return false;
+    }
+
+    public void initializeDB() {
+
+        try{
+            jdbcDriver = ServerSettings.getSetting("appcatalog.jdbc.driver");
+            jdbcUrl = ServerSettings.getSetting("appcatalog.jdbc.url");
+            jdbcUser = ServerSettings.getSetting("appcatalog.jdbc.user");
+            jdbcPassword = ServerSettings.getSetting("appcatalog.jdbc.password");
+            jdbcUrl = jdbcUrl + "?" + "user=" + jdbcUser + "&" + "password=" + jdbcPassword;
+        } catch (ApplicationSettingsException e) {
+            logger.error("Unable to read properties", e);
+        }
+
+        startDerbyInServerMode();
+        if(!isServerStarted(server, 20)){
+           throw new RuntimeException("Derby server cound not started within five seconds...");
+        }
+//      startDerbyInEmbeddedMode();
+
+        Connection conn = null;
+        try {
+            Class.forName(jdbcDriver).newInstance();
+            conn = DriverManager.getConnection(jdbcUrl, jdbcUser, jdbcPassword);
+            if (!isDatabaseStructureCreated(COMPUTE_RESOURCE_TABLE, conn)) {
+                executeSQLScript(conn);
+                logger.info("New Database created for App Catalog !!!");
+            } else {
+                logger.debug("Database already created for App Catalog!");
+            }
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            throw new RuntimeException("Database failure", e);
+        } finally {
+            try {
+                if (conn != null){
+                    if (!conn.getAutoCommit()) {
+                        conn.commit();
+                    }
+                    conn.close();
+                }
+            } catch (SQLException e) {
+                logger.error(e.getMessage(), e);
+            }
+        }
+    }
+
+    public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
+        try {
+            System.out.println("Running a query to test the database tables existence.");
+            // check whether the tables are already created with a query
+            Statement statement = null;
+            try {
+                statement = conn.createStatement();
+                ResultSet rs = statement.executeQuery("select * from " + tableName);
+                if (rs != null) {
+                    rs.close();
+                }
+            } finally {
+                try {
+                    if (statement != null) {
+                        statement.close();
+                    }
+                } catch (SQLException e) {
+                    return false;
+                }
+            }
+        } catch (SQLException e) {
+            return false;
+        }
+
+        return true;
+    }
+
+    private void executeSQLScript(Connection conn) throws Exception {
+        StringBuffer sql = new StringBuffer();
+        BufferedReader reader = null;
+        try{
+
+        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(scriptName);
+        reader = new BufferedReader(new InputStreamReader(inputStream));
+        String line;
+        while ((line = reader.readLine()) != null) {
+            line = line.trim();
+            if (line.startsWith("//")) {
+                continue;
+            }
+            if (line.startsWith("--")) {
+                continue;
+            }
+            StringTokenizer st = new StringTokenizer(line);
+            if (st.hasMoreTokens()) {
+                String token = st.nextToken();
+                if ("REM".equalsIgnoreCase(token)) {
+                    continue;
+                }
+            }
+            sql.append(" ").append(line);
+
+            // SQL defines "--" as a comment to EOL
+            // and in Oracle it may contain a hint
+            // so we cannot just remove it, instead we must end it
+            if (line.indexOf("--") >= 0) {
+                sql.append("\n");
+            }
+            if ((checkStringBufferEndsWith(sql, delimiter))) {
+                executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
+                sql.replace(0, sql.length(), "");
+            }
+        }
+        // Catch any statements not followed by ;
+        if (sql.length() > 0) {
+            executeSQL(sql.toString(), conn);
+        }
+        }catch (IOException e){
+            logger.error("Error occurred while executing SQL script for creating Airavata database", e);
+            throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
+        }finally {
+            if (reader != null) {
+                reader.close();
+            }
+
+        }
+
+    }
+
+    private static void executeSQL(String sql, Connection conn) throws Exception {
+        // Check and ignore empty statements
+        if ("".equals(sql.trim())) {
+            return;
+        }
+
+        Statement statement = null;
+        try {
+            logger.debug("SQL : " + sql);
+
+            boolean ret;
+            int updateCount = 0, updateCountTotal = 0;
+            statement = conn.createStatement();
+            ret = statement.execute(sql);
+            updateCount = statement.getUpdateCount();
+            do {
+                if (!ret) {
+                    if (updateCount != -1) {
+                        updateCountTotal += updateCount;
+                    }
+                }
+                ret = statement.getMoreResults();
+                if (ret) {
+                    updateCount = statement.getUpdateCount();
+                }
+            } while (ret);
+
+            logger.debug(sql + " : " + updateCountTotal + " rows affected");
+
+            SQLWarning warning = conn.getWarnings();
+            while (warning != null) {
+                logger.warn(warning + " sql warning");
+                warning = warning.getNextWarning();
+            }
+            conn.clearWarnings();
+        } catch (SQLException e) {
+            if (e.getSQLState().equals("X0Y32")) {
+                // eliminating the table already exception for the derby
+                // database
+                logger.info("Table Already Exists", e);
+            } else {
+                throw new Exception("Error occurred while executing : " + sql, e);
+            }
+        } finally {
+            if (statement != null) {
+                try {
+                    statement.close();
+                } catch (SQLException e) {
+                    logger.error("Error occurred while closing result set.", e);
+                }
+            }
+        }
+    }
+
+    private void startDerbyInServerMode() {
+        try {
+            System.setProperty(DERBY_SERVER_MODE_SYS_PROPERTY, "true");
+            server = new NetworkServerControl(InetAddress.getByName("0.0.0.0"),
+                    20000,
+                    jdbcUser, jdbcPassword);
+            java.io.PrintWriter consoleWriter = new java.io.PrintWriter(System.out, true);
+            server.start(consoleWriter);
+        } catch (IOException e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        } catch (Exception e) {
+            logger.error("Unable to start Apache derby in the server mode! Check whether " +
+                    "specified port is available");
+        }
+
+    }
+
+    public static int getPort(String jdbcURL){
+        try{
+            String cleanURI = jdbcURL.substring(5);
+            URI uri = URI.create(cleanURI);
+            return uri.getPort();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+            return -1;
+        }
+    }
+
+    private void startDerbyInEmbeddedMode(){
+        try {
+            Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
+            DriverManager.getConnection("jdbc:derby:memory:unit-testing-jpa;create=true").close();
+        } catch (ClassNotFoundException e) {
+            logger.error(e.getMessage(), e);
+        } catch (SQLException e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+
+    public void stopDerbyServer() {
+        try {
+            server.shutdown();
+        } catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+    }
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata] 05/06: Reverting unrelated changes

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit c974220c9bcc368558c94f4d1777a4bb205cab21
Author: Sachin Kariyattin <sa...@gmail.com>
AuthorDate: Thu Dec 21 21:03:22 2017 -0500

    Reverting unrelated changes
---
 .../airavata/registry/core/repositories/AbstractRepository.java      | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
index 29d6f85..a98fdff 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
@@ -96,9 +96,4 @@ public abstract class AbstractRepository<T, E, Id> {
         return gatewayList;
     }
 
-    public boolean isExists(Id id) {
-        return get(id) != null;
-    }
-
-
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata] 03/06: Changes to RegistryServiceHandler

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 667cf6a78f3a1ca8869c5cd19d34f47df4bfb8f8
Author: Sachin Kariyattin <sa...@gmail.com>
AuthorDate: Wed Dec 20 13:18:08 2017 -0500

    Changes to RegistryServiceHandler
---
 .../appcatalog/GwyResourceProfileRepository.java   |   8 +-
 .../registry-server/registry-api-service/pom.xml   |   5 +
 .../api/service/handler/RegistryServerHandler.java | 110 ++++++++++-----------
 3 files changed, 59 insertions(+), 64 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
index 07055d9..7003201 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
@@ -63,17 +63,17 @@ public class GwyResourceProfileRepository extends AbstractRepository<GatewayReso
         return gatewayResourceProfile;
     }
 
-    public boolean removeGatewayResourceProfile(String gatewayId) {
+ /*   public boolean removeGatewayResourceProfile(String gatewayId) {
         //return delete(gatewayId);
     }
 
     public boolean isGatewayResourceProfileExists(String gatewayId) {
         //return isExists(gatewayId);
-    }
+    }*/
 
-    public List<String> getGatewayProfileIds(String gatewayName) {
+    /*public List<String> getGatewayProfileIds(String gatewayName) {
         // TODO - Not used anywhere (dev list??)
-    }
+    }*/
 
     public List<GatewayResourceProfile> getAllGatewayProfiles() {
 
diff --git a/modules/registry/registry-server/registry-api-service/pom.xml b/modules/registry/registry-server/registry-api-service/pom.xml
index 8a12c8e..43bb797 100644
--- a/modules/registry/registry-server/registry-api-service/pom.xml
+++ b/modules/registry/registry-server/registry-api-service/pom.xml
@@ -70,5 +70,10 @@
             <artifactId>libthrift</artifactId>
             <version>${thrift.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>registry-refactoring</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index d90c20b..011cee0 100644
--- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -62,6 +62,7 @@ import org.apache.airavata.registry.core.app.catalog.util.AppCatalogThriftConver
 import org.apache.airavata.registry.core.experiment.catalog.ExpCatResourceUtils;
 import org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
 import org.apache.airavata.registry.core.experiment.catalog.resources.AbstractExpCatResource;
+import org.apache.airavata.registry.core.repositories.appcatalog.GwyResourceProfileRepository;
 import org.apache.airavata.registry.cpi.*;
 import org.apache.airavata.registry.cpi.utils.Constants;
 import org.apache.thrift.TException;
@@ -1596,12 +1597,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            GatewayResourceProfile gatewayResourceProfile = gatewayProfile.getGatewayProfile(gatewayID);
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            GatewayResourceProfile gatewayResourceProfile = gwyResourceProfileRepository.getGatewayProfile(gatewayID);
             logger.debug("Airavata retrieved gateway profile with gateway id : " + gatewayID);
             return gatewayResourceProfile;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while retrieving gateway resource profile...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while retrieving gateway resource profile. More info : " + e.getMessage());
@@ -1623,12 +1623,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            gatewayProfile.removeGatewayResourceProfile(gatewayID);
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            gwyResourceProfileRepository.delete(gatewayID);
             logger.debug("Airavata deleted gateway profile with gateway id : " + gatewayID);
             return true;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while removing gateway resource profile...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while removing gateway resource profile. More info : " + e.getMessage());
@@ -1726,10 +1725,9 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            return gatewayProfile.getGatewayProfile(gatewayID).getComputeResourcePreferences();
-        } catch (AppCatalogException e) {
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            return gwyResourceProfileRepository.getGatewayProfile(gatewayID).getComputeResourcePreferences();
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preferences...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while reading gateway compute resource preferences. More info : " + e.getMessage());
@@ -1751,10 +1749,9 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            return gatewayProfile.getGatewayProfile(gatewayID).getStoragePreferences();
-        } catch (AppCatalogException e) {
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            return gwyResourceProfileRepository.getGatewayProfile(gatewayID).getStoragePreferences();
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preferences...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while reading gateway data storage preferences. More info : " + e.getMessage());
@@ -1771,10 +1768,9 @@ public class RegistryServerHandler implements RegistryService.Iface {
     @Override
     public List<GatewayResourceProfile> getAllGatewayResourceProfiles() throws RegistryServiceException, TException {
         try {
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            return gatewayProfile.getAllGatewayProfiles();
-        } catch (AppCatalogException e) {
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            return gwyResourceProfileRepository.getAllGatewayProfiles();
+        } catch (Exception e) {
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while reading retrieving all gateway profiles. More info : " + e.getMessage());
             throw exception;
@@ -1796,10 +1792,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            return gatewayProfile.removeComputeResourcePreferenceFromGateway(gatewayID, computeResourceId);
-        } catch (AppCatalogException e) {
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+
+            return gwyResourceProfileRepository.removeComputeResourcePreferenceFromGateway(gatewayID, computeResourceId);
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while updating gateway compute resource preference. More info : " + e.getMessage());
@@ -1822,10 +1818,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            return gatewayProfile.removeDataStoragePreferenceFromGateway(gatewayID, storageId);
-        } catch (AppCatalogException e) {
+
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            return gwyResourceProfileRepository.removeDataStoragePreferenceFromGateway(gatewayID, storageId);
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
@@ -2055,9 +2051,8 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            GatewayResourceProfile profile = gwyResourceProfileRepository.getGatewayProfile(gatewayID);
             List<StoragePreference> dataStoragePreferences = profile.getStoragePreferences();
             StoragePreference preferenceToRemove = null;
             for (StoragePreference preference : dataStoragePreferences) {
@@ -2071,10 +2066,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
                         preferenceToRemove);
             }
             profile.getStoragePreferences().add(storagePreference);
-            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
+            gwyResourceProfileRepository.updateGatewayResourceProfile(profile);
             logger.debug("Airavata updated storage resource preference with gateway id : " + gatewayID + " and for storage resource id : " + storageId );
             return true;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
@@ -2098,9 +2093,8 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            GatewayResourceProfile profile = gwyResourceProfileRepository.getGatewayProfile(gatewayID);
             List<ComputeResourcePreference> computeResourcePreferences = profile.getComputeResourcePreferences();
             ComputeResourcePreference preferenceToRemove = null;
             for (ComputeResourcePreference preference : computeResourcePreferences) {
@@ -2114,10 +2108,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
                         preferenceToRemove);
             }
             profile.getComputeResourcePreferences().add(computeResourcePreference);
-            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
+            gwyResourceProfileRepository.updateGatewayResourceProfile(profile);
             logger.debug("Airavata updated compute resource preference with gateway id : " + gatewayID + " and for compute resource id : " + computeResourceId );
             return true;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while updating gateway compute resource preference. More info : " + e.getMessage());
@@ -2142,19 +2136,19 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){
+
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            if (!(gwyResourceProfileRepository.isExists(gatewayID))){
                 throw new RegistryServiceException("Gateway resource profile '"+gatewayID+"' does not exist!!!");
             }
-            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
-//            gatewayProfile.removeGatewayResourceProfile(gatewayID);
+            GatewayResourceProfile profile = gwyResourceProfileRepository.getGatewayProfile(gatewayID);
+
             dataStoragePreference.setStorageResourceId(storageResourceId);
             profile.addToStoragePreferences(dataStoragePreference);
-            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
+            gwyResourceProfileRepository.updateGatewayResourceProfile(profile);
             logger.debug("Airavata added storage resource preference with gateway id : " + gatewayID + " and for storage resource id : " + storageResourceId );
             return true;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while registering gateway resource profile preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while registering gateway resource profile preference. More info : " + e.getMessage());
@@ -2179,18 +2173,16 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            if (!(gwyResourceProfileRepository.isExists(gatewayID))){
                 throw new RegistryServiceException("Gateway resource profile '"+gatewayID+"' does not exist!!!");
             }
-            GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
-//            gatewayProfile.removeGatewayResourceProfile(gatewayID);
+            GatewayResourceProfile profile = gwyResourceProfileRepository.getGatewayProfile(gatewayID);
             profile.addToComputeResourcePreferences(computeResourcePreference);
-            gatewayProfile.updateGatewayResourceProfile(gatewayID, profile);
+            gwyResourceProfileRepository.updateGatewayResourceProfile(profile);
             logger.debug("Airavata added gateway compute resource preference with gateway id : " + gatewayID + " and for compute resource id : " + computeResourceId );
             return true;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while registering gateway resource profile preference...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while registering gateway resource profile preference. More info : " + e.getMessage());
@@ -2213,12 +2205,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            gatewayProfile.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            gwyResourceProfileRepository.updateGatewayResourceProfile(gatewayResourceProfile);
             logger.debug("Airavata updated gateway profile with gateway id : " + gatewayID);
             return true;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error(gatewayID, "Error while updating gateway resource profile...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while updating gateway resource profile. More info : " + e.getMessage());
@@ -2248,12 +2239,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
                 logger.error("Gateway does not exist.Please provide a valid gateway id...");
                 throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
             }
-            appCatalog = RegistryFactory.getAppCatalog();
-            GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
-            String resourceProfile = gatewayProfile.addGatewayResourceProfile(gatewayResourceProfile);
+            GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
+            String resourceProfile = gwyResourceProfileRepository.addGatewayResourceProfile(gatewayResourceProfile);
             logger.debug("Airavata registered gateway profile with gateway id : " + gatewayResourceProfile.getGatewayID());
             return resourceProfile;
-        } catch (AppCatalogException e) {
+        } catch (Exception e) {
             logger.error("Error while registering gateway resource profile...", e);
             RegistryServiceException exception = new RegistryServiceException();
             exception.setMessage("Error while registering gateway resource profile. More info : " + e.getMessage());

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata] 02/06: Adding repositories for ComputePref and StoragePref

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 034b41a8ff5255c113b7096c1f38dfdbafbfb3b9
Author: Sachin Kariyattin <sa...@gmail.com>
AuthorDate: Wed Dec 20 12:13:14 2017 -0500

    Adding repositories for ComputePref and StoragePref
---
 .../ComputeResourcePreferenceEntity.java           |  2 +-
 .../entities/appcatalog/GatewayProfileEntity.java  |  2 +-
 ...nceEntity.java => StoragePreferenceEntity.java} | 12 +--
 ...ePreferencePK.java => StoragePreferencePK.java} |  8 +-
 .../appcatalog/ComputeResourceRepository.java      | 14 ++++
 .../appcatalog/GwyResourceProfileRepository.java   | 90 ++++++++++++++++++----
 .../appcatalog/StoragePrefRepository.java          | 13 ++++
 .../airavata/registry/core/utils/DBConstants.java  | 13 ++++
 .../registry/core/utils/QueryConstants.java        | 10 +++
 .../src/main/resources/META-INF/persistence.xml    |  4 +-
 10 files changed, 140 insertions(+), 28 deletions(-)

diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferenceEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferenceEntity.java
index 8b005c6..682981a 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferenceEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/ComputeResourcePreferenceEntity.java
@@ -32,7 +32,7 @@ import java.sql.Timestamp;
  * The persistent class for the compute_resource_preference database table.
  */
 @Entity
-@Table(name = "compute_resource_preference")
+@Table(name = "COMPUTE_RESOURCE_PREFERENCE")
 public class ComputeResourcePreferenceEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java
index 4dbb95a..71fcd71 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java
@@ -32,7 +32,7 @@ import java.sql.Timestamp;
  * The persistent class for the gateway_profile database table.
  */
 @Entity
-@Table(name = "gateway_profile")
+@Table(name = "GATEWAY_PROFILE")
 public class GatewayProfileEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataStoragePreferenceEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/StoragePreferenceEntity.java
similarity index 87%
rename from modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataStoragePreferenceEntity.java
rename to modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/StoragePreferenceEntity.java
index 0798cad..631657c 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataStoragePreferenceEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/StoragePreferenceEntity.java
@@ -30,12 +30,12 @@ import java.io.Serializable;
  * The persistent class for the data_storage_preference database table.
  */
 @Entity
-@Table(name = "data_storage_preference")
-public class DataStoragePreferenceEntity implements Serializable {
+@Table(name = "STORAGE_PREFERENCE")
+public class StoragePreferenceEntity implements Serializable {
     private static final long serialVersionUID = 1L;
 
     @EmbeddedId
-    private DataStoragePreferencePK id;
+    private StoragePreferencePK id;
 
     @Column(name = "FS_ROOT_LOCATION")
     private String fsRootLocation;
@@ -46,14 +46,14 @@ public class DataStoragePreferenceEntity implements Serializable {
     @Column(name = "RESOURCE_CS_TOKEN")
     private String resourceCsToken;
 
-    public DataStoragePreferenceEntity() {
+    public StoragePreferenceEntity() {
     }
 
-    public DataStoragePreferencePK getId() {
+    public StoragePreferencePK getId() {
         return id;
     }
 
-    public void setId(DataStoragePreferencePK id) {
+    public void setId(StoragePreferencePK id) {
         this.id = id;
     }
 
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataStoragePreferencePK.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/StoragePreferencePK.java
similarity index 90%
rename from modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataStoragePreferencePK.java
rename to modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/StoragePreferencePK.java
index a03c62c..7002540 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/DataStoragePreferencePK.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/StoragePreferencePK.java
@@ -28,7 +28,7 @@ import java.io.Serializable;
  * The primary key class for the data_storage_preference database table.
  */
 @Embeddable
-public class DataStoragePreferencePK implements Serializable {
+public class StoragePreferencePK implements Serializable {
     //default serial version id, required for serializable classes.
     private static final long serialVersionUID = 1L;
 
@@ -38,7 +38,7 @@ public class DataStoragePreferencePK implements Serializable {
     @Column(name = "STORAGE_RESOURCE_ID")
     private String storageResourceId;
 
-    public DataStoragePreferencePK() {
+    public StoragePreferencePK() {
     }
 
     public String getGatewayId() {
@@ -61,10 +61,10 @@ public class DataStoragePreferencePK implements Serializable {
         if (this == other) {
             return true;
         }
-        if (!(other instanceof DataStoragePreferencePK)) {
+        if (!(other instanceof StoragePreferencePK)) {
             return false;
         }
-        DataStoragePreferencePK castOther = (DataStoragePreferencePK) other;
+        StoragePreferencePK castOther = (StoragePreferencePK) other;
         return
                 this.gatewayId.equals(castOther.gatewayId)
                         && this.storageResourceId.equals(castOther.storageResourceId);
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java
new file mode 100644
index 0000000..6add69f
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/ComputeResourceRepository.java
@@ -0,0 +1,14 @@
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
+import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferencePK;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+
+public class ComputeResourceRepository extends AbstractRepository<ComputeResourcePreference, ComputeResourceEntity, ComputeResourcePreferencePK> {
+
+    public ComputeResourceRepository() {
+        super(ComputeResourcePreference.class, ComputeResourceEntity.class);
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
index 98bc194..07055d9 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
@@ -1,23 +1,32 @@
 package org.apache.airavata.registry.core.repositories.appcatalog;
 
 import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
 import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
+import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferencePK;
+import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferencePK;
 import org.apache.airavata.registry.core.entities.appcatalog.GatewayProfileEntity;
 import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.apache.airavata.registry.core.utils.DBConstants;
 import org.apache.airavata.registry.core.utils.JPAUtils;
 import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.apache.airavata.registry.core.utils.QueryConstants;
 import org.dozer.Mapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 public class GwyResourceProfileRepository extends AbstractRepository<GatewayResourceProfile, GatewayProfileEntity, String>{
 
     private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileRepository.class);
 
-    public GwyResourceProfileRepository(Class<GatewayResourceProfile> thriftGenericClass, Class<GatewayProfileEntity> dbEntityGenericClass) {
-        super(thriftGenericClass, dbEntityGenericClass);
+    public GwyResourceProfileRepository() {
+        super(GatewayResourceProfile.class, GatewayProfileEntity.class);
     }
 
     public String addGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
@@ -25,29 +34,41 @@ public class GwyResourceProfileRepository extends AbstractRepository<GatewayReso
     }
 
     public String updateGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
+        String gatewayId = gatewayResourceProfile.getGatewayID();
         Mapper mapper = ObjectMapperSingleton.getInstance();
         GatewayProfileEntity gatewayProfileEntity = mapper.map(gatewayResourceProfile, GatewayProfileEntity.class);
         gatewayProfileEntity.setUpdateTime(AiravataUtils.getCurrentTimestamp());
         GatewayProfileEntity persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(gatewayProfileEntity));
 
-        //TODO ComputeResourcePreference
-        //TODO StoragePreference
-
+        List<ComputeResourcePreference> computeResourcePreferences = gatewayResourceProfile.getComputeResourcePreferences();
+        if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()) {
+            for (ComputeResourcePreference preference : computeResourcePreferences ) {
+                (new ComputeResourceRepository()).create(preference);
+            }
+        }
+
+        List<StoragePreference> dataStoragePreferences = gatewayResourceProfile.getStoragePreferences();
+        if (dataStoragePreferences != null && !dataStoragePreferences.isEmpty()) {
+            for (StoragePreference storagePreference : dataStoragePreferences) {
+                (new StoragePrefRepository()).create(storagePreference);
+            }
+        }
         return persistedCopy.getGatewayId();
-
     }
 
     public GatewayResourceProfile getGatewayProfile(String gatewayId) {
-        //TODO ComputeResourcePreference
-        //TODO StoragePreference
+        GatewayResourceProfile gatewayResourceProfile = (new GwyResourceProfileRepository()).getGatewayProfile(gatewayId);
+        gatewayResourceProfile.setComputeResourcePreferences(getAllComputeResourcePreferences(gatewayId));
+        gatewayResourceProfile.setStoragePreferences(getAllStoragePreferences(gatewayId));
+        return gatewayResourceProfile;
     }
 
     public boolean removeGatewayResourceProfile(String gatewayId) {
-        // TODO - Call from handler
+        //return delete(gatewayId);
     }
 
     public boolean isGatewayResourceProfileExists(String gatewayId) {
-        // TODO - Call isExists from handler
+        //return isExists(gatewayId);
     }
 
     public List<String> getGatewayProfileIds(String gatewayName) {
@@ -56,15 +77,56 @@ public class GwyResourceProfileRepository extends AbstractRepository<GatewayReso
 
     public List<GatewayResourceProfile> getAllGatewayProfiles() {
 
-        String queryString = "SELECT * FROM GATEWAY_PROFILE";
+        List<GatewayResourceProfile> gwyResourceProfileList = new ArrayList<GatewayResourceProfile>();
+        List<GatewayResourceProfile> gatewayResourceProfileList = select(QueryConstants.FIND_ALL_GATEWAY_PROFILES,-1, 0);
+        if (gatewayResourceProfileList != null && !gatewayResourceProfileList.isEmpty()) {
+            for (GatewayResourceProfile gatewayResourceProfile: gatewayResourceProfileList) {
+                gatewayResourceProfile.setComputeResourcePreferences(getAllComputeResourcePreferences(gatewayResourceProfile.getGatewayID()));
+                gatewayResourceProfile.setStoragePreferences(getAllStoragePreferences(gatewayResourceProfile.getGatewayID()));
+            }
+        }
+        return gwyResourceProfileList;
+    }
 
-        List<GatewayResourceProfile> gatewayResourceProfileList = select(queryString,-1, 0);
+    public boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) {
+        ComputeResourcePreferencePK computeResourcePreferencePK = new ComputeResourcePreferencePK();
+        computeResourcePreferencePK.setGatewayId(gatewayId);
+        computeResourcePreferencePK.setResourceId(preferenceId);
+        (new ComputeResourceRepository()).delete(computeResourcePreferencePK);
+        return true;
+    }
 
-        //TODO ComputeResourcePreference
-        //TODO StoragePreference
+    public boolean removeDataStoragePreferenceFromGateway(String gatewayId, String preferenceId) {
+        StoragePreferencePK storagePreferencePK = new StoragePreferencePK();
+        storagePreferencePK.setGatewayId(gatewayId);
+        storagePreferencePK.setStorageResourceId(preferenceId);
+        (new StoragePrefRepository()).delete(storagePreferencePK);
+        return true;
     }
 
+    public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) {
+        ComputeResourcePreferencePK computeResourcePreferencePK = new ComputeResourcePreferencePK();
+        computeResourcePreferencePK.setGatewayId(gatewayId);
+        computeResourcePreferencePK.setResourceId(hostId);
+        return (new ComputeResourceRepository()).get(computeResourcePreferencePK);
+    }
 
+    public StoragePreference getStoragePreference(String gatewayId, String storageId){
+        StoragePreferencePK storagePreferencePK = new StoragePreferencePK();
+        storagePreferencePK.setStorageResourceId(storageId);
+        storagePreferencePK.setGatewayId(gatewayId);
+        return (new StoragePrefRepository()).get(storagePreferencePK);
+    }
 
+    public List<ComputeResourcePreference> getAllComputeResourcePreferences(String gatewayId) {
+        Map<String,Object> queryParameters = new HashMap<>();
+        queryParameters.put(DBConstants.ComputeResourcePreference.GATEWAY_ID, gatewayId);
+        return (new ComputeResourceRepository()).select(QueryConstants.FIND_ALL_COMPUTE_RESOURCE_PREFERENCES, -1, 0, queryParameters);
+    }
 
+    public List<StoragePreference> getAllStoragePreferences(String gatewayId) {
+        Map<String,Object> queryParameters = new HashMap<>();
+        queryParameters.put(DBConstants.StorageResourcePreference.GATEWAY_ID, gatewayId);
+        return (new StoragePrefRepository()).select(QueryConstants.FIND_ALL_STORAGE_RESOURCE_PREFERENCES, -1, 0, queryParameters);
+    }
 }
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java
new file mode 100644
index 0000000..d5b054a
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/StoragePrefRepository.java
@@ -0,0 +1,13 @@
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference;
+import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferenceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferencePK;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+
+public class StoragePrefRepository extends AbstractRepository<StoragePreference, StoragePreferenceEntity, StoragePreferencePK> {
+
+    public StoragePrefRepository() {
+        super(StoragePreference.class, StoragePreferenceEntity.class);
+    }
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
new file mode 100644
index 0000000..752b556
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java
@@ -0,0 +1,13 @@
+package org.apache.airavata.registry.core.utils;
+
+public class DBConstants {
+
+    public static class ComputeResourcePreference {
+        public static final String GATEWAY_ID = "gatewayId";
+    }
+
+    public static class StorageResourcePreference {
+        public static final String GATEWAY_ID = "gatewayId";
+    }
+
+}
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
index 250c461..244f9d6 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
@@ -2,6 +2,10 @@ package org.apache.airavata.registry.core.utils;
 
 import org.apache.airavata.model.user.UserProfile;
 
+import org.apache.airavata.registry.core.entities.appcatalog.ComputeResourcePreferenceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.StoragePreferenceEntity;
+import org.apache.airavata.registry.core.entities.appcatalog.GatewayProfileEntity;
+
 public interface QueryConstants {
 
     String FIND_USER_PROFILE_BY_USER_ID = "SELECT u FROM UserProfileEntity u " +
@@ -10,4 +14,10 @@ public interface QueryConstants {
 
     String FIND_ALL_USER_PROFILES_BY_GATEWAY_ID = "SELECT u FROM UserProfileEntity u " +
             "where u.gatewayId LIKE :"+ UserProfile._Fields.GATEWAY_ID.getFieldName() + "";
+
+    String FIND_ALL_GATEWAY_PROFILES = "SELECT G FROM " + GatewayProfileEntity.class.getSimpleName() + "G";
+    String FIND_ALL_COMPUTE_RESOURCE_PREFERENCES = "SELECT DISTINCT CR FROM " + ComputeResourcePreferenceEntity.class.getSimpleName() + "CR " +
+            "WHERE CR.gatewayId LIKE : " + DBConstants.ComputeResourcePreference.GATEWAY_ID;
+    String FIND_ALL_STORAGE_RESOURCE_PREFERENCES = "SELECT DISTINCT S FROM " + StoragePreferenceEntity.class.getSimpleName() + "S " +
+            "WHERE S.gatewayId LIKE : " + DBConstants.StorageResourcePreference.GATEWAY_ID;
 }
diff --git a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
index 68861e4..645165d 100644
--- a/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry-refactoring/src/main/resources/META-INF/persistence.xml
@@ -97,7 +97,7 @@
         <class>org.apache.airavata.registry.core.entities.appcatalog.JobManagerCommandEntity</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.ParallelismCommandEntity</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.LocalDataMovementEntity</class>
-        <class>org.apache.airavata.registry.core.entities.appcatalog.DataStoragePreferenceEntity</class>
+        <class>org.apache.airavata.registry.core.entities.appcatalog.StoragePreferenceEntity</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.GlobusGkEndpointPK</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshPostjobcommandPK</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.GsisshPrejobcommandPK</class>
@@ -124,7 +124,7 @@
         <class>org.apache.airavata.registry.core.entities.appcatalog.StorageInterfacePK</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.JobManagerCommandPK</class>
         <class>org.apache.airavata.registry.core.entities.appcatalog.ParallelismCommandPK</class>
-        <class>org.apache.airavata.registry.core.entities.appcatalog.DataStoragePreferencePK</class>
+        <class>org.apache.airavata.registry.core.entities.appcatalog.StoragePreferencePK</class>
 
         <exclude-unlisted-classes>true</exclude-unlisted-classes>
     </persistence-unit>

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata] 01/06: Added GatewayResourceProfile Repository

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit a4acd74c14eb06a85d06e278c5fc1985aecbc352
Author: Sachin Kariyattin <sa...@gmail.com>
AuthorDate: Mon Dec 18 15:11:45 2017 -0500

    Added GatewayResourceProfile Repository
---
 modules/registry-refactoring/pom.xml               |  5 ++
 .../entities/appcatalog/GatewayProfileEntity.java  | 13 ++--
 .../core/repositories/AbstractRepository.java      |  6 ++
 .../appcatalog/GwyResourceProfileRepository.java   | 70 ++++++++++++++++++++++
 4 files changed, 87 insertions(+), 7 deletions(-)

diff --git a/modules/registry-refactoring/pom.xml b/modules/registry-refactoring/pom.xml
index b794349..7f1180a 100644
--- a/modules/registry-refactoring/pom.xml
+++ b/modules/registry-refactoring/pom.xml
@@ -69,6 +69,11 @@
             <version>4.12</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-commons</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java
index ea92602..4dbb95a 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/entities/appcatalog/GatewayProfileEntity.java
@@ -43,8 +43,8 @@ public class GatewayProfileEntity implements Serializable {
     @Column(name = "CREATION_TIME")
     private Timestamp creationTime;
 
-    @Column(name = "CS_TOKEN")
-    private String csToken;
+    @Column(name = "CREDENTIAL_STORE_TOKEN")
+    private String credentialStoreToken;
 
     @Column(name = "IDENTITY_SERVER_PWD_CRED_TOKEN")
     private String identityServerPwdCredToken;
@@ -55,7 +55,6 @@ public class GatewayProfileEntity implements Serializable {
     @Column(name = "UPDATE_TIME")
     private Timestamp updateTime;
 
-
     public GatewayProfileEntity() {
     }
 
@@ -75,12 +74,12 @@ public class GatewayProfileEntity implements Serializable {
         this.creationTime = creationTime;
     }
 
-    public String getCsToken() {
-        return csToken;
+    public String getCredentialStoreToken() {
+        return credentialStoreToken;
     }
 
-    public void setCsToken(String csToken) {
-        this.csToken = csToken;
+    public void setCredentialStoreToken(String credentialStoreToken) {
+        this.credentialStoreToken = credentialStoreToken;
     }
 
     public String getIdentityServerPwdCredToken() {
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
index a83928d..29d6f85 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
@@ -95,4 +95,10 @@ public abstract class AbstractRepository<T, E, Id> {
         resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
         return gatewayList;
     }
+
+    public boolean isExists(Id id) {
+        return get(id) != null;
+    }
+
+
 }
\ No newline at end of file
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
new file mode 100644
index 0000000..98bc194
--- /dev/null
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
@@ -0,0 +1,70 @@
+package org.apache.airavata.registry.core.repositories.appcatalog;
+
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile;
+import org.apache.airavata.registry.core.entities.appcatalog.GatewayProfileEntity;
+import org.apache.airavata.registry.core.repositories.AbstractRepository;
+import org.apache.airavata.registry.core.utils.JPAUtils;
+import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
+import org.dozer.Mapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+public class GwyResourceProfileRepository extends AbstractRepository<GatewayResourceProfile, GatewayProfileEntity, String>{
+
+    private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileRepository.class);
+
+    public GwyResourceProfileRepository(Class<GatewayResourceProfile> thriftGenericClass, Class<GatewayProfileEntity> dbEntityGenericClass) {
+        super(thriftGenericClass, dbEntityGenericClass);
+    }
+
+    public String addGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
+            return updateGatewayResourceProfile(gatewayResourceProfile);
+    }
+
+    public String updateGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
+        Mapper mapper = ObjectMapperSingleton.getInstance();
+        GatewayProfileEntity gatewayProfileEntity = mapper.map(gatewayResourceProfile, GatewayProfileEntity.class);
+        gatewayProfileEntity.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+        GatewayProfileEntity persistedCopy = JPAUtils.execute(entityManager -> entityManager.merge(gatewayProfileEntity));
+
+        //TODO ComputeResourcePreference
+        //TODO StoragePreference
+
+        return persistedCopy.getGatewayId();
+
+    }
+
+    public GatewayResourceProfile getGatewayProfile(String gatewayId) {
+        //TODO ComputeResourcePreference
+        //TODO StoragePreference
+    }
+
+    public boolean removeGatewayResourceProfile(String gatewayId) {
+        // TODO - Call from handler
+    }
+
+    public boolean isGatewayResourceProfileExists(String gatewayId) {
+        // TODO - Call isExists from handler
+    }
+
+    public List<String> getGatewayProfileIds(String gatewayName) {
+        // TODO - Not used anywhere (dev list??)
+    }
+
+    public List<GatewayResourceProfile> getAllGatewayProfiles() {
+
+        String queryString = "SELECT * FROM GATEWAY_PROFILE";
+
+        List<GatewayResourceProfile> gatewayResourceProfileList = select(queryString,-1, 0);
+
+        //TODO ComputeResourcePreference
+        //TODO StoragePreference
+    }
+
+
+
+
+}

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.

[airavata] 06/06: Adding CPI dependency

Posted by sm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

smarru pushed a commit to branch registry-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 502650a16567196853dcc1dfc67db2f37419d3d9
Author: Sachin Kariyattin <sa...@gmail.com>
AuthorDate: Fri Dec 22 13:28:49 2017 -0500

    Adding CPI dependency
---
 modules/registry-refactoring/pom.xml               |  5 ++++
 .../core/repositories/AbstractRepository.java      |  1 -
 .../appcatalog/GwyResourceProfileRepository.java   | 34 +++++++++++++++++++++-
 3 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/modules/registry-refactoring/pom.xml b/modules/registry-refactoring/pom.xml
index b1cc56c..ab95f61 100644
--- a/modules/registry-refactoring/pom.xml
+++ b/modules/registry-refactoring/pom.xml
@@ -79,6 +79,11 @@
             <artifactId>airavata-server-configuration</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-registry-cpi</artifactId>
+            <version>0.17-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
     <build>
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
index a98fdff..a83928d 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/AbstractRepository.java
@@ -95,5 +95,4 @@ public abstract class AbstractRepository<T, E, Id> {
         resultSet.stream().forEach(rs -> gatewayList.add(mapper.map(rs, thriftGenericClass)));
         return gatewayList;
     }
-
 }
\ No newline at end of file
diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
index fb3d4a7..00afa66 100644
--- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
+++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GwyResourceProfileRepository.java
@@ -10,6 +10,8 @@ import org.apache.airavata.registry.core.entities.appcatalog.GatewayProfileEntit
 import org.apache.airavata.registry.core.utils.DBConstants;
 import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
 import org.apache.airavata.registry.core.utils.QueryConstants;
+import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.apache.airavata.registry.cpi.GwyResourceProfile;
 import org.dozer.Mapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -19,7 +21,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-public class GwyResourceProfileRepository extends AppCatAbstractRepository<GatewayResourceProfile, GatewayProfileEntity, String>{
+public class GwyResourceProfileRepository extends AppCatAbstractRepository<GatewayResourceProfile, GatewayProfileEntity, String> implements GwyResourceProfile {
 
     private final static Logger logger = LoggerFactory.getLogger(GwyResourceProfileRepository.class);
 
@@ -27,11 +29,17 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         super(GatewayResourceProfile.class, GatewayProfileEntity.class);
     }
 
+    @Override
     public String addGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
 
         return updateGatewayResourceProfile(gatewayResourceProfile);
     }
 
+    @Override
+    public void updateGatewayResourceProfile(String gatewayId, GatewayResourceProfile updatedProfile) throws AppCatalogException {
+        updateGatewayResourceProfile(updatedProfile);
+    }
+
     public String updateGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
         String gatewayId = gatewayResourceProfile.getGatewayID();
         Mapper mapper = ObjectMapperSingleton.getInstance();
@@ -60,6 +68,7 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return persistedCopy.getGatewayId();
     }
 
+    @Override
     public GatewayResourceProfile getGatewayProfile(String gatewayId) {
         GatewayResourceProfile gatewayResourceProfile = get(gatewayId);
         gatewayResourceProfile.setComputeResourcePreferences(getAllComputeResourcePreferences(gatewayId));
@@ -67,6 +76,12 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return gatewayResourceProfile;
     }
 
+    @Override
+    public boolean removeGatewayResourceProfile(String gatewayId) throws AppCatalogException {
+        return delete(gatewayId);
+    }
+
+    @Override
     public List<GatewayResourceProfile> getAllGatewayProfiles() {
 
         List<GatewayResourceProfile> gwyResourceProfileList = new ArrayList<GatewayResourceProfile>();
@@ -80,6 +95,7 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return gatewayResourceProfileList;
     }
 
+    @Override
     public boolean removeComputeResourcePreferenceFromGateway(String gatewayId, String preferenceId) {
         ComputeResourcePreferencePK computeResourcePreferencePK = new ComputeResourcePreferencePK();
         computeResourcePreferencePK.setGatewayId(gatewayId);
@@ -88,6 +104,7 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return true;
     }
 
+    @Override
     public boolean removeDataStoragePreferenceFromGateway(String gatewayId, String preferenceId) {
         StoragePreferencePK storagePreferencePK = new StoragePreferencePK();
         storagePreferencePK.setGatewayId(gatewayId);
@@ -96,6 +113,12 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return true;
     }
 
+    @Override
+    public boolean isGatewayResourceProfileExists(String gatewayId) throws AppCatalogException {
+        return isExists(gatewayId);
+    }
+
+    @Override
     public ComputeResourcePreference getComputeResourcePreference(String gatewayId, String hostId) {
         ComputeResourcePreferencePK computeResourcePreferencePK = new ComputeResourcePreferencePK();
         computeResourcePreferencePK.setGatewayId(gatewayId);
@@ -103,6 +126,7 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return (new ComputeResourceRepository()).get(computeResourcePreferencePK);
     }
 
+    @Override
     public StoragePreference getStoragePreference(String gatewayId, String storageId){
         StoragePreferencePK storagePreferencePK = new StoragePreferencePK();
         storagePreferencePK.setStorageResourceId(storageId);
@@ -110,15 +134,23 @@ public class GwyResourceProfileRepository extends AppCatAbstractRepository<Gatew
         return (new StoragePrefRepository()).get(storagePreferencePK);
     }
 
+    @Override
     public List<ComputeResourcePreference> getAllComputeResourcePreferences(String gatewayId) {
         Map<String,Object> queryParameters = new HashMap<>();
         queryParameters.put(DBConstants.ComputeResourcePreference.GATEWAY_ID, gatewayId);
         return (new ComputeResourceRepository()).select(QueryConstants.FIND_ALL_COMPUTE_RESOURCE_PREFERENCES, -1, 0, queryParameters);
     }
 
+    @Override
     public List<StoragePreference> getAllStoragePreferences(String gatewayId) {
         Map<String,Object> queryParameters = new HashMap<>();
         queryParameters.put(DBConstants.StorageResourcePreference.GATEWAY_ID, gatewayId);
         return (new StoragePrefRepository()).select(QueryConstants.FIND_ALL_STORAGE_RESOURCE_PREFERENCES, -1, 0, queryParameters);
     }
+
+    @Override
+    public List<String> getGatewayProfileIds(String gatewayName) throws AppCatalogException {
+        //not used anywhere. Skipping the implementation
+        return null;
+    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@airavata.apache.org" <co...@airavata.apache.org>.