You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sh...@apache.org on 2015/03/19 20:11:36 UTC
[18/50] [abbrv] airavata git commit: fixing AIRAVATA-1626
fixing AIRAVATA-1626
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/fd557d82
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/fd557d82
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/fd557d82
Branch: refs/heads/new-workflow-design
Commit: fd557d829f282bdb1ec084cf1e7b19b57a270932
Parents: 04cecb4
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Mon Mar 9 12:34:51 2015 -0400
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Mon Mar 9 12:34:51 2015 -0400
----------------------------------------------------------------------
.../server/handler/AiravataServerHandler.java | 43 ++++++++++++++++++++
.../data/impl/GwyResourceProfileImpl.java | 2 +-
.../integration/tools/DocumentCreatorNew.java | 7 +++-
3 files changed, 49 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/fd557d82/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 264243a..c111a07 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -2680,6 +2680,17 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public String registerGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!validateString(gatewayResourceProfile.getGatewayID())){
+ logger.error("Cannot create gateway profile with empty gateway id");
+ AiravataSystemException exception = new AiravataSystemException();
+ exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Cannot create gateway profile with empty gateway id");
+ throw exception;
+ }
+ if (!isGatewayExist(gatewayResourceProfile.getGatewayID())){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
return gatewayProfile.addGatewayResourceProfile(gatewayResourceProfile);
@@ -2702,6 +2713,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public GatewayResourceProfile getGatewayResourceProfile(String gatewayID) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
return gatewayProfile.getGatewayProfile(gatewayID);
@@ -2725,6 +2740,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean updateGatewayResourceProfile(String gatewayID, GatewayResourceProfile gatewayResourceProfile) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
gatewayProfile.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
@@ -2748,6 +2767,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean deleteGatewayResourceProfile(String gatewayID) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
gatewayProfile.removeGatewayResourceProfile(gatewayID);
@@ -2774,6 +2797,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean addGatewayComputeResourcePreference(String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
if (!gatewayProfile.isGatewayResourceProfileExists(gatewayID)){
@@ -2804,6 +2831,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayID, String computeResourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
ComputeResource computeResource = appCatalog.getComputeResource();
@@ -2841,6 +2872,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public List<ComputeResourcePreference> getAllGatewayComputeResourcePreferences(String gatewayID) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
return gatewayProfile.getGatewayProfile(gatewayID).getComputeResourcePreferences();
@@ -2879,6 +2914,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean updateGatewayComputeResourcePreference(String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
GatewayResourceProfile profile = gatewayProfile.getGatewayProfile(gatewayID);
@@ -2917,6 +2956,10 @@ public class AiravataServerHandler implements Airavata.Iface {
@Override
public boolean deleteGatewayComputeResourcePreference(String gatewayID, String computeResourceId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
+ if (!isGatewayExist(gatewayID)){
+ logger.error("Gateway does not exist.Please provide a valid gateway id...");
+ throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ }
appCatalog = AppCatalogFactory.getAppCatalog();
GwyResourceProfile gatewayProfile = appCatalog.getGatewayProfile();
return gatewayProfile.removeComputeResourcePreferenceFromGateway(gatewayID, computeResourceId);
http://git-wip-us.apache.org/repos/asf/airavata/blob/fd557d82/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
index d03ef2a..4537efd 100644
--- a/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
+++ b/modules/app-catalog/app-catalog-data/src/main/java/org/apache/aiaravata/application/catalog/data/impl/GwyResourceProfileImpl.java
@@ -46,7 +46,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
if (!gatewayProfile.getGatewayID().equals("") && !gatewayProfile.getGatewayID().equals(gatewayResourceProfileModelConstants.DEFAULT_ID)){
profileResource.setGatewayID(gatewayProfile.getGatewayID());
}
- profileResource.setGatewayID(gatewayProfile.getGatewayID());
+// profileResource.setGatewayID(gatewayProfile.getGatewayID());
profileResource.save();
List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()){
http://git-wip-us.apache.org/repos/asf/airavata/blob/fd557d82/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
----------------------------------------------------------------------
diff --git a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
index 273efce..34786fe 100644
--- a/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
+++ b/modules/integration-tests/src/test/java/org/apache/airavata/integration/tools/DocumentCreatorNew.java
@@ -44,11 +44,14 @@ import org.apache.airavata.model.error.AiravataClientException;
import org.apache.airavata.model.error.AiravataSystemException;
import org.apache.airavata.model.error.InvalidRequestException;
import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.*;
public class DocumentCreatorNew {
+ private final static Logger log = LoggerFactory.getLogger(DocumentCreatorNew.class);
private static final String DEFAULT_GATEWAY = "php_reference_gateway";
private AppCatalog appcatalog = null;
@@ -115,7 +118,7 @@ public class DocumentCreatorNew {
null, null);
gatewayResourceProfile = new GatewayResourceProfile();
// gatewayResourceProfile.setGatewayID("default");
- gatewayResourceProfile.setGatewayID(ClientSettings.getSetting("default.registry.gateway", "php_reference_gateway"));
+ gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
gatewayResourceProfile.addToComputeResourcePreferences(computeResourcePreference);
String gatewayId = client.registerGatewayResourceProfile(gatewayResourceProfile);
gatewayResourceProfile.setGatewayID(gatewayId);
@@ -133,7 +136,7 @@ public class DocumentCreatorNew {
if (gatewayResourceProfile == null) {
gatewayResourceProfile = new GatewayResourceProfile();
// gatewayResourceProfile.setGatewayID("default");
- gatewayResourceProfile.setGatewayID("php_reference_gateway");
+ gatewayResourceProfile.setGatewayID(DEFAULT_GATEWAY);
gatewayResourceProfile.setGatewayID(client.registerGatewayResourceProfile(gatewayResourceProfile));
}
// }