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:36:03 UTC

[airavata] 06/06: Adding CPI dependency

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>.