You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ya...@apache.org on 2025/12/16 05:37:15 UTC
(airavata) branch service-layer-improvements updated: fix all servicehandlers and get airavata to compile
This is an automated email from the ASF dual-hosted git repository.
yasith pushed a commit to branch service-layer-improvements
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/service-layer-improvements by this push:
new 4e7a80a37c fix all servicehandlers and get airavata to compile
4e7a80a37c is described below
commit 4e7a80a37cd6b7fbba43d71a4c4d21a0aec3e0ed
Author: yasithdev <ya...@icloud.com>
AuthorDate: Mon Dec 15 15:06:07 2025 -0600
fix all servicehandlers and get airavata to compile
---
.../service/services/AiravataService.java | 13 +-
.../thriftapi/handler/AiravataServiceHandler.java | 3371 +++++---------------
.../handler/CredentialServiceHandler.java | 201 +-
.../handler/GroupManagerServiceHandler.java | 324 +-
.../thriftapi/handler/IamAdminServiceHandler.java | 240 +-
.../handler/OrchestratorServiceHandler.java | 104 +-
.../thriftapi/handler/RegistryServiceHandler.java | 1944 +++++++++--
.../handler/SharingRegistryServerHandler.java | 808 ++++-
.../handler/TenantProfileServiceHandler.java | 173 +-
.../handler/UserProfileServiceHandler.java | 223 +-
.../thriftapi/mapper/NSFDemographicsMapper.java | 30 +
.../thriftapi/mapper/UserProfileMapper.java | 30 +
.../handler/TestSharingRegistryHandler.java | 500 ---
13 files changed, 3466 insertions(+), 4495 deletions(-)
diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java
index 13be7bee7d..0a1fe9b9f4 100644
--- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java
+++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/services/AiravataService.java
@@ -26,10 +26,6 @@ import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.airavata.agent.connection.service.UserContext;
-import org.apache.airavata.common.exception.AiravataClientException;
-import org.apache.airavata.common.exception.AiravataSystemException;
-import org.apache.airavata.common.exception.AuthorizationException;
-import org.apache.airavata.common.exception.InvalidRequestException;
import org.apache.airavata.common.model.ComputeResourceType;
import org.apache.airavata.common.model.ExperimentSummaryModel;
import org.apache.airavata.common.model.GroupComputeResourcePreference;
@@ -37,6 +33,10 @@ import org.apache.airavata.common.model.GroupResourceProfile;
import org.apache.airavata.common.model.Project;
import org.apache.airavata.config.AiravataServerProperties;
import org.apache.airavata.thriftapi.client.AiravataServiceClientFactory;
+import org.apache.airavata.thriftapi.exception.AiravataClientException;
+import org.apache.airavata.thriftapi.exception.AiravataSystemException;
+import org.apache.airavata.thriftapi.exception.AuthorizationException;
+import org.apache.airavata.thriftapi.exception.InvalidRequestException;
import org.apache.airavata.thriftapi.service.Airavata;
import org.apache.thrift.TException;
import org.slf4j.Logger;
@@ -76,7 +76,7 @@ public class AiravataService {
public Airavata.Client airavata() {
try {
return AiravataServiceClientFactory.createAiravataClient(serverUrl, port, secure, properties);
- } catch (AiravataClientException e) {
+ } catch (org.apache.airavata.common.exception.AiravataClientException e) {
LOGGER.error("Error while creating Airavata client", e);
throw new RuntimeException("Error while creating Airavata client", e);
}
@@ -331,8 +331,7 @@ public class AiravataService {
domainModel.setUserName(thriftModel.getUserName());
domainModel.setName(thriftModel.getName());
if (thriftModel.getExperimentStatus() != null) {
- domainModel.setExperimentStatus(org.apache.airavata.common.model.ExperimentStatus.valueOf(
- thriftModel.getExperimentStatus().name()));
+ domainModel.setExperimentStatus(thriftModel.getExperimentStatus());
}
return domainModel;
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/AiravataServiceHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/AiravataServiceHandler.java
index 1997b02ecd..d56a37d5cc 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/AiravataServiceHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/AiravataServiceHandler.java
@@ -23,20 +23,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
-import org.apache.airavata.accountprovisioning.ConfigParam;
import org.apache.airavata.accountprovisioning.SSHAccountProvisionerFactory;
-import org.apache.airavata.accountprovisioning.SSHAccountProvisionerProvider;
import org.apache.airavata.common.exception.AiravataException;
import org.apache.airavata.common.utils.Constants;
import org.apache.airavata.security.interceptor.SecurityCheck;
import org.apache.airavata.service.AiravataService;
-import org.apache.airavata.thriftapi.credential.exception.CredentialStoreException;
import org.apache.airavata.thriftapi.exception.AiravataClientException;
-import org.apache.airavata.thriftapi.exception.AiravataErrorType;
import org.apache.airavata.thriftapi.exception.AiravataSystemException;
import org.apache.airavata.thriftapi.exception.AuthorizationException;
import org.apache.airavata.thriftapi.exception.InvalidRequestException;
-import org.apache.airavata.thriftapi.exception.ProjectNotFoundException;
import org.apache.airavata.thriftapi.mapper.ApplicationDeploymentDescriptionMapper;
import org.apache.airavata.thriftapi.mapper.ApplicationInterfaceDescriptionMapper;
import org.apache.airavata.thriftapi.mapper.ApplicationModuleMapper;
@@ -61,6 +56,7 @@ import org.apache.airavata.thriftapi.mapper.GroupComputeResourcePreferenceMapper
import org.apache.airavata.thriftapi.mapper.GroupResourceProfileMapper;
import org.apache.airavata.thriftapi.mapper.InputDataObjectTypeMapper;
import org.apache.airavata.thriftapi.mapper.JobModelMapper;
+import org.apache.airavata.thriftapi.mapper.JobStatusMapper;
import org.apache.airavata.thriftapi.mapper.LOCALDataMovementMapper;
import org.apache.airavata.thriftapi.mapper.LOCALSubmissionMapper;
import org.apache.airavata.thriftapi.mapper.NotificationMapper;
@@ -72,7 +68,6 @@ import org.apache.airavata.thriftapi.mapper.ProjectMapper;
import org.apache.airavata.thriftapi.mapper.QueueStatusModelMapper;
import org.apache.airavata.thriftapi.mapper.ResourceJobManagerMapper;
import org.apache.airavata.thriftapi.mapper.SCPDataMovementMapper;
-import org.apache.airavata.thriftapi.mapper.SSHAccountProvisionerDescriptionMapper;
import org.apache.airavata.thriftapi.mapper.SSHJobSubmissionMapper;
import org.apache.airavata.thriftapi.mapper.StorageDirectoryInfoMapper;
import org.apache.airavata.thriftapi.mapper.StoragePreferenceMapper;
@@ -108,7 +103,6 @@ import org.apache.airavata.thriftapi.model.GroupComputeResourcePreference;
import org.apache.airavata.thriftapi.model.GroupResourceProfile;
import org.apache.airavata.thriftapi.model.InputDataObjectType;
import org.apache.airavata.thriftapi.model.JobModel;
-import org.apache.airavata.thriftapi.model.JobState;
import org.apache.airavata.thriftapi.model.JobStatus;
import org.apache.airavata.thriftapi.model.LOCALDataMovement;
import org.apache.airavata.thriftapi.model.LOCALSubmission;
@@ -159,6 +153,7 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
private final OutputDataObjectTypeMapper outputDataObjectTypeMapper = OutputDataObjectTypeMapper.INSTANCE;
private final InputDataObjectTypeMapper inputDataObjectTypeMapper = InputDataObjectTypeMapper.INSTANCE;
private final JobModelMapper jobModelMapper = JobModelMapper.INSTANCE;
+ private final JobStatusMapper jobStatusMapper = JobStatusMapper.INSTANCE;
private final DataProductModelMapper dataProductModelMapper = DataProductModelMapper.INSTANCE;
private final CredentialSummaryMapper credentialSummaryMapper = CredentialSummaryMapper.INSTANCE;
private final AuthzTokenMapper authzTokenMapper = AuthzTokenMapper.INSTANCE;
@@ -186,8 +181,6 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
private final UserStoragePreferenceMapper userStoragePreferenceMapper = UserStoragePreferenceMapper.INSTANCE;
private final DataReplicaLocationModelMapper dataReplicaLocationModelMapper =
DataReplicaLocationModelMapper.INSTANCE;
- private final SSHAccountProvisionerDescriptionMapper sshAccountProvisionerDescriptionMapper =
- SSHAccountProvisionerDescriptionMapper.INSTANCE;
private final ApplicationModuleMapper applicationModuleMapper = ApplicationModuleMapper.INSTANCE;
private final ParserMapper parserMapper = ParserMapper.INSTANCE;
private final ParsingTemplateMapper parsingTemplateMapper = ParsingTemplateMapper.INSTANCE;
@@ -207,69 +200,77 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
this.airavataService.init();
}
- // Helper method to convert domain exceptions to thrift exceptions
- private org.apache.airavata.thriftapi.exception.AiravataSystemException convertToThriftSystemException(
- org.apache.airavata.common.exception.AiravataSystemException e) {
- var thriftException = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
+ /**
+ * Converts any thrown exception from Airavata Services layer to appropriate Thrift API exception type.
+ * The mapping strategy is:
+ * - If the cause is already a Thrift exception, return as is.
+ * - If the cause is a known domain exception, map accordingly.
+ * - If unknown, wrap in a generic AiravataSystemException.
+ *
+ * This merges all domain-to-thrift exception conversions into a single convenient method.
+ */
+ private org.apache.thrift.TException wrapException(Throwable e) {
+ if (e instanceof org.apache.thrift.TException te) return te;
+ org.apache.thrift.TException thriftException = null;
+ if (e instanceof org.apache.airavata.common.exception.ApplicationSettingsException
+ || e instanceof org.apache.airavata.common.exception.AiravataSystemException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.AuthorizationException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AuthorizationException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.credential.exception.CredentialStoreException) {
+ var ex = new org.apache.airavata.thriftapi.credential.exception.CredentialStoreException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.InvalidRequestException) {
+ var ex = new org.apache.airavata.thriftapi.exception.InvalidRequestException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.ExperimentNotFoundException) {
+ var ex = new org.apache.airavata.thriftapi.exception.ExperimentNotFoundException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.ProjectNotFoundException) {
+ var ex = new org.apache.airavata.thriftapi.exception.ProjectNotFoundException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.AiravataClientException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataClientException();
+ if (e != null) {
+ ex.setParameter(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
}
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.InvalidRequestException convertToThriftInvalidRequestException(
- org.apache.airavata.common.exception.InvalidRequestException e) {
- var thriftException = new org.apache.airavata.thriftapi.exception.InvalidRequestException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.AiravataClientException convertToThriftAiravataClientException(
- org.apache.airavata.common.exception.AiravataClientException e) {
- var thriftException = new org.apache.airavata.thriftapi.exception.AiravataClientException();
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- if (e.getMessage() != null) {
- thriftException.setParameter(e.getMessage());
+ if (thriftException == null) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
}
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.AuthorizationException convertToThriftAuthorizationException(
- org.apache.airavata.common.exception.AuthorizationException e) {
- var thriftException = new org.apache.airavata.thriftapi.exception.AuthorizationException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
-
- private CredentialStoreException convertToThriftCredentialStoreException(
- org.apache.airavata.credential.exception.CredentialStoreException e) {
- var thriftException = new CredentialStoreException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.ExperimentNotFoundException
- convertToThriftExperimentNotFoundException(
- org.apache.airavata.common.exception.ExperimentNotFoundException e) {
- var thriftException = new org.apache.airavata.thriftapi.exception.ExperimentNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.ProjectNotFoundException convertToThriftProjectNotFoundException(
- org.apache.airavata.common.exception.ProjectNotFoundException e) {
- var thriftException = new org.apache.airavata.thriftapi.exception.ProjectNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
return thriftException;
}
@@ -287,18 +288,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- if (false) throw new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.isUserExists(gatewayId, userName);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- var exception = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error checking if user exists: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -312,17 +304,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
var domainGateway = gatewayMapper.toDomain(gateway);
return airavataService.addGateway(domainGateway);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- var exception = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error adding gateway: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -336,14 +321,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
return airavataService.getAllUsersInGateway(gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- var exception = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error getting all users in gateway: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -358,23 +337,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
org.apache.airavata.common.model.Gateway domainGateway = gatewayMapper.toDomain(updatedGateway);
return airavataService.updateGateway(gatewayId, domainGateway);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- AiravataSystemException thriftException = new AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(
- AiravataErrorType.valueOf(e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error updating gateway: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -387,18 +353,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
org.apache.airavata.common.model.Gateway domainGateway = airavataService.getGateway(gatewayId);
- // Convert domain model to thrift model
return gatewayMapper.toThrift(domainGateway);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error getting gateway: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -411,15 +369,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
return airavataService.deleteGateway(gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error deleting gateway: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -432,19 +383,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- List<org.apache.airavata.common.model.Gateway> domainGateways = airavataService.getAllGateways();
- // Convert domain models to thrift models
- return domainGateways.stream().map(gatewayMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error getting all gateways: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ var gateways = airavataService.getAllGateways();
+ return gateways.stream().map(gatewayMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -457,15 +399,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
return airavataService.isGatewayExist(gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error checking if gateway exists: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -479,19 +414,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.Notification domainNotification =
- notificationMapper.toDomain(notification);
+ var domainNotification = notificationMapper.toDomain(notification);
return airavataService.createNotification(domainNotification);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error creating notification: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -505,19 +431,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.Notification domainNotification =
- notificationMapper.toDomain(notification);
+ var domainNotification = notificationMapper.toDomain(notification);
return airavataService.updateNotification(domainNotification);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating notification: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -531,15 +448,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
return airavataService.deleteNotification(gatewayId, notificationId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting notification: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -552,20 +462,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.common.model.Notification domainNotification =
- airavataService.getNotification(gatewayId, notificationId);
- // Convert domain model to thrift model
+ var domainNotification = airavataService.getNotification(gatewayId, notificationId);
return notificationMapper.toThrift(domainNotification);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting notification: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -578,22 +478,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- List<org.apache.airavata.common.model.Notification> domainNotifications =
- airavataService.getAllNotifications(gatewayId);
- // Convert domain models to thrift models
- return domainNotifications.stream()
- .map(notificationMapper::toThrift)
- .collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all notifications: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ var notifications = airavataService.getAllNotifications(gatewayId);
+ return notifications.stream().map(notificationMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -603,25 +491,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.security.model.AuthzToken authzToken, String description)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- if (false) throw new org.apache.airavata.thriftapi.exception.InvalidRequestException();
- if (false) throw new org.apache.airavata.thriftapi.exception.AiravataClientException();
- if (false) throw new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- String userName = domainAuthzToken.getClaimsMap().get(Constants.USER_NAME);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var userName = domainAuthzToken.getClaimsMap().get(Constants.USER_NAME);
return airavataService.generateAndRegisterSSHKeys(gatewayId, userName, description);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error generating and registering SSH keys: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -634,25 +509,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
String description)
throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
try {
- if (false) throw new org.apache.airavata.thriftapi.exception.InvalidRequestException();
- if (false) throw new org.apache.airavata.thriftapi.exception.AiravataClientException();
- if (false) throw new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- String userName = domainAuthzToken.getClaimsMap().get(Constants.USER_NAME);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var userName = domainAuthzToken.getClaimsMap().get(Constants.USER_NAME);
return airavataService.registerPwdCredential(gatewayId, userName, loginUserName, password, description);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error registering password credential: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -665,21 +527,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- org.apache.airavata.credential.model.CredentialSummary domainSummary =
- airavataService.getCredentialSummary(tokenId, gatewayId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var domainSummary = airavataService.getCredentialSummary(tokenId, gatewayId);
return credentialSummaryMapper.toThrift(domainSummary);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
- throw convertToThriftCredentialStoreException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error getting credential summary: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -692,28 +545,18 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException,
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.credential.model.SummaryType domainType =
- org.apache.airavata.credential.model.SummaryType.valueOf(type.name());
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- String userName = domainAuthzToken.getClaimsMap().get(Constants.USER_NAME);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainType = org.apache.airavata.credential.model.SummaryType.valueOf(type.name());
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var userName = domainAuthzToken.getClaimsMap().get(Constants.USER_NAME);
try {
- List<org.apache.airavata.credential.model.CredentialSummary> domainSummaries =
+ var domainSummaries =
airavataService.getAllCredentialSummaries(domainAuthzToken, domainType, gatewayId, userName);
return domainSummaries.stream()
.map(credentialSummaryMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error getting all credential summaries: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -726,17 +569,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
return airavataService.deleteSSHCredential(airavataCredStoreToken, gatewayId);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
- throw convertToThriftCredentialStoreException(e);
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error deleting SSH credential: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -749,21 +586,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
return airavataService.deletePWDCredential(domainAuthzToken, airavataCredStoreToken, gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting PWD credential: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -778,18 +605,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.Project domainProject = projectMapper.toDomain(project);
+ var domainProject = projectMapper.toDomain(project);
return airavataService.createProject(gatewayId, domainProject);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error creating project: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -805,34 +624,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.ProjectNotFoundException, AuthorizationException,
TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Convert thrift model to domain model
- org.apache.airavata.common.model.Project domainProject = projectMapper.toDomain(updatedProject);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProject = projectMapper.toDomain(updatedProject);
airavataService.updateProject(domainAuthzToken, projectId, domainProject);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- AiravataSystemException thriftException = new AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(
- AiravataErrorType.valueOf(e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- InvalidRequestException thriftException = new InvalidRequestException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- throw thriftException;
- } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
- ProjectNotFoundException thriftException = new ProjectNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error updating project: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -845,21 +641,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.ProjectNotFoundException, AuthorizationException,
TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteProject(domainAuthzToken, projectId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
- org.apache.airavata.thriftapi.exception.ProjectNotFoundException thriftException =
- new org.apache.airavata.thriftapi.exception.ProjectNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error deleting project: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -873,31 +658,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.ProjectNotFoundException, AuthorizationException,
TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Get domain model from service
- org.apache.airavata.common.model.Project domainProject =
- airavataService.getProject(domainAuthzToken, projectId);
- // Convert domain model to thrift model
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProject = airavataService.getProject(domainAuthzToken, projectId);
return projectMapper.toThrift(domainProject);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- AiravataSystemException thriftException = new AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(
- AiravataErrorType.valueOf(e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
- ProjectNotFoundException thriftException = new ProjectNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error getting project: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -914,21 +679,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.Project> domainProjects =
- airavataService.getUserProjects(domainAuthzToken, gatewayId, userName, limit, offset);
- // Convert domain models to thrift models
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProjects = airavataService.getUserProjects(domainAuthzToken, gatewayId, userName, limit, offset);
return domainProjects.stream().map(projectMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting user projects: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -946,27 +701,19 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift models to domain models
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- Map<org.apache.airavata.common.model.ProjectSearchFields, String> domainFilters = new java.util.HashMap<>();
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainFilters = new java.util.HashMap<org.apache.airavata.common.model.ProjectSearchFields, String>();
for (Map.Entry<ProjectSearchFields, String> entry : filters.entrySet()) {
domainFilters.put(
org.apache.airavata.common.model.ProjectSearchFields.valueOf(
entry.getKey().name()),
entry.getValue());
}
- // Get domain models from service
- List<org.apache.airavata.common.model.Project> domainProjects =
+ var domainProjects =
airavataService.searchProjects(domainAuthzToken, gatewayId, userName, domainFilters, limit, offset);
- // Convert domain models to thrift models
return domainProjects.stream().map(projectMapper::toThrift).collect(Collectors.toList());
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error searching projects: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -984,8 +731,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
// Convert thrift models to domain models
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- Map<org.apache.airavata.common.model.ExperimentSearchFields, String> domainFilters = new java.util.HashMap<>();
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainFilters = new java.util.HashMap<org.apache.airavata.common.model.ExperimentSearchFields, String>();
for (Map.Entry<ExperimentSearchFields, String> entry : filters.entrySet()) {
domainFilters.put(
org.apache.airavata.common.model.ExperimentSearchFields.valueOf(
@@ -993,23 +740,13 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
entry.getValue());
}
try {
- // Get domain models from service
- List<org.apache.airavata.common.model.ExperimentSummaryModel> domainSummaries =
- airavataService.searchExperiments(
- domainAuthzToken, gatewayId, userName, domainFilters, limit, offset);
- // Convert domain models to thrift models
+ var domainSummaries = airavataService.searchExperiments(
+ domainAuthzToken, gatewayId, userName, domainFilters, limit, offset);
return domainSummaries.stream()
.map(experimentSummaryModelMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error searching experiments: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1030,9 +767,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<String> accessibleExpIds = null;
- org.apache.airavata.common.model.ExperimentStatistics domainStats = airavataService.getExperimentStatistics(
+ var accessibleExpIds = new ArrayList<String>();
+ var domainStats = airavataService.getExperimentStatistics(
gatewayId,
fromTime,
toTime,
@@ -1043,24 +779,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
limit,
offset);
return experimentStatisticsMapper.toThrift(domainStats);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting experiment statistics: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1074,30 +794,14 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.ProjectNotFoundException, AuthorizationException,
TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- // Get domain models from service
- List<org.apache.airavata.common.model.ExperimentModel> domainExperiments =
- airavataService.getExperimentsInProject(gatewayId, projectId, limit, offset);
- // Convert domain models to thrift models
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
+ var domainExperiments = airavataService.getExperimentsInProject(gatewayId, projectId, limit, offset);
return domainExperiments.stream()
.map(experimentModelMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error getting experiments in project: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1114,30 +818,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.ExperimentModel> domainExperiments =
- airavataService.getUserExperiments(gatewayId, userName, limit, offset);
- // Convert domain models to thrift models
+ var domainExperiments = airavataService.getUserExperiments(gatewayId, userName, limit, offset);
return domainExperiments.stream()
.map(experimentModelMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setMessage("Error getting user experiments: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1152,17 +838,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.ExperimentModel domainExperiment =
- experimentModelMapper.toDomain(experiment);
+ var domainExperiment = experimentModelMapper.toDomain(experiment);
return airavataService.createExperiment(gatewayId, domainExperiment);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error creating experiment: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1175,19 +854,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteExperimentWithAuth(domainAuthzToken, experimentId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error deleting experiment: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1200,30 +870,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ExperimentModel domainExperiment =
- airavataService.getExperiment(domainAuthzToken, airavataExperimentId);
- // Convert domain model to thrift model
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainExperiment = airavataService.getExperiment(domainAuthzToken, airavataExperimentId);
return experimentModelMapper.toThrift(domainExperiment);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setMessage("Error getting experiment: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1236,27 +887,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ExperimentModel domainExperiment =
- airavataService.getExperimentByAdmin(domainAuthzToken, airavataExperimentId);
- // Convert domain model to thrift model
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainExperiment = airavataService.getExperimentByAdmin(domainAuthzToken, airavataExperimentId);
return experimentModelMapper.toThrift(domainExperiment);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error getting experiment by admin: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1269,27 +904,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ExperimentModel domainExperiment =
- airavataService.getDetailedExperimentTree(airavataExperimentId);
- // Convert domain model to thrift model
+ var domainExperiment = airavataService.getDetailedExperimentTree(airavataExperimentId);
return experimentModelMapper.toThrift(domainExperiment);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Error getting detailed experiment tree: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1305,18 +923,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ExperimentModel domainExperiment =
- experimentModelMapper.toDomain(experiment);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainExperiment = experimentModelMapper.toDomain(experiment);
airavataService.updateExperiment(domainAuthzToken, airavataExperimentId, domainExperiment);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error updating experiment: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1331,19 +942,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserConfigurationDataModel domainUserConfig =
- userConfigurationDataModelMapper.toDomain(userConfiguration);
+ var domainUserConfig = userConfigurationDataModelMapper.toDomain(userConfiguration);
airavataService.updateExperimentConfiguration(airavataExperimentId, domainUserConfig);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating experiment configuration: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1357,19 +959,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ComputationalResourceSchedulingModel domainScheduling =
- computationalResourceSchedulingModelMapper.toDomain(resourceScheduling);
+ var domainScheduling = computationalResourceSchedulingModelMapper.toDomain(resourceScheduling);
airavataService.updateResourceScheduleing(airavataExperimentId, domainScheduling);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating resource scheduling: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1382,28 +975,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Validate experiment access first
- org.apache.airavata.common.model.ExperimentModel experiment =
- airavataService.getExperiment(domainAuthzToken, airavataExperimentId);
- // Basic validation - check if experiment exists and user has access
- // Full validation would require orchestrator service which is not directly
- // accessible
- // For now, return true if experiment exists and is accessible
- return experiment != null;
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error validating experiment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainExperiment = airavataService.getExperiment(domainAuthzToken, airavataExperimentId);
+ return domainExperiment != null;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1417,24 +993,16 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.ExperimentStatus domainStatus =
- airavataService.getExperimentStatus(airavataExperimentId);
- ExperimentStatus thriftStatus = new ExperimentStatus();
+ var domainStatus = airavataService.getExperimentStatus(airavataExperimentId);
+ var thriftStatus = new ExperimentStatus();
thriftStatus.setState(
ExperimentState.valueOf(domainStatus.getState().name()));
thriftStatus.setTimeOfStateChange(domainStatus.getTimeOfStateChange());
thriftStatus.setReason(domainStatus.getReason());
thriftStatus.setStatusId(domainStatus.getStatusId());
return thriftStatus;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting experiment status: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1448,23 +1016,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
- airavataService.getExperimentOutputs(airavataExperimentId);
- // Convert domain models to thrift models
+ var domainOutputs = airavataService.getExperimentOutputs(airavataExperimentId);
return domainOutputs.stream()
.map(outputDataObjectTypeMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting experiment outputs: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1478,30 +1035,13 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // getIntermediateOutputs is not directly available in AiravataService
- // Using registry service through experiment service
- // This is a workaround - ideally AiravataService should expose this method
- org.apache.airavata.common.model.ExperimentModel experiment =
- airavataService.getExperiment(domainAuthzToken, airavataExperimentId);
- // For now, return empty list as getIntermediateOutputs requires registry
- // service access
- // TODO: Add getIntermediateOutputs method to AiravataService
- List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs = new java.util.ArrayList<>();
- return domainOutputs.stream()
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var experiment = airavataService.getExperiment(domainAuthzToken, airavataExperimentId);
+ return experiment.getExperimentOutputs().stream()
.map(outputDataObjectTypeMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting intermediate outputs: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1516,21 +1056,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
airavataService.fetchIntermediateOutputs(domainAuthzToken, airavataExperimentId, outputNames);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error fetching intermediate outputs: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1544,28 +1073,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- Map<String, org.apache.airavata.common.model.JobStatus> domainStatuses =
- airavataService.getJobStatuses(airavataExperimentId);
- Map<String, JobStatus> thriftStatuses = new java.util.HashMap<>();
- for (Map.Entry<String, org.apache.airavata.common.model.JobStatus> entry : domainStatuses.entrySet()) {
- JobStatus thriftStatus = new JobStatus();
- thriftStatus.setJobState(
- JobState.valueOf(entry.getValue().getJobState().name()));
- thriftStatus.setTimeOfStateChange(entry.getValue().getTimeOfStateChange());
- thriftStatus.setReason(entry.getValue().getReason());
- thriftStatus.setStatusId(entry.getValue().getStatusId());
- thriftStatuses.put(entry.getKey(), thriftStatus);
- }
- return thriftStatuses;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting job statuses: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ var domainStatuses = airavataService.getJobStatuses(airavataExperimentId);
+ return domainStatuses.entrySet().stream()
+ .collect(Collectors.toMap(Map.Entry::getKey, entry -> jobStatusMapper.toThrift(entry.getValue())));
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1579,20 +1091,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- List<org.apache.airavata.common.model.JobModel> domainJobs =
- airavataService.getJobDetails(airavataExperimentId);
- // Convert domain models to thrift models
+ var domainJobs = airavataService.getJobDetails(airavataExperimentId);
return domainJobs.stream().map(jobModelMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting job details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1608,40 +1110,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
airavataService.launchExperiment(domainAuthzToken, gatewayId, airavataExperimentId);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.ExperimentNotFoundException e) {
- org.apache.airavata.thriftapi.exception.ExperimentNotFoundException thriftException =
- new org.apache.airavata.thriftapi.exception.ExperimentNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- throw thriftException;
- } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
- org.apache.airavata.thriftapi.exception.ProjectNotFoundException thriftException =
- new org.apache.airavata.thriftapi.exception.ProjectNotFoundException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- throw thriftException;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (org.apache.airavata.sharing.model.SharingRegistryException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error launching experiment: " + e.getMessage());
- exception.initCause(e);
- throw exception;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error launching experiment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1659,33 +1131,16 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException,
org.apache.airavata.thriftapi.exception.ProjectNotFoundException, TException {
try {
- // getExperiment will apply sharing permissions
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ExperimentModel existingExperiment =
- airavataService.getExperiment(domainAuthzToken, existingExperimentID);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var existingExperiment = airavataService.getExperiment(domainAuthzToken, existingExperimentID);
return airavataService.cloneExperiment(
domainAuthzToken,
existingExperimentID,
newExperimentName,
newExperimentProjectId,
existingExperiment);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.ExperimentNotFoundException e) {
- throw convertToThriftExperimentNotFoundException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
- throw convertToThriftProjectNotFoundException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error cloning experiment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1703,35 +1158,16 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException,
org.apache.airavata.thriftapi.exception.ProjectNotFoundException, TException {
try {
- // get existing experiment by bypassing normal sharing permissions for the admin
- // user
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ExperimentModel existingExperiment =
- airavataService.getExperimentByAdmin(domainAuthzToken, existingExperimentID);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var existingExperiment = airavataService.getExperimentByAdmin(domainAuthzToken, existingExperimentID);
return airavataService.cloneExperiment(
domainAuthzToken,
existingExperimentID,
newExperimentName,
newExperimentProjectId,
existingExperiment);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.ExperimentNotFoundException e) {
- throw convertToThriftExperimentNotFoundException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
- throw convertToThriftProjectNotFoundException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error cloning experiment by admin: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1746,19 +1182,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
airavataService.terminateExperiment(airavataExperimentId, gatewayId);
- } catch (org.apache.airavata.common.exception.ExperimentNotFoundException e) {
- throw convertToThriftExperimentNotFoundException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error terminating experiment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1773,19 +1199,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationModule domainModule =
- applicationModuleMapper.toDomain(applicationModule);
+ var domainModule = applicationModuleMapper.toDomain(applicationModule);
+ applicationModuleMapper.toDomain(applicationModule);
return airavataService.registerApplicationModule(gatewayId, domainModule);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering application module: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1798,19 +1216,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationModule domainModule =
- airavataService.getApplicationModule(appModuleId);
+ var domainModule = airavataService.getApplicationModule(appModuleId);
return applicationModuleMapper.toThrift(domainModule);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting application module: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1825,20 +1234,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationModule domainModule =
- applicationModuleMapper.toDomain(applicationModule);
+ var domainModule = applicationModuleMapper.toDomain(applicationModule);
airavataService.updateApplicationModule(appModuleId, domainModule);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating application module: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1851,19 +1251,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.ApplicationModule> domainModules =
- airavataService.getAllAppModules(gatewayId);
+ var domainModules = airavataService.getAllAppModules(gatewayId);
return domainModules.stream().map(applicationModuleMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all app modules: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1876,21 +1267,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.ApplicationModule> domainModules =
- airavataService.getAccessibleAppModules(domainAuthzToken, gatewayId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainModules = airavataService.getAccessibleAppModules(domainAuthzToken, gatewayId);
return domainModules.stream().map(applicationModuleMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting accessible app modules: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1903,17 +1284,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteApplicationModule(appModuleId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting application module: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1928,21 +1301,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationDeploymentDescription domainDeployment =
- applicationDeploymentDescriptionMapper.toDomain(applicationDeployment);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainDeployment = applicationDeploymentDescriptionMapper.toDomain(applicationDeployment);
return airavataService.registerApplicationDeployment(domainAuthzToken, gatewayId, domainDeployment);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error registering application deployment: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1955,23 +1318,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationDeploymentDescription domainDeployment =
- airavataService.getApplicationDeployment(domainAuthzToken, appDeploymentId);
- // Convert domain model to thrift model
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainDeployment = airavataService.getApplicationDeployment(domainAuthzToken, appDeploymentId);
return applicationDeploymentDescriptionMapper.toThrift(domainDeployment);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting application deployment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -1986,22 +1337,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationDeploymentDescription domainDeployment =
- applicationDeploymentDescriptionMapper.toDomain(applicationDeployment);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainDeployment = applicationDeploymentDescriptionMapper.toDomain(applicationDeployment);
return airavataService.updateApplicationDeployment(domainAuthzToken, appDeploymentId, domainDeployment);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating application deployment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2014,19 +1354,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteApplicationDeployment(domainAuthzToken, appDeploymentId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting application deployment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2052,30 +1383,16 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourcePermissionType domainPermissionType =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPermissionType =
org.apache.airavata.common.model.ResourcePermissionType.valueOf(permissionType.name());
- List<org.apache.airavata.common.model.ApplicationDeploymentDescription> domainDeployments =
- airavataService.getAccessibleApplicationDeployments(
- domainAuthzToken, gatewayId, domainPermissionType);
- // Convert domain models to thrift models
+ var domainDeployments = airavataService.getAccessibleApplicationDeployments(
+ domainAuthzToken, gatewayId, domainPermissionType);
return domainDeployments.stream()
.map(applicationDeploymentDescriptionMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting accessible application deployments: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2089,17 +1406,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.getAppModuleDeployedResources(appModuleId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting app module deployed resources: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2114,29 +1423,14 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.ApplicationDeploymentDescription> domainDeployments =
- airavataService.getApplicationDeploymentsForAppModuleAndGroupResourceProfile(
- domainAuthzToken, appModuleId, groupResourceProfileId);
- // Convert domain models to thrift models
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainDeployments = airavataService.getApplicationDeploymentsForAppModuleAndGroupResourceProfile(
+ domainAuthzToken, appModuleId, groupResourceProfileId);
return domainDeployments.stream()
.map(applicationDeploymentDescriptionMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting application deployments for app module and group resource profile: "
- + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2151,20 +1445,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationInterfaceDescription domainInterface =
- applicationInterfaceDescriptionMapper.toDomain(applicationInterface);
+ var domainInterface = applicationInterfaceDescriptionMapper.toDomain(applicationInterface);
return airavataService.registerApplicationInterface(gatewayId, domainInterface);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering application interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2181,19 +1465,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
return airavataService.cloneApplicationInterface(existingAppInterfaceID, newApplicationName, gatewayId);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error cloning application interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2206,19 +1479,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationInterfaceDescription domainInterface =
- airavataService.getApplicationInterface(appInterfaceId);
+ var domainInterface = airavataService.getApplicationInterface(appInterfaceId);
return applicationInterfaceDescriptionMapper.toThrift(domainInterface);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting application interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2233,21 +1497,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ApplicationInterfaceDescription domainInterface =
- applicationInterfaceDescriptionMapper.toDomain(applicationInterface);
+ var domainInterface = applicationInterfaceDescriptionMapper.toDomain(applicationInterface);
airavataService.updateApplicationInterface(appInterfaceId, domainInterface);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating application interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2260,17 +1514,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteApplicationInterface(appInterfaceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting application interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2283,17 +1529,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.getAllApplicationInterfaceNames(gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all application interface names: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2306,22 +1544,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- List<org.apache.airavata.common.model.ApplicationInterfaceDescription> domainInterfaces =
- airavataService.getAllApplicationInterfaces(gatewayId);
- // Convert domain models to thrift models
+ var domainInterfaces = airavataService.getAllApplicationInterfaces(gatewayId);
return domainInterfaces.stream()
.map(applicationInterfaceDescriptionMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all application interfaces: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2334,23 +1562,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.InputDataObjectType> domainInputs =
- airavataService.getApplicationInputs(appInterfaceId);
- // Convert domain models to thrift models
+ var domainInputs = airavataService.getApplicationInputs(appInterfaceId);
return domainInputs.stream()
.map(inputDataObjectTypeMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting application inputs: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2363,23 +1580,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
- airavataService.getApplicationOutputs(appInterfaceId);
- // Convert domain models to thrift models
+ var domainOutputs = airavataService.getApplicationOutputs(appInterfaceId);
return domainOutputs.stream()
.map(outputDataObjectTypeMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting application outputs: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2393,17 +1599,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.getAvailableAppInterfaceComputeResources(appInterfaceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting available app interface compute resources: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2417,20 +1615,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Convert thrift model to domain model
- org.apache.airavata.common.model.ComputeResourceDescription domainComputeResource =
- computeResourceDescriptionMapper.toDomain(computeResourceDescription);
+ var domainComputeResource = computeResourceDescriptionMapper.toDomain(computeResourceDescription);
return airavataService.registerComputeResource(domainComputeResource);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering compute resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2443,21 +1631,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Get domain model from service
- org.apache.airavata.common.model.ComputeResourceDescription domainComputeResource =
- airavataService.getComputeResource(computeResourceId);
- // Convert domain model to thrift model
+ var domainComputeResource = airavataService.getComputeResource(computeResourceId);
return computeResourceDescriptionMapper.toThrift(domainComputeResource);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting compute resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2470,17 +1647,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.getAllComputeResourceNames();
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all compute resource names: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2495,20 +1664,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ComputeResourceDescription domainComputeResource =
- computeResourceDescriptionMapper.toDomain(computeResourceDescription);
+ var domainComputeResource = computeResourceDescriptionMapper.toDomain(computeResourceDescription);
airavataService.updateComputeResource(computeResourceId, domainComputeResource);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating compute resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2521,17 +1681,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteComputeResource(computeResourceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting compute resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2545,27 +1697,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StorageResourceDescription domainStorage =
- storageResourceDescriptionMapper.toDomain(storageResourceDescription);
+ var domainStorage = storageResourceDescriptionMapper.toDomain(storageResourceDescription);
return airavataService.registerStorageResource(domainStorage);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering storage resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2578,19 +1713,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StorageResourceDescription domainStorage =
- airavataService.getStorageResource(storageResourceId);
+ var domainStorage = airavataService.getStorageResource(storageResourceId);
return storageResourceDescriptionMapper.toThrift(domainStorage);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting storage resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2603,17 +1729,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.getAllStorageResourceNames();
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all storage resource names: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2628,27 +1746,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StorageResourceDescription domainStorage =
- storageResourceDescriptionMapper.toDomain(storageResourceDescription);
+ var domainStorage = storageResourceDescriptionMapper.toDomain(storageResourceDescription);
return airavataService.updateStorageResource(storageResourceId, domainStorage);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating storage resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2661,17 +1762,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteStorageResource(storageResourceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting storage resource: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2684,21 +1777,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StorageVolumeInfo domainInfo =
- airavataService.getResourceStorageInfo(domainAuthzToken, resourceId, location);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainInfo = airavataService.getResourceStorageInfo(domainAuthzToken, resourceId, location);
return storageVolumeInfoMapper.toThrift(domainInfo);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting resource storage info: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2711,21 +1794,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StorageDirectoryInfo domainInfo =
- airavataService.getStorageDirectoryInfo(domainAuthzToken, resourceId, location);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainInfo = airavataService.getStorageDirectoryInfo(domainAuthzToken, resourceId, location);
return storageDirectoryInfoMapper.toThrift(domainInfo);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting storage directory info: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2741,19 +1814,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.LOCALSubmission domainLocal =
- localSubmissionMapper.toDomain(localSubmission);
+ var domainLocal = localSubmissionMapper.toDomain(localSubmission);
return airavataService.addLocalSubmissionDetails(computeResourceId, priorityOrder, domainLocal);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding local submission details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2768,20 +1832,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.LOCALSubmission domainLocal =
- localSubmissionMapper.toDomain(localSubmission);
+ var domainLocal = localSubmissionMapper.toDomain(localSubmission);
airavataService.updateLocalSubmissionDetails(jobSubmissionInterfaceId, domainLocal);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating local submission details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2794,18 +1849,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.LOCALSubmission domainLocal =
- airavataService.getLocalJobSubmission(jobSubmissionId);
+ var domainLocal = airavataService.getLocalJobSubmission(jobSubmissionId);
return localSubmissionMapper.toThrift(domainLocal);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting local job submission: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2821,27 +1868,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.SSHJobSubmission domainSSH =
- sshJobSubmissionMapper.toDomain(sshJobSubmission);
+ var domainSSH = sshJobSubmissionMapper.toDomain(sshJobSubmission);
return airavataService.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, domainSSH);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding SSH job submission details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2857,27 +1887,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.SSHJobSubmission domainSSH =
- sshJobSubmissionMapper.toDomain(sshJobSubmission);
+ var domainSSH = sshJobSubmissionMapper.toDomain(sshJobSubmission);
return airavataService.addSSHForkJobSubmissionDetails(computeResourceId, priorityOrder, domainSSH);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding SSH fork job submission details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2890,19 +1903,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.SSHJobSubmission domainSSH =
- airavataService.getSSHJobSubmission(jobSubmissionId);
+ var domainSSH = airavataService.getSSHJobSubmission(jobSubmissionId);
return sshJobSubmissionMapper.toThrift(domainSSH);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting SSH job submission: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2918,27 +1922,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.CloudJobSubmission domainCloud =
- cloudJobSubmissionMapper.toDomain(cloudJobSubmission);
+ var domainCloud = cloudJobSubmissionMapper.toDomain(cloudJobSubmission);
return airavataService.addCloudJobSubmissionDetails(computeResourceId, priorityOrder, domainCloud);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding cloud job submission details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2951,19 +1938,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.CloudJobSubmission domainCloud =
- airavataService.getCloudJobSubmission(jobSubmissionId);
+ var domainCloud = airavataService.getCloudJobSubmission(jobSubmissionId);
return cloudJobSubmissionMapper.toThrift(domainCloud);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting cloud job submission: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -2979,19 +1957,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UnicoreJobSubmission domainUnicore =
- unicoreJobSubmissionMapper.toDomain(unicoreJobSubmission);
+ var domainUnicore = unicoreJobSubmissionMapper.toDomain(unicoreJobSubmission);
return airavataService.addUNICOREJobSubmissionDetails(computeResourceId, priorityOrder, domainUnicore);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding UNICORE job submission details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3004,19 +1973,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UnicoreJobSubmission domainUnicore =
- airavataService.getUnicoreJobSubmission(jobSubmissionId);
+ var domainUnicore = airavataService.getUnicoreJobSubmission(jobSubmissionId);
return unicoreJobSubmissionMapper.toThrift(domainUnicore);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting Unicore job submission: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3031,7 +1991,6 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
org.apache.airavata.common.model.SSHJobSubmission domainSSH =
sshJobSubmissionMapper.toDomain(sshJobSubmission);
return airavataService.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, domainSSH);
@@ -3066,7 +2025,6 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
org.apache.airavata.common.model.CloudJobSubmission domainCloud =
cloudJobSubmissionMapper.toDomain(cloudJobSubmission);
return airavataService.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, domainCloud);
@@ -3101,7 +2059,6 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
org.apache.airavata.common.model.UnicoreJobSubmission domainUnicore =
unicoreJobSubmissionMapper.toDomain(unicoreJobSubmission);
return airavataService.updateUnicoreJobSubmissionDetails(jobSubmissionInterfaceId, domainUnicore);
@@ -3136,19 +2093,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.LOCALDataMovement domainLocalDataMovement =
- localDataMovementMapper.toDomain(localDataMovement);
+ var domainLocalDataMovement = localDataMovementMapper.toDomain(localDataMovement);
airavataService.updateLocalDataMovementDetails(dataMovementInterfaceId, domainLocalDataMovement);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating local data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3163,26 +2112,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.SCPDataMovement domainSCP =
- scpDataMovementMapper.toDomain(scpDataMovement);
+ var domainSCP = scpDataMovementMapper.toDomain(scpDataMovement);
return airavataService.updateSCPDataMovementDetails(dataMovementInterfaceId, domainSCP);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating SCP data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3195,19 +2128,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.SCPDataMovement domainSCP =
- airavataService.getSCPDataMovement(dataMovementId);
+ var domainSCP = airavataService.getSCPDataMovement(dataMovementId);
return scpDataMovementMapper.toThrift(domainSCP);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting SCP data movement: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3224,22 +2148,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.DMType domainDMType =
- org.apache.airavata.common.model.DMType.valueOf(dmType.name());
- org.apache.airavata.common.model.UnicoreDataMovement domainUnicore =
- unicoreDataMovementMapper.toDomain(unicoreDataMovement);
+ var domainDMType = org.apache.airavata.common.model.DMType.valueOf(dmType.name());
+ var domainUnicore = unicoreDataMovementMapper.toDomain(unicoreDataMovement);
return airavataService.addUnicoreDataMovementDetails(
resourceId, domainDMType, priorityOrder, domainUnicore);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding Unicore data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3254,20 +2168,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UnicoreDataMovement domainUnicore =
- unicoreDataMovementMapper.toDomain(unicoreDataMovement);
+ var domainUnicore = unicoreDataMovementMapper.toDomain(unicoreDataMovement);
airavataService.updateUnicoreDataMovementDetails(dataMovementInterfaceId, domainUnicore);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating Unicore data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3280,18 +2185,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.LOCALDataMovement domainLocal =
- airavataService.getLocalDataMovement(dataMovementId);
+ var domainLocal = airavataService.getLocalDataMovement(dataMovementId);
return localDataMovementMapper.toThrift(domainLocal);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting local data movement: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3304,19 +2201,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UnicoreDataMovement domainUnicore =
- airavataService.getUnicoreDataMovement(dataMovementId);
+ var domainUnicore = airavataService.getUnicoreDataMovement(dataMovementId);
return unicoreDataMovementMapper.toThrift(domainUnicore);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting Unicore data movement: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3333,22 +2221,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.DMType domainDMType =
- org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
- org.apache.airavata.common.model.GridFTPDataMovement domainGridFTP =
- gridFTPDataMovementMapper.toDomain(gridFTPDataMovement);
+ var domainDMType = org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
+ var domainGridFTP = gridFTPDataMovementMapper.toDomain(gridFTPDataMovement);
return airavataService.addGridFTPDataMovementDetails(
productUri, domainDMType, priorityOrder, domainGridFTP);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding GridFTP data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3363,20 +2241,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GridFTPDataMovement domainGridFTP =
- gridFTPDataMovementMapper.toDomain(gridFTPDataMovement);
+ var domainGridFTP = gridFTPDataMovementMapper.toDomain(gridFTPDataMovement);
airavataService.updateGridFTPDataMovementDetails(dataMovementInterfaceId, domainGridFTP);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating GridFTP data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3389,18 +2258,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.GridFTPDataMovement domainGridFTP =
- airavataService.getGridFTPDataMovement(dataMovementId);
+ var domainGridFTP = airavataService.getGridFTPDataMovement(dataMovementId);
return gridFTPDataMovementMapper.toThrift(domainGridFTP);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting GridFTP data movement: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3463,19 +2324,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourceJobManager domainRJM =
- resourceJobManagerMapper.toDomain(resourceJobManager);
+ var domainRJM = resourceJobManagerMapper.toDomain(resourceJobManager);
return airavataService.registerResourceJobManager(domainRJM);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering resource job manager: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3490,26 +2342,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.ResourceJobManager domainRJM =
- resourceJobManagerMapper.toDomain(updatedResourceJobManager);
+ var domainRJM = resourceJobManagerMapper.toDomain(updatedResourceJobManager);
return airavataService.updateResourceJobManager(resourceJobManagerId, domainRJM);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating resource job manager: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3522,18 +2358,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.ResourceJobManager domainRJM =
- airavataService.getResourceJobManager(resourceJobManagerId);
+ var domainRJM = airavataService.getResourceJobManager(resourceJobManagerId);
return resourceJobManagerMapper.toThrift(domainRJM);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting resource job manager: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3546,17 +2374,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteResourceJobManager(resourceJobManagerId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting resource job manager: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3571,17 +2391,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteBatchQueue(computeResourceId, queueName);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting batch queue: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3595,19 +2407,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.GatewayResourceProfile domainProfile =
- gatewayResourceProfileMapper.toDomain(gatewayResourceProfile);
+ var domainProfile = gatewayResourceProfileMapper.toDomain(gatewayResourceProfile);
return airavataService.registerGatewayResourceProfile(domainProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering gateway resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3620,20 +2423,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.common.model.GatewayResourceProfile domainProfile =
- airavataService.getGatewayResourceProfile(gatewayID);
- // Convert domain model to thrift model
+ var domainProfile = airavataService.getGatewayResourceProfile(gatewayID);
return gatewayResourceProfileMapper.toThrift(domainProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting gateway resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3648,20 +2441,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.GatewayResourceProfile domainProfile =
- gatewayResourceProfileMapper.toDomain(gatewayResourceProfile);
+ var domainProfile = gatewayResourceProfileMapper.toDomain(gatewayResourceProfile);
airavataService.updateGatewayResourceProfile(gatewayID, domainProfile);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating gateway resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3674,17 +2458,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteGatewayResourceProfile(gatewayID);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting gateway resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3700,19 +2476,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.ComputeResourcePreference domainPreference =
- computeResourcePreferenceMapper.toDomain(computeResourcePreference);
+ var domainPreference = computeResourcePreferenceMapper.toDomain(computeResourcePreference);
airavataService.addGatewayComputeResourcePreference(gatewayID, computeResourceId, domainPreference);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding gateway compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3728,27 +2496,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StoragePreference domainPreference =
- storagePreferenceMapper.toDomain(dataStoragePreference);
+ var domainPreference = storagePreferenceMapper.toDomain(dataStoragePreference);
return airavataService.addGatewayStoragePreference(gatewayID, storageResourceId, domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding gateway storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3763,19 +2514,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ComputeResourcePreference domainPreference =
- airavataService.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
+ var domainPreference = airavataService.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
return computeResourcePreferenceMapper.toThrift(domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting gateway compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3788,18 +2530,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.StoragePreference domainPreference =
- airavataService.getGatewayStoragePreference(gatewayID, storageId);
+ var domainPreference = airavataService.getGatewayStoragePreference(gatewayID, storageId);
return storagePreferenceMapper.toThrift(domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting gateway storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3812,20 +2546,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.StoragePreference> domainPreferences =
- airavataService.getAllGatewayStoragePreferences(gatewayID);
+ var domainPreferences = airavataService.getAllGatewayStoragePreferences(gatewayID);
return domainPreferences.stream()
.map(storagePreferenceMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all gateway storage preferences: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3838,23 +2564,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Get domain models from service
- List<org.apache.airavata.common.model.GatewayResourceProfile> domainProfiles =
- airavataService.getAllGatewayResourceProfiles();
- // Convert domain models to thrift models
+ var domainProfiles = airavataService.getAllGatewayResourceProfiles();
return domainProfiles.stream()
.map(gatewayResourceProfileMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all gateway resource profiles: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3870,20 +2585,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ComputeResourcePreference domainPreference =
- computeResourcePreferenceMapper.toDomain(computeResourcePreference);
+ var domainPreference = computeResourcePreferenceMapper.toDomain(computeResourcePreference);
return airavataService.updateGatewayComputeResourcePreference(
gatewayID, computeResourceId, domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating gateway compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3899,27 +2605,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.StoragePreference domainPreference =
- storagePreferenceMapper.toDomain(dataStoragePreference);
+ var domainPreference = storagePreferenceMapper.toDomain(dataStoragePreference);
return airavataService.updateGatewayStoragePreference(gatewayID, storageId, domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating gateway storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3934,17 +2623,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting gateway compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3957,17 +2638,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteGatewayStoragePreference(gatewayID, storageId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting gateway storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -3979,38 +2652,37 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException,
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
-
- List<SSHAccountProvisionerDescription> domainProvisioners = new ArrayList<>();
- List<SSHAccountProvisionerProvider> sshAccountProvisionerProviders =
- SSHAccountProvisionerFactory.getSSHAccountProvisionerProviders();
- for (SSHAccountProvisionerProvider provider : sshAccountProvisionerProviders) {
- SSHAccountProvisionerDescription sshAccountProvisionerStruct = new SSHAccountProvisionerDescription();
- sshAccountProvisionerStruct.setCanCreateAccount(provider.canCreateAccount());
- sshAccountProvisionerStruct.setCanInstallSSHKey(provider.canInstallSSHKey());
- sshAccountProvisionerStruct.setName(provider.getName());
- List<SSHAccountProvisionerConfigParam> sshAccountProvisionerConfigParams = new ArrayList<>();
- for (ConfigParam configParam : provider.getConfigParams()) {
- SSHAccountProvisionerConfigParam sshAccountProvisionerConfigParam =
- new SSHAccountProvisionerConfigParam();
- sshAccountProvisionerConfigParam.setName(configParam.getName());
- sshAccountProvisionerConfigParam.setDescription(configParam.getDescription());
- sshAccountProvisionerConfigParam.setIsOptional(configParam.isOptional());
- switch (configParam.getType()) {
- case STRING:
- sshAccountProvisionerConfigParam.setType(SSHAccountProvisionerConfigParamType.STRING);
- break;
- case CRED_STORE_PASSWORD_TOKEN:
- sshAccountProvisionerConfigParam.setType(
- SSHAccountProvisionerConfigParamType.CRED_STORE_PASSWORD_TOKEN);
- break;
+ try {
+ var domainProvisioners = new ArrayList<SSHAccountProvisionerDescription>();
+ var sshAccountProvisionerProviders = SSHAccountProvisionerFactory.getSSHAccountProvisionerProviders();
+ for (var provider : sshAccountProvisionerProviders) {
+ var pr = new SSHAccountProvisionerDescription();
+ pr.setCanCreateAccount(provider.canCreateAccount());
+ pr.setCanInstallSSHKey(provider.canInstallSSHKey());
+ pr.setName(provider.getName());
+ var cp = new ArrayList<SSHAccountProvisionerConfigParam>();
+ for (var configParam : provider.getConfigParams()) {
+ var param = new SSHAccountProvisionerConfigParam();
+ param.setName(configParam.getName());
+ param.setDescription(configParam.getDescription());
+ param.setIsOptional(configParam.isOptional());
+ switch (configParam.getType()) {
+ case STRING:
+ param.setType(SSHAccountProvisionerConfigParamType.STRING);
+ break;
+ case CRED_STORE_PASSWORD_TOKEN:
+ param.setType(SSHAccountProvisionerConfigParamType.CRED_STORE_PASSWORD_TOKEN);
+ break;
+ }
+ cp.add(param);
}
- sshAccountProvisionerConfigParams.add(sshAccountProvisionerConfigParam);
+ pr.setConfigParams(cp);
+ domainProvisioners.add(pr);
}
- sshAccountProvisionerStruct.setConfigParams(sshAccountProvisionerConfigParams);
- domainProvisioners.add(sshAccountProvisionerStruct);
+ return domainProvisioners;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
- // domainProvisioners already contains Thrift objects, return directly
- return domainProvisioners;
}
@Override
@@ -4022,22 +2694,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.doesUserHaveSSHAccount(domainAuthzToken, computeResourceId, userId);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error checking if user has SSH account: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4052,18 +2712,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.isSSHAccountSetupComplete(
domainAuthzToken, computeResourceId, airavataCredStoreToken);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error checking SSH setup completion: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4079,24 +2732,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserComputeResourcePreference domainPreference =
- airavataService.setupSSHAccount(
- domainAuthzToken, computeResourceId, userId, airavataCredStoreToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPreference = airavataService.setupSSHAccount(
+ domainAuthzToken, computeResourceId, userId, airavataCredStoreToken);
return userComputeResourcePreferenceMapper.toThrift(domainPreference);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error setting up user compute resource preferences for SSH: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4109,19 +2750,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserResourceProfile domainProfile =
- userResourceProfileMapper.toDomain(userResourceProfile);
+ var domainProfile = userResourceProfileMapper.toDomain(userResourceProfile);
return airavataService.registerUserResourceProfile(domainProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering user resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4134,17 +2766,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.isUserResourceProfileExists(userId, gatewayID);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error checking if user resource profile exists: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4157,21 +2781,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Get domain model from service
- org.apache.airavata.common.model.UserResourceProfile domainProfile =
- airavataService.getUserResourceProfile(userId, gatewayID);
- // Convert domain model to thrift model
+ var domainProfile = airavataService.getUserResourceProfile(userId, gatewayID);
return userResourceProfileMapper.toThrift(domainProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting user resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4187,20 +2800,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- // Convert thrift model to domain model
- org.apache.airavata.common.model.UserResourceProfile domainProfile =
- userResourceProfileMapper.toDomain(userResourceProfile);
+ var domainProfile = userResourceProfileMapper.toDomain(userResourceProfile);
return airavataService.updateUserResourceProfile(userId, gatewayID, domainProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating user resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4213,17 +2816,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteUserResourceProfile(userId, gatewayID);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting user resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4240,28 +2835,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserComputeResourcePreference domainPreference =
- userComputeResourcePreferenceMapper.toDomain(userComputeResourcePreference);
+ var domainPreference = userComputeResourcePreferenceMapper.toDomain(userComputeResourcePreference);
return airavataService.addUserComputeResourcePreference(
userId, gatewayID, computeResourceId, domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding user compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4278,27 +2856,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserStoragePreference domainPreference =
- userStoragePreferenceMapper.toDomain(dataStoragePreference);
+ var domainPreference = userStoragePreferenceMapper.toDomain(dataStoragePreference);
return airavataService.addUserStoragePreference(userId, gatewayID, userStorageResourceId, domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding user storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4314,18 +2875,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.UserComputeResourcePreference domainPreference =
+ var domainPreference =
airavataService.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
return userComputeResourcePreferenceMapper.toThrift(domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting user compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4341,18 +2895,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.UserStoragePreference domainPreference =
- airavataService.getUserStoragePreference(userId, gatewayID, userStorageId);
+ var domainPreference = airavataService.getUserStoragePreference(userId, gatewayID, userStorageId);
return userStoragePreferenceMapper.toThrift(domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting user storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4365,20 +2911,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.UserComputeResourcePreference> domainPreferences =
- airavataService.getAllUserComputeResourcePreferences(userId, gatewayID);
+ var domainPreferences = airavataService.getAllUserComputeResourcePreferences(userId, gatewayID);
return domainPreferences.stream()
.map(userComputeResourcePreferenceMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all user compute resource preferences: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4391,20 +2929,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.UserStoragePreference> domainPreferences =
- airavataService.getAllUserStoragePreferences(userId, gatewayID);
+ var domainPreferences = airavataService.getAllUserStoragePreferences(userId, gatewayID);
return domainPreferences.stream()
.map(userStoragePreferenceMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all user storage preferences: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4417,20 +2947,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.UserResourceProfile> domainProfiles =
- airavataService.getAllUserResourceProfiles();
+ var domainProfiles = airavataService.getAllUserResourceProfiles();
return domainProfiles.stream()
.map(userResourceProfileMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all user resource profiles: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4447,21 +2969,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserComputeResourcePreference domainPreference =
- userComputeResourcePreferenceMapper.toDomain(userComputeResourcePreference);
+ var domainPreference = userComputeResourcePreferenceMapper.toDomain(userComputeResourcePreference);
airavataService.updateUserComputeResourcePreference(
userId, gatewayID, userComputeResourceId, domainPreference);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating user compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4478,27 +2991,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserStoragePreference domainPreference =
- userStoragePreferenceMapper.toDomain(dataStoragePreference);
+ var domainPreference = userStoragePreferenceMapper.toDomain(dataStoragePreference);
return airavataService.updateUserStoragePreference(userId, gatewayID, userStorageId, domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating user storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4514,17 +3010,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting user compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4540,17 +3028,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteUserStoragePreference(userId, gatewayID, userStorageId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting user storage preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4563,19 +3043,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
var domainStatuses = airavataService.getLatestQueueStatuses();
- // Convert domain models to thrift models
return domainStatuses.stream().map(queueStatusModelMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting latest queue statuses: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4587,20 +3058,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException,
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.DataProductModel domainDataProduct =
- dataProductModelMapper.toDomain(dataProductModel);
try {
+ var domainDataProduct = dataProductModelMapper.toDomain(dataProductModel);
return airavataService.registerDataProduct(domainDataProduct);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering data product: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4613,20 +3075,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.common.model.DataProductModel domainDataProduct =
- airavataService.getDataProduct(productUri);
- // Convert domain model to thrift model
+ var domainDataProduct = airavataService.getDataProduct(productUri);
return dataProductModelMapper.toThrift(domainDataProduct);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting data product: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4640,19 +3092,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Convert thrift model to domain model
- org.apache.airavata.common.model.DataReplicaLocationModel domainReplica =
- dataReplicaLocationModelMapper.toDomain(replicaLocationModel);
+ var domainReplica = dataReplicaLocationModelMapper.toDomain(replicaLocationModel);
return airavataService.registerReplicaLocation(domainReplica);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error registering replica location: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4665,20 +3108,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain model from service
- org.apache.airavata.common.model.DataProductModel domainDataProduct =
- airavataService.getParentDataProduct(productUri);
- // Convert domain model to thrift model
+ var domainDataProduct = airavataService.getParentDataProduct(productUri);
return dataProductModelMapper.toThrift(domainDataProduct);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting parent data product: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4691,21 +3124,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- // Get domain models from service
var domainDataProducts = airavataService.getChildDataProducts(productUri);
- // Convert domain models to thrift models
return domainDataProducts.stream()
.map(dataProductModelMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting child data products: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4720,27 +3144,15 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- Map<String, org.apache.airavata.common.model.ResourcePermissionType> domainUserPermissionList =
- new java.util.HashMap<>();
- for (Map.Entry<String, ResourcePermissionType> entry : userPermissionList.entrySet()) {
- domainUserPermissionList.put(
- entry.getKey(),
- org.apache.airavata.common.model.ResourcePermissionType.valueOf(
- entry.getValue().name()));
- }
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainUserPermissionList = userPermissionList.entrySet().stream()
+ .collect(Collectors.toMap(
+ Map.Entry::getKey,
+ entry -> org.apache.airavata.common.model.ResourcePermissionType.valueOf(
+ entry.getValue().name())));
return airavataService.shareResourceWithUsers(domainAuthzToken, resourceId, domainUserPermissionList);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error sharing resource with users: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4755,27 +3167,15 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- Map<String, org.apache.airavata.common.model.ResourcePermissionType> domainGroupPermissionList =
- new java.util.HashMap<>();
- for (Map.Entry<String, ResourcePermissionType> entry : groupPermissionList.entrySet()) {
- domainGroupPermissionList.put(
- entry.getKey(),
- org.apache.airavata.common.model.ResourcePermissionType.valueOf(
- entry.getValue().name()));
- }
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroupPermissionList = groupPermissionList.entrySet().stream()
+ .collect(Collectors.toMap(
+ Map.Entry::getKey,
+ entry -> org.apache.airavata.common.model.ResourcePermissionType.valueOf(
+ entry.getValue().name())));
return airavataService.shareResourceWithGroups(domainAuthzToken, resourceId, domainGroupPermissionList);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error sharing resource with groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4790,28 +3190,16 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- Map<String, org.apache.airavata.common.model.ResourcePermissionType> domainUserPermissionList =
- new java.util.HashMap<>();
- for (Map.Entry<String, ResourcePermissionType> entry : userPermissionList.entrySet()) {
- domainUserPermissionList.put(
- entry.getKey(),
- org.apache.airavata.common.model.ResourcePermissionType.valueOf(
- entry.getValue().name()));
- }
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainUserPermissionList = userPermissionList.entrySet().stream()
+ .collect(Collectors.toMap(
+ Map.Entry::getKey,
+ entry -> org.apache.airavata.common.model.ResourcePermissionType.valueOf(
+ entry.getValue().name())));
return airavataService.revokeSharingOfResourceFromUsers(
domainAuthzToken, resourceId, domainUserPermissionList);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error revoking sharing of resource from users: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4826,28 +3214,16 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- Map<String, org.apache.airavata.common.model.ResourcePermissionType> domainGroupPermissionList =
- new java.util.HashMap<>();
- for (Map.Entry<String, ResourcePermissionType> entry : groupPermissionList.entrySet()) {
- domainGroupPermissionList.put(
- entry.getKey(),
- org.apache.airavata.common.model.ResourcePermissionType.valueOf(
- entry.getValue().name()));
- }
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroupPermissionList = groupPermissionList.entrySet().stream()
+ .collect(Collectors.toMap(
+ Map.Entry::getKey,
+ entry -> org.apache.airavata.common.model.ResourcePermissionType.valueOf(
+ entry.getValue().name())));
return airavataService.revokeSharingOfResourceFromGroups(
domainAuthzToken, resourceId, domainGroupPermissionList);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error revoking sharing of resource from groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4862,19 +3238,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourcePermissionType domainPermissionType =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPermissionType =
org.apache.airavata.common.model.ResourcePermissionType.valueOf(permissionType.name());
return airavataService.getAllAccessibleUsers(domainAuthzToken, resourceId, domainPermissionType, false);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all accessible users: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4889,19 +3258,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourcePermissionType domainPermissionType =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPermissionType =
org.apache.airavata.common.model.ResourcePermissionType.valueOf(permissionType.name());
return airavataService.getAllAccessibleUsers(domainAuthzToken, resourceId, domainPermissionType, true);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all directly accessible users: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4916,19 +3278,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourcePermissionType domainPermissionType =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPermissionType =
org.apache.airavata.common.model.ResourcePermissionType.valueOf(permissionType.name());
return airavataService.getAllAccessibleGroups(domainAuthzToken, resourceId, domainPermissionType, false);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all accessible groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4943,19 +3298,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourcePermissionType domainPermissionType =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPermissionType =
org.apache.airavata.common.model.ResourcePermissionType.valueOf(permissionType.name());
return airavataService.getAllAccessibleGroups(domainAuthzToken, resourceId, domainPermissionType, true);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all directly accessible groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4970,19 +3318,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ResourcePermissionType domainPermissionType =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPermissionType =
org.apache.airavata.common.model.ResourcePermissionType.valueOf(permissionType.name());
return airavataService.userHasAccess(domainAuthzToken, resourceId, domainPermissionType);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error checking user access: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -4996,19 +3337,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupResourceProfile domainGroupResourceProfile =
- groupResourceProfileMapper.toDomain(groupResourceProfile);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroupResourceProfile = groupResourceProfileMapper.toDomain(groupResourceProfile);
return airavataService.createGroupResourceProfile(domainAuthzToken, domainGroupResourceProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error creating group resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5022,19 +3355,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupResourceProfile domainGroupResourceProfile =
- groupResourceProfileMapper.toDomain(groupResourceProfile);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroupResourceProfile = groupResourceProfileMapper.toDomain(groupResourceProfile);
airavataService.updateGroupResourceProfile(domainAuthzToken, domainGroupResourceProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating group resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5047,19 +3372,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupResourceProfile domainProfile =
- airavataService.getGroupResourceProfile(domainAuthzToken, groupResourceProfileId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProfile = airavataService.getGroupResourceProfile(domainAuthzToken, groupResourceProfileId);
return groupResourceProfileMapper.toThrift(domainProfile);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5072,19 +3389,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.removeGroupResourceProfile(domainAuthzToken, groupResourceProfileId);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error removing group resource profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5097,21 +3405,13 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.GroupResourceProfile> domainProfiles =
- airavataService.getGroupResourceList(domainAuthzToken, gatewayId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProfiles = airavataService.getGroupResourceList(domainAuthzToken, gatewayId);
return domainProfiles.stream()
.map(groupResourceProfileMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group resource list: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5126,19 +3426,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.removeGroupComputePrefs(domainAuthzToken, computeResourceId, groupResourceProfileId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error removing group compute preferences: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5151,19 +3442,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.removeGroupComputeResourcePolicy(domainAuthzToken, resourcePolicyId);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error removing group compute resource policy: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5176,19 +3458,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.removeGroupBatchQueueResourcePolicy(domainAuthzToken, resourcePolicyId);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error removing group batch queue resource policy: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5201,21 +3474,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ComputeResourcePolicy domainPolicy =
- airavataService.getGroupComputeResourcePolicy(domainAuthzToken, resourcePolicyId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPolicy = airavataService.getGroupComputeResourcePolicy(domainAuthzToken, resourcePolicyId);
return computeResourcePolicyMapper.toThrift(domainPolicy);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group compute resource policy: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5228,21 +3491,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.BatchQueueResourcePolicy domainPolicy =
- airavataService.getBatchQueueResourcePolicy(domainAuthzToken, resourcePolicyId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPolicy = airavataService.getBatchQueueResourcePolicy(domainAuthzToken, resourcePolicyId);
return batchQueueResourcePolicyMapper.toThrift(domainPolicy);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting batch queue resource policy: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5255,23 +3508,13 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.GroupComputeResourcePreference> domainPrefs =
- airavataService.getGroupComputeResourcePrefList(domainAuthzToken, groupResourceProfileId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPrefs = airavataService.getGroupComputeResourcePrefList(domainAuthzToken, groupResourceProfileId);
return domainPrefs.stream()
.map(groupComputeResourcePreferenceMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group compute resource preference list: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5284,23 +3527,14 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.BatchQueueResourcePolicy> domainPolicies =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPolicies =
airavataService.getGroupBatchQueueResourcePolicyList(domainAuthzToken, groupResourceProfileId);
return domainPolicies.stream()
.map(batchQueueResourcePolicyMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group batch queue resource policy list: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5313,23 +3547,14 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.ComputeResourcePolicy> domainPolicies =
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainPolicies =
airavataService.getGroupComputeResourcePolicyList(domainAuthzToken, groupResourceProfileId);
return domainPolicies.stream()
.map(computeResourcePolicyMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group compute resource policy list: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5341,19 +3566,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
String gatewayId = domainAuthzToken.getClaimsMap().get(Constants.GATEWAY_ID);
- org.apache.airavata.common.model.GatewayGroups domainGroups = airavataService.getGatewayGroups(gatewayId);
+ var domainGroups = airavataService.getGatewayGroups(gatewayId);
return gatewayGroupsMapper.toThrift(domainGroups);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting gateway groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5366,17 +3584,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.Parser domainParser = airavataService.getParser(parserId, gatewayId);
+ var domainParser = airavataService.getParser(parserId, gatewayId);
return parserMapper.toThrift(domainParser);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting parser: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5390,18 +3601,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.Parser domainParser = parserMapper.toDomain(parser);
+ var domainParser = parserMapper.toDomain(parser);
return airavataService.saveParser(domainParser);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error saving parser: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5414,17 +3617,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.Parser> domainParsers = airavataService.listAllParsers(gatewayId);
+ var domainParsers = airavataService.listAllParsers(gatewayId);
return domainParsers.stream().map(parserMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error listing parsers: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5439,15 +3635,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
try {
airavataService.removeParser(parserId, gatewayId);
return true;
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error removing parser: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5460,18 +3649,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.common.model.ParsingTemplate domainTemplate =
- airavataService.getParsingTemplate(templateId, gatewayId);
+ var domainTemplate = airavataService.getParsingTemplate(templateId, gatewayId);
return parsingTemplateMapper.toThrift(domainTemplate);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting parsing template: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5484,18 +3665,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.ParsingTemplate> domainTemplates =
- airavataService.getParsingTemplatesForExperiment(experimentId, gatewayId);
+ var domainTemplates = airavataService.getParsingTemplatesForExperiment(experimentId, gatewayId);
return domainTemplates.stream().map(parsingTemplateMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting parsing templates for experiment: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5509,27 +3682,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ParsingTemplate domainTemplate =
- parsingTemplateMapper.toDomain(parsingTemplate);
+ var domainTemplate = parsingTemplateMapper.toDomain(parsingTemplate);
return airavataService.saveParsingTemplate(domainTemplate);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- throw thriftException;
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error saving parsing template: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5543,15 +3699,8 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
airavataService.removeParsingTemplate(templateId, gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error removing parsing template: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
return true;
}
@@ -5565,18 +3714,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- List<org.apache.airavata.common.model.ParsingTemplate> domainTemplates =
- airavataService.listAllParsingTemplates(gatewayId);
+ var domainTemplates = airavataService.listAllParsingTemplates(gatewayId);
return domainTemplates.stream().map(parsingTemplateMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error listing parsing templates: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5594,24 +3735,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataClientException, AiravataSystemException,
AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ProcessStatus domainStatus =
- airavataService.getIntermediateOutputProcessStatus(
- domainAuthzToken, airavataExperimentId, outputNames);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainStatus = airavataService.getIntermediateOutputProcessStatus(
+ domainAuthzToken, airavataExperimentId, outputNames);
return processStatusMapper.toThrift(domainStatus);
- } catch (org.apache.airavata.common.exception.InvalidRequestException e) {
- throw convertToThriftInvalidRequestException(e);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting intermediate output process status: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5623,19 +3752,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.model.ComputationalResourceSchedulingModel resourceScheduling)
throws AuthorizationException, TException {
try {
- if (false) throw new org.apache.airavata.thriftapi.exception.AuthorizationException();
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.ComputationalResourceSchedulingModel domainScheduling =
- computationalResourceSchedulingModelMapper.toDomain(resourceScheduling);
+ var domainScheduling = computationalResourceSchedulingModelMapper.toDomain(resourceScheduling);
airavataService.updateResourceScheduleing(airavataExperimentId, domainScheduling);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error updating resource scheduling: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5648,21 +3768,12 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.ComputeResourcePreference> domainPreferences =
- airavataService.getAllGatewayComputeResourcePreferences(gatewayID);
+ var domainPreferences = airavataService.getAllGatewayComputeResourcePreferences(gatewayID);
return domainPreferences.stream()
.map(computeResourcePreferenceMapper::toThrift)
.collect(Collectors.toList());
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting all gateway compute resource preferences: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5677,19 +3788,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupComputeResourcePreference domainPreference =
+ var domainPreference =
airavataService.getGroupComputeResourcePreference(groupResourceProfileId, computeResourceId);
return groupComputeResourcePreferenceMapper.toThrift(domainPreference);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error getting group compute resource preference: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5704,17 +3807,9 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return airavataService.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting job submission interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5731,21 +3826,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.DMType domainDMType =
- org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
- org.apache.airavata.common.model.LOCALDataMovement domainLocal =
- localDataMovementMapper.toDomain(localDataMovement);
+ var domainDMType = org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
+ var domainLocal = localDataMovementMapper.toDomain(localDataMovement);
return airavataService.addLocalDataMovementDetails(productUri, domainDMType, priorityOrder, domainLocal);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding local data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5761,19 +3846,10 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.DMType domainDMType =
- org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
+ var domainDMType = org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
return airavataService.deleteDataMovementInterface(productUri, dataMovementInterfaceId, domainDMType);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException ex =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error deleting data movement interface: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -5790,20 +3866,11 @@ public class AiravataServiceHandler implements org.apache.airavata.thriftapi.ser
org.apache.airavata.thriftapi.exception.AiravataSystemException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.DMType domainDMType =
- org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
- org.apache.airavata.common.model.SCPDataMovement domainSCP =
- scpDataMovementMapper.toDomain(scpDataMovement);
+ var domainDMType = org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
+ var domainSCP = scpDataMovementMapper.toDomain(scpDataMovement);
return airavataService.addSCPDataMovementDetails(productUri, domainDMType, priorityOrder, domainSCP);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftSystemException(e);
- } catch (Exception e) {
- var ex = new AiravataSystemException();
- ex.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- ex.setMessage("Error adding SCP data movement details: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/CredentialServiceHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/CredentialServiceHandler.java
index bdbaf68f5e..2d47522fbb 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/CredentialServiceHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/CredentialServiceHandler.java
@@ -21,11 +21,11 @@ package org.apache.airavata.thriftapi.handler;
import java.util.List;
import java.util.stream.Collectors;
-import org.apache.airavata.credential.model.CertificateCredential;
-import org.apache.airavata.credential.model.CredentialSummary;
-import org.apache.airavata.credential.model.SSHCredential;
-import org.apache.airavata.credential.model.SummaryType;
import org.apache.airavata.service.security.CredentialStoreService;
+import org.apache.airavata.thriftapi.mapper.CertificateCredentialMapper;
+import org.apache.airavata.thriftapi.mapper.CredentialSummaryMapper;
+import org.apache.airavata.thriftapi.mapper.PasswordCredentialMapper;
+import org.apache.airavata.thriftapi.mapper.SSHCredentialMapper;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -37,6 +37,10 @@ public class CredentialServiceHandler
protected static Logger log = LoggerFactory.getLogger(CredentialServiceHandler.class);
private final CredentialStoreService credentialStoreService;
+ private final SSHCredentialMapper sshCredentialMapper = SSHCredentialMapper.INSTANCE;
+ private final CertificateCredentialMapper certificateCredentialMapper = CertificateCredentialMapper.INSTANCE;
+ private final PasswordCredentialMapper passwordCredentialMapper = PasswordCredentialMapper.INSTANCE;
+ private final CredentialSummaryMapper credentialSummaryMapper = CredentialSummaryMapper.INSTANCE;
public CredentialServiceHandler(CredentialStoreService credentialStoreService) {
this.credentialStoreService = credentialStoreService;
@@ -47,12 +51,32 @@ public class CredentialServiceHandler
return org.apache.airavata.thriftapi.credential.model.credential_store_cpiConstants.CS_CPI_VERSION;
}
- private org.apache.airavata.thriftapi.credential.exception.CredentialStoreException wrapException(
- org.apache.airavata.credential.exception.CredentialStoreException e) {
- org.apache.airavata.thriftapi.credential.exception.CredentialStoreException thriftException =
- new org.apache.airavata.thriftapi.credential.exception.CredentialStoreException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
+ private org.apache.thrift.TException wrapException(Throwable e) {
+ if (e instanceof org.apache.thrift.TException te) return te;
+ org.apache.thrift.TException thriftException = null;
+ if (e instanceof org.apache.airavata.credential.exception.CredentialStoreException) {
+ var ex = new org.apache.airavata.thriftapi.credential.exception.CredentialStoreException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.AiravataSystemException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ }
+ if (thriftException == null) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
+ if (e != null) {
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ }
+ thriftException = ex;
+ }
return thriftException;
}
@@ -60,10 +84,9 @@ public class CredentialServiceHandler
public String addSSHCredential(org.apache.airavata.thriftapi.credential.model.SSHCredential sshCredential)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- // Convert thrift to domain
- SSHCredential domainCredential = convertToDomainSSH(sshCredential);
+ var domainCredential = sshCredentialMapper.toDomain(sshCredential);
return credentialStoreService.addSSHCredential(domainCredential);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -73,10 +96,9 @@ public class CredentialServiceHandler
org.apache.airavata.thriftapi.credential.model.CertificateCredential certificateCredential)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- // Convert thrift to domain
- CertificateCredential domainCredential = convertToDomainCertificate(certificateCredential);
+ var domainCredential = certificateCredentialMapper.toDomain(certificateCredential);
return credentialStoreService.addCertificateCredential(domainCredential);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -86,11 +108,9 @@ public class CredentialServiceHandler
org.apache.airavata.thriftapi.credential.model.PasswordCredential passwordCredential)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- // Convert thrift to domain
- org.apache.airavata.credential.model.PasswordCredential domainCredential =
- convertToDomainPassword(passwordCredential);
+ var domainCredential = passwordCredentialMapper.toDomain(passwordCredential);
return credentialStoreService.addPasswordCredential(domainCredential);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -100,9 +120,9 @@ public class CredentialServiceHandler
String tokenId, String gatewayId)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- SSHCredential domainCredential = credentialStoreService.getSSHCredential(tokenId, gatewayId);
- return convertToThriftSSH(domainCredential);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ var domainCredential = credentialStoreService.getSSHCredential(tokenId, gatewayId);
+ return sshCredentialMapper.toThrift(domainCredential);
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -112,10 +132,9 @@ public class CredentialServiceHandler
String tokenId, String gatewayId)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- org.apache.airavata.credential.model.CredentialSummary domainSummary =
- credentialStoreService.getCredentialSummary(tokenId, gatewayId);
- return convertToThriftSummary(domainSummary);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ var domainSummary = credentialStoreService.getCredentialSummary(tokenId, gatewayId);
+ return credentialSummaryMapper.toThrift(domainSummary);
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -127,11 +146,13 @@ public class CredentialServiceHandler
String gatewayId)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- SummaryType domainType = SummaryType.valueOf(type.name());
- List<CredentialSummary> domainSummaries =
+ var domainType = org.apache.airavata.credential.model.SummaryType.valueOf(type.name());
+ var domainSummaries =
credentialStoreService.getAllCredentialSummaries(domainType, accessibleTokenIds, gatewayId);
- return domainSummaries.stream().map(this::convertToThriftSummary).collect(Collectors.toList());
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ return domainSummaries.stream()
+ .map(credentialSummaryMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -141,10 +162,9 @@ public class CredentialServiceHandler
String tokenId, String gatewayId)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- CertificateCredential domainCredential =
- credentialStoreService.getCertificateCredential(tokenId, gatewayId);
- return convertToThriftCertificate(domainCredential);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ var domainCredential = credentialStoreService.getCertificateCredential(tokenId, gatewayId);
+ return certificateCredentialMapper.toThrift(domainCredential);
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -154,10 +174,9 @@ public class CredentialServiceHandler
String tokenId, String gatewayId)
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
- org.apache.airavata.credential.model.PasswordCredential domainCredential =
- credentialStoreService.getPasswordCredential(tokenId, gatewayId);
- return convertToThriftPassword(domainCredential);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ var domainCredential = credentialStoreService.getPasswordCredential(tokenId, gatewayId);
+ return passwordCredentialMapper.toThrift(domainCredential);
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -167,7 +186,7 @@ public class CredentialServiceHandler
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
return credentialStoreService.deleteSSHCredential(tokenId, gatewayId);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ } catch (Throwable e) {
throw wrapException(e);
}
}
@@ -177,108 +196,8 @@ public class CredentialServiceHandler
throws org.apache.airavata.thriftapi.credential.exception.CredentialStoreException, TException {
try {
return credentialStoreService.deletePWDCredential(tokenId, gatewayId);
- } catch (org.apache.airavata.credential.exception.CredentialStoreException e) {
+ } catch (Throwable e) {
throw wrapException(e);
}
}
-
- // Helper methods to convert between domain and thrift models
- private org.apache.airavata.credential.model.SSHCredential convertToDomainSSH(
- org.apache.airavata.thriftapi.credential.model.SSHCredential thrift) {
- org.apache.airavata.credential.model.SSHCredential domain =
- new org.apache.airavata.credential.model.SSHCredential();
- domain.setToken(thrift.getToken());
- domain.setPublicKey(thrift.getPublicKey());
- domain.setPrivateKey(thrift.getPrivateKey());
- domain.setPassphrase(thrift.getPassphrase());
- domain.setGatewayId(thrift.getGatewayId());
- domain.setUsername(thrift.getUsername());
- domain.setDescription(thrift.getDescription());
- domain.setPersistedTime(thrift.getPersistedTime());
- return domain;
- }
-
- private org.apache.airavata.thriftapi.credential.model.SSHCredential convertToThriftSSH(
- org.apache.airavata.credential.model.SSHCredential domain) {
- org.apache.airavata.thriftapi.credential.model.SSHCredential thrift =
- new org.apache.airavata.thriftapi.credential.model.SSHCredential();
- thrift.setToken(domain.getToken());
- thrift.setPublicKey(domain.getPublicKey());
- thrift.setPrivateKey(domain.getPrivateKey());
- thrift.setPassphrase(domain.getPassphrase());
- thrift.setGatewayId(domain.getGatewayId());
- thrift.setUsername(domain.getUsername());
- thrift.setDescription(domain.getDescription());
- thrift.setPersistedTime(domain.getPersistedTime());
- return thrift;
- }
-
- private org.apache.airavata.credential.model.CertificateCredential convertToDomainCertificate(
- org.apache.airavata.thriftapi.credential.model.CertificateCredential thrift) {
- org.apache.airavata.credential.model.CertificateCredential domain =
- new org.apache.airavata.credential.model.CertificateCredential();
- domain.setToken(thrift.getToken());
- domain.setX509Cert(thrift.getX509Cert());
- domain.setPrivateKey(thrift.getPrivateKey());
- domain.setGatewayId(thrift.getGatewayId());
- return domain;
- }
-
- private org.apache.airavata.thriftapi.credential.model.CertificateCredential convertToThriftCertificate(
- org.apache.airavata.credential.model.CertificateCredential domain) {
- org.apache.airavata.thriftapi.credential.model.CertificateCredential thrift =
- new org.apache.airavata.thriftapi.credential.model.CertificateCredential();
- thrift.setToken(domain.getToken());
- thrift.setX509Cert(domain.getX509Cert());
- thrift.setGatewayId(domain.getGatewayId());
- thrift.setUserName(domain.getUserName());
- thrift.setDescription(domain.getDescription());
- thrift.setPersistedTime(domain.getPersistedTime());
- return thrift;
- }
-
- private org.apache.airavata.credential.model.PasswordCredential convertToDomainPassword(
- org.apache.airavata.thriftapi.credential.model.PasswordCredential thrift) {
- org.apache.airavata.credential.model.PasswordCredential domain =
- new org.apache.airavata.credential.model.PasswordCredential();
- domain.setToken(thrift.getToken());
- domain.setLoginUserName(thrift.getLoginUserName());
- domain.setPortalUserName(thrift.getPortalUserName());
- domain.setPassword(thrift.getPassword());
- domain.setGatewayId(thrift.getGatewayId());
- domain.setDescription(thrift.getDescription());
- domain.setPersistedTime(thrift.getPersistedTime());
- return domain;
- }
-
- private org.apache.airavata.thriftapi.credential.model.PasswordCredential convertToThriftPassword(
- org.apache.airavata.credential.model.PasswordCredential domain) {
- org.apache.airavata.thriftapi.credential.model.PasswordCredential thrift =
- new org.apache.airavata.thriftapi.credential.model.PasswordCredential();
- thrift.setToken(domain.getToken());
- thrift.setLoginUserName(domain.getLoginUserName());
- thrift.setPortalUserName(domain.getPortalUserName());
- thrift.setPassword(domain.getPassword());
- thrift.setGatewayId(domain.getGatewayId());
- thrift.setDescription(domain.getDescription());
- thrift.setPersistedTime(domain.getPersistedTime());
- return thrift;
- }
-
- private org.apache.airavata.thriftapi.credential.model.CredentialSummary convertToThriftSummary(
- org.apache.airavata.credential.model.CredentialSummary domain) {
- org.apache.airavata.thriftapi.credential.model.CredentialSummary thrift =
- new org.apache.airavata.thriftapi.credential.model.CredentialSummary();
- thrift.setToken(domain.getToken());
- thrift.setUsername(domain.getUsername());
- thrift.setPublicKey(domain.getPublicKey());
- thrift.setGatewayId(domain.getGatewayId());
- thrift.setDescription(domain.getDescription());
- thrift.setPersistedTime(domain.getPersistedTime());
- if (domain.getType() != null) {
- thrift.setType(org.apache.airavata.thriftapi.credential.model.SummaryType.valueOf(
- domain.getType().name()));
- }
- return thrift;
- }
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/GroupManagerServiceHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/GroupManagerServiceHandler.java
index 2ee695003a..4a4c38edd4 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/GroupManagerServiceHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/GroupManagerServiceHandler.java
@@ -23,7 +23,6 @@ import java.util.List;
import java.util.stream.Collectors;
import org.apache.airavata.security.interceptor.SecurityCheck;
import org.apache.airavata.service.security.GroupManagerService;
-import org.apache.airavata.sharing.model.SharingRegistryException;
import org.apache.airavata.thriftapi.mapper.AuthzTokenMapper;
import org.apache.airavata.thriftapi.mapper.GroupModelMapper;
import org.apache.thrift.TException;
@@ -50,6 +49,36 @@ public class GroupManagerServiceHandler
return org.apache.airavata.thriftapi.profile.model.group_manager_cpiConstants.GROUP_MANAGER_CPI_VERSION;
}
+ private org.apache.thrift.TException wrapException(Throwable e) {
+ if (e instanceof org.apache.thrift.TException te) return te;
+ org.apache.thrift.TException thriftException = null;
+
+ if (e instanceof org.apache.airavata.profile.exception.GroupManagerServiceException) {
+ var ex = new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException();
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.sharing.model.SharingRegistryException) {
+ var ex = new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException();
+ ex.setMessage("Error from Sharing Registry: " + e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.AuthorizationException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AuthorizationException();
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ }
+
+ if (thriftException == null) {
+ var ex = new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException();
+ ex.setMessage("Internal Error: " + e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ }
+ return thriftException;
+ }
+
@Override
@SecurityCheck
public String createGroup(
@@ -58,25 +87,11 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupModel domainGroup = groupModelMapper.toDomain(groupModel);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroup = groupModelMapper.toDomain(groupModel);
return groupManagerService.createGroup(domainAuthzToken, domainGroup);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error creating group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error creating group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -88,25 +103,11 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupModel domainGroup = groupModelMapper.toDomain(groupModel);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroup = groupModelMapper.toDomain(groupModel);
return groupManagerService.updateGroup(domainAuthzToken, domainGroup);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error updating group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error updating group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -117,24 +118,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.deleteGroup(domainAuthzToken, groupId, ownerId);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error deleting group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error deleting group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -145,26 +132,11 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.GroupModel domainGroup =
- groupManagerService.getGroup(domainAuthzToken, groupId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroup = groupManagerService.getGroup(domainAuthzToken, groupId);
return groupModelMapper.toThrift(domainGroup);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error getting group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error getting group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -175,26 +147,11 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.GroupModel> domainGroups =
- groupManagerService.getGroups(domainAuthzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroups = groupManagerService.getGroups(domainAuthzToken);
return domainGroups.stream().map(groupModelMapper::toThrift).collect(Collectors.toList());
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error getting groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error getting groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -205,26 +162,11 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.GroupModel> domainGroups =
- groupManagerService.getAllGroupsUserBelongs(domainAuthzToken, userName);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGroups = groupManagerService.getAllGroupsUserBelongs(domainAuthzToken, userName);
return domainGroups.stream().map(groupModelMapper::toThrift).collect(Collectors.toList());
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error getting user groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error getting user groups: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -234,24 +176,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.addUsersToGroup(domainAuthzToken, userIds, groupId);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error adding users to group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error adding users to group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -261,24 +189,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.removeUsersFromGroup(domainAuthzToken, userIds, groupId);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error removing users from group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error removing users from group: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -289,24 +203,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.transferGroupOwnership(domainAuthzToken, groupId, newOwnerId);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error transferring group ownership: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error transferring group ownership: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -317,24 +217,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.addGroupAdmins(domainAuthzToken, groupId, adminIds);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error adding group admins: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error adding group admins: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -345,24 +231,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.removeGroupAdmins(domainAuthzToken, groupId, adminIds);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error removing group admins: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error removing group admins: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -373,24 +245,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.hasAdminAccess(domainAuthzToken, groupId, adminId);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error checking admin access: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error checking admin access: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -401,44 +259,10 @@ public class GroupManagerServiceHandler
throws org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return groupManagerService.hasOwnerAccess(domainAuthzToken, groupId, ownerId);
- } catch (SharingRegistryException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error checking owner access: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- throw convertToThriftGroupManagerServiceException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException ex =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException(
- "Error checking owner access: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
-
- // Helper methods for exception conversion
- private org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException
- convertToThriftGroupManagerServiceException(
- org.apache.airavata.profile.exception.GroupManagerServiceException e) {
- org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException thriftException =
- new org.apache.airavata.thriftapi.profile.exception.GroupManagerServiceException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.AuthorizationException convertToThriftAuthorizationException(
- org.apache.airavata.common.exception.AuthorizationException e) {
- org.apache.airavata.thriftapi.exception.AuthorizationException thriftException =
- new org.apache.airavata.thriftapi.exception.AuthorizationException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/IamAdminServiceHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/IamAdminServiceHandler.java
index 70a16336cb..b887da2fe8 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/IamAdminServiceHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/IamAdminServiceHandler.java
@@ -56,6 +56,36 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
.IAM_ADMIN_SERVICES_CPI_VERSION;
}
+ private org.apache.thrift.TException wrapException(Throwable e) {
+ if (e instanceof org.apache.thrift.TException te) return te;
+ org.apache.thrift.TException thriftException = null;
+
+ if (e instanceof org.apache.airavata.profile.exception.IamAdminServicesException) {
+ var ex = new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException();
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.credential.exception.CredentialStoreException) {
+ var ex = new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException();
+ ex.setMessage("Credential Store Error: " + e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.common.exception.AuthorizationException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AuthorizationException();
+ ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ }
+
+ if (thriftException == null) {
+ var ex = new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException();
+ ex.setMessage("Internal Error: " + e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ }
+ return thriftException;
+ }
+
@Override
@SecurityCheck
public org.apache.airavata.thriftapi.model.Gateway setUpGateway(
@@ -64,27 +94,12 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.Gateway domainGateway = gatewayMapper.toDomain(gateway);
- org.apache.airavata.common.model.Gateway result =
- iamAdminService.setUpGateway(domainAuthzToken, domainGateway);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainGateway = gatewayMapper.toDomain(gateway);
+ var result = iamAdminService.setUpGateway(domainAuthzToken, domainGateway);
return gatewayMapper.toThrift(result);
- } catch (org.apache.airavata.common.exception.CredentialStoreException e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error setting up gateway: " + e.getMessage());
- ex.initCause(e);
- throw ex;
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error setting up gateway: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -95,18 +110,10 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.isUsernameAvailable(domainAuthzToken, username);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error checking username availability: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -122,19 +129,11 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.registerUser(
domainAuthzToken, username, emailAddress, firstName, lastName, newPassword);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error registering user: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -144,18 +143,10 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.enableUser(domainAuthzToken, username);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error enabling user: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -165,18 +156,10 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.isUserEnabled(domainAuthzToken, username);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error checking if user is enabled: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -186,18 +169,10 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.isUserExist(domainAuthzToken, username);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error checking if user exists: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -208,20 +183,11 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserProfile domainProfile =
- iamAdminService.getUser(domainAuthzToken, username);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProfile = iamAdminService.getUser(domainAuthzToken, username);
return userProfileMapper.toThrift(domainProfile);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error getting user: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -232,20 +198,11 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.UserProfile> domainProfiles =
- iamAdminService.getUsers(domainAuthzToken, offset, limit, search);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProfiles = iamAdminService.getUsers(domainAuthzToken, offset, limit, search);
return domainProfiles.stream().map(userProfileMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error getting users: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -256,18 +213,10 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.resetUserPassword(domainAuthzToken, username, newPassword);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error resetting user password: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -278,20 +227,11 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- List<org.apache.airavata.common.model.UserProfile> domainProfiles =
- iamAdminService.findUsers(domainAuthzToken, email, userId);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProfiles = iamAdminService.findUsers(domainAuthzToken, email, userId);
return domainProfiles.stream().map(userProfileMapper::toThrift).collect(Collectors.toList());
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error finding users: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -303,19 +243,11 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
- org.apache.airavata.common.model.UserProfile domainProfile = userProfileMapper.toDomain(userDetails);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainProfile = userProfileMapper.toDomain(userDetails);
iamAdminService.updateUserProfile(domainAuthzToken, domainProfile);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error updating user profile: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
@@ -325,38 +257,10 @@ public class IamAdminServiceHandler implements org.apache.airavata.thriftapi.pro
throws org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException,
org.apache.airavata.thriftapi.exception.AuthorizationException, TException {
try {
- org.apache.airavata.security.model.AuthzToken domainAuthzToken = authzTokenMapper.toDomain(authzToken);
+ var domainAuthzToken = authzTokenMapper.toDomain(authzToken);
return iamAdminService.deleteUser(domainAuthzToken, username);
- } catch (org.apache.airavata.profile.exception.IamAdminServicesException e) {
- throw convertToThriftIamAdminServicesException(e);
- } catch (org.apache.airavata.common.exception.AuthorizationException e) {
- throw convertToThriftAuthorizationException(e);
- } catch (Exception e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException ex =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException(
- "Error deleting user: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ throw wrapException(e);
}
}
-
- // Helper methods for exception conversion
- private org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException
- convertToThriftIamAdminServicesException(
- org.apache.airavata.profile.exception.IamAdminServicesException e) {
- org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException thriftException =
- new org.apache.airavata.thriftapi.profile.exception.IamAdminServicesException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.AuthorizationException convertToThriftAuthorizationException(
- org.apache.airavata.common.exception.AuthorizationException e) {
- org.apache.airavata.thriftapi.exception.AuthorizationException thriftException =
- new org.apache.airavata.thriftapi.exception.AuthorizationException();
- thriftException.setMessage(e.getMessage());
- thriftException.initCause(e);
- return thriftException;
- }
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/OrchestratorServiceHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/OrchestratorServiceHandler.java
index 22a1d27320..fad6b972a5 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/OrchestratorServiceHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/OrchestratorServiceHandler.java
@@ -50,6 +50,33 @@ public class OrchestratorServiceHandler
log.info("OrchestratorServiceHandler initialized with Spring-injected OrchestratorService");
}
+ private org.apache.thrift.TException wrapException(Throwable e) {
+ if (e instanceof org.apache.thrift.TException te) return te;
+ org.apache.thrift.TException thriftException = null;
+
+ if (e instanceof org.apache.airavata.common.exception.LaunchValidationException) {
+ var ex = new org.apache.airavata.thriftapi.exception.LaunchValidationException();
+ ex.setErrorMessage(((org.apache.airavata.common.exception.LaunchValidationException) e).getErrorMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.orchestrator.exception.OrchestratorException) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
+ ex.setMessage(e.getMessage());
+ ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
+ ex.initCause(e);
+ thriftException = ex;
+ }
+
+ if (thriftException == null) {
+ var ex = new org.apache.airavata.thriftapi.exception.AiravataSystemException();
+ ex.setMessage("Internal Error: " + e.getMessage());
+ ex.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
+ ex.initCause(e);
+ thriftException = ex;
+ }
+ return thriftException;
+ }
+
/**
* * After creating the experiment Data user have the * experimentID as the
* handler to the experiment, during the launchProcess * We just have to
@@ -64,16 +91,9 @@ public class OrchestratorServiceHandler
var pool = OrchestratorServerThreadPoolExecutor.getCachedThreadPool();
try {
return orchestratorService.launchExperiment(experimentId, gatewayId, pool);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftAiravataSystemException(e);
} catch (Throwable e) {
log.error("Error launching experiment: " + experimentId, e);
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error launching experiment: " + experimentId + ". More info: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ throw wrapException(e);
}
}
@@ -90,16 +110,9 @@ public class OrchestratorServiceHandler
throws org.apache.airavata.thriftapi.exception.LaunchValidationException, TException {
try {
return orchestratorService.validateExperiment(experimentId);
- } catch (org.apache.airavata.common.exception.LaunchValidationException e) {
- throw convertToThriftLaunchValidationException(e);
} catch (Throwable e) {
log.error("Error validating experiment: " + experimentId, e);
- org.apache.airavata.thriftapi.exception.LaunchValidationException exception =
- new org.apache.airavata.thriftapi.exception.LaunchValidationException();
- exception.setErrorMessage(
- "Error validating experiment: " + experimentId + ". More info: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ throw wrapException(e);
}
}
@@ -111,15 +124,9 @@ public class OrchestratorServiceHandler
List<ProcessModel> domainProcesses =
processes.stream().map(processModelMapper::toDomain).collect(Collectors.toList());
return orchestratorService.validateProcess(experimentId, domainProcesses);
- } catch (org.apache.airavata.common.exception.LaunchValidationException e) {
- throw convertToThriftLaunchValidationException(e);
} catch (Throwable e) {
log.error("Error validating process: " + experimentId, e);
- org.apache.airavata.thriftapi.exception.LaunchValidationException exception =
- new org.apache.airavata.thriftapi.exception.LaunchValidationException();
- exception.setErrorMessage("Error validating process: " + experimentId + ". More info: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ throw wrapException(e);
}
}
@@ -136,16 +143,9 @@ public class OrchestratorServiceHandler
log.info("Experiment: {} is cancelling !!!!!", experimentId);
try {
return orchestratorService.terminateExperiment(experimentId, gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftAiravataSystemException(e);
} catch (Throwable e) {
log.error("Error terminating experiment: " + experimentId, e);
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error terminating experiment: " + experimentId + ". More info: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ throw wrapException(e);
}
}
@@ -153,17 +153,9 @@ public class OrchestratorServiceHandler
throws org.apache.airavata.thriftapi.exception.AiravataSystemException, TException {
try {
orchestratorService.fetchIntermediateOutputs(experimentId, gatewayId, outputNames);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftAiravataSystemException(e);
} catch (Throwable e) {
log.error("Error fetching intermediate outputs for experiment: " + experimentId, e);
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error fetching intermediate outputs for experiment: " + experimentId + ". More info: "
- + e.getMessage());
- exception.initCause(e);
- throw exception;
+ throw wrapException(e);
}
}
@@ -172,39 +164,9 @@ public class OrchestratorServiceHandler
throws org.apache.airavata.thriftapi.exception.AiravataSystemException, TException {
try {
return orchestratorService.launchProcess(processId, airavataCredStoreToken, gatewayId);
- } catch (org.apache.airavata.common.exception.AiravataSystemException e) {
- throw convertToThriftAiravataSystemException(e);
} catch (Throwable e) {
log.error("Error launching process: " + processId, e);
- org.apache.airavata.thriftapi.exception.AiravataSystemException exception =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- exception.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error launching process: " + processId + ". More info: " + e.getMessage());
- exception.initCause(e);
- throw exception;
+ throw wrapException(e);
}
}
-
- // Helper methods for exception conversion
- private org.apache.airavata.thriftapi.exception.AiravataSystemException convertToThriftAiravataSystemException(
- org.apache.airavata.common.exception.AiravataSystemException e) {
- org.apache.airavata.thriftapi.exception.AiravataSystemException thriftException =
- new org.apache.airavata.thriftapi.exception.AiravataSystemException();
- thriftException.setMessage(e.getMessage());
- if (e.getAiravataErrorType() != null) {
- thriftException.setAiravataErrorType(org.apache.airavata.thriftapi.exception.AiravataErrorType.valueOf(
- e.getAiravataErrorType().name()));
- }
- thriftException.initCause(e);
- return thriftException;
- }
-
- private org.apache.airavata.thriftapi.exception.LaunchValidationException convertToThriftLaunchValidationException(
- org.apache.airavata.common.exception.LaunchValidationException e) {
- org.apache.airavata.thriftapi.exception.LaunchValidationException thriftException =
- new org.apache.airavata.thriftapi.exception.LaunchValidationException();
- thriftException.setErrorMessage(e.getErrorMessage());
- thriftException.initCause(e);
- return thriftException;
- }
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/RegistryServiceHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/RegistryServiceHandler.java
index 6ab8f5f5d7..18f393a4ca 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/RegistryServiceHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/RegistryServiceHandler.java
@@ -21,71 +21,124 @@ package org.apache.airavata.thriftapi.handler;
import java.util.List;
import java.util.Map;
-import org.apache.airavata.common.exception.AiravataClientException;
-import org.apache.airavata.common.exception.AiravataSystemException;
-import org.apache.airavata.common.exception.DuplicateEntryException;
-import org.apache.airavata.common.exception.ExperimentNotFoundException;
-import org.apache.airavata.common.exception.InvalidRequestException;
-import org.apache.airavata.common.exception.ProjectNotFoundException;
-import org.apache.airavata.common.model.ApplicationDeploymentDescription;
-import org.apache.airavata.common.model.ApplicationInterfaceDescription;
-import org.apache.airavata.common.model.ApplicationModule;
-import org.apache.airavata.common.model.BatchQueueResourcePolicy;
-import org.apache.airavata.common.model.CloudJobSubmission;
-import org.apache.airavata.common.model.ComputationalResourceSchedulingModel;
-import org.apache.airavata.common.model.ComputeResourceDescription;
-import org.apache.airavata.common.model.ComputeResourcePolicy;
-import org.apache.airavata.common.model.ComputeResourcePreference;
-import org.apache.airavata.common.model.DMType;
-import org.apache.airavata.common.model.DataProductModel;
-import org.apache.airavata.common.model.DataReplicaLocationModel;
-import org.apache.airavata.common.model.ErrorModel;
-import org.apache.airavata.common.model.ExperimentModel;
-import org.apache.airavata.common.model.ExperimentSearchFields;
-import org.apache.airavata.common.model.ExperimentStatistics;
-import org.apache.airavata.common.model.ExperimentStatus;
-import org.apache.airavata.common.model.ExperimentSummaryModel;
-import org.apache.airavata.common.model.Gateway;
-import org.apache.airavata.common.model.GatewayGroups;
-import org.apache.airavata.common.model.GatewayResourceProfile;
-import org.apache.airavata.common.model.GatewayUsageReportingCommand;
-import org.apache.airavata.common.model.GridFTPDataMovement;
-import org.apache.airavata.common.model.GroupComputeResourcePreference;
-import org.apache.airavata.common.model.GroupResourceProfile;
-import org.apache.airavata.common.model.InputDataObjectType;
-import org.apache.airavata.common.model.JobModel;
-import org.apache.airavata.common.model.JobStatus;
-import org.apache.airavata.common.model.LOCALDataMovement;
-import org.apache.airavata.common.model.LOCALSubmission;
-import org.apache.airavata.common.model.Notification;
-import org.apache.airavata.common.model.OutputDataObjectType;
-import org.apache.airavata.common.model.Parser;
-import org.apache.airavata.common.model.ParserInput;
-import org.apache.airavata.common.model.ParserOutput;
-import org.apache.airavata.common.model.ParsingTemplate;
-import org.apache.airavata.common.model.ProcessModel;
-import org.apache.airavata.common.model.ProcessState;
-import org.apache.airavata.common.model.ProcessStatus;
-import org.apache.airavata.common.model.ProcessWorkflow;
-import org.apache.airavata.common.model.Project;
-import org.apache.airavata.common.model.ProjectSearchFields;
-import org.apache.airavata.common.model.QueueStatusModel;
-import org.apache.airavata.common.model.ResourceJobManager;
-import org.apache.airavata.common.model.SCPDataMovement;
-import org.apache.airavata.common.model.SSHJobSubmission;
-import org.apache.airavata.common.model.StoragePreference;
-import org.apache.airavata.common.model.StorageResourceDescription;
-import org.apache.airavata.common.model.TaskModel;
-import org.apache.airavata.common.model.TaskStatus;
-import org.apache.airavata.common.model.UnicoreDataMovement;
-import org.apache.airavata.common.model.UnicoreJobSubmission;
-import org.apache.airavata.common.model.UserComputeResourcePreference;
-import org.apache.airavata.common.model.UserConfigurationDataModel;
-import org.apache.airavata.common.model.UserProfile;
-import org.apache.airavata.common.model.UserResourceProfile;
-import org.apache.airavata.common.model.UserStoragePreference;
-import org.apache.airavata.registry.exception.RegistryServiceException;
+import java.util.stream.Collectors;
import org.apache.airavata.service.registry.RegistryService;
+import org.apache.airavata.thriftapi.exception.AiravataClientException;
+import org.apache.airavata.thriftapi.exception.AiravataSystemException;
+import org.apache.airavata.thriftapi.exception.DuplicateEntryException;
+import org.apache.airavata.thriftapi.exception.ExperimentNotFoundException;
+import org.apache.airavata.thriftapi.exception.InvalidRequestException;
+import org.apache.airavata.thriftapi.exception.ProjectNotFoundException;
+import org.apache.airavata.thriftapi.mapper.ApplicationDeploymentDescriptionMapper;
+import org.apache.airavata.thriftapi.mapper.ApplicationInterfaceDescriptionMapper;
+import org.apache.airavata.thriftapi.mapper.ApplicationModuleMapper;
+import org.apache.airavata.thriftapi.mapper.BatchQueueResourcePolicyMapper;
+import org.apache.airavata.thriftapi.mapper.CloudJobSubmissionMapper;
+import org.apache.airavata.thriftapi.mapper.ComputationalResourceSchedulingModelMapper;
+import org.apache.airavata.thriftapi.mapper.ComputeResourceDescriptionMapper;
+import org.apache.airavata.thriftapi.mapper.ComputeResourcePolicyMapper;
+import org.apache.airavata.thriftapi.mapper.ComputeResourcePreferenceMapper;
+import org.apache.airavata.thriftapi.mapper.DataProductModelMapper;
+import org.apache.airavata.thriftapi.mapper.DataReplicaLocationModelMapper;
+import org.apache.airavata.thriftapi.mapper.ErrorModelMapper;
+import org.apache.airavata.thriftapi.mapper.ExperimentModelMapper;
+import org.apache.airavata.thriftapi.mapper.ExperimentStatisticsMapper;
+import org.apache.airavata.thriftapi.mapper.ExperimentStatusMapper;
+import org.apache.airavata.thriftapi.mapper.ExperimentSummaryModelMapper;
+import org.apache.airavata.thriftapi.mapper.GatewayGroupsMapper;
+import org.apache.airavata.thriftapi.mapper.GatewayMapper;
+import org.apache.airavata.thriftapi.mapper.GatewayResourceProfileMapper;
+import org.apache.airavata.thriftapi.mapper.GatewayUsageReportingCommandMapper;
+import org.apache.airavata.thriftapi.mapper.GridFTPDataMovementMapper;
+import org.apache.airavata.thriftapi.mapper.GroupComputeResourcePreferenceMapper;
+import org.apache.airavata.thriftapi.mapper.GroupResourceProfileMapper;
+import org.apache.airavata.thriftapi.mapper.InputDataObjectTypeMapper;
+import org.apache.airavata.thriftapi.mapper.JobModelMapper;
+import org.apache.airavata.thriftapi.mapper.JobStatusMapper;
+import org.apache.airavata.thriftapi.mapper.LOCALDataMovementMapper;
+import org.apache.airavata.thriftapi.mapper.LOCALSubmissionMapper;
+import org.apache.airavata.thriftapi.mapper.NotificationMapper;
+import org.apache.airavata.thriftapi.mapper.OutputDataObjectTypeMapper;
+import org.apache.airavata.thriftapi.mapper.ParserInputMapper;
+import org.apache.airavata.thriftapi.mapper.ParserMapper;
+import org.apache.airavata.thriftapi.mapper.ParserOutputMapper;
+import org.apache.airavata.thriftapi.mapper.ParsingTemplateMapper;
+import org.apache.airavata.thriftapi.mapper.ProcessModelMapper;
+import org.apache.airavata.thriftapi.mapper.ProcessStatusMapper;
+import org.apache.airavata.thriftapi.mapper.ProcessWorkflowMapper;
+import org.apache.airavata.thriftapi.mapper.ProjectMapper;
+import org.apache.airavata.thriftapi.mapper.QueueStatusModelMapper;
+import org.apache.airavata.thriftapi.mapper.ResourceJobManagerMapper;
+import org.apache.airavata.thriftapi.mapper.SCPDataMovementMapper;
+import org.apache.airavata.thriftapi.mapper.SSHJobSubmissionMapper;
+import org.apache.airavata.thriftapi.mapper.StoragePreferenceMapper;
+import org.apache.airavata.thriftapi.mapper.StorageResourceDescriptionMapper;
+import org.apache.airavata.thriftapi.mapper.TaskModelMapper;
+import org.apache.airavata.thriftapi.mapper.TaskStatusMapper;
+import org.apache.airavata.thriftapi.mapper.UnicoreDataMovementMapper;
+import org.apache.airavata.thriftapi.mapper.UnicoreJobSubmissionMapper;
+import org.apache.airavata.thriftapi.mapper.UserComputeResourcePreferenceMapper;
+import org.apache.airavata.thriftapi.mapper.UserConfigurationDataModelMapper;
+import org.apache.airavata.thriftapi.mapper.UserProfileMapper;
+import org.apache.airavata.thriftapi.mapper.UserResourceProfileMapper;
+import org.apache.airavata.thriftapi.mapper.UserStoragePreferenceMapper;
+import org.apache.airavata.thriftapi.model.ApplicationDeploymentDescription;
+import org.apache.airavata.thriftapi.model.ApplicationInterfaceDescription;
+import org.apache.airavata.thriftapi.model.ApplicationModule;
+import org.apache.airavata.thriftapi.model.BatchQueueResourcePolicy;
+import org.apache.airavata.thriftapi.model.CloudJobSubmission;
+import org.apache.airavata.thriftapi.model.ComputationalResourceSchedulingModel;
+import org.apache.airavata.thriftapi.model.ComputeResourceDescription;
+import org.apache.airavata.thriftapi.model.ComputeResourcePolicy;
+import org.apache.airavata.thriftapi.model.ComputeResourcePreference;
+import org.apache.airavata.thriftapi.model.DMType;
+import org.apache.airavata.thriftapi.model.DataProductModel;
+import org.apache.airavata.thriftapi.model.DataReplicaLocationModel;
+import org.apache.airavata.thriftapi.model.ErrorModel;
+import org.apache.airavata.thriftapi.model.ExperimentModel;
+import org.apache.airavata.thriftapi.model.ExperimentSearchFields;
+import org.apache.airavata.thriftapi.model.ExperimentStatistics;
+import org.apache.airavata.thriftapi.model.ExperimentStatus;
+import org.apache.airavata.thriftapi.model.ExperimentSummaryModel;
+import org.apache.airavata.thriftapi.model.Gateway;
+import org.apache.airavata.thriftapi.model.GatewayGroups;
+import org.apache.airavata.thriftapi.model.GatewayResourceProfile;
+import org.apache.airavata.thriftapi.model.GatewayUsageReportingCommand;
+import org.apache.airavata.thriftapi.model.GridFTPDataMovement;
+import org.apache.airavata.thriftapi.model.GroupComputeResourcePreference;
+import org.apache.airavata.thriftapi.model.GroupResourceProfile;
+import org.apache.airavata.thriftapi.model.InputDataObjectType;
+import org.apache.airavata.thriftapi.model.JobModel;
+import org.apache.airavata.thriftapi.model.LOCALDataMovement;
+import org.apache.airavata.thriftapi.model.LOCALSubmission;
+import org.apache.airavata.thriftapi.model.Notification;
+import org.apache.airavata.thriftapi.model.OutputDataObjectType;
+import org.apache.airavata.thriftapi.model.Parser;
+import org.apache.airavata.thriftapi.model.ParserInput;
+import org.apache.airavata.thriftapi.model.ParserOutput;
+import org.apache.airavata.thriftapi.model.ParsingTemplate;
+import org.apache.airavata.thriftapi.model.ProcessModel;
+import org.apache.airavata.thriftapi.model.ProcessState;
+import org.apache.airavata.thriftapi.model.ProcessStatus;
+import org.apache.airavata.thriftapi.model.ProcessWorkflow;
+import org.apache.airavata.thriftapi.model.Project;
+import org.apache.airavata.thriftapi.model.ProjectSearchFields;
+import org.apache.airavata.thriftapi.model.QueueStatusModel;
+import org.apache.airavata.thriftapi.model.ResourceJobManager;
+import org.apache.airavata.thriftapi.model.SCPDataMovement;
+import org.apache.airavata.thriftapi.model.SSHJobSubmission;
+import org.apache.airavata.thriftapi.model.StoragePreference;
+import org.apache.airavata.thriftapi.model.StorageResourceDescription;
+import org.apache.airavata.thriftapi.model.TaskModel;
+import org.apache.airavata.thriftapi.model.TaskStatus;
+import org.apache.airavata.thriftapi.model.UnicoreDataMovement;
+import org.apache.airavata.thriftapi.model.UnicoreJobSubmission;
+import org.apache.airavata.thriftapi.model.UserComputeResourcePreference;
+import org.apache.airavata.thriftapi.model.UserConfigurationDataModel;
+import org.apache.airavata.thriftapi.model.UserProfile;
+import org.apache.airavata.thriftapi.model.UserResourceProfile;
+import org.apache.airavata.thriftapi.model.UserStoragePreference;
+import org.apache.airavata.thriftapi.registry.exception.RegistryServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -95,6 +148,71 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
private static final Logger logger = LoggerFactory.getLogger(RegistryServiceHandler.class);
private final RegistryService registryService;
+ private final GatewayMapper gatewayMapper = GatewayMapper.INSTANCE;
+ private final ParserMapper parserMapper = ParserMapper.INSTANCE;
+ private final ParsingTemplateMapper parsingTemplateMapper = ParsingTemplateMapper.INSTANCE;
+ private final ParserInputMapper parserInputMapper = ParserInputMapper.INSTANCE;
+ private final ParserOutputMapper parserOutputMapper = ParserOutputMapper.INSTANCE;
+ private final GatewayGroupsMapper gatewayGroupsMapper = GatewayGroupsMapper.INSTANCE;
+ private final GroupResourceProfileMapper groupResourceProfileMapper = GroupResourceProfileMapper.INSTANCE;
+ private final GroupComputeResourcePreferenceMapper groupComputeResourcePreferenceMapper =
+ GroupComputeResourcePreferenceMapper.INSTANCE;
+ private final ComputeResourcePolicyMapper computeResourcePolicyMapper = ComputeResourcePolicyMapper.INSTANCE;
+ private final BatchQueueResourcePolicyMapper batchQueueResourcePolicyMapper =
+ BatchQueueResourcePolicyMapper.INSTANCE;
+ private final JobStatusMapper jobStatusMapper = JobStatusMapper.INSTANCE;
+ private final GatewayUsageReportingCommandMapper gatewayUsageReportingCommandMapper =
+ GatewayUsageReportingCommandMapper.INSTANCE;
+ private final QueueStatusModelMapper queueStatusModelMapper = QueueStatusModelMapper.INSTANCE;
+ private final NotificationMapper notificationMapper = NotificationMapper.INSTANCE;
+ private final ProjectMapper projectMapper = ProjectMapper.INSTANCE;
+ private final ExperimentModelMapper experimentModelMapper = ExperimentModelMapper.INSTANCE;
+ private final ExperimentSummaryModelMapper experimentSummaryModelMapper = ExperimentSummaryModelMapper.INSTANCE;
+ private final ExperimentStatisticsMapper experimentStatisticsMapper = ExperimentStatisticsMapper.INSTANCE;
+ private final ExperimentStatusMapper experimentStatusMapper = ExperimentStatusMapper.INSTANCE;
+ private final OutputDataObjectTypeMapper outputDataObjectTypeMapper = OutputDataObjectTypeMapper.INSTANCE;
+ private final ErrorModelMapper errorModelMapper = ErrorModelMapper.INSTANCE;
+ private final TaskStatusMapper taskStatusMapper = TaskStatusMapper.INSTANCE;
+ private final ProcessStatusMapper processStatusMapper = ProcessStatusMapper.INSTANCE;
+ private final JobModelMapper jobModelMapper = JobModelMapper.INSTANCE;
+ private final ProcessModelMapper processModelMapper = ProcessModelMapper.INSTANCE;
+ private final TaskModelMapper taskModelMapper = TaskModelMapper.INSTANCE;
+ private final ProcessWorkflowMapper processWorkflowMapper = ProcessWorkflowMapper.INSTANCE;
+ private final UserConfigurationDataModelMapper userConfigurationDataModelMapper =
+ UserConfigurationDataModelMapper.INSTANCE;
+ private final ApplicationModuleMapper applicationModuleMapper = ApplicationModuleMapper.INSTANCE;
+ private final ApplicationDeploymentDescriptionMapper applicationDeploymentDescriptionMapper =
+ ApplicationDeploymentDescriptionMapper.INSTANCE;
+ private final ApplicationInterfaceDescriptionMapper applicationInterfaceDescriptionMapper =
+ ApplicationInterfaceDescriptionMapper.INSTANCE;
+ private final InputDataObjectTypeMapper inputDataObjectTypeMapper = InputDataObjectTypeMapper.INSTANCE;
+ private final ComputeResourceDescriptionMapper computeResourceDescriptionMapper =
+ ComputeResourceDescriptionMapper.INSTANCE;
+ private final StorageResourceDescriptionMapper storageResourceDescriptionMapper =
+ StorageResourceDescriptionMapper.INSTANCE;
+ private final LOCALSubmissionMapper localSubmissionMapper = LOCALSubmissionMapper.INSTANCE;
+ private final SSHJobSubmissionMapper sshJobSubmissionMapper = SSHJobSubmissionMapper.INSTANCE;
+ private final UnicoreJobSubmissionMapper unicoreJobSubmissionMapper = UnicoreJobSubmissionMapper.INSTANCE;
+ private final CloudJobSubmissionMapper cloudJobSubmissionMapper = CloudJobSubmissionMapper.INSTANCE;
+ private final LOCALDataMovementMapper localDataMovementMapper = LOCALDataMovementMapper.INSTANCE;
+ private final SCPDataMovementMapper scpDataMovementMapper = SCPDataMovementMapper.INSTANCE;
+ private final UnicoreDataMovementMapper unicoreDataMovementMapper = UnicoreDataMovementMapper.INSTANCE;
+ private final GridFTPDataMovementMapper gridFTPDataMovementMapper = GridFTPDataMovementMapper.INSTANCE;
+ private final ResourceJobManagerMapper resourceJobManagerMapper = ResourceJobManagerMapper.INSTANCE;
+ private final GatewayResourceProfileMapper gatewayResourceProfileMapper = GatewayResourceProfileMapper.INSTANCE;
+ private final ComputeResourcePreferenceMapper computeResourcePreferenceMapper =
+ ComputeResourcePreferenceMapper.INSTANCE;
+ private final StoragePreferenceMapper storagePreferenceMapper = StoragePreferenceMapper.INSTANCE;
+ private final DataProductModelMapper dataProductModelMapper = DataProductModelMapper.INSTANCE;
+ private final DataReplicaLocationModelMapper dataReplicaLocationModelMapper =
+ DataReplicaLocationModelMapper.INSTANCE;
+ private final ComputationalResourceSchedulingModelMapper computationalResourceSchedulingModelMapper =
+ ComputationalResourceSchedulingModelMapper.INSTANCE;
+ private final UserResourceProfileMapper userResourceProfileMapper = UserResourceProfileMapper.INSTANCE;
+ private final UserProfileMapper userProfileMapper = UserProfileMapper.INSTANCE;
+ private final UserComputeResourcePreferenceMapper userComputeResourcePreferenceMapper =
+ UserComputeResourcePreferenceMapper.INSTANCE;
+ private final UserStoragePreferenceMapper userStoragePreferenceMapper = UserStoragePreferenceMapper.INSTANCE;
public RegistryServiceHandler(RegistryService registryService) {
this.registryService = registryService;
@@ -108,12 +226,26 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
return exception;
}
+ private ProjectNotFoundException convertToThriftProjectNotFoundException(
+ org.apache.airavata.common.exception.ProjectNotFoundException e) {
+ ProjectNotFoundException exception = new ProjectNotFoundException();
+ exception.setMessage(e.getMessage());
+ return exception;
+ }
+
+ private DuplicateEntryException convertToThriftDuplicateEntryException(
+ org.apache.airavata.common.exception.DuplicateEntryException e) {
+ DuplicateEntryException exception = new DuplicateEntryException();
+ exception.setMessage(e.getMessage());
+ return exception;
+ }
+
/**
* Fetch Apache Registry API version
*/
@Override
public String getAPIVersion() throws AiravataSystemException {
- return org.apache.airavata.registry.model.registry_apiConstants.REGISTRY_API_VERSION;
+ return org.apache.airavata.thriftapi.registry.model.registry_apiConstants.REGISTRY_API_VERSION;
}
/**
@@ -125,7 +257,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean isUserExists(String gatewayId, String userName) throws RegistryServiceException {
- return registryService.isUserExists(gatewayId, userName);
+ try {
+ return registryService.isUserExists(gatewayId, userName);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if user exists");
+ }
}
/**
@@ -137,7 +273,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<String> getAllUsersInGateway(String gatewayId) throws RegistryServiceException {
- return registryService.getAllUsersInGateway(gatewayId);
+ try {
+ return registryService.getAllUsersInGateway(gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all users in gateway");
+ }
}
/**
@@ -149,7 +289,12 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public Gateway getGateway(String gatewayId) throws RegistryServiceException {
- return registryService.getGateway(gatewayId);
+ try {
+ org.apache.airavata.common.model.Gateway domainGateway = registryService.getGateway(gatewayId);
+ return gatewayMapper.toThrift(domainGateway);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get gateway");
+ }
}
/**
@@ -161,7 +306,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteGateway(String gatewayId) throws RegistryServiceException {
- return registryService.deleteGateway(gatewayId);
+ try {
+ return registryService.deleteGateway(gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete gateway");
+ }
}
/**
@@ -169,7 +318,12 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<Gateway> getAllGateways() throws RegistryServiceException {
- return registryService.getAllGateways();
+ try {
+ List<org.apache.airavata.common.model.Gateway> domainGateways = registryService.getAllGateways();
+ return domainGateways.stream().map(gatewayMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all gateways");
+ }
}
/**
@@ -181,22 +335,44 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean isGatewayExist(String gatewayId) throws RegistryServiceException {
- return registryService.isGatewayExist(gatewayId);
+ try {
+ return registryService.isGatewayExist(gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if gateway exists");
+ }
}
@Override
public boolean deleteNotification(String gatewayId, String notificationId) throws RegistryServiceException {
- return registryService.deleteNotification(gatewayId, notificationId);
+ try {
+ return registryService.deleteNotification(gatewayId, notificationId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete notification");
+ }
}
@Override
public Notification getNotification(String gatewayId, String notificationId) throws RegistryServiceException {
- return registryService.getNotification(gatewayId, notificationId);
+ try {
+ org.apache.airavata.common.model.Notification domainNotification =
+ registryService.getNotification(gatewayId, notificationId);
+ return notificationMapper.toThrift(domainNotification);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get notification");
+ }
}
@Override
public List<Notification> getAllNotifications(String gatewayId) throws RegistryServiceException {
- return registryService.getAllNotifications(gatewayId);
+ try {
+ List<org.apache.airavata.common.model.Notification> domainNotifications =
+ registryService.getAllNotifications(gatewayId);
+ return domainNotifications.stream()
+ .map(notificationMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all notifications");
+ }
}
/**
@@ -209,7 +385,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public Project getProject(String projectId) throws RegistryServiceException, ProjectNotFoundException {
- return registryService.getProject(projectId);
+ try {
+ org.apache.airavata.common.model.Project domainProject = registryService.getProject(projectId);
+ return projectMapper.toThrift(domainProject);
+ } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
+ throw convertToThriftProjectNotFoundException(e);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get project");
+ }
}
/**
@@ -224,7 +407,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteProject(String projectId) throws RegistryServiceException, ProjectNotFoundException {
- return registryService.deleteProject(projectId);
+ try {
+ return registryService.deleteProject(projectId);
+ } catch (org.apache.airavata.common.exception.ProjectNotFoundException e) {
+ throw convertToThriftProjectNotFoundException(e);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete project");
+ }
}
/**
@@ -239,7 +428,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<Project> getUserProjects(String gatewayId, String userName, int limit, int offset)
throws RegistryServiceException {
- return registryService.getUserProjects(gatewayId, userName, limit, offset);
+ try {
+ List<org.apache.airavata.common.model.Project> domainProjects =
+ registryService.getUserProjects(gatewayId, userName, limit, offset);
+ return domainProjects.stream().map(projectMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get user projects");
+ }
}
/**
@@ -262,16 +457,22 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
int limit,
int offset)
throws RegistryServiceException {
- return registryService.getExperimentStatistics(
- gatewayId,
- fromTime,
- toTime,
- userName,
- applicationName,
- resourceHostName,
- accessibleExpIds,
- limit,
- offset);
+ try {
+ org.apache.airavata.common.model.ExperimentStatistics domainExperimentStatistics =
+ registryService.getExperimentStatistics(
+ gatewayId,
+ fromTime,
+ toTime,
+ userName,
+ applicationName,
+ resourceHostName,
+ accessibleExpIds,
+ limit,
+ offset);
+ return experimentStatisticsMapper.toThrift(domainExperimentStatistics);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get experiment statistics");
+ }
}
/**
@@ -286,7 +487,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<ExperimentModel> getExperimentsInProject(String gatewayId, String projectId, int limit, int offset)
throws RegistryServiceException {
- return registryService.getExperimentsInProject(gatewayId, projectId, limit, offset);
+ try {
+ List<org.apache.airavata.common.model.ExperimentModel> domainExperiments =
+ registryService.getExperimentsInProject(gatewayId, projectId, limit, offset);
+ return domainExperiments.stream()
+ .map(experimentModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get experiments in project");
+ }
}
/**
@@ -301,7 +510,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<ExperimentModel> getUserExperiments(String gatewayId, String userName, int limit, int offset)
throws RegistryServiceException {
- return registryService.getUserExperiments(gatewayId, userName, limit, offset);
+ try {
+ List<org.apache.airavata.common.model.ExperimentModel> domainExperiments =
+ registryService.getUserExperiments(gatewayId, userName, limit, offset);
+ return domainExperiments.stream()
+ .map(experimentModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get user experiments");
+ }
}
/**
@@ -313,7 +530,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteExperiment(String experimentId) throws RegistryServiceException {
- return registryService.deleteExperiment(experimentId);
+ try {
+ return registryService.deleteExperiment(experimentId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete experiment");
+ }
}
/**
@@ -357,8 +578,9 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public ExperimentModel getExperiment(String airavataExperimentId)
throws RegistryServiceException, ExperimentNotFoundException {
- ExperimentModel experimentModel = getExperimentInternal(airavataExperimentId);
- return experimentModel;
+ org.apache.airavata.common.model.ExperimentModel domainExperimentModel =
+ getExperimentInternal(airavataExperimentId);
+ return experimentModelMapper.toThrift(domainExperimentModel);
}
/**
@@ -388,7 +610,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public ExperimentModel getDetailedExperimentTree(String airavataExperimentId) throws RegistryServiceException {
- return registryService.getDetailedExperimentTree(airavataExperimentId);
+ try {
+ org.apache.airavata.common.model.ExperimentModel domainExperimentModel =
+ registryService.getDetailedExperimentTree(airavataExperimentId);
+ return experimentModelMapper.toThrift(domainExperimentModel);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get detailed experiment tree");
+ }
}
/**
@@ -402,7 +630,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public ExperimentStatus getExperimentStatus(String airavataExperimentId) throws RegistryServiceException {
- return registryService.getExperimentStatus(airavataExperimentId);
+ try {
+ org.apache.airavata.common.model.ExperimentStatus domainExperimentStatus =
+ registryService.getExperimentStatus(airavataExperimentId);
+ return experimentStatusMapper.toThrift(domainExperimentStatus);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get experiment status");
+ }
}
/**
@@ -416,7 +650,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<OutputDataObjectType> getExperimentOutputs(String airavataExperimentId)
throws RegistryServiceException {
- return registryService.getExperimentOutputs(airavataExperimentId);
+ try {
+ List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
+ registryService.getExperimentOutputs(airavataExperimentId);
+ return domainOutputs.stream()
+ .map(outputDataObjectTypeMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get experiment outputs");
+ }
}
/**
@@ -430,7 +672,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<OutputDataObjectType> getIntermediateOutputs(String airavataExperimentId)
throws RegistryServiceException {
- return registryService.getIntermediateOutputs(airavataExperimentId);
+ try {
+ List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
+ registryService.getIntermediateOutputs(airavataExperimentId);
+ return domainOutputs.stream()
+ .map(outputDataObjectTypeMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get intermediate outputs");
+ }
}
/**
@@ -441,105 +691,242 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
* Job status (string) for all all the existing jobs for the experiment will be returned in the form of a map
*/
@Override
- public Map<String, JobStatus> getJobStatuses(String airavataExperimentId) throws RegistryServiceException {
- return registryService.getJobStatuses(airavataExperimentId);
+ public Map<String, org.apache.airavata.thriftapi.model.JobStatus> getJobStatuses(String airavataExperimentId)
+ throws RegistryServiceException {
+ try {
+ Map<String, org.apache.airavata.common.model.JobStatus> domainJobStatuses =
+ registryService.getJobStatuses(airavataExperimentId);
+ Map<String, org.apache.airavata.thriftapi.model.JobStatus> thriftStatuses = new java.util.HashMap<>();
+ for (Map.Entry<String, org.apache.airavata.common.model.JobStatus> entry : domainJobStatuses.entrySet()) {
+ org.apache.airavata.thriftapi.model.JobStatus thriftStatus =
+ new org.apache.airavata.thriftapi.model.JobStatus();
+ thriftStatus.setJobState(org.apache.airavata.thriftapi.model.JobState.valueOf(
+ entry.getValue().getJobState().name()));
+ thriftStatus.setTimeOfStateChange(entry.getValue().getTimeOfStateChange());
+ thriftStatus.setReason(entry.getValue().getReason());
+ thriftStatus.setStatusId(entry.getValue().getStatusId());
+ thriftStatuses.put(entry.getKey(), thriftStatus);
+ }
+ return thriftStatuses;
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get job statuses");
+ }
}
@Override
public void addExperimentProcessOutputs(String outputType, List<OutputDataObjectType> outputs, String id)
throws RegistryServiceException {
- registryService.addExperimentProcessOutputs(outputType, outputs, id);
+ try {
+ List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
+ outputs.stream().map(outputDataObjectTypeMapper::toDomain).collect(Collectors.toList());
+ registryService.addExperimentProcessOutputs(outputType, domainOutputs, id);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add experiment process outputs");
+ }
}
@Override
public void addErrors(String errorType, ErrorModel errorModel, String id) throws RegistryServiceException {
- registryService.addErrors(errorType, errorModel, id);
+ try {
+ org.apache.airavata.common.model.ErrorModel domainErrorModel = errorModelMapper.toDomain(errorModel);
+ registryService.addErrors(errorType, domainErrorModel, id);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add errors");
+ }
}
@Override
public void addTaskStatus(TaskStatus taskStatus, String taskId) throws RegistryServiceException {
- registryService.addTaskStatus(taskStatus, taskId);
+ try {
+ org.apache.airavata.common.model.TaskStatus domainTaskStatus = taskStatusMapper.toDomain(taskStatus);
+ registryService.addTaskStatus(domainTaskStatus, taskId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add task status");
+ }
}
@Override
public void addProcessStatus(ProcessStatus processStatus, String processId) throws RegistryServiceException {
- registryService.addProcessStatus(processStatus, processId);
+ try {
+ org.apache.airavata.common.model.ProcessStatus domainProcessStatus =
+ processStatusMapper.toDomain(processStatus);
+ registryService.addProcessStatus(domainProcessStatus, processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add process status");
+ }
}
@Override
public void updateProcessStatus(ProcessStatus processStatus, String processId) throws RegistryServiceException {
- registryService.updateProcessStatus(processStatus, processId);
+ try {
+ org.apache.airavata.common.model.ProcessStatus domainProcessStatus =
+ processStatusMapper.toDomain(processStatus);
+ registryService.updateProcessStatus(domainProcessStatus, processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update process status");
+ }
}
@Override
public void updateExperimentStatus(ExperimentStatus experimentStatus, String experimentId)
throws RegistryServiceException {
- registryService.updateExperimentStatus(experimentStatus, experimentId);
+ try {
+ org.apache.airavata.common.model.ExperimentStatus domainExperimentStatus =
+ experimentStatusMapper.toDomain(experimentStatus);
+ registryService.updateExperimentStatus(domainExperimentStatus, experimentId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update experiment status");
+ }
}
@Override
- public void addJobStatus(JobStatus jobStatus, String taskId, String jobId) throws RegistryServiceException {
- registryService.addJobStatus(jobStatus, taskId, jobId);
+ public void addJobStatus(org.apache.airavata.thriftapi.model.JobStatus jobStatus, String taskId, String jobId)
+ throws RegistryServiceException {
+ try {
+ org.apache.airavata.common.model.JobStatus domainJobStatus =
+ new org.apache.airavata.common.model.JobStatus();
+ domainJobStatus.setJobState(org.apache.airavata.common.model.JobState.valueOf(
+ jobStatus.getJobState().name()));
+ domainJobStatus.setTimeOfStateChange(jobStatus.getTimeOfStateChange());
+ domainJobStatus.setReason(jobStatus.getReason());
+ domainJobStatus.setStatusId(jobStatus.getStatusId());
+ registryService.addJobStatus(domainJobStatus, taskId, jobId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add job status");
+ }
}
@Override
public void addJob(JobModel jobModel, String processId) throws RegistryServiceException {
- registryService.addJob(jobModel, processId);
+ try {
+ org.apache.airavata.common.model.JobModel domainJobModel = jobModelMapper.toDomain(jobModel);
+ registryService.addJob(domainJobModel, processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add job");
+ }
}
@Override
public void deleteJobs(String processId) throws RegistryServiceException {
- registryService.deleteJobs(processId);
+ try {
+ registryService.deleteJobs(processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete jobs");
+ }
}
@Override
public String addProcess(ProcessModel processModel, String experimentId) throws RegistryServiceException {
- return registryService.addProcess(processModel, experimentId);
+ try {
+ org.apache.airavata.common.model.ProcessModel domainProcessModel =
+ processModelMapper.toDomain(processModel);
+ return registryService.addProcess(domainProcessModel, experimentId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add process");
+ }
}
@Override
public void updateProcess(ProcessModel processModel, String processId) throws RegistryServiceException {
- registryService.updateProcess(processModel, processId);
+ try {
+ org.apache.airavata.common.model.ProcessModel domainProcessModel =
+ processModelMapper.toDomain(processModel);
+ registryService.updateProcess(domainProcessModel, processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update process");
+ }
}
@Override
public String addTask(TaskModel taskModel, String processId) throws RegistryServiceException {
- return registryService.addTask(taskModel, processId);
+ try {
+ org.apache.airavata.common.model.TaskModel domainTaskModel = taskModelMapper.toDomain(taskModel);
+ return registryService.addTask(domainTaskModel, processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add task");
+ }
}
@Override
public void deleteTasks(String processId) throws RegistryServiceException {
- registryService.deleteTasks(processId);
+ try {
+ registryService.deleteTasks(processId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete tasks");
+ }
}
@Override
public UserConfigurationDataModel getUserConfigurationData(String experimentId) throws RegistryServiceException {
- return registryService.getUserConfigurationData(experimentId);
+ try {
+ org.apache.airavata.common.model.UserConfigurationDataModel domainUserConfigurationDataModel =
+ registryService.getUserConfigurationData(experimentId);
+ return userConfigurationDataModelMapper.toThrift(domainUserConfigurationDataModel);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get user configuration data");
+ }
}
@Override
public ProcessModel getProcess(String processId) throws RegistryServiceException {
- return registryService.getProcess(processId);
+ try {
+ org.apache.airavata.common.model.ProcessModel domainProcessModel = registryService.getProcess(processId);
+ return processModelMapper.toThrift(domainProcessModel);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process");
+ }
}
@Override
public List<ProcessModel> getProcessList(String experimentId) throws RegistryServiceException {
- return registryService.getProcessList(experimentId);
+ try {
+ List<org.apache.airavata.common.model.ProcessModel> domainProcessModels =
+ registryService.getProcessList(experimentId);
+ return domainProcessModels.stream()
+ .map(processModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process list");
+ }
}
@Override
public ProcessStatus getProcessStatus(String processId) throws RegistryServiceException {
- return registryService.getProcessStatus(processId);
+ try {
+ org.apache.airavata.common.model.ProcessStatus domainProcessStatus =
+ registryService.getProcessStatus(processId);
+ return processStatusMapper.toThrift(domainProcessStatus);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process status");
+ }
}
@Override
public List<ProcessModel> getProcessListInState(ProcessState processState) throws RegistryServiceException {
- return registryService.getProcessListInState(processState);
+ try {
+ org.apache.airavata.common.model.ProcessState domainProcessState =
+ org.apache.airavata.common.model.ProcessState.valueOf(processState.name());
+ List<org.apache.airavata.common.model.ProcessModel> domainProcessModels =
+ registryService.getProcessListInState(domainProcessState);
+ return domainProcessModels.stream()
+ .map(processModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process list in state");
+ }
}
@Override
public List<ProcessStatus> getProcessStatusList(String processId) throws RegistryServiceException {
- return registryService.getProcessStatusList(processId);
+ try {
+ List<org.apache.airavata.common.model.ProcessStatus> domainProcessStatuses =
+ registryService.getProcessStatusList(processId);
+ return domainProcessStatuses.stream()
+ .map(processStatusMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process status list");
+ }
}
/**
@@ -547,7 +934,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean isJobExist(String queryType, String id) throws RegistryServiceException {
- return registryService.isJobExist(queryType, id);
+ try {
+ return registryService.isJobExist(queryType, id);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if job exists");
+ }
}
/**
@@ -555,45 +946,96 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public JobModel getJob(String queryType, String id) throws RegistryServiceException {
- return registryService.getJob(queryType, id);
+ try {
+ org.apache.airavata.common.model.JobModel domainJobModel = registryService.getJob(queryType, id);
+ return jobModelMapper.toThrift(domainJobModel);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get job");
+ }
}
@Override
public List<JobModel> getJobs(String queryType, String id) throws RegistryServiceException {
- return registryService.getJobs(queryType, id);
+ try {
+ List<org.apache.airavata.common.model.JobModel> domainJobModels = registryService.getJobs(queryType, id);
+ return domainJobModels.stream().map(jobModelMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get jobs");
+ }
}
@Override
public int getJobCount(
- org.apache.airavata.common.model.JobStatus jobStatus, String gatewayId, double searchBackTimeInMinutes)
+ org.apache.airavata.thriftapi.model.JobStatus jobStatus, String gatewayId, double searchBackTimeInMinutes)
throws RegistryServiceException {
- return registryService.getJobCount(jobStatus, gatewayId, searchBackTimeInMinutes);
+ try {
+ org.apache.airavata.common.model.JobStatus domainJobStatus =
+ new org.apache.airavata.common.model.JobStatus();
+ domainJobStatus.setJobState(org.apache.airavata.common.model.JobState.valueOf(
+ jobStatus.getJobState().name()));
+ domainJobStatus.setTimeOfStateChange(jobStatus.getTimeOfStateChange());
+ domainJobStatus.setReason(jobStatus.getReason());
+ domainJobStatus.setStatusId(jobStatus.getStatusId());
+ return registryService.getJobCount(domainJobStatus, gatewayId, searchBackTimeInMinutes);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get job count");
+ }
}
@Override
public Map<String, Double> getAVGTimeDistribution(String gatewayId, double searchBackTimeInMinutes)
throws RegistryServiceException {
- return registryService.getAVGTimeDistribution(gatewayId, searchBackTimeInMinutes);
+ try {
+ return registryService.getAVGTimeDistribution(gatewayId, searchBackTimeInMinutes);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get average time distribution");
+ }
}
@Override
public List<OutputDataObjectType> getProcessOutputs(String processId) throws RegistryServiceException {
- return registryService.getProcessOutputs(processId);
+ try {
+ List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
+ registryService.getProcessOutputs(processId);
+ return domainOutputs.stream()
+ .map(outputDataObjectTypeMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process outputs");
+ }
}
@Override
public List<ProcessWorkflow> getProcessWorkflows(String processId) throws RegistryServiceException {
- return registryService.getProcessWorkflows(processId);
+ try {
+ List<org.apache.airavata.common.model.ProcessWorkflow> domainProcessWorkflows =
+ registryService.getProcessWorkflows(processId);
+ return domainProcessWorkflows.stream()
+ .map(processWorkflowMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process workflows");
+ }
}
@Override
public void addProcessWorkflow(ProcessWorkflow processWorkflow) throws RegistryServiceException {
- registryService.addProcessWorkflow(processWorkflow);
+ try {
+ org.apache.airavata.common.model.ProcessWorkflow domainProcessWorkflow =
+ processWorkflowMapper.toDomain(processWorkflow);
+ registryService.addProcessWorkflow(domainProcessWorkflow);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add process workflow");
+ }
}
@Override
public List<String> getProcessIds(String experimentId) throws RegistryServiceException {
- return registryService.getProcessIds(experimentId);
+ try {
+ return registryService.getProcessIds(experimentId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get process ids");
+ }
}
/**
@@ -605,7 +1047,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<JobModel> getJobDetails(String airavataExperimentId) throws RegistryServiceException {
- return registryService.getJobDetails(airavataExperimentId);
+ try {
+ List<org.apache.airavata.common.model.JobModel> domainJobModels =
+ registryService.getJobDetails(airavataExperimentId);
+ return domainJobModels.stream().map(jobModelMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get job details");
+ }
}
/**
@@ -617,7 +1065,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public ApplicationModule getApplicationModule(String appModuleId) throws RegistryServiceException {
- return registryService.getApplicationModule(appModuleId);
+ try {
+ org.apache.airavata.common.model.ApplicationModule domainApplicationModule =
+ registryService.getApplicationModule(appModuleId);
+ return applicationModuleMapper.toThrift(domainApplicationModule);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get application module");
+ }
}
/**
@@ -629,7 +1083,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<ApplicationModule> getAllAppModules(String gatewayId) throws RegistryServiceException {
- return registryService.getAllAppModules(gatewayId);
+ try {
+ List<org.apache.airavata.common.model.ApplicationModule> domainApplicationModules =
+ registryService.getAllAppModules(gatewayId);
+ return domainApplicationModules.stream()
+ .map(applicationModuleMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all app modules");
+ }
}
/**
@@ -644,7 +1106,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public List<ApplicationModule> getAccessibleAppModules(
String gatewayId, List<String> accessibleAppIds, List<String> accessibleComputeResourceIds)
throws RegistryServiceException {
- return registryService.getAccessibleAppModules(gatewayId, accessibleAppIds, accessibleComputeResourceIds);
+ try {
+ List<org.apache.airavata.common.model.ApplicationModule> domainApplicationModules =
+ registryService.getAccessibleAppModules(gatewayId, accessibleAppIds, accessibleComputeResourceIds);
+ return domainApplicationModules.stream()
+ .map(applicationModuleMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get accessible app modules");
+ }
}
/**
@@ -656,7 +1126,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteApplicationModule(String appModuleId) throws RegistryServiceException {
- return registryService.deleteApplicationModule(appModuleId);
+ try {
+ return registryService.deleteApplicationModule(appModuleId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete application module");
+ }
}
/**
@@ -669,7 +1143,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public ApplicationDeploymentDescription getApplicationDeployment(String appDeploymentId)
throws RegistryServiceException {
- return registryService.getApplicationDeployment(appDeploymentId);
+ try {
+ org.apache.airavata.common.model.ApplicationDeploymentDescription domainApplicationDeploymentDescription =
+ registryService.getApplicationDeployment(appDeploymentId);
+ return applicationDeploymentDescriptionMapper.toThrift(domainApplicationDeploymentDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get application deployment");
+ }
}
/**
@@ -681,7 +1161,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteApplicationDeployment(String appDeploymentId) throws RegistryServiceException {
- return registryService.deleteApplicationDeployment(appDeploymentId);
+ try {
+ return registryService.deleteApplicationDeployment(appDeploymentId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete application deployment");
+ }
}
/**
@@ -695,7 +1179,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<ApplicationDeploymentDescription> getAllApplicationDeployments(String gatewayId)
throws RegistryServiceException {
- return registryService.getAllApplicationDeployments(gatewayId);
+ try {
+ List<org.apache.airavata.common.model.ApplicationDeploymentDescription>
+ domainApplicationDeploymentDescriptions = registryService.getAllApplicationDeployments(gatewayId);
+ return domainApplicationDeploymentDescriptions.stream()
+ .map(applicationDeploymentDescriptionMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all application deployments");
+ }
}
/**
@@ -710,8 +1202,16 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public List<ApplicationDeploymentDescription> getAccessibleApplicationDeployments(
String gatewayId, List<String> accessibleAppDeploymentIds, List<String> accessibleComputeResourceIds)
throws RegistryServiceException {
- return registryService.getAccessibleApplicationDeployments(
- gatewayId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
+ try {
+ List<org.apache.airavata.common.model.ApplicationDeploymentDescription>
+ domainApplicationDeploymentDescriptions = registryService.getAccessibleApplicationDeployments(
+ gatewayId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
+ return domainApplicationDeploymentDescriptions.stream()
+ .map(applicationDeploymentDescriptionMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get accessible application deployments");
+ }
}
/**
@@ -731,8 +1231,18 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
List<String> accessibleAppDeploymentIds,
List<String> accessibleComputeResourceIds)
throws RegistryServiceException {
- return registryService.getAccessibleApplicationDeploymentsForAppModule(
- gatewayId, appModuleId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
+ try {
+ List<org.apache.airavata.common.model.ApplicationDeploymentDescription>
+ domainApplicationDeploymentDescriptions =
+ registryService.getAccessibleApplicationDeploymentsForAppModule(
+ gatewayId, appModuleId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
+ return domainApplicationDeploymentDescriptions.stream()
+ .map(applicationDeploymentDescriptionMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(
+ e, "Failed to get accessible application deployments for app module");
+ }
}
/**
@@ -744,13 +1254,25 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<String> getAppModuleDeployedResources(String appModuleId) throws RegistryServiceException {
- return registryService.getAppModuleDeployedResources(appModuleId);
+ try {
+ return registryService.getAppModuleDeployedResources(appModuleId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get app module deployed resources");
+ }
}
@Override
public List<ApplicationDeploymentDescription> getApplicationDeployments(String appModuleId)
throws RegistryServiceException {
- return registryService.getApplicationDeployments(appModuleId);
+ try {
+ List<org.apache.airavata.common.model.ApplicationDeploymentDescription>
+ domainApplicationDeploymentDescriptions = registryService.getApplicationDeployments(appModuleId);
+ return domainApplicationDeploymentDescriptions.stream()
+ .map(applicationDeploymentDescriptionMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get application deployments");
+ }
}
/**
@@ -763,7 +1285,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public ApplicationInterfaceDescription getApplicationInterface(String appInterfaceId)
throws RegistryServiceException {
- return registryService.getApplicationInterface(appInterfaceId);
+ try {
+ org.apache.airavata.common.model.ApplicationInterfaceDescription domainApplicationInterfaceDescription =
+ registryService.getApplicationInterface(appInterfaceId);
+ return applicationInterfaceDescriptionMapper.toThrift(domainApplicationInterfaceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get application interface");
+ }
}
/**
@@ -775,7 +1303,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteApplicationInterface(String appInterfaceId) throws RegistryServiceException {
- return registryService.deleteApplicationInterface(appInterfaceId);
+ try {
+ return registryService.deleteApplicationInterface(appInterfaceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete application interface");
+ }
}
/**
@@ -787,7 +1319,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public Map<String, String> getAllApplicationInterfaceNames(String gatewayId) throws RegistryServiceException {
- return registryService.getAllApplicationInterfaceNames(gatewayId);
+ try {
+ return registryService.getAllApplicationInterfaceNames(gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all application interface names");
+ }
}
/**
@@ -800,7 +1336,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId)
throws RegistryServiceException {
- return registryService.getAllApplicationInterfaces(gatewayId);
+ try {
+ List<org.apache.airavata.common.model.ApplicationInterfaceDescription>
+ domainApplicationInterfaceDescriptions = registryService.getAllApplicationInterfaces(gatewayId);
+ return domainApplicationInterfaceDescriptions.stream()
+ .map(applicationInterfaceDescriptionMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all application interfaces");
+ }
}
/**
@@ -812,7 +1356,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<InputDataObjectType> getApplicationInputs(String appInterfaceId) throws RegistryServiceException {
- return registryService.getApplicationInputs(appInterfaceId);
+ try {
+ List<org.apache.airavata.common.model.InputDataObjectType> domainInputs =
+ registryService.getApplicationInputs(appInterfaceId);
+ return domainInputs.stream()
+ .map(inputDataObjectTypeMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get application inputs");
+ }
}
/**
@@ -824,7 +1376,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<OutputDataObjectType> getApplicationOutputs(String appInterfaceId) throws RegistryServiceException {
- return registryService.getApplicationOutputs(appInterfaceId);
+ try {
+ List<org.apache.airavata.common.model.OutputDataObjectType> domainOutputs =
+ registryService.getApplicationOutputs(appInterfaceId);
+ return domainOutputs.stream()
+ .map(outputDataObjectTypeMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get application outputs");
+ }
}
/**
@@ -838,7 +1398,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public Map<String, String> getAvailableAppInterfaceComputeResources(String appInterfaceId)
throws RegistryServiceException {
- return registryService.getAvailableAppInterfaceComputeResources(appInterfaceId);
+ try {
+ return registryService.getAvailableAppInterfaceComputeResources(appInterfaceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get available app interface compute resources");
+ }
}
/**
@@ -850,7 +1414,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public ComputeResourceDescription getComputeResource(String computeResourceId) throws RegistryServiceException {
- return registryService.getComputeResource(computeResourceId);
+ try {
+ org.apache.airavata.common.model.ComputeResourceDescription domainComputeResourceDescription =
+ registryService.getComputeResource(computeResourceId);
+ return computeResourceDescriptionMapper.toThrift(domainComputeResourceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get compute resource");
+ }
}
/**
@@ -861,7 +1431,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public Map<String, String> getAllComputeResourceNames() throws RegistryServiceException {
- return registryService.getAllComputeResourceNames();
+ try {
+ return registryService.getAllComputeResourceNames();
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all compute resource names");
+ }
}
/**
@@ -873,7 +1447,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteComputeResource(String computeResourceId) throws RegistryServiceException {
- return registryService.deleteComputeResource(computeResourceId);
+ try {
+ return registryService.deleteComputeResource(computeResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete compute resource");
+ }
}
/**
@@ -885,7 +1463,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public StorageResourceDescription getStorageResource(String storageResourceId) throws RegistryServiceException {
- return registryService.getStorageResource(storageResourceId);
+ try {
+ org.apache.airavata.common.model.StorageResourceDescription domainStorageResourceDescription =
+ registryService.getStorageResource(storageResourceId);
+ return storageResourceDescriptionMapper.toThrift(domainStorageResourceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get storage resource");
+ }
}
/**
@@ -896,7 +1480,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public Map<String, String> getAllStorageResourceNames() throws RegistryServiceException {
- return registryService.getAllStorageResourceNames();
+ try {
+ return registryService.getAllStorageResourceNames();
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all storage resource names");
+ }
}
/**
@@ -908,7 +1496,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteStorageResource(String storageResourceId) throws RegistryServiceException {
- return registryService.deleteStorageResource(storageResourceId);
+ try {
+ return registryService.deleteStorageResource(storageResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete storage resource");
+ }
}
/**
@@ -918,7 +1510,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public LOCALSubmission getLocalJobSubmission(String jobSubmissionId) throws RegistryServiceException {
- return registryService.getLocalJobSubmission(jobSubmissionId);
+ try {
+ org.apache.airavata.common.model.LOCALSubmission domainLocalSubmission =
+ registryService.getLocalJobSubmission(jobSubmissionId);
+ return localSubmissionMapper.toThrift(domainLocalSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get local job submission");
+ }
}
/**
@@ -928,7 +1526,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public SSHJobSubmission getSSHJobSubmission(String jobSubmissionId) throws RegistryServiceException {
- return registryService.getSSHJobSubmission(jobSubmissionId);
+ try {
+ org.apache.airavata.common.model.SSHJobSubmission domainSSHJobSubmission =
+ registryService.getSSHJobSubmission(jobSubmissionId);
+ return sshJobSubmissionMapper.toThrift(domainSSHJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get SSH job submission");
+ }
}
/**
@@ -945,7 +1549,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public UnicoreJobSubmission getUnicoreJobSubmission(String jobSubmissionId) throws RegistryServiceException {
- return registryService.getUnicoreJobSubmission(jobSubmissionId);
+ try {
+ org.apache.airavata.common.model.UnicoreJobSubmission domainUnicoreJobSubmission =
+ registryService.getUnicoreJobSubmission(jobSubmissionId);
+ return unicoreJobSubmissionMapper.toThrift(domainUnicoreJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get Unicore job submission");
+ }
}
/**
@@ -960,7 +1570,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public CloudJobSubmission getCloudJobSubmission(String jobSubmissionId) throws RegistryServiceException {
- return registryService.getCloudJobSubmission(jobSubmissionId);
+ try {
+ org.apache.airavata.common.model.CloudJobSubmission domainCloudJobSubmission =
+ registryService.getCloudJobSubmission(jobSubmissionId);
+ return cloudJobSubmissionMapper.toThrift(domainCloudJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get cloud job submission");
+ }
}
/**
@@ -971,7 +1587,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public LOCALDataMovement getLocalDataMovement(String dataMovementId) throws RegistryServiceException {
- return registryService.getLocalDataMovement(dataMovementId);
+ try {
+ org.apache.airavata.common.model.LOCALDataMovement domainLocalDataMovement =
+ registryService.getLocalDataMovement(dataMovementId);
+ return localDataMovementMapper.toThrift(domainLocalDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get local data movement");
+ }
}
/**
@@ -982,7 +1604,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public SCPDataMovement getSCPDataMovement(String dataMovementId) throws RegistryServiceException {
- return registryService.getSCPDataMovement(dataMovementId);
+ try {
+ org.apache.airavata.common.model.SCPDataMovement domainSCPDataMovement =
+ registryService.getSCPDataMovement(dataMovementId);
+ return scpDataMovementMapper.toThrift(domainSCPDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get SCP data movement");
+ }
}
/**
@@ -993,7 +1621,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public UnicoreDataMovement getUnicoreDataMovement(String dataMovementId) throws RegistryServiceException {
- return registryService.getUnicoreDataMovement(dataMovementId);
+ try {
+ org.apache.airavata.common.model.UnicoreDataMovement domainUnicoreDataMovement =
+ registryService.getUnicoreDataMovement(dataMovementId);
+ return unicoreDataMovementMapper.toThrift(domainUnicoreDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get Unicore data movement");
+ }
}
/**
@@ -1004,7 +1638,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public GridFTPDataMovement getGridFTPDataMovement(String dataMovementId) throws RegistryServiceException {
- return registryService.getGridFTPDataMovement(dataMovementId);
+ try {
+ org.apache.airavata.common.model.GridFTPDataMovement domainGridFTPDataMovement =
+ registryService.getGridFTPDataMovement(dataMovementId);
+ return gridFTPDataMovementMapper.toThrift(domainGridFTPDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get GridFTP data movement");
+ }
}
/**
@@ -1072,17 +1712,31 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean deleteJobSubmissionInterface(String computeResourceId, String jobSubmissionInterfaceId)
throws RegistryServiceException {
- return registryService.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
+ try {
+ return registryService.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete job submission interface");
+ }
}
@Override
public ResourceJobManager getResourceJobManager(String resourceJobManagerId) throws RegistryServiceException {
- return registryService.getResourceJobManager(resourceJobManagerId);
+ try {
+ org.apache.airavata.common.model.ResourceJobManager domainResourceJobManager =
+ registryService.getResourceJobManager(resourceJobManagerId);
+ return resourceJobManagerMapper.toThrift(domainResourceJobManager);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get resource job manager");
+ }
}
@Override
public boolean deleteResourceJobManager(String resourceJobManagerId) throws RegistryServiceException {
- return registryService.deleteResourceJobManager(resourceJobManagerId);
+ try {
+ return registryService.deleteResourceJobManager(resourceJobManagerId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete resource job manager");
+ }
}
/**
@@ -1095,7 +1749,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteBatchQueue(String computeResourceId, String queueName) throws RegistryServiceException {
- return registryService.deleteBatchQueue(computeResourceId, queueName);
+ try {
+ return registryService.deleteBatchQueue(computeResourceId, queueName);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete batch queue");
+ }
}
/**
@@ -1107,7 +1765,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public GatewayResourceProfile getGatewayResourceProfile(String gatewayID) throws RegistryServiceException {
- return registryService.getGatewayResourceProfile(gatewayID);
+ try {
+ org.apache.airavata.common.model.GatewayResourceProfile domainGatewayResourceProfile =
+ registryService.getGatewayResourceProfile(gatewayID);
+ return gatewayResourceProfileMapper.toThrift(domainGatewayResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get gateway resource profile");
+ }
}
/**
@@ -1119,7 +1783,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteGatewayResourceProfile(String gatewayID) throws RegistryServiceException {
- return registryService.deleteGatewayResourceProfile(gatewayID);
+ try {
+ return registryService.deleteGatewayResourceProfile(gatewayID);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete gateway resource profile");
+ }
}
/**
@@ -1133,7 +1801,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayID, String computeResourceId)
throws RegistryServiceException {
- return registryService.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
+ try {
+ org.apache.airavata.common.model.ComputeResourcePreference domainComputeResourcePreference =
+ registryService.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
+ return computeResourcePreferenceMapper.toThrift(domainComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get gateway compute resource preference");
+ }
}
/**
@@ -1147,7 +1821,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public StoragePreference getGatewayStoragePreference(String gatewayID, String storageId)
throws RegistryServiceException {
- return registryService.getGatewayStoragePreference(gatewayID, storageId);
+ try {
+ org.apache.airavata.common.model.StoragePreference domainStoragePreference =
+ registryService.getGatewayStoragePreference(gatewayID, storageId);
+ return storagePreferenceMapper.toThrift(domainStoragePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get gateway storage preference");
+ }
}
/**
@@ -1160,7 +1840,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<ComputeResourcePreference> getAllGatewayComputeResourcePreferences(String gatewayID)
throws RegistryServiceException {
- return registryService.getAllGatewayComputeResourcePreferences(gatewayID);
+ try {
+ List<org.apache.airavata.common.model.ComputeResourcePreference> domainComputeResourcePreferences =
+ registryService.getAllGatewayComputeResourcePreferences(gatewayID);
+ return domainComputeResourcePreferences.stream()
+ .map(computeResourcePreferenceMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all gateway compute resource preferences");
+ }
}
/**
@@ -1172,7 +1860,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<StoragePreference> getAllGatewayStoragePreferences(String gatewayID) throws RegistryServiceException {
- return registryService.getAllGatewayStoragePreferences(gatewayID);
+ try {
+ List<org.apache.airavata.common.model.StoragePreference> domainStoragePreferences =
+ registryService.getAllGatewayStoragePreferences(gatewayID);
+ return domainStoragePreferences.stream()
+ .map(storagePreferenceMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all gateway storage preferences");
+ }
}
/**
@@ -1183,7 +1879,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<GatewayResourceProfile> getAllGatewayResourceProfiles() throws RegistryServiceException {
- return registryService.getAllGatewayResourceProfiles();
+ try {
+ List<org.apache.airavata.common.model.GatewayResourceProfile> domainGatewayResourceProfiles =
+ registryService.getAllGatewayResourceProfiles();
+ return domainGatewayResourceProfiles.stream()
+ .map(gatewayResourceProfileMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all gateway resource profiles");
+ }
}
/**
@@ -1197,7 +1901,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean deleteGatewayComputeResourcePreference(String gatewayID, String computeResourceId)
throws RegistryServiceException {
- return registryService.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
+ try {
+ return registryService.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete gateway compute resource preference");
+ }
}
/**
@@ -1210,126 +1918,254 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteGatewayStoragePreference(String gatewayID, String storageId) throws RegistryServiceException {
- return registryService.deleteGatewayStoragePreference(gatewayID, storageId);
+ try {
+ return registryService.deleteGatewayStoragePreference(gatewayID, storageId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete gateway storage preference");
+ }
}
@Override
public DataProductModel getDataProduct(String productUri) throws RegistryServiceException {
- return registryService.getDataProduct(productUri);
+ try {
+ org.apache.airavata.common.model.DataProductModel domainDataProductModel =
+ registryService.getDataProduct(productUri);
+ return dataProductModelMapper.toThrift(domainDataProductModel);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get data product");
+ }
}
@Override
public DataProductModel getParentDataProduct(String productUri) throws RegistryServiceException {
- return registryService.getParentDataProduct(productUri);
+ try {
+ org.apache.airavata.common.model.DataProductModel domainDataProductModel =
+ registryService.getParentDataProduct(productUri);
+ return dataProductModelMapper.toThrift(domainDataProductModel);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get parent data product");
+ }
}
@Override
public List<DataProductModel> getChildDataProducts(String productUri) throws RegistryServiceException {
- return registryService.getChildDataProducts(productUri);
+ try {
+ List<org.apache.airavata.common.model.DataProductModel> domainDataProductModels =
+ registryService.getChildDataProducts(productUri);
+ return domainDataProductModels.stream()
+ .map(dataProductModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(
+ e, "Failed to get child data products for productUri=" + productUri);
+ }
}
@Override
public List<DataProductModel> searchDataProductsByName(
String gatewayId, String userId, String productName, int limit, int offset)
throws RegistryServiceException {
- return registryService.searchDataProductsByName(gatewayId, userId, productName, limit, offset);
+ try {
+ List<org.apache.airavata.common.model.DataProductModel> domainDataProductModels =
+ registryService.searchDataProductsByName(gatewayId, userId, productName, limit, offset);
+ return domainDataProductModels.stream()
+ .map(dataProductModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to search data products by name");
+ }
}
@Override
public String createGroupResourceProfile(GroupResourceProfile groupResourceProfile)
throws RegistryServiceException {
- return registryService.createGroupResourceProfile(groupResourceProfile);
+ try {
+ org.apache.airavata.common.model.GroupResourceProfile domainGroupResourceProfile =
+ groupResourceProfileMapper.toDomain(groupResourceProfile);
+ return registryService.createGroupResourceProfile(domainGroupResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to create group resource profile");
+ }
}
@Override
public void updateGroupResourceProfile(GroupResourceProfile groupResourceProfile) throws RegistryServiceException {
- registryService.updateGroupResourceProfile(groupResourceProfile);
+ try {
+ org.apache.airavata.common.model.GroupResourceProfile domainGroupResourceProfile =
+ groupResourceProfileMapper.toDomain(groupResourceProfile);
+ registryService.updateGroupResourceProfile(domainGroupResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update group resource profile");
+ }
}
@Override
public GroupResourceProfile getGroupResourceProfile(String groupResourceProfileId) throws RegistryServiceException {
- return registryService.getGroupResourceProfile(groupResourceProfileId);
+ try {
+ org.apache.airavata.common.model.GroupResourceProfile domainGroupResourceProfile =
+ registryService.getGroupResourceProfile(groupResourceProfileId);
+ return groupResourceProfileMapper.toThrift(domainGroupResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group resource profile");
+ }
}
@Override
public boolean isGroupResourceProfileExists(String groupResourceProfileId) throws RegistryServiceException {
- return registryService.isGroupResourceProfileExists(groupResourceProfileId);
+ try {
+ return registryService.isGroupResourceProfileExists(groupResourceProfileId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if group resource profile exists");
+ }
}
@Override
public boolean removeGroupResourceProfile(String groupResourceProfileId) throws RegistryServiceException {
- return registryService.removeGroupResourceProfile(groupResourceProfileId);
+ try {
+ return registryService.removeGroupResourceProfile(groupResourceProfileId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove group resource profile");
+ }
}
@Override
public List<GroupResourceProfile> getGroupResourceList(String gatewayId, List<String> accessibleGroupResProfileIds)
throws RegistryServiceException {
- return registryService.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
+ try {
+ List<org.apache.airavata.common.model.GroupResourceProfile> domainGroupResourceProfiles =
+ registryService.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
+ return domainGroupResourceProfiles.stream()
+ .map(groupResourceProfileMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group resource list");
+ }
}
@Override
public boolean removeGroupComputePrefs(String computeResourceId, String groupResourceProfileId)
throws RegistryServiceException {
- return registryService.removeGroupComputePrefs(computeResourceId, groupResourceProfileId);
+ try {
+ return registryService.removeGroupComputePrefs(computeResourceId, groupResourceProfileId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove group compute prefs");
+ }
}
@Override
public boolean removeGroupComputeResourcePolicy(String resourcePolicyId) throws RegistryServiceException {
- return registryService.removeGroupComputeResourcePolicy(resourcePolicyId);
+ try {
+ return registryService.removeGroupComputeResourcePolicy(resourcePolicyId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove group compute resource policy");
+ }
}
@Override
public boolean removeGroupBatchQueueResourcePolicy(String resourcePolicyId) throws RegistryServiceException {
- return registryService.removeGroupBatchQueueResourcePolicy(resourcePolicyId);
+ try {
+ return registryService.removeGroupBatchQueueResourcePolicy(resourcePolicyId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove group batch queue resource policy");
+ }
}
@Override
public GroupComputeResourcePreference getGroupComputeResourcePreference(
String computeResourceId, String groupResourceProfileId) throws RegistryServiceException {
- return registryService.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId);
+ try {
+ org.apache.airavata.common.model.GroupComputeResourcePreference domainGroupComputeResourcePreference =
+ registryService.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId);
+ return groupComputeResourcePreferenceMapper.toThrift(domainGroupComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group compute resource preference");
+ }
}
@Override
public boolean isGroupComputeResourcePreferenceExists(String computeResourceId, String groupResourceProfileId)
throws RegistryServiceException {
- return registryService.isGroupComputeResourcePreferenceExists(computeResourceId, groupResourceProfileId);
+ try {
+ return registryService.isGroupComputeResourcePreferenceExists(computeResourceId, groupResourceProfileId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if group compute resource preference exists");
+ }
}
@Override
public ComputeResourcePolicy getGroupComputeResourcePolicy(String resourcePolicyId)
throws RegistryServiceException {
- return registryService.getGroupComputeResourcePolicy(resourcePolicyId);
+ try {
+ org.apache.airavata.common.model.ComputeResourcePolicy domainComputeResourcePolicy =
+ registryService.getGroupComputeResourcePolicy(resourcePolicyId);
+ return computeResourcePolicyMapper.toThrift(domainComputeResourcePolicy);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group compute resource policy");
+ }
}
@Override
public BatchQueueResourcePolicy getBatchQueueResourcePolicy(String resourcePolicyId)
throws RegistryServiceException {
- return registryService.getBatchQueueResourcePolicy(resourcePolicyId);
+ try {
+ org.apache.airavata.common.model.BatchQueueResourcePolicy domainBatchQueueResourcePolicy =
+ registryService.getBatchQueueResourcePolicy(resourcePolicyId);
+ return batchQueueResourcePolicyMapper.toThrift(domainBatchQueueResourcePolicy);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get batch queue resource policy");
+ }
}
@Override
public List<GroupComputeResourcePreference> getGroupComputeResourcePrefList(String groupResourceProfileId)
throws RegistryServiceException {
- return registryService.getGroupComputeResourcePrefList(groupResourceProfileId);
+ try {
+ List<org.apache.airavata.common.model.GroupComputeResourcePreference>
+ domainGroupComputeResourcePreferences =
+ registryService.getGroupComputeResourcePrefList(groupResourceProfileId);
+ return domainGroupComputeResourcePreferences.stream()
+ .map(groupComputeResourcePreferenceMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group compute resource pref list");
+ }
}
@Override
public List<BatchQueueResourcePolicy> getGroupBatchQueueResourcePolicyList(String groupResourceProfileId)
throws RegistryServiceException {
- return registryService.getGroupBatchQueueResourcePolicyList(groupResourceProfileId);
+ try {
+ List<org.apache.airavata.common.model.BatchQueueResourcePolicy> domainBatchQueueResourcePolicies =
+ registryService.getGroupBatchQueueResourcePolicyList(groupResourceProfileId);
+ return domainBatchQueueResourcePolicies.stream()
+ .map(batchQueueResourcePolicyMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group batch queue resource policy list");
+ }
}
@Override
public List<ComputeResourcePolicy> getGroupComputeResourcePolicyList(String groupResourceProfileId)
throws RegistryServiceException {
- return registryService.getGroupComputeResourcePolicyList(groupResourceProfileId);
+ try {
+ List<org.apache.airavata.common.model.ComputeResourcePolicy> domainComputeResourcePolicies =
+ registryService.getGroupComputeResourcePolicyList(groupResourceProfileId);
+ return domainComputeResourcePolicies.stream()
+ .map(computeResourcePolicyMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get group compute resource policy list");
+ }
}
@Override
public String registerReplicaLocation(DataReplicaLocationModel replicaLocationModel)
throws RegistryServiceException {
try {
- return registryService.registerReplicaLocation(replicaLocationModel);
+ org.apache.airavata.common.model.DataReplicaLocationModel domainReplicaLocationModel =
+ dataReplicaLocationModelMapper.toDomain(replicaLocationModel);
+ return registryService.registerReplicaLocation(domainReplicaLocationModel);
} catch (Throwable e) {
throw convertToRegistryServiceException(
e, "Error in retreiving the replica " + replicaLocationModel.getReplicaName());
@@ -1344,7 +2180,9 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerDataProduct(DataProductModel dataProductModel) throws RegistryServiceException {
try {
- return registryService.registerDataProduct(dataProductModel);
+ org.apache.airavata.common.model.DataProductModel domainDataProductModel =
+ dataProductModelMapper.toDomain(dataProductModel);
+ return registryService.registerDataProduct(domainDataProductModel);
} catch (Throwable e) {
throw convertToRegistryServiceException(
e, "Error in registering the data resource" + dataProductModel.getProductName());
@@ -1363,7 +2201,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateGatewayStoragePreference(
String gatewayID, String storageId, StoragePreference storagePreference) throws RegistryServiceException {
- return registryService.updateGatewayStoragePreference(gatewayID, storageId, storagePreference);
+ try {
+ org.apache.airavata.common.model.StoragePreference domainStoragePreference =
+ storagePreferenceMapper.toDomain(storagePreference);
+ return registryService.updateGatewayStoragePreference(gatewayID, storageId, domainStoragePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update gateway storage preference");
+ }
}
/**
@@ -1379,8 +2223,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean updateGatewayComputeResourcePreference(
String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference)
throws RegistryServiceException {
- return registryService.updateGatewayComputeResourcePreference(
- gatewayID, computeResourceId, computeResourcePreference);
+ try {
+ org.apache.airavata.common.model.ComputeResourcePreference domainComputeResourcePreference =
+ computeResourcePreferenceMapper.toDomain(computeResourcePreference);
+ return registryService.updateGatewayComputeResourcePreference(
+ gatewayID, computeResourceId, domainComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update gateway compute resource preference");
+ }
}
/**
@@ -1397,7 +2247,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean addGatewayStoragePreference(
String gatewayID, String storageResourceId, StoragePreference dataStoragePreference)
throws RegistryServiceException {
- return registryService.addGatewayStoragePreference(gatewayID, storageResourceId, dataStoragePreference);
+ try {
+ org.apache.airavata.common.model.StoragePreference domainStoragePreference =
+ storagePreferenceMapper.toDomain(dataStoragePreference);
+ return registryService.addGatewayStoragePreference(gatewayID, storageResourceId, domainStoragePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add gateway storage preference");
+ }
}
/**
@@ -1414,8 +2270,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean addGatewayComputeResourcePreference(
String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference)
throws RegistryServiceException {
- return registryService.addGatewayComputeResourcePreference(
- gatewayID, computeResourceId, computeResourcePreference);
+ try {
+ org.apache.airavata.common.model.ComputeResourcePreference domainComputeResourcePreference =
+ computeResourcePreferenceMapper.toDomain(computeResourcePreference);
+ return registryService.addGatewayComputeResourcePreference(
+ gatewayID, computeResourceId, domainComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add gateway compute resource preference");
+ }
}
/**
@@ -1429,7 +2291,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateGatewayResourceProfile(String gatewayID, GatewayResourceProfile gatewayResourceProfile)
throws RegistryServiceException {
- return registryService.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
+ try {
+ org.apache.airavata.common.model.GatewayResourceProfile domainGatewayResourceProfile =
+ gatewayResourceProfileMapper.toDomain(gatewayResourceProfile);
+ return registryService.updateGatewayResourceProfile(gatewayID, domainGatewayResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update gateway resource profile");
+ }
}
/**
@@ -1444,18 +2312,36 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile)
throws RegistryServiceException {
- return registryService.registerGatewayResourceProfile(gatewayResourceProfile);
+ try {
+ org.apache.airavata.common.model.GatewayResourceProfile domainGatewayResourceProfile =
+ gatewayResourceProfileMapper.toDomain(gatewayResourceProfile);
+ return registryService.registerGatewayResourceProfile(domainGatewayResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register gateway resource profile");
+ }
}
@Override
public boolean updateResourceJobManager(String resourceJobManagerId, ResourceJobManager updatedResourceJobManager)
throws RegistryServiceException {
- return registryService.updateResourceJobManager(resourceJobManagerId, updatedResourceJobManager);
+ try {
+ org.apache.airavata.common.model.ResourceJobManager domainResourceJobManager =
+ resourceJobManagerMapper.toDomain(updatedResourceJobManager);
+ return registryService.updateResourceJobManager(resourceJobManagerId, domainResourceJobManager);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update resource job manager");
+ }
}
@Override
public String registerResourceJobManager(ResourceJobManager resourceJobManager) throws RegistryServiceException {
- return registryService.registerResourceJobManager(resourceJobManager);
+ try {
+ org.apache.airavata.common.model.ResourceJobManager domainResourceJobManager =
+ resourceJobManagerMapper.toDomain(resourceJobManager);
+ return registryService.registerResourceJobManager(domainResourceJobManager);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register resource job manager");
+ }
}
/**
@@ -1469,7 +2355,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean deleteDataMovementInterface(String resourceId, String dataMovementInterfaceId, DMType dmType)
throws RegistryServiceException {
- return registryService.deleteDataMovementInterface(resourceId, dataMovementInterfaceId, dmType);
+ try {
+ org.apache.airavata.common.model.DMType domainDMType =
+ org.apache.airavata.common.model.DMType.valueOf(dmType.name());
+ return registryService.deleteDataMovementInterface(resourceId, dataMovementInterfaceId, domainDMType);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete data movement interface");
+ }
}
/**
@@ -1503,8 +2395,16 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addGridFTPDataMovementDetails(
String computeResourceId, DMType dmType, int priorityOrder, GridFTPDataMovement gridFTPDataMovement)
throws RegistryServiceException {
- return registryService.addGridFTPDataMovementDetails(
- computeResourceId, dmType, priorityOrder, gridFTPDataMovement);
+ try {
+ org.apache.airavata.common.model.DMType domainDMType =
+ org.apache.airavata.common.model.DMType.valueOf(dmType.name());
+ org.apache.airavata.common.model.GridFTPDataMovement domainGridFTPDataMovement =
+ gridFTPDataMovementMapper.toDomain(gridFTPDataMovement);
+ return registryService.addGridFTPDataMovementDetails(
+ computeResourceId, domainDMType, priorityOrder, domainGridFTPDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add GridFTP data movement details");
+ }
}
/**
@@ -1538,7 +2438,16 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addUnicoreDataMovementDetails(
String resourceId, DMType dmType, int priorityOrder, UnicoreDataMovement unicoreDataMovement)
throws RegistryServiceException {
- return registryService.addUnicoreDataMovementDetails(resourceId, dmType, priorityOrder, unicoreDataMovement);
+ try {
+ org.apache.airavata.common.model.DMType domainDMType =
+ org.apache.airavata.common.model.DMType.valueOf(dmType.name());
+ org.apache.airavata.common.model.UnicoreDataMovement domainUnicoreDataMovement =
+ unicoreDataMovementMapper.toDomain(unicoreDataMovement);
+ return registryService.addUnicoreDataMovementDetails(
+ resourceId, domainDMType, priorityOrder, domainUnicoreDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add Unicore data movement details");
+ }
}
/**
@@ -1553,7 +2462,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateSCPDataMovementDetails(String dataMovementInterfaceId, SCPDataMovement scpDataMovement)
throws RegistryServiceException {
- return registryService.updateSCPDataMovementDetails(dataMovementInterfaceId, scpDataMovement);
+ try {
+ org.apache.airavata.common.model.SCPDataMovement domainSCPDataMovement =
+ scpDataMovementMapper.toDomain(scpDataMovement);
+ return registryService.updateSCPDataMovementDetails(dataMovementInterfaceId, domainSCPDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update SCP data movement details");
+ }
}
/**
@@ -1572,7 +2487,16 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addSCPDataMovementDetails(
String resourceId, DMType dmType, int priorityOrder, SCPDataMovement scpDataMovement)
throws RegistryServiceException {
- return registryService.addSCPDataMovementDetails(resourceId, dmType, priorityOrder, scpDataMovement);
+ try {
+ org.apache.airavata.common.model.DMType domainDMType =
+ org.apache.airavata.common.model.DMType.valueOf(dmType.name());
+ org.apache.airavata.common.model.SCPDataMovement domainSCPDataMovement =
+ scpDataMovementMapper.toDomain(scpDataMovement);
+ return registryService.addSCPDataMovementDetails(
+ resourceId, domainDMType, priorityOrder, domainSCPDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add SCP data movement details");
+ }
}
/**
@@ -1586,7 +2510,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateLocalDataMovementDetails(String dataMovementInterfaceId, LOCALDataMovement localDataMovement)
throws RegistryServiceException {
- return registryService.updateLocalDataMovementDetails(dataMovementInterfaceId, localDataMovement);
+ try {
+ org.apache.airavata.common.model.LOCALDataMovement domainLocalDataMovement =
+ localDataMovementMapper.toDomain(localDataMovement);
+ return registryService.updateLocalDataMovementDetails(dataMovementInterfaceId, domainLocalDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update local data movement details");
+ }
}
/**
@@ -1605,7 +2535,16 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addLocalDataMovementDetails(
String resourceId, DMType dataMoveType, int priorityOrder, LOCALDataMovement localDataMovement)
throws RegistryServiceException {
- return registryService.addLocalDataMovementDetails(resourceId, dataMoveType, priorityOrder, localDataMovement);
+ try {
+ org.apache.airavata.common.model.DMType domainDMType =
+ org.apache.airavata.common.model.DMType.valueOf(dataMoveType.name());
+ org.apache.airavata.common.model.LOCALDataMovement domainLocalDataMovement =
+ localDataMovementMapper.toDomain(localDataMovement);
+ return registryService.addLocalDataMovementDetails(
+ resourceId, domainDMType, priorityOrder, domainLocalDataMovement);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add local data movement details");
+ }
}
/**
@@ -1634,7 +2573,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateCloudJobSubmissionDetails(String jobSubmissionInterfaceId, CloudJobSubmission sshJobSubmission)
throws RegistryServiceException {
- return registryService.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, sshJobSubmission);
+ try {
+ org.apache.airavata.common.model.CloudJobSubmission domainCloudJobSubmission =
+ cloudJobSubmissionMapper.toDomain(sshJobSubmission);
+ return registryService.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, domainCloudJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update cloud job submission details");
+ }
}
/**
@@ -1648,7 +2593,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateSSHJobSubmissionDetails(String jobSubmissionInterfaceId, SSHJobSubmission sshJobSubmission)
throws RegistryServiceException {
- return registryService.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, sshJobSubmission);
+ try {
+ org.apache.airavata.common.model.SSHJobSubmission domainSSHJobSubmission =
+ sshJobSubmissionMapper.toDomain(sshJobSubmission);
+ return registryService.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, domainSSHJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update SSH job submission details");
+ }
}
/**
@@ -1678,7 +2629,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addCloudJobSubmissionDetails(
String computeResourceId, int priorityOrder, CloudJobSubmission cloudSubmission)
throws RegistryServiceException {
- return registryService.addCloudJobSubmissionDetails(computeResourceId, priorityOrder, cloudSubmission);
+ try {
+ org.apache.airavata.common.model.CloudJobSubmission domainCloudJobSubmission =
+ cloudJobSubmissionMapper.toDomain(cloudSubmission);
+ return registryService.addCloudJobSubmissionDetails(
+ computeResourceId, priorityOrder, domainCloudJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add cloud job submission details");
+ }
}
/**
@@ -1695,7 +2653,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addUNICOREJobSubmissionDetails(
String computeResourceId, int priorityOrder, UnicoreJobSubmission unicoreJobSubmission)
throws RegistryServiceException {
- return registryService.addUNICOREJobSubmissionDetails(computeResourceId, priorityOrder, unicoreJobSubmission);
+ try {
+ org.apache.airavata.common.model.UnicoreJobSubmission domainUnicoreJobSubmission =
+ unicoreJobSubmissionMapper.toDomain(unicoreJobSubmission);
+ return registryService.addUNICOREJobSubmissionDetails(
+ computeResourceId, priorityOrder, domainUnicoreJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add UNICORE job submission details");
+ }
}
/**
@@ -1712,7 +2677,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addSSHForkJobSubmissionDetails(
String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
throws RegistryServiceException {
- return registryService.addSSHForkJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
+ try {
+ org.apache.airavata.common.model.SSHJobSubmission domainSSHJobSubmission =
+ sshJobSubmissionMapper.toDomain(sshJobSubmission);
+ return registryService.addSSHForkJobSubmissionDetails(
+ computeResourceId, priorityOrder, domainSSHJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add SSH fork job submission details");
+ }
}
/**
@@ -1729,7 +2701,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addSSHJobSubmissionDetails(
String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
throws RegistryServiceException {
- return registryService.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
+ try {
+ org.apache.airavata.common.model.SSHJobSubmission domainSSHJobSubmission =
+ sshJobSubmissionMapper.toDomain(sshJobSubmission);
+ return registryService.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, domainSSHJobSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add SSH job submission details");
+ }
}
/**
@@ -1743,7 +2721,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateLocalSubmissionDetails(String jobSubmissionInterfaceId, LOCALSubmission localSubmission)
throws RegistryServiceException {
- return registryService.updateLocalSubmissionDetails(jobSubmissionInterfaceId, localSubmission);
+ try {
+ org.apache.airavata.common.model.LOCALSubmission domainLocalSubmission =
+ localSubmissionMapper.toDomain(localSubmission);
+ return registryService.updateLocalSubmissionDetails(jobSubmissionInterfaceId, domainLocalSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update local submission details");
+ }
}
/**
@@ -1760,7 +2744,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public String addLocalSubmissionDetails(
String computeResourceId, int priorityOrder, LOCALSubmission localSubmission)
throws RegistryServiceException {
- return registryService.addLocalSubmissionDetails(computeResourceId, priorityOrder, localSubmission);
+ try {
+ org.apache.airavata.common.model.LOCALSubmission domainLocalSubmission =
+ localSubmissionMapper.toDomain(localSubmission);
+ return registryService.addLocalSubmissionDetails(computeResourceId, priorityOrder, domainLocalSubmission);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add local submission details");
+ }
}
/**
@@ -1775,7 +2765,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean updateStorageResource(
String storageResourceId, StorageResourceDescription storageResourceDescription)
throws RegistryServiceException {
- return registryService.updateStorageResource(storageResourceId, storageResourceDescription);
+ try {
+ org.apache.airavata.common.model.StorageResourceDescription domainStorageResourceDescription =
+ storageResourceDescriptionMapper.toDomain(storageResourceDescription);
+ return registryService.updateStorageResource(storageResourceId, domainStorageResourceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update storage resource");
+ }
}
/**
@@ -1788,7 +2784,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerStorageResource(StorageResourceDescription storageResourceDescription)
throws RegistryServiceException {
- return registryService.registerStorageResource(storageResourceDescription);
+ try {
+ org.apache.airavata.common.model.StorageResourceDescription domainStorageResourceDescription =
+ storageResourceDescriptionMapper.toDomain(storageResourceDescription);
+ return registryService.registerStorageResource(domainStorageResourceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register storage resource");
+ }
}
/**
@@ -1803,7 +2805,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean updateComputeResource(
String computeResourceId, ComputeResourceDescription computeResourceDescription)
throws RegistryServiceException {
- return registryService.updateComputeResource(computeResourceId, computeResourceDescription);
+ try {
+ org.apache.airavata.common.model.ComputeResourceDescription domainComputeResourceDescription =
+ computeResourceDescriptionMapper.toDomain(computeResourceDescription);
+ return registryService.updateComputeResource(computeResourceId, domainComputeResourceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update compute resource");
+ }
}
/**
@@ -1816,7 +2824,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerComputeResource(ComputeResourceDescription computeResourceDescription)
throws RegistryServiceException {
- return registryService.registerComputeResource(computeResourceDescription);
+ try {
+ org.apache.airavata.common.model.ComputeResourceDescription domainComputeResourceDescription =
+ computeResourceDescriptionMapper.toDomain(computeResourceDescription);
+ return registryService.registerComputeResource(domainComputeResourceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register compute resource");
+ }
}
/**
@@ -1831,7 +2845,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean updateApplicationInterface(
String appInterfaceId, ApplicationInterfaceDescription applicationInterface)
throws RegistryServiceException {
- return registryService.updateApplicationInterface(appInterfaceId, applicationInterface);
+ try {
+ org.apache.airavata.common.model.ApplicationInterfaceDescription domainApplicationInterfaceDescription =
+ applicationInterfaceDescriptionMapper.toDomain(applicationInterface);
+ return registryService.updateApplicationInterface(appInterfaceId, domainApplicationInterfaceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update application interface");
+ }
}
/**
@@ -1845,7 +2865,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerApplicationInterface(String gatewayId, ApplicationInterfaceDescription applicationInterface)
throws RegistryServiceException {
- return registryService.registerApplicationInterface(gatewayId, applicationInterface);
+ try {
+ org.apache.airavata.common.model.ApplicationInterfaceDescription domainApplicationInterfaceDescription =
+ applicationInterfaceDescriptionMapper.toDomain(applicationInterface);
+ return registryService.registerApplicationInterface(gatewayId, domainApplicationInterfaceDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register application interface");
+ }
}
/**
@@ -1860,7 +2886,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean updateApplicationDeployment(
String appDeploymentId, ApplicationDeploymentDescription applicationDeployment)
throws RegistryServiceException {
- return registryService.updateApplicationDeployment(appDeploymentId, applicationDeployment);
+ try {
+ org.apache.airavata.common.model.ApplicationDeploymentDescription domainApplicationDeploymentDescription =
+ applicationDeploymentDescriptionMapper.toDomain(applicationDeployment);
+ return registryService.updateApplicationDeployment(appDeploymentId, domainApplicationDeploymentDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update application deployment");
+ }
}
/**
@@ -1874,7 +2906,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerApplicationDeployment(
String gatewayId, ApplicationDeploymentDescription applicationDeployment) throws RegistryServiceException {
- return registryService.registerApplicationDeployment(gatewayId, applicationDeployment);
+ try {
+ org.apache.airavata.common.model.ApplicationDeploymentDescription domainApplicationDeploymentDescription =
+ applicationDeploymentDescriptionMapper.toDomain(applicationDeployment);
+ return registryService.registerApplicationDeployment(gatewayId, domainApplicationDeploymentDescription);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register application deployment");
+ }
}
/**
@@ -1888,7 +2926,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateApplicationModule(String appModuleId, ApplicationModule applicationModule)
throws RegistryServiceException {
- return registryService.updateApplicationModule(appModuleId, applicationModule);
+ try {
+ org.apache.airavata.common.model.ApplicationModule domainApplicationModule =
+ applicationModuleMapper.toDomain(applicationModule);
+ return registryService.updateApplicationModule(appModuleId, domainApplicationModule);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update application module");
+ }
}
/**
@@ -1903,20 +2947,38 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public String registerApplicationModule(String gatewayId, ApplicationModule applicationModule)
throws RegistryServiceException {
- return registryService.registerApplicationModule(gatewayId, applicationModule);
+ try {
+ org.apache.airavata.common.model.ApplicationModule domainApplicationModule =
+ applicationModuleMapper.toDomain(applicationModule);
+ return registryService.registerApplicationModule(gatewayId, domainApplicationModule);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register application module");
+ }
}
@Override
public void updateResourceScheduleing(
String airavataExperimentId, ComputationalResourceSchedulingModel resourceScheduling)
throws RegistryServiceException {
- registryService.updateResourceScheduleing(airavataExperimentId, resourceScheduling);
+ try {
+ org.apache.airavata.common.model.ComputationalResourceSchedulingModel domainResourceScheduling =
+ computationalResourceSchedulingModelMapper.toDomain(resourceScheduling);
+ registryService.updateResourceScheduleing(airavataExperimentId, domainResourceScheduling);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update resource scheduling");
+ }
}
@Override
public void updateExperimentConfiguration(String airavataExperimentId, UserConfigurationDataModel userConfiguration)
throws RegistryServiceException {
- registryService.updateExperimentConfiguration(airavataExperimentId, userConfiguration);
+ try {
+ org.apache.airavata.common.model.UserConfigurationDataModel domainUserConfiguration =
+ userConfigurationDataModelMapper.toDomain(userConfiguration);
+ registryService.updateExperimentConfiguration(airavataExperimentId, domainUserConfiguration);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update experiment configuration");
+ }
}
/**
@@ -1946,7 +3008,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public void updateExperiment(String airavataExperimentId, ExperimentModel experiment)
throws RegistryServiceException {
- registryService.updateExperiment(airavataExperimentId, experiment);
+ try {
+ org.apache.airavata.common.model.ExperimentModel domainExperiment =
+ experimentModelMapper.toDomain(experiment);
+ registryService.updateExperiment(airavataExperimentId, domainExperiment);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update experiment");
+ }
}
/**
@@ -1995,7 +3063,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public String createExperiment(String gatewayId, ExperimentModel experiment) throws RegistryServiceException {
- return registryService.createExperiment(gatewayId, experiment);
+ try {
+ org.apache.airavata.common.model.ExperimentModel domainExperiment =
+ experimentModelMapper.toDomain(experiment);
+ return registryService.createExperiment(gatewayId, domainExperiment);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to create experiment");
+ }
}
/**
@@ -2019,7 +3093,24 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
int limit,
int offset)
throws RegistryServiceException {
- return registryService.searchExperiments(gatewayId, userName, accessibleExpIds, filters, limit, offset);
+ try {
+ Map<org.apache.airavata.common.model.ExperimentSearchFields, String> domainFilters =
+ new java.util.HashMap<>();
+ for (Map.Entry<ExperimentSearchFields, String> entry : filters.entrySet()) {
+ domainFilters.put(
+ org.apache.airavata.common.model.ExperimentSearchFields.valueOf(
+ entry.getKey().name()),
+ entry.getValue());
+ }
+ List<org.apache.airavata.common.model.ExperimentSummaryModel> domainSummaries =
+ registryService.searchExperiments(
+ gatewayId, userName, accessibleExpIds, domainFilters, limit, offset);
+ return domainSummaries.stream()
+ .map(experimentSummaryModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to search experiments");
+ }
}
/**
@@ -2042,7 +3133,20 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
int limit,
int offset)
throws RegistryServiceException {
- return registryService.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
+ try {
+ Map<org.apache.airavata.common.model.ProjectSearchFields, String> domainFilters = new java.util.HashMap<>();
+ for (Map.Entry<ProjectSearchFields, String> entry : filters.entrySet()) {
+ domainFilters.put(
+ org.apache.airavata.common.model.ProjectSearchFields.valueOf(
+ entry.getKey().name()),
+ entry.getValue());
+ }
+ List<org.apache.airavata.common.model.Project> domainProjects = registryService.searchProjects(
+ gatewayId, userName, accessibleProjIds, domainFilters, limit, offset);
+ return domainProjects.stream().map(projectMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to search projects");
+ }
}
/**
@@ -2055,7 +3159,12 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public void updateProject(String projectId, Project updatedProject) throws RegistryServiceException {
- registryService.updateProject(projectId, updatedProject);
+ try {
+ org.apache.airavata.common.model.Project domainProject = projectMapper.toDomain(updatedProject);
+ registryService.updateProject(projectId, domainProject);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update project");
+ }
}
/**
@@ -2067,12 +3176,23 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public String createProject(String gatewayId, Project project) throws RegistryServiceException {
- return registryService.createProject(gatewayId, project);
+ try {
+ org.apache.airavata.common.model.Project domainProject = projectMapper.toDomain(project);
+ return registryService.createProject(gatewayId, domainProject);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to create project");
+ }
}
@Override
public boolean updateNotification(Notification notification) throws RegistryServiceException {
- return registryService.updateNotification(notification);
+ try {
+ org.apache.airavata.common.model.Notification domainNotification =
+ notificationMapper.toDomain(notification);
+ return registryService.updateNotification(domainNotification);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update notification");
+ }
}
/**
@@ -2083,7 +3203,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public String createNotification(Notification notification) throws RegistryServiceException {
- return registryService.createNotification(notification);
+ try {
+ org.apache.airavata.common.model.Notification domainNotification =
+ notificationMapper.toDomain(notification);
+ return registryService.createNotification(domainNotification);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to create notification");
+ }
}
/**
@@ -2097,7 +3223,12 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean updateGateway(String gatewayId, Gateway updatedGateway) throws RegistryServiceException {
- return registryService.updateGateway(gatewayId, updatedGateway);
+ try {
+ org.apache.airavata.common.model.Gateway domainGateway = gatewayMapper.toDomain(updatedGateway);
+ return registryService.updateGateway(gatewayId, domainGateway);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update gateway");
+ }
}
/**
@@ -2109,15 +3240,20 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public String addGateway(Gateway gateway) throws RegistryServiceException, DuplicateEntryException {
- return registryService.addGateway(gateway);
+ try {
+ org.apache.airavata.common.model.Gateway domainGateway = gatewayMapper.toDomain(gateway);
+ return registryService.addGateway(domainGateway);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add gateway");
+ }
}
/*This private method wraps the logic of getExperiment method as this method is called internally in the API.*/
- private ExperimentModel getExperimentInternal(String airavataExperimentId)
+ private org.apache.airavata.common.model.ExperimentModel getExperimentInternal(String airavataExperimentId)
throws RegistryServiceException, ExperimentNotFoundException {
try {
return registryService.getExperiment(airavataExperimentId);
- } catch (RegistryServiceException e) {
+ } catch (Throwable e) {
// Check if this is a "not found" error based on the message
if (e.getMessage() != null && e.getMessage().contains("does not exist")) {
logger.error("Experiment not found: " + airavataExperimentId, e);
@@ -2126,8 +3262,6 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
"Requested experiment id " + airavataExperimentId + " does not exist in the system.");
throw exception;
}
- throw e;
- } catch (Throwable e) {
logger.error("Error while retrieving the experiment", e);
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Error while retrieving the experiment. More info : " + e.getMessage());
@@ -2146,12 +3280,22 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public String registerUserResourceProfile(UserResourceProfile userResourceProfile) throws RegistryServiceException {
- return registryService.registerUserResourceProfile(userResourceProfile);
+ try {
+ org.apache.airavata.common.model.UserResourceProfile domainUserResourceProfile =
+ userResourceProfileMapper.toDomain(userResourceProfile);
+ return registryService.registerUserResourceProfile(domainUserResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register user resource profile");
+ }
}
@Override
public boolean isUserResourceProfileExists(String userId, String gatewayId) throws RegistryServiceException {
- return registryService.isUserResourceProfileExists(userId, gatewayId);
+ try {
+ return registryService.isUserResourceProfileExists(userId, gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if user resource profile exists");
+ }
}
/**
@@ -2162,7 +3306,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public UserResourceProfile getUserResourceProfile(String userId, String gatewayId) throws RegistryServiceException {
- return registryService.getUserResourceProfile(userId, gatewayId);
+ try {
+ org.apache.airavata.common.model.UserResourceProfile domainUserResourceProfile =
+ registryService.getUserResourceProfile(userId, gatewayId);
+ return userResourceProfileMapper.toThrift(domainUserResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get user resource profile");
+ }
}
/**
@@ -2176,7 +3326,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean updateUserResourceProfile(String userId, String gatewayID, UserResourceProfile userResourceProfile)
throws RegistryServiceException {
- return registryService.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
+ try {
+ org.apache.airavata.common.model.UserResourceProfile domainUserResourceProfile =
+ userResourceProfileMapper.toDomain(userResourceProfile);
+ return registryService.updateUserResourceProfile(userId, gatewayID, domainUserResourceProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update user resource profile");
+ }
}
/**
@@ -2189,12 +3345,21 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public boolean deleteUserResourceProfile(String userId, String gatewayID) throws RegistryServiceException {
- return registryService.deleteUserResourceProfile(userId, gatewayID);
+ try {
+ return registryService.deleteUserResourceProfile(userId, gatewayID);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete user resource profile");
+ }
}
@Override
public String addUser(UserProfile userProfile) throws RegistryServiceException, DuplicateEntryException {
- return registryService.addUser(userProfile);
+ try {
+ org.apache.airavata.common.model.UserProfile domainUserProfile = userProfileMapper.toDomain(userProfile);
+ return registryService.addUser(domainUserProfile);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add user");
+ }
}
/**
@@ -2215,8 +3380,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
String computeResourceId,
UserComputeResourcePreference userComputeResourcePreference)
throws RegistryServiceException {
- return registryService.addUserComputeResourcePreference(
- userId, gatewayID, computeResourceId, userComputeResourcePreference);
+ try {
+ org.apache.airavata.common.model.UserComputeResourcePreference domainUserComputeResourcePreference =
+ userComputeResourcePreferenceMapper.toDomain(userComputeResourcePreference);
+ return registryService.addUserComputeResourcePreference(
+ userId, gatewayID, computeResourceId, domainUserComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add user compute resource preference");
+ }
}
/**
@@ -2231,7 +3402,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean isUserComputeResourcePreferenceExists(String userId, String gatewayID, String computeResourceId)
throws RegistryServiceException {
- return registryService.isUserComputeResourcePreferenceExists(userId, gatewayID, computeResourceId);
+ try {
+ return registryService.isUserComputeResourcePreferenceExists(userId, gatewayID, computeResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if user compute resource preference exists");
+ }
}
/**
@@ -2248,7 +3423,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean addUserStoragePreference(
String userId, String gatewayID, String storageResourceId, UserStoragePreference dataStoragePreference)
throws RegistryServiceException {
- return registryService.addUserStoragePreference(userId, gatewayID, storageResourceId, dataStoragePreference);
+ try {
+ org.apache.airavata.common.model.UserStoragePreference domainUserStoragePreference =
+ userStoragePreferenceMapper.toDomain(dataStoragePreference);
+ return registryService.addUserStoragePreference(
+ userId, gatewayID, storageResourceId, domainUserStoragePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add user storage preference");
+ }
}
/**
@@ -2263,7 +3445,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public UserComputeResourcePreference getUserComputeResourcePreference(
String userId, String gatewayID, String userComputeResourceId) throws RegistryServiceException {
- return registryService.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
+ try {
+ org.apache.airavata.common.model.UserComputeResourcePreference domainUserComputeResourcePreference =
+ registryService.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
+ return userComputeResourcePreferenceMapper.toThrift(domainUserComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get user compute resource preference");
+ }
}
/**
@@ -2278,7 +3466,13 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public UserStoragePreference getUserStoragePreference(String userId, String gatewayID, String storageId)
throws RegistryServiceException {
- return registryService.getUserStoragePreference(userId, gatewayID, storageId);
+ try {
+ org.apache.airavata.common.model.UserStoragePreference domainUserStoragePreference =
+ registryService.getUserStoragePreference(userId, gatewayID, storageId);
+ return userStoragePreferenceMapper.toThrift(domainUserStoragePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get user storage preference");
+ }
}
/**
@@ -2289,7 +3483,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<UserResourceProfile> getAllUserResourceProfiles() throws RegistryServiceException {
- return registryService.getAllUserResourceProfiles();
+ try {
+ List<org.apache.airavata.common.model.UserResourceProfile> domainUserResourceProfiles =
+ registryService.getAllUserResourceProfiles();
+ return domainUserResourceProfiles.stream()
+ .map(userResourceProfileMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all user resource profiles");
+ }
}
/**
@@ -2309,8 +3511,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
String computeResourceId,
UserComputeResourcePreference userComputeResourcePreference)
throws RegistryServiceException {
- return registryService.updateUserComputeResourcePreference(
- userId, gatewayID, computeResourceId, userComputeResourcePreference);
+ try {
+ org.apache.airavata.common.model.UserComputeResourcePreference domainUserComputeResourcePreference =
+ userComputeResourcePreferenceMapper.toDomain(userComputeResourcePreference);
+ return registryService.updateUserComputeResourcePreference(
+ userId, gatewayID, computeResourceId, domainUserComputeResourcePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update user compute resource preference");
+ }
}
/**
@@ -2327,7 +3535,14 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
public boolean updateUserStoragePreference(
String userId, String gatewayID, String storageId, UserStoragePreference userStoragePreference)
throws RegistryServiceException {
- return registryService.updateUserStoragePreference(userId, gatewayID, storageId, userStoragePreference);
+ try {
+ org.apache.airavata.common.model.UserStoragePreference domainUserStoragePreference =
+ userStoragePreferenceMapper.toDomain(userStoragePreference);
+ return registryService.updateUserStoragePreference(
+ userId, gatewayID, storageId, domainUserStoragePreference);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update user storage preference");
+ }
}
/**
@@ -2342,7 +3557,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean deleteUserComputeResourcePreference(String userId, String gatewayID, String computeResourceId)
throws RegistryServiceException {
- return registryService.deleteUserComputeResourcePreference(userId, gatewayID, computeResourceId);
+ try {
+ return registryService.deleteUserComputeResourcePreference(userId, gatewayID, computeResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete user compute resource preference");
+ }
}
/**
@@ -2357,7 +3576,11 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public boolean deleteUserStoragePreference(String userId, String gatewayID, String storageId)
throws RegistryServiceException {
- return registryService.deleteUserStoragePreference(userId, gatewayID, storageId);
+ try {
+ return registryService.deleteUserStoragePreference(userId, gatewayID, storageId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to delete user storage preference");
+ }
}
/**
@@ -2366,17 +3589,37 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
*/
@Override
public List<QueueStatusModel> getLatestQueueStatuses() throws RegistryServiceException {
- return registryService.getLatestQueueStatuses();
+ try {
+ List<org.apache.airavata.common.model.QueueStatusModel> domainQueueStatuses =
+ registryService.getLatestQueueStatuses();
+ return domainQueueStatuses.stream()
+ .map(queueStatusModelMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get latest queue statuses");
+ }
}
@Override
public void registerQueueStatuses(List<QueueStatusModel> queueStatuses) throws RegistryServiceException {
- registryService.registerQueueStatuses(queueStatuses);
+ try {
+ List<org.apache.airavata.common.model.QueueStatusModel> domainQueueStatuses =
+ queueStatuses.stream().map(queueStatusModelMapper::toDomain).collect(Collectors.toList());
+ registryService.registerQueueStatuses(domainQueueStatuses);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to register queue statuses");
+ }
}
@Override
public QueueStatusModel getQueueStatus(String hostName, String queueName) throws RegistryServiceException {
- return registryService.getQueueStatus(hostName, queueName);
+ try {
+ org.apache.airavata.common.model.QueueStatusModel domainQueueStatus =
+ registryService.getQueueStatus(hostName, queueName);
+ return queueStatusModelMapper.toThrift(domainQueueStatus);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get queue status");
+ }
}
/**
@@ -2390,7 +3633,15 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<UserComputeResourcePreference> getAllUserComputeResourcePreferences(String userId, String gatewayID)
throws RegistryServiceException {
- return registryService.getAllUserComputeResourcePreferences(userId, gatewayID);
+ try {
+ List<org.apache.airavata.common.model.UserComputeResourcePreference> domainUserComputeResourcePreferences =
+ registryService.getAllUserComputeResourcePreferences(userId, gatewayID);
+ return domainUserComputeResourcePreferences.stream()
+ .map(userComputeResourcePreferenceMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all user compute resource preferences");
+ }
}
/**
@@ -2404,14 +3655,24 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public List<UserStoragePreference> getAllUserStoragePreferences(String userId, String gatewayID)
throws RegistryServiceException {
- return registryService.getAllUserStoragePreferences(userId, gatewayID);
+ try {
+ List<org.apache.airavata.common.model.UserStoragePreference> domainUserStoragePreferences =
+ registryService.getAllUserStoragePreferences(userId, gatewayID);
+ return domainUserStoragePreferences.stream()
+ .map(userStoragePreferenceMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get all user storage preferences");
+ }
}
@Override
public void createGatewayGroups(GatewayGroups gatewayGroups)
throws RegistryServiceException, DuplicateEntryException {
try {
- registryService.createGatewayGroups(gatewayGroups);
+ org.apache.airavata.common.model.GatewayGroups domainGatewayGroups =
+ gatewayGroupsMapper.toDomain(gatewayGroups);
+ registryService.createGatewayGroups(domainGatewayGroups);
} catch (Throwable e) {
if (e.getMessage() != null && e.getMessage().contains("already exists")) {
throw new DuplicateEntryException(e.getMessage());
@@ -2422,95 +3683,194 @@ public class RegistryServiceHandler implements org.apache.airavata.thriftapi.reg
@Override
public void updateGatewayGroups(GatewayGroups gatewayGroups) throws RegistryServiceException {
- registryService.updateGatewayGroups(gatewayGroups);
+ try {
+ org.apache.airavata.common.model.GatewayGroups domainGatewayGroups =
+ gatewayGroupsMapper.toDomain(gatewayGroups);
+ registryService.updateGatewayGroups(domainGatewayGroups);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to update gateway groups");
+ }
}
@Override
public boolean isGatewayGroupsExists(String gatewayId) throws RegistryServiceException {
- return registryService.isGatewayGroupsExists(gatewayId);
+ try {
+ return registryService.isGatewayGroupsExists(gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if gateway groups exists");
+ }
}
@Override
public GatewayGroups getGatewayGroups(String gatewayId) throws RegistryServiceException {
- return registryService.getGatewayGroups(gatewayId);
+ try {
+ org.apache.airavata.common.model.GatewayGroups domainGatewayGroups =
+ registryService.getGatewayGroups(gatewayId);
+ return gatewayGroupsMapper.toThrift(domainGatewayGroups);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get gateway groups");
+ }
}
@Override
public Parser getParser(String parserId, String gatewayId) throws RegistryServiceException {
- return registryService.getParser(parserId, gatewayId);
+ try {
+ org.apache.airavata.common.model.Parser domainParser = registryService.getParser(parserId, gatewayId);
+ return parserMapper.toThrift(domainParser);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get parser");
+ }
}
@Override
public String saveParser(Parser parser) throws RegistryServiceException {
- return registryService.saveParser(parser);
+ try {
+ org.apache.airavata.common.model.Parser domainParser = parserMapper.toDomain(parser);
+ return registryService.saveParser(domainParser);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to save parser");
+ }
}
@Override
public List<Parser> listAllParsers(String gatewayId) throws RegistryServiceException {
- return registryService.listAllParsers(gatewayId);
+ try {
+ List<org.apache.airavata.common.model.Parser> domainParsers = registryService.listAllParsers(gatewayId);
+ return domainParsers.stream().map(parserMapper::toThrift).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to list all parsers");
+ }
}
@Override
public void removeParser(String parserId, String gatewayId) throws RegistryServiceException {
- registryService.removeParser(parserId, gatewayId);
+ try {
+ registryService.removeParser(parserId, gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove parser");
+ }
}
@Override
public ParserInput getParserInput(String parserInputId, String gatewayId) throws RegistryServiceException {
- return registryService.getParserInput(parserInputId, gatewayId);
+ try {
+ org.apache.airavata.common.model.ParserInput domainParserInput =
+ registryService.getParserInput(parserInputId, gatewayId);
+ return parserInputMapper.toThrift(domainParserInput);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get parser input");
+ }
}
@Override
public ParserOutput getParserOutput(String parserOutputId, String gatewayId) throws RegistryServiceException {
- return registryService.getParserOutput(parserOutputId, gatewayId);
+ try {
+ org.apache.airavata.common.model.ParserOutput domainParserOutput =
+ registryService.getParserOutput(parserOutputId, gatewayId);
+ return parserOutputMapper.toThrift(domainParserOutput);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get parser output");
+ }
}
@Override
public ParsingTemplate getParsingTemplate(String templateId, String gatewayId) throws RegistryServiceException {
- return registryService.getParsingTemplate(templateId, gatewayId);
+ try {
+ org.apache.airavata.common.model.ParsingTemplate domainParsingTemplate =
+ registryService.getParsingTemplate(templateId, gatewayId);
+ return parsingTemplateMapper.toThrift(domainParsingTemplate);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get parsing template");
+ }
}
@Override
public List<ParsingTemplate> getParsingTemplatesForExperiment(String experimentId, String gatewayId)
throws RegistryServiceException {
- return registryService.getParsingTemplatesForExperiment(experimentId, gatewayId);
+ try {
+ List<org.apache.airavata.common.model.ParsingTemplate> domainParsingTemplates =
+ registryService.getParsingTemplatesForExperiment(experimentId, gatewayId);
+ return domainParsingTemplates.stream()
+ .map(parsingTemplateMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get parsing templates for experiment");
+ }
}
@Override
public String saveParsingTemplate(ParsingTemplate parsingTemplate) throws RegistryServiceException {
- return registryService.saveParsingTemplate(parsingTemplate);
+ try {
+ org.apache.airavata.common.model.ParsingTemplate domainParsingTemplate =
+ parsingTemplateMapper.toDomain(parsingTemplate);
+ return registryService.saveParsingTemplate(domainParsingTemplate);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to save parsing template");
+ }
}
@Override
public List<ParsingTemplate> listAllParsingTemplates(String gatewayId) throws RegistryServiceException {
- return registryService.listAllParsingTemplates(gatewayId);
+ try {
+ List<org.apache.airavata.common.model.ParsingTemplate> domainParsingTemplates =
+ registryService.listAllParsingTemplates(gatewayId);
+ return domainParsingTemplates.stream()
+ .map(parsingTemplateMapper::toThrift)
+ .collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to list all parsing templates");
+ }
}
@Override
public void removeParsingTemplate(String templateId, String gatewayId) throws RegistryServiceException {
- registryService.removeParsingTemplate(templateId, gatewayId);
+ try {
+ registryService.removeParsingTemplate(templateId, gatewayId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove parsing template");
+ }
}
@Override
public boolean isGatewayUsageReportingAvailable(String gatewayId, String computeResourceId)
throws RegistryServiceException {
- return registryService.isGatewayUsageReportingAvailable(gatewayId, computeResourceId);
+ try {
+ return registryService.isGatewayUsageReportingAvailable(gatewayId, computeResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to check if gateway usage reporting is available");
+ }
}
@Override
public GatewayUsageReportingCommand getGatewayReportingCommand(String gatewayId, String computeResourceId)
throws RegistryServiceException {
- return registryService.getGatewayReportingCommand(gatewayId, computeResourceId);
+ try {
+ org.apache.airavata.common.model.GatewayUsageReportingCommand domainCommand =
+ registryService.getGatewayReportingCommand(gatewayId, computeResourceId);
+ return gatewayUsageReportingCommandMapper.toThrift(domainCommand);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to get gateway reporting command");
+ }
}
@Override
public void addGatewayUsageReportingCommand(GatewayUsageReportingCommand command) throws RegistryServiceException {
- registryService.addGatewayUsageReportingCommand(command);
+ try {
+ org.apache.airavata.common.model.GatewayUsageReportingCommand domainCommand =
+ gatewayUsageReportingCommandMapper.toDomain(command);
+ registryService.addGatewayUsageReportingCommand(domainCommand);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to add gateway usage reporting command");
+ }
}
@Override
public void removeGatewayUsageReportingCommand(String gatewayId, String computeResourceId)
throws RegistryServiceException {
- registryService.removeGatewayUsageReportingCommand(gatewayId, computeResourceId);
+ try {
+ registryService.removeGatewayUsageReportingCommand(gatewayId, computeResourceId);
+ } catch (Throwable e) {
+ throw convertToRegistryServiceException(e, "Failed to remove gateway usage reporting command");
+ }
}
}
diff --git a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/SharingRegistryServerHandler.java b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/SharingRegistryServerHandler.java
index acf6043467..33bff55ffa 100644
--- a/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/SharingRegistryServerHandler.java
+++ b/modules/thrift-api/src/main/java/org/apache/airavata/thriftapi/handler/SharingRegistryServerHandler.java
@@ -20,6 +20,7 @@
package org.apache.airavata.thriftapi.handler;
import java.util.List;
+import java.util.stream.Collectors;
import org.apache.airavata.service.SharingRegistryService;
import org.apache.airavata.sharing.model.Domain;
import org.apache.airavata.sharing.model.DuplicateEntryException;
@@ -30,6 +31,7 @@ import org.apache.airavata.sharing.model.SearchCriteria;
import org.apache.airavata.sharing.model.SharingRegistryException;
import org.apache.airavata.sharing.model.User;
import org.apache.airavata.sharing.model.UserGroup;
+import org.apache.thrift.TException;
import org.springframework.stereotype.Component;
@Component
@@ -45,7 +47,32 @@ public class SharingRegistryServerHandler
@Override
public String getAPIVersion() {
- return org.apache.airavata.sharing.model.sharing_cpiConstants.SHARING_CPI_VERSION;
+ return org.apache.airavata.thriftapi.sharing.model.sharing_cpiConstants.SHARING_CPI_VERSION;
+ }
+
+ private org.apache.thrift.TException wrapException(Throwable e) {
+ if (e instanceof org.apache.thrift.TException te) return te;
+ org.apache.thrift.TException thriftException = null;
+
+ if (e instanceof org.apache.airavata.sharing.model.DuplicateEntryException) {
+ var ex = new org.apache.airavata.thriftapi.sharing.model.DuplicateEntryException();
+ if (e.getMessage() != null) ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ } else if (e instanceof org.apache.airavata.sharing.model.SharingRegistryException) {
+ var ex = new org.apache.airavata.thriftapi.sharing.model.SharingRegistryException();
+ if (e.getMessage() != null) ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ }
+
+ if (thriftException == null) {
+ var ex = new org.apache.airavata.thriftapi.sharing.model.SharingRegistryException();
+ ex.setMessage("Internal Error: " + e.getMessage());
+ ex.initCause(e);
+ thriftException = ex;
+ }
+ return thriftException;
}
/**
@@ -53,13 +80,26 @@ public class SharingRegistryServerHandler
* *
*/
@Override
- public String createDomain(Domain domain) throws SharingRegistryException, DuplicateEntryException {
- return sharingRegistryService.createDomain(domain);
+ public String createDomain(org.apache.airavata.thriftapi.sharing.model.Domain domain)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException,
+ org.apache.airavata.thriftapi.sharing.model.DuplicateEntryException, TException {
+ try {
+ Domain domainDomain = convertToDomainDomain(domain);
+ return sharingRegistryService.createDomain(domainDomain);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean updateDomain(Domain domain) throws SharingRegistryException {
- return sharingRegistryService.updateDomain(domain);
+ public boolean updateDomain(org.apache.airavata.thriftapi.sharing.model.Domain domain)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ Domain domainDomain = convertToDomainDomain(domain);
+ return sharingRegistryService.updateDomain(domainDomain);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
/**
@@ -68,23 +108,45 @@ public class SharingRegistryServerHandler
* @param domainId
*/
@Override
- public boolean isDomainExists(String domainId) throws SharingRegistryException {
- return sharingRegistryService.isDomainExists(domainId);
+ public boolean isDomainExists(String domainId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.isDomainExists(domainId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean deleteDomain(String domainId) throws SharingRegistryException {
- return sharingRegistryService.deleteDomain(domainId);
+ public boolean deleteDomain(String domainId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.deleteDomain(domainId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public Domain getDomain(String domainId) throws SharingRegistryException {
- return sharingRegistryService.getDomain(domainId);
+ public org.apache.airavata.thriftapi.sharing.model.Domain getDomain(String domainId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ Domain domainDomain = sharingRegistryService.getDomain(domainId);
+ return convertToThriftDomain(domainDomain);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public List<Domain> getDomains(int offset, int limit) throws SharingRegistryException {
- return sharingRegistryService.getDomains(offset, limit);
+ public List<org.apache.airavata.thriftapi.sharing.model.Domain> getDomains(int offset, int limit)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ List<Domain> domainDomains = sharingRegistryService.getDomains(offset, limit);
+ return domainDomains.stream().map(this::convertToThriftDomain).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
/**
@@ -92,13 +154,26 @@ public class SharingRegistryServerHandler
* *
*/
@Override
- public String createUser(User user) throws SharingRegistryException, DuplicateEntryException {
- return sharingRegistryService.createUser(user);
+ public String createUser(org.apache.airavata.thriftapi.sharing.model.User user)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException,
+ org.apache.airavata.thriftapi.sharing.model.DuplicateEntryException, TException {
+ try {
+ User domainUser = convertToDomainUser(user);
+ return sharingRegistryService.createUser(domainUser);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean updatedUser(User user) throws SharingRegistryException {
- return sharingRegistryService.updatedUser(user);
+ public boolean updatedUser(org.apache.airavata.thriftapi.sharing.model.User user)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ User domainUser = convertToDomainUser(user);
+ return sharingRegistryService.updatedUser(domainUser);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
/**
@@ -107,23 +182,45 @@ public class SharingRegistryServerHandler
* @param userId
*/
@Override
- public boolean isUserExists(String domainId, String userId) throws SharingRegistryException {
- return sharingRegistryService.isUserExists(domainId, userId);
+ public boolean isUserExists(String domainId, String userId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.isUserExists(domainId, userId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean deleteUser(String domainId, String userId) throws SharingRegistryException {
- return sharingRegistryService.deleteUser(domainId, userId);
+ public boolean deleteUser(String domainId, String userId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.deleteUser(domainId, userId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public User getUser(String domainId, String userId) throws SharingRegistryException {
- return sharingRegistryService.getUser(domainId, userId);
+ public org.apache.airavata.thriftapi.sharing.model.User getUser(String domainId, String userId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ User domainUser = sharingRegistryService.getUser(domainId, userId);
+ return convertToThriftUser(domainUser);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public List<User> getUsers(String domain, int offset, int limit) throws SharingRegistryException {
- return sharingRegistryService.getUsers(domain, offset, limit);
+ public List<org.apache.airavata.thriftapi.sharing.model.User> getUsers(String domain, int offset, int limit)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ List<User> domainUsers = sharingRegistryService.getUsers(domain, offset, limit);
+ return domainUsers.stream().map(this::convertToThriftUser).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
/**
@@ -131,13 +228,25 @@ public class SharingRegistryServerHandler
* *
*/
@Override
- public String createGroup(UserGroup group) throws SharingRegistryException {
- return sharingRegistryService.createGroup(group);
+ public String createGroup(org.apache.airavata.thriftapi.sharing.model.UserGroup group)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ UserGroup domainGroup = convertToDomainUserGroup(group);
+ return sharingRegistryService.createGroup(domainGroup);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean updateGroup(UserGroup group) throws SharingRegistryException {
- return sharingRegistryService.updateGroup(group);
+ public boolean updateGroup(org.apache.airavata.thriftapi.sharing.model.UserGroup group)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ UserGroup domainGroup = convertToDomainUserGroup(group);
+ return sharingRegistryService.updateGroup(domainGroup);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
/**
@@ -148,106 +257,184 @@ public class SharingRegistryServerHandler
* @throws SharingRegistryException
* @ */
@Override
- public boolean isGroupExists(String domainId, String groupId) throws SharingRegistryException {
- return sharingRegistryService.isGroupExists(domainId, groupId);
+ public boolean isGroupExists(String domainId, String groupId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.isGroupExists(domainId, groupId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean deleteGroup(String domainId, String groupId) throws SharingRegistryException {
- return sharingRegistryService.deleteGroup(domainId, groupId);
+ public boolean deleteGroup(String domainId, String groupId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.deleteGroup(domainId, groupId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public UserGroup getGroup(String domainId, String groupId) throws SharingRegistryException {
- return sharingRegistryService.getGroup(domainId, groupId);
+ public org.apache.airavata.thriftapi.sharing.model.UserGroup getGroup(String domainId, String groupId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ UserGroup domainGroup = sharingRegistryService.getGroup(domainId, groupId);
+ return convertToThriftUserGroup(domainGroup);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public List<UserGroup> getGroups(String domain, int offset, int limit) throws SharingRegistryException {
- return sharingRegistryService.getGroups(domain, offset, limit);
+ public List<org.apache.airavata.thriftapi.sharing.model.UserGroup> getGroups(String domain, int offset, int limit)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ List<UserGroup> domainGroups = sharingRegistryService.getGroups(domain, offset, limit);
+ return domainGroups.stream().map(this::convertToThriftUserGroup).collect(Collectors.toList());
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
public boolean addUsersToGroup(String domainId, List<String> userIds, String groupId)
- throws SharingRegistryException {
- return sharingRegistryService.addUsersToGroup(domainId, userIds, groupId);
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.addUsersToGroup(domainId, userIds, groupId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
public boolean removeUsersFromGroup(String domainId, List<String> userIds, String groupId)
- throws SharingRegistryException {
- return sharingRegistryService.removeUsersFromGroup(domainId, userIds, groupId);
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.removeUsersFromGroup(domainId, userIds, groupId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
public boolean transferGroupOwnership(String domainId, String groupId, String newOwnerId)
- throws SharingRegistryException {
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
try {
return sharingRegistryService.transferGroupOwnership(domainId, groupId, newOwnerId);
- } catch (DuplicateEntryException e) {
- SharingRegistryException ex = new SharingRegistryException();
- ex.setMessage("Error transferring group ownership: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ if (e instanceof DuplicateEntryException) {
+ var ex = new org.apache.airavata.thriftapi.sharing.model.SharingRegistryException();
+ if (e.getMessage() != null) ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ throw wrapException(e);
}
}
@Override
public boolean addGroupAdmins(String domainId, String groupId, List<String> adminIds)
- throws SharingRegistryException {
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
try {
return sharingRegistryService.addGroupAdmins(domainId, groupId, adminIds);
- } catch (DuplicateEntryException e) {
- SharingRegistryException ex = new SharingRegistryException();
- ex.setMessage("Error adding group admins: " + e.getMessage());
- ex.initCause(e);
- throw ex;
+ } catch (Throwable e) {
+ if (e instanceof DuplicateEntryException) {
+ var ex = new org.apache.airavata.thriftapi.sharing.model.SharingRegistryException();
+ if (e.getMessage() != null) ex.setMessage(e.getMessage());
+ ex.initCause(e);
+ throw ex;
+ }
+ throw wrapException(e);
}
}
@Override
public boolean removeGroupAdmins(String domainId, String groupId, List<String> adminIds)
- throws SharingRegistryException {
- return sharingRegistryService.removeGroupAdmins(domainId, groupId, adminIds);
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.removeGroupAdmins(domainId, groupId, adminIds);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean hasAdminAccess(String domainId, String groupId, String adminId) throws SharingRegistryException {
- return sharingRegistryService.hasAdminAccess(domainId, groupId, adminId);
+ public boolean hasAdminAccess(String domainId, String groupId, String adminId)
+ throws org.apache.airavata.thriftapi.sharing.model.SharingRegistryException, TException {
+ try {
+ return sharingRegistryService.hasAdminAccess(domainId, groupId, adminId);
+ } catch (Throwable e) {
+ throw wrapException(e);
+ }
}
@Override
- public boolean hasOwnerAccess(String domainId, String groupId, String ownerId) throws SharingRegistryException {
- return sharingRegistryService.hasOwnerAccess(domainId, groupId, ownerId);
+ public boolean hasOwnerAccess(String domainId, String groupId, String ownerId)
... 1801 lines suppressed ...