airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject [1/2] git commit: updating the app deployment filtering function + refactoring the error message logs
Date Fri, 11 Jul 2014 19:25:46 GMT
Repository: airavata
Updated Branches:
  refs/heads/master f13b4eb0e -> d64741c74


updating the app deployment filtering function + refactoring the error message logs


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

Branch: refs/heads/master
Commit: 4e192562d367e2dea4f7b5a920522de12af7b155
Parents: 50c7475
Author: Saminda Wijeratne <samindaw@gmail.com>
Authored: Fri Jul 11 15:25:25 2014 -0400
Committer: Saminda Wijeratne <samindaw@gmail.com>
Committed: Fri Jul 11 15:25:25 2014 -0400

----------------------------------------------------------------------
 .../data/impl/ApplicationDeploymentImpl.java    | 23 ++++++++++++++--
 .../data/impl/ApplicationInterfaceImpl.java     | 28 ++++++++++----------
 2 files changed, 35 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/4e192562/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
index 9edc226..2394d3c 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationDeploymentImpl.java
@@ -239,21 +239,40 @@ public class ApplicationDeploymentImpl implements ApplicationDeployment
{
         List<ApplicationDeploymentDescription> deploymentDescriptions = new ArrayList<ApplicationDeploymentDescription>();
         try {
             AppDeploymentResource resource = new AppDeploymentResource();
+            boolean firstTry=true;
             for (String fieldName : filters.keySet() ){
+                List<ApplicationDeploymentDescription> tmpDescriptions = new ArrayList<ApplicationDeploymentDescription>();
                 if (fieldName.equals(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID)){
                     List<Resource> resources = resource.get(AbstractResource.ApplicationDeploymentConstants.APP_MODULE_ID,
filters.get(fieldName));
                     if (resources != null && !resources.isEmpty()){
-                        deploymentDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
+                    	tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
                     }
                 }else if (fieldName.equals(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID)){
                     List<Resource> resources = resource.get(AbstractResource.ApplicationDeploymentConstants.COMPUTE_HOST_ID,
filters.get(fieldName));
                     if (resources != null && !resources.isEmpty()){
-                        deploymentDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
+                    	tmpDescriptions = AppCatalogThriftConversion.getAppDepDescList(resources);
                     }
                 } else {
                     logger.error("Unsupported field name for app deployment.", new IllegalArgumentException());
                     throw new IllegalArgumentException("Unsupported field name for app deployment.");
                 }
+                if (firstTry){
+                	deploymentDescriptions.addAll(tmpDescriptions);
+                    firstTry=false;
+                }else{
+                    List<String> ids=new ArrayList<String>();
+                	for (ApplicationDeploymentDescription applicationDeploymentDescription :
deploymentDescriptions) {
+						ids.add(applicationDeploymentDescription.getAppDeploymentId());
+					}
+                    List<ApplicationDeploymentDescription> tmp2Descriptions = new ArrayList<ApplicationDeploymentDescription>();
+                	for (ApplicationDeploymentDescription applicationDeploymentDescription :
tmpDescriptions) {
+						if (ids.contains(applicationDeploymentDescription.getAppDeploymentId())){
+							tmp2Descriptions.add(applicationDeploymentDescription);
+						}
+					}
+                	deploymentDescriptions.clear();
+                	deploymentDescriptions.addAll(tmp2Descriptions);
+                }
             }
         }catch (Exception e){
             logger.error("Error while retrieving app deployment list...", e);

http://git-wip-us.apache.org/repos/asf/airavata/blob/4e192562/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
index cdd1842..c4040c4 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/ApplicationInterfaceImpl.java
@@ -53,7 +53,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface {
             applicationModule.setAppModuleId(moduleResource.getModuleId());
             return moduleResource.getModuleId();
         }catch (Exception e) {
-            logger.error("Error while saving application module...", e);
+            logger.error("Error while adding application module "+applicationModule.getAppModuleName()+"
["+applicationModule.getAppModuleVersion()+"]", e);
             throw new AppCatalogException(e);
         }
     }
@@ -112,7 +112,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             }
             return resource.getInterfaceId();
         }catch (Exception e) {
-            logger.error("Error while saving application interface...", e);
+            logger.error("Error while adding application interface "+applicationInterfaceDescription.getApplicationName(),
e);
             throw new AppCatalogException(e);
         }
     }
@@ -129,7 +129,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             moduleMappingResource.setAppInterfaceResource((AppInterfaceResource)interfaceResource.get(interfaceId));
             moduleMappingResource.save();
         }catch (Exception e) {
-            logger.error("Error while saving application module mapping...", e);
+            logger.error("Error while saving application module mapping "+moduleId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -144,7 +144,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             existingModule.setModuleVersion(updatedModule.getAppModuleVersion());
             existingModule.save();
         }catch (Exception e) {
-            logger.error("Error while updating application module...", e);
+            logger.error("Error while updating application module "+moduleId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -216,7 +216,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
                 }
             }
         }catch (Exception e) {
-            logger.error("Error while updating application interface...", e);
+            logger.error("Error while updating application interface "+interfaceId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -227,7 +227,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             AppModuleResource appModuleResource = new AppModuleResource();
             return AppCatalogThriftConversion.getApplicationModuleDesc((AppModuleResource)
appModuleResource.get(moduleId));
         }catch (Exception e) {
-            logger.error("Error while retrieving application module...", e);
+            logger.error("Error while retrieving application module "+moduleId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -238,7 +238,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             AppInterfaceResource interfaceResource = new AppInterfaceResource();
             return AppCatalogThriftConversion.getApplicationInterfaceDescription((AppInterfaceResource)interfaceResource.get(interfaceId));
         }catch (Exception e) {
-            logger.error("Error while retrieving application interface...", e);
+            logger.error("Error while retrieving application interface '"+interfaceId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -277,7 +277,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
                     appInterfaces = AppCatalogThriftConversion.getAppInterfaceDescList(resources);
                 }else {
                     logger.error("Unsupported field name for app interface.", new IllegalArgumentException());
-                    throw new IllegalArgumentException("Unsupported field name for app interface.");
+                    throw new IllegalArgumentException("Unsupported field name '"+fieldName+"'
for app interface.");
                 }
             }
         }catch (Exception e){
@@ -317,7 +317,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             resource.remove(interfaceId);
             return true;
         }catch (Exception e){
-            logger.error("Error while removing app interface...", e);
+            logger.error("Error while removing app interface "+interfaceId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -329,7 +329,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             resource.remove(moduleId);
             return true;
         }catch (Exception e){
-            logger.error("Error while removing app module...", e);
+            logger.error("Error while removing app module "+moduleId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -340,7 +340,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             AppInterfaceResource resource = new AppInterfaceResource();
             return resource.isExists(interfaceId);
         }catch (Exception e){
-            logger.error("Error while retrieving app interface...", e);
+            logger.error("Error while checking app interface existence "+interfaceId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -351,7 +351,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             AppModuleResource resource = new AppModuleResource();
             return resource.isExists(moduleId);
         }catch (Exception e){
-            logger.error("Error while retrieving app module...", e);
+            logger.error("Error while checking app module existence "+moduleId, e);
             throw new AppCatalogException(e);
         }
     }
@@ -363,7 +363,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             List<Resource> resources = resource.get(AbstractResource.AppInputConstants.INTERFACE_ID,
interfaceId);
             return AppCatalogThriftConversion.getAppInputs(resources);
         }catch (Exception e){
-            logger.error("Error while retrieving app inputs...", e);
+            logger.error("Error while retrieving app inputs for application "+interfaceId,
e);
             throw new AppCatalogException(e);
         }
     }
@@ -375,7 +375,7 @@ public class ApplicationInterfaceImpl implements ApplicationInterface
{
             List<Resource> resources = resource.get(AbstractResource.AppOutputConstants.INTERFACE_ID,
interfaceId);
             return AppCatalogThriftConversion.getAppOutputs(resources);
         }catch (Exception e){
-            logger.error("Error while retrieving app outputs...", e);
+            logger.error("Error while retrieving app outputs for application "+interfaceId,
e);
             throw new AppCatalogException(e);
         }
     }


Mime
View raw message