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 2026/04/01 19:04:47 UTC
(airavata) 14/49: fix: resolve proto API compilation errors in handler and repository layers
This is an automated email from the ASF dual-hosted git repository.
yasith pushed a commit to branch feat/grpc-armeria-migration
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 069bcb8ccddd6e2d541b26cef1d3004049b72287
Author: yasithdev <ya...@icloud.com>
AuthorDate: Tue Mar 31 10:11:39 2026 -0400
fix: resolve proto API compilation errors in handler and repository layers
- RegistryServerHandler: remove Thrift Iface implementation, replace
proto error types (AiravataSystemException, ProjectNotFoundException,
ExperimentNotFoundException, DuplicateEntryException) with
RegistryServiceException, fix proto enum prefixes, use builders for
immutable proto objects
- ComputeResourceRepository: fix Map<FileSystems,String> to
Map<Integer,String>, use builders for immutable setters, convert
enum-keyed maps for ResourceJobManager
- GwyResourceProfileRepository: use builders for immutable proto
ComputeResourcePreference and GatewayResourceProfile
- UserResourceProfileRepository: getGatewayID -> getGatewayId
- ParserRepository: getInputFiles/getOutputFiles -> list versions
- All repository files: fix proto immutable setter calls with
toBuilder().setX().build(), null checks to isEmpty() for proto
strings, repeated field getters to List-suffixed versions,
ExperimentState/ProcessState/TaskState enum name prefixes
- Utils, SSHAccountManager: use RegistryServerHandler directly
instead of Thrift RegistryService.Iface
---
.../repository/ComputeResourceRepository.java | 116 ++--
.../repository/GwyResourceProfileRepository.java | 67 ++-
.../compute/repository/ParserRepository.java | 4 +-
.../repository/UserResourceProfileRepository.java | 4 +-
.../service/provisioning/SSHAccountManager.java | 9 +-
.../execution/handler/RegistryServerHandler.java | 588 +++++----------------
.../repository/ExperimentErrorRepository.java | 4 +-
.../execution/repository/ExperimentRepository.java | 44 +-
.../repository/ExperimentStatusRepository.java | 21 +-
.../repository/ExperimentSummaryRepository.java | 38 +-
.../execution/repository/JobRepository.java | 23 +-
.../execution/repository/JobStatusRepository.java | 4 +-
.../repository/NotificationRepository.java | 2 +-
.../repository/ProcessErrorRepository.java | 6 +-
.../execution/repository/ProcessRepository.java | 47 +-
.../repository/ProcessStatusRepository.java | 18 +-
.../repository/ProcessWorkflowRepository.java | 2 +-
.../execution/repository/ProjectRepository.java | 10 +-
.../execution/repository/TaskErrorRepository.java | 6 +-
.../execution/repository/TaskRepository.java | 31 +-
.../execution/repository/TaskStatusRepository.java | 16 +-
.../execution/repository/WorkflowRepository.java | 21 +-
.../apache/airavata/execution/scheduler/Utils.java | 10 +-
.../storage/repository/DataProductRepository.java | 7 +-
.../repository/DataReplicaLocationRepository.java | 8 +-
.../repository/StorageResourceRepository.java | 32 +-
26 files changed, 452 insertions(+), 686 deletions(-)
diff --git a/airavata-api/src/main/java/org/apache/airavata/compute/repository/ComputeResourceRepository.java b/airavata-api/src/main/java/org/apache/airavata/compute/repository/ComputeResourceRepository.java
index 51f42a38a5..6e49b9da6e 100644
--- a/airavata-api/src/main/java/org/apache/airavata/compute/repository/ComputeResourceRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/compute/repository/ComputeResourceRepository.java
@@ -20,6 +20,7 @@
package org.apache.airavata.compute.repository;
import jakarta.persistence.Query;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -131,13 +132,14 @@ public class ComputeResourceRepository
protected void saveFileSystems(ComputeResourceDescription description, ComputeResourceEntity computeHostResource)
throws AppCatalogException {
- Map<FileSystems, String> fileSystems = description.getFileSystems();
- if (fileSystems != null && !fileSystems.isEmpty()) {
- for (FileSystems key : fileSystems.keySet()) {
+ Map<Integer, String> fileSystems = description.getFileSystemsMap();
+ if (!fileSystems.isEmpty()) {
+ for (Map.Entry<Integer, String> entry : fileSystems.entrySet()) {
+ FileSystems key = FileSystems.forNumber(entry.getKey());
ComputeResourceFileSystemEntity computeResourceFileSystemEntity = new ComputeResourceFileSystemEntity();
computeResourceFileSystemEntity.setComputeResourceId(computeHostResource.getComputeResourceId());
computeResourceFileSystemEntity.setFileSystem(key);
- computeResourceFileSystemEntity.setPath(fileSystems.get(key));
+ computeResourceFileSystemEntity.setPath(entry.getValue());
computeResourceFileSystemEntity.setComputeResource(computeHostResource);
execute(entityManager -> entityManager.merge(computeResourceFileSystemEntity));
}
@@ -190,10 +192,13 @@ public class ComputeResourceRepository
DBConstants.ComputeResource.HOST_NAME, filters.get(DBConstants.ComputeResource.HOST_NAME));
List<ComputeResourceDescription> computeResourceDescriptionList =
select(QueryConstants.FIND_COMPUTE_RESOURCE, -1, 0, queryParameters);
+ List<ComputeResourceDescription> result = new ArrayList<>();
for (ComputeResourceDescription cd : computeResourceDescriptionList) {
- cd.setFileSystems(getFileSystems(cd.getComputeResourceId()));
+ result.add(cd.toBuilder()
+ .putAllFileSystems(getFileSystems(cd.getComputeResourceId()))
+ .build());
}
- return computeResourceDescriptionList;
+ return result;
} else {
logger.error("Unsupported field name for compute resource.", new IllegalArgumentException());
throw new IllegalArgumentException("Unsupported field name for compute resource.");
@@ -204,10 +209,13 @@ public class ComputeResourceRepository
public List<ComputeResourceDescription> getAllComputeResourceList() throws AppCatalogException {
List<ComputeResourceDescription> computeResourceDescriptionList =
select(QueryConstants.FIND_ALL_COMPUTE_RESOURCES, 0);
+ List<ComputeResourceDescription> result = new ArrayList<>();
for (ComputeResourceDescription cd : computeResourceDescriptionList) {
- cd.setFileSystems(getFileSystems(cd.getComputeResourceId()));
+ result.add(cd.toBuilder()
+ .putAllFileSystems(getFileSystems(cd.getComputeResourceId()))
+ .build());
}
- return computeResourceDescriptionList;
+ return result;
}
@Override
@@ -231,7 +239,7 @@ public class ComputeResourceRepository
select(QueryConstants.FIND_ALL_COMPUTE_RESOURCES, 0);
if (computeResourceDescriptionList != null && !computeResourceDescriptionList.isEmpty()) {
for (ComputeResourceDescription computeResourceDescription : computeResourceDescriptionList) {
- if (computeResourceDescription.isEnabled()) {
+ if (computeResourceDescription.getEnabled()) {
computeResourceMap.put(
computeResourceDescription.getComputeResourceId(),
computeResourceDescription.getHostName());
@@ -426,19 +434,21 @@ public class ComputeResourceRepository
@Override
public String addUNICOREJobSubmission(UnicoreJobSubmission unicoreJobSubmission) throws AppCatalogException {
- unicoreJobSubmission.setJobSubmissionInterfaceId(AppCatalogUtils.getID("UNICORE"));
+ unicoreJobSubmission = unicoreJobSubmission.toBuilder()
+ .setJobSubmissionInterfaceId(AppCatalogUtils.getID("UNICORE"))
+ .build();
UnicoreSubmissionEntity unicoreSubmissionEntity =
ComputeMapper.INSTANCE.unicoreSubmissionToEntity(unicoreJobSubmission);
- if (unicoreJobSubmission.getSecurityProtocol() != null) {
- unicoreSubmissionEntity.setSecurityProtocol(unicoreJobSubmission.getSecurityProtocol());
- }
+ unicoreSubmissionEntity.setSecurityProtocol(unicoreJobSubmission.getSecurityProtocol());
execute(entityManager -> entityManager.merge(unicoreSubmissionEntity));
return unicoreJobSubmission.getJobSubmissionInterfaceId();
}
@Override
public String addLocalDataMovement(LOCALDataMovement localDataMovement) throws AppCatalogException {
- localDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("LOCAL"));
+ localDataMovement = localDataMovement.toBuilder()
+ .setDataMovementInterfaceId(AppCatalogUtils.getID("LOCAL"))
+ .build();
LocalDataMovementEntity localDataMovementEntity =
ComputeMapper.INSTANCE.localDataMovementToEntity(localDataMovement);
execute(entityManager -> entityManager.merge(localDataMovementEntity));
@@ -453,7 +463,9 @@ public class ComputeResourceRepository
@Override
public String addScpDataMovement(SCPDataMovement scpDataMovement) throws AppCatalogException {
- scpDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("SCP"));
+ scpDataMovement = scpDataMovement.toBuilder()
+ .setDataMovementInterfaceId(AppCatalogUtils.getID("SCP"))
+ .build();
ScpDataMovementEntity scpDataMovementEntity = ComputeMapper.INSTANCE.scpDataMovementToEntity(scpDataMovement);
execute(entityManager -> entityManager.merge(scpDataMovementEntity));
return scpDataMovementEntity.getDataMovementInterfaceId();
@@ -467,7 +479,9 @@ public class ComputeResourceRepository
@Override
public String addUnicoreDataMovement(UnicoreDataMovement unicoreDataMovement) throws AppCatalogException {
- unicoreDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("UNICORE"));
+ unicoreDataMovement = unicoreDataMovement.toBuilder()
+ .setDataMovementInterfaceId(AppCatalogUtils.getID("UNICORE"))
+ .build();
UnicoreDatamovementEntity unicoreDatamovementEntity =
ComputeMapper.INSTANCE.unicoreDataMovementToEntity(unicoreDataMovement);
execute(entityManager -> entityManager.merge(unicoreDatamovementEntity));
@@ -482,11 +496,13 @@ public class ComputeResourceRepository
@Override
public String addGridFTPDataMovement(GridFTPDataMovement gridFTPDataMovement) throws AppCatalogException {
- gridFTPDataMovement.setDataMovementInterfaceId(AppCatalogUtils.getID("GRIDFTP"));
+ gridFTPDataMovement = gridFTPDataMovement.toBuilder()
+ .setDataMovementInterfaceId(AppCatalogUtils.getID("GRIDFTP"))
+ .build();
GridftpDataMovementEntity gridftpDataMovementEntity =
ComputeMapper.INSTANCE.gridFtpDataMovementToEntity(gridFTPDataMovement);
execute(entityManager -> entityManager.merge(gridftpDataMovementEntity));
- List<String> gridFTPEndPoint = gridFTPDataMovement.getGridFTPEndPoints();
+ List<String> gridFTPEndPoint = gridFTPDataMovement.getGridFtpEndPointsList();
if (gridFTPEndPoint != null && !gridFTPEndPoint.isEmpty()) {
for (String endpoint : gridFTPEndPoint) {
GridftpEndpointEntity gridftpEndpointEntity = new GridftpEndpointEntity();
@@ -505,17 +521,24 @@ public class ComputeResourceRepository
execute(entityManager -> entityManager.find(SshJobSubmissionEntity.class, submissionId));
if (entity == null) return null;
SSHJobSubmission sshJobSubmission = ComputeMapper.INSTANCE.sshJobSubmissionToModel(entity);
- sshJobSubmission
- .getResourceJobManager()
- .setParallelismPrefix((new ResourceJobManagerRepository()
- .getParallelismPrefix(
- sshJobSubmission.getResourceJobManager().getResourceJobManagerId())));
- sshJobSubmission
- .getResourceJobManager()
- .setJobManagerCommands((new ResourceJobManagerRepository()
- .getJobManagerCommand(
- sshJobSubmission.getResourceJobManager().getResourceJobManagerId())));
- return sshJobSubmission;
+ String rjmId = sshJobSubmission.getResourceJobManager().getResourceJobManagerId();
+ ResourceJobManagerRepository rjmRepo = new ResourceJobManagerRepository();
+ Map<ApplicationParallelismType, String> parPrefix = rjmRepo.getParallelismPrefix(rjmId);
+ Map<Integer, String> parPrefixInt = new HashMap<>();
+ for (Map.Entry<ApplicationParallelismType, String> e : parPrefix.entrySet()) {
+ parPrefixInt.put(e.getKey().getNumber(), e.getValue());
+ }
+ Map<JobManagerCommand, String> jmCommands = rjmRepo.getJobManagerCommand(rjmId);
+ Map<Integer, String> jmCommandsInt = new HashMap<>();
+ for (Map.Entry<JobManagerCommand, String> e : jmCommands.entrySet()) {
+ jmCommandsInt.put(e.getKey().getNumber(), e.getValue());
+ }
+ return sshJobSubmission.toBuilder()
+ .setResourceJobManager(sshJobSubmission.getResourceJobManager().toBuilder()
+ .putAllParallelismPrefix(parPrefixInt)
+ .putAllJobManagerCommands(jmCommandsInt)
+ .build())
+ .build();
}
@Override
@@ -574,9 +597,9 @@ public class ComputeResourceRepository
.map(GridftpEndpointEntity::getEndpoint)
.collect(Collectors.toList());
GridFTPDataMovement dataMovement = ComputeMapper.INSTANCE.gridFtpDataMovementToModel(entity);
- dataMovement.setGridFTPEndPoints(endpoints);
-
- return dataMovement;
+ return dataMovement.toBuilder()
+ .addAllGridFtpEndPoints(endpoints)
+ .build();
}
@Override
@@ -625,17 +648,24 @@ public class ComputeResourceRepository
execute(entityManager -> entityManager.find(LocalSubmissionEntity.class, submissionId));
if (entity == null) return null;
LOCALSubmission localSubmission = ComputeMapper.INSTANCE.localSubmissionToModel(entity);
- localSubmission
- .getResourceJobManager()
- .setParallelismPrefix((new ResourceJobManagerRepository()
- .getParallelismPrefix(
- localSubmission.getResourceJobManager().getResourceJobManagerId())));
- localSubmission
- .getResourceJobManager()
- .setJobManagerCommands((new ResourceJobManagerRepository()
- .getJobManagerCommand(
- localSubmission.getResourceJobManager().getResourceJobManagerId())));
- return localSubmission;
+ String rjmId = localSubmission.getResourceJobManager().getResourceJobManagerId();
+ ResourceJobManagerRepository rjmRepo = new ResourceJobManagerRepository();
+ Map<ApplicationParallelismType, String> parPrefix = rjmRepo.getParallelismPrefix(rjmId);
+ Map<Integer, String> parPrefixInt = new HashMap<>();
+ for (Map.Entry<ApplicationParallelismType, String> e : parPrefix.entrySet()) {
+ parPrefixInt.put(e.getKey().getNumber(), e.getValue());
+ }
+ Map<JobManagerCommand, String> jmCommands = rjmRepo.getJobManagerCommand(rjmId);
+ Map<Integer, String> jmCommandsInt = new HashMap<>();
+ for (Map.Entry<JobManagerCommand, String> e : jmCommands.entrySet()) {
+ jmCommandsInt.put(e.getKey().getNumber(), e.getValue());
+ }
+ return localSubmission.toBuilder()
+ .setResourceJobManager(localSubmission.getResourceJobManager().toBuilder()
+ .putAllParallelismPrefix(parPrefixInt)
+ .putAllJobManagerCommands(jmCommandsInt)
+ .build())
+ .build();
}
@Override
diff --git a/airavata-api/src/main/java/org/apache/airavata/compute/repository/GwyResourceProfileRepository.java b/airavata-api/src/main/java/org/apache/airavata/compute/repository/GwyResourceProfileRepository.java
index d3c2d3bb02..8b26e003d9 100644
--- a/airavata-api/src/main/java/org/apache/airavata/compute/repository/GwyResourceProfileRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/compute/repository/GwyResourceProfileRepository.java
@@ -71,7 +71,7 @@ public class GwyResourceProfileRepository
}
public String updateGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile) {
- String gatewayId = gatewayResourceProfile.getGatewayID();
+ String gatewayId = gatewayResourceProfile.getGatewayId();
GatewayProfileEntity gatewayProfileEntity =
ComputeMapper.INSTANCE.gatewayProfileToEntity(gatewayResourceProfile);
// Explicitly set gatewayId since Dozer mapping does not handle gatewayID -> gatewayId conversion
@@ -91,19 +91,18 @@ public class GwyResourceProfileRepository
GatewayProfileEntity persistedCopy = execute(entityManager -> entityManager.merge(gatewayProfileEntity));
List<ComputeResourcePreference> computeResourcePreferences =
- gatewayResourceProfile.getComputeResourcePreferences();
+ gatewayResourceProfile.getComputeResourcePreferencesList();
if (computeResourcePreferences != null && !computeResourcePreferences.isEmpty()) {
for (ComputeResourcePreference preference : computeResourcePreferences) {
- if (preference.getSshAccountProvisionerConfig() != null
- && !preference.getSshAccountProvisionerConfig().isEmpty()) {
+ if (!preference.getSshAccountProvisionerConfigMap().isEmpty()) {
ComputeResourcePreferenceEntity computeResourcePreferenceEntity =
ComputeMapper.INSTANCE.computeResourcePrefToEntity(preference);
computeResourcePreferenceEntity.setGatewayId(gatewayId);
List<SSHAccountProvisionerConfiguration> configurations = new ArrayList<>();
for (String sshAccountProvisionerConfigName :
- preference.getSshAccountProvisionerConfig().keySet()) {
+ preference.getSshAccountProvisionerConfigMap().keySet()) {
String value =
- preference.getSshAccountProvisionerConfig().get(sshAccountProvisionerConfigName);
+ preference.getSshAccountProvisionerConfigMap().get(sshAccountProvisionerConfigName);
configurations.add(new SSHAccountProvisionerConfiguration(
sshAccountProvisionerConfigName, value, computeResourcePreferenceEntity));
}
@@ -118,16 +117,20 @@ public class GwyResourceProfileRepository
@Override
public GatewayResourceProfile getGatewayProfile(String gatewayId) {
GatewayResourceProfile gatewayResourceProfile = get(gatewayId);
- gatewayResourceProfile.setGatewayID(gatewayId);
- if (gatewayResourceProfile.getComputeResourcePreferences() != null
- && !gatewayResourceProfile.getComputeResourcePreferences().isEmpty()) {
- for (ComputeResourcePreference preference : gatewayResourceProfile.getComputeResourcePreferences()) {
+ GatewayResourceProfile.Builder builder = gatewayResourceProfile.toBuilder()
+ .setGatewayId(gatewayId);
+ if (!gatewayResourceProfile.getComputeResourcePreferencesList().isEmpty()) {
+ builder.clearComputeResourcePreferences();
+ for (ComputeResourcePreference preference : gatewayResourceProfile.getComputeResourcePreferencesList()) {
ComputeResourcePrefRepository computeResourcePrefRepository = new ComputeResourcePrefRepository();
- preference.setSshAccountProvisionerConfig(computeResourcePrefRepository.getsshAccountProvisionerConfig(
- gatewayResourceProfile.getGatewayID(), preference.getComputeResourceId()));
+ Map<String, String> sshConfig = computeResourcePrefRepository.getsshAccountProvisionerConfig(
+ gatewayId, preference.getComputeResourceId());
+ builder.addComputeResourcePreferences(preference.toBuilder()
+ .putAllSshAccountProvisionerConfig(sshConfig)
+ .build());
}
}
- return gatewayResourceProfile;
+ return builder.build();
}
@Override
@@ -138,24 +141,30 @@ public class GwyResourceProfileRepository
@Override
public List<GatewayResourceProfile> getAllGatewayProfiles() {
- List<GatewayResourceProfile> gwyResourceProfileList = new ArrayList<GatewayResourceProfile>();
List<GatewayResourceProfile> gatewayResourceProfileList = select(QueryConstants.FIND_ALL_GATEWAY_PROFILES, 0);
if (gatewayResourceProfileList != null && !gatewayResourceProfileList.isEmpty()) {
+ List<GatewayResourceProfile> result = new ArrayList<>();
for (GatewayResourceProfile gatewayResourceProfile : gatewayResourceProfileList) {
- if (gatewayResourceProfile.getComputeResourcePreferences() != null
- && !gatewayResourceProfile
- .getComputeResourcePreferences()
- .isEmpty()) {
+ if (!gatewayResourceProfile.getComputeResourcePreferencesList().isEmpty()) {
+ GatewayResourceProfile.Builder builder = gatewayResourceProfile.toBuilder();
+ builder.clearComputeResourcePreferences();
for (ComputeResourcePreference preference :
- gatewayResourceProfile.getComputeResourcePreferences()) {
+ gatewayResourceProfile.getComputeResourcePreferencesList()) {
ComputeResourcePrefRepository computeResourcePrefRepository =
new ComputeResourcePrefRepository();
- preference.setSshAccountProvisionerConfig(
+ Map<String, String> sshConfig =
computeResourcePrefRepository.getsshAccountProvisionerConfig(
- gatewayResourceProfile.getGatewayID(), preference.getComputeResourceId()));
+ gatewayResourceProfile.getGatewayId(), preference.getComputeResourceId());
+ builder.addComputeResourcePreferences(preference.toBuilder()
+ .putAllSshAccountProvisionerConfig(sshConfig)
+ .build());
}
+ result.add(builder.build());
+ } else {
+ result.add(gatewayResourceProfile);
}
}
+ return result;
}
return gatewayResourceProfileList;
}
@@ -191,9 +200,10 @@ public class GwyResourceProfileRepository
ComputeResourcePrefRepository computeResourcePrefRepository = new ComputeResourcePrefRepository();
ComputeResourcePreference computeResourcePreference =
computeResourcePrefRepository.get(computeResourcePreferencePK);
- computeResourcePreference.setSshAccountProvisionerConfig(
- computeResourcePrefRepository.getsshAccountProvisionerConfig(gatewayId, hostId));
- return computeResourcePreference;
+ Map<String, String> sshConfig = computeResourcePrefRepository.getsshAccountProvisionerConfig(gatewayId, hostId);
+ return computeResourcePreference.toBuilder()
+ .putAllSshAccountProvisionerConfig(sshConfig)
+ .build();
}
@Override
@@ -212,10 +222,15 @@ public class GwyResourceProfileRepository
List<ComputeResourcePreference> preferences = computeResourcePrefRepository.select(
QueryConstants.FIND_ALL_COMPUTE_RESOURCE_PREFERENCES, -1, 0, queryParameters);
if (preferences != null && !preferences.isEmpty()) {
+ List<ComputeResourcePreference> result = new ArrayList<>();
for (ComputeResourcePreference preference : preferences) {
- preference.setSshAccountProvisionerConfig(computeResourcePrefRepository.getsshAccountProvisionerConfig(
- gatewayId, preference.getComputeResourceId()));
+ Map<String, String> sshConfig = computeResourcePrefRepository.getsshAccountProvisionerConfig(
+ gatewayId, preference.getComputeResourceId());
+ result.add(preference.toBuilder()
+ .putAllSshAccountProvisionerConfig(sshConfig)
+ .build());
}
+ return result;
}
return preferences;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/compute/repository/ParserRepository.java b/airavata-api/src/main/java/org/apache/airavata/compute/repository/ParserRepository.java
index b3eec170fc..204517d988 100644
--- a/airavata-api/src/main/java/org/apache/airavata/compute/repository/ParserRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/compute/repository/ParserRepository.java
@@ -55,14 +55,14 @@ public class ParserRepository extends AbstractRepository<Parser, ParserEntity, S
try {
ParserEntity parserEntity = ComputeMapper.INSTANCE.parserToEntity(parser);
- if (parser.getInputFiles() != null) {
+ if (!parser.getInputFilesList().isEmpty()) {
parserEntity.getInputFiles().forEach(input -> {
input.setParser(parserEntity);
input.setParserId(parserEntity.getId());
});
}
- if (parser.getOutputFiles() != null) {
+ if (!parser.getOutputFilesList().isEmpty()) {
parserEntity.getOutputFiles().forEach(output -> {
output.setParser(parserEntity);
output.setParserId(parserEntity.getId());
diff --git a/airavata-api/src/main/java/org/apache/airavata/compute/repository/UserResourceProfileRepository.java b/airavata-api/src/main/java/org/apache/airavata/compute/repository/UserResourceProfileRepository.java
index c4144830fd..fdd1f458e9 100644
--- a/airavata-api/src/main/java/org/apache/airavata/compute/repository/UserResourceProfileRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/compute/repository/UserResourceProfileRepository.java
@@ -65,7 +65,7 @@ public class UserResourceProfileRepository
protected UserResourceProfileEntity saveUserResourceProfile(UserResourceProfile userResourceProfile)
throws AppCatalogException {
String userId = userResourceProfile.getUserId();
- String gatewayId = userResourceProfile.getGatewayID();
+ String gatewayId = userResourceProfile.getGatewayId();
UserResourceProfileEntity userResourceProfileEntity =
ComputeMapper.INSTANCE.userResourceProfileToEntity(userResourceProfile);
@@ -183,7 +183,7 @@ public class UserResourceProfileRepository
select(QueryConstants.GET_ALL_GATEWAY_ID, -1, 0, queryParameters);
List<String> gatewayIdList = new ArrayList<>();
for (UserResourceProfile userResourceProfile : userResourceProfileList) {
- gatewayIdList.add(userResourceProfile.getGatewayID());
+ gatewayIdList.add(userResourceProfile.getGatewayId());
}
return gatewayIdList;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/service/provisioning/SSHAccountManager.java b/airavata-api/src/main/java/org/apache/airavata/credential/service/provisioning/SSHAccountManager.java
index 310ad23e03..c662b292d0 100644
--- a/airavata-api/src/main/java/org/apache/airavata/credential/service/provisioning/SSHAccountManager.java
+++ b/airavata-api/src/main/java/org/apache/airavata/credential/service/provisioning/SSHAccountManager.java
@@ -35,8 +35,7 @@ import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePrefer
import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference;
import org.apache.airavata.model.credential.store.PasswordCredential;
import org.apache.airavata.model.credential.store.SSHCredential;
-import org.apache.airavata.registry.api.RegistryService;
-import org.apache.thrift.TException;
+import org.apache.airavata.registry.api.exception.RegistryServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,7 +68,7 @@ public class SSHAccountManager {
private static SSHAccountProvisioner getSshAccountProvisioner(String gatewayId, String computeResourceId)
throws InvalidSetupException {
// get compute resource preferences for the gateway and hostname
- RegistryService.Iface registryServiceClient = getRegistryServiceClient();
+ RegistryServerHandler registryServiceClient = getRegistryServiceClient();
ComputeResourcePreference computeResourcePreference = null;
try {
computeResourcePreference =
@@ -111,7 +110,7 @@ public class SSHAccountManager {
throws InvalidSetupException, InvalidUsernameException {
// get compute resource preferences for the gateway and hostname
- RegistryService.Iface registryServiceClient = getRegistryServiceClient();
+ RegistryServerHandler registryServiceClient = getRegistryServiceClient();
ComputeResourcePreference computeResourcePreference = null;
ComputeResourceDescription computeResourceDescription = null;
SSHJobSubmission sshJobSubmission = null;
@@ -282,7 +281,7 @@ public class SSHAccountManager {
return result;
}
- private static RegistryService.Iface getRegistryServiceClient() {
+ private static RegistryServerHandler getRegistryServiceClient() {
return new RegistryServerHandler();
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/handler/RegistryServerHandler.java b/airavata-api/src/main/java/org/apache/airavata/execution/handler/RegistryServerHandler.java
index 318aadd476..de12be6763 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/handler/RegistryServerHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/handler/RegistryServerHandler.java
@@ -70,7 +70,6 @@ import org.apache.airavata.model.workspace.proto.Gateway;
import org.apache.airavata.model.workspace.proto.GatewayUsageReportingCommand;
import org.apache.airavata.model.workspace.proto.Notification;
import org.apache.airavata.model.workspace.proto.Project;
-import org.apache.airavata.registry.api.RegistryService;
import org.apache.airavata.registry.api.exception.RegistryServiceException;
import org.apache.airavata.registry.api.registry_apiConstants;
import org.apache.airavata.storage.repository.DataProductRepository;
@@ -82,7 +81,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
-public class RegistryServerHandler implements RegistryService.Iface {
+public class RegistryServerHandler {
private static final Logger logger = LoggerFactory.getLogger(RegistryServerHandler.class);
@PostConstruct
@@ -130,7 +129,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
/**
* Fetch Apache Registry API version
*/
- @Override
public String getAPIVersion() throws Exception {
return registry_apiConstants.REGISTRY_API_VERSION;
}
@@ -142,7 +140,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param userName
* @return true/false
*/
- @Override
public boolean isUserExists(String gatewayId, String userName) throws RegistryServiceException, Exception {
try {
return userRepository.isUserExists(gatewayId, userName);
@@ -161,7 +158,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return users
* list of usernames of the users in the gateway
*/
- @Override
public List<String> getAllUsersInGateway(String gatewayId) throws RegistryServiceException, Exception {
try {
return userRepository.getAllUsernamesInGateway(gatewayId);
@@ -180,13 +176,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return gateway
* Gateway obejct.
*/
- @Override
public Gateway getGateway(String gatewayId) throws RegistryServiceException, Exception {
try {
if (!gatewayRepository.isGatewayExist(gatewayId)) {
logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
+ RegistryServiceException exception = new RegistryServiceException("Gateway does not exist in the system. Please provide a valid gateway ID...");
throw exception;
}
Gateway gateway = gatewayRepository.getGateway(gatewayId);
@@ -207,13 +201,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return boolean
* Boolean identifier for the success or failure of the deletion operation.
*/
- @Override
public boolean deleteGateway(String gatewayId) throws RegistryServiceException, Exception {
try {
if (!gatewayRepository.isGatewayExist(gatewayId)) {
logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
+ RegistryServiceException exception = new RegistryServiceException("Gateway does not exist in the system. Please provide a valid gateway ID...");
throw exception;
}
gatewayRepository.removeGateway(gatewayId);
@@ -230,7 +222,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
/**
* Get All the Gateways Connected to Airavata.
*/
- @Override
public List<Gateway> getAllGateways() throws RegistryServiceException, Exception {
try {
List<Gateway> gateways = gatewayRepository.getAllGateways();
@@ -251,7 +242,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return gatewayId
* return the gatewayId of the existing gateway.
*/
- @Override
public boolean isGatewayExist(String gatewayId) throws RegistryServiceException, Exception {
try {
return gatewayRepository.isGatewayExist(gatewayId);
@@ -263,7 +253,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean deleteNotification(String gatewayId, String notificationId)
throws RegistryServiceException, Exception {
try {
@@ -277,7 +266,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public Notification getNotification(String gatewayId, String notificationId)
throws RegistryServiceException, Exception {
try {
@@ -290,7 +278,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<Notification> getAllNotifications(String gatewayId) throws RegistryServiceException, Exception {
try {
List<Notification> notifications = notificationRepository.getAllGatewayNotifications(gatewayId);
@@ -311,13 +298,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return project
* project data model will be returned.
*/
- @Override
public Project getProject(String projectId) throws RegistryServiceException, Exception {
try {
if (!projectRepository.isProjectExist(projectId)) {
logger.error("Project does not exist in the system. Please provide a valid project ID...");
- ProjectNotFoundException exception = new ProjectNotFoundException();
- exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
+ RegistryServiceException exception = new RegistryServiceException("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
logger.debug("Airavata retrieved project with project Id : " + projectId);
@@ -342,13 +327,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
* <p>
* NOTE: This method is not used within gateways connected with Airavata.
*/
- @Override
public boolean deleteProject(String projectId) throws RegistryServiceException, Exception {
try {
if (!projectRepository.isProjectExist(projectId)) {
logger.error("Project does not exist in the system. Please provide a valid project ID...");
- ProjectNotFoundException exception = new ProjectNotFoundException();
- exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
+ RegistryServiceException exception = new RegistryServiceException("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
@@ -372,7 +355,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param limit The amount results to be fetched.
* @param offset The starting point of the results to be fetched.
*/
- @Override
public List<Project> getUserProjects(String gatewayId, String userName, int limit, int offset)
throws RegistryServiceException, Exception {
if (!validateString(userName)) {
@@ -418,7 +400,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param fromTime Starting date time.
* @param toTime Ending data time.
*/
- @Override
public ExperimentStatistics getExperimentStatistics(
String gatewayId,
long fromTime,
@@ -432,7 +413,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
// FIXME: for now allowing to pass null accessibleExpIds (only admin users should call this method)
// if (accessibleExpIds == null) {
@@ -479,12 +460,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param limit Amount of results to be fetched.
* @param offset The starting point of the results to be fetched.
*/
- @Override
public List<ExperimentModel> getExperimentsInProject(String gatewayId, String projectId, int limit, int offset)
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
if (!validateString(projectId)) {
logger.error("Project id cannot be empty. Please provide a valid project ID...");
@@ -495,8 +475,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
try {
if (!projectRepository.isProjectExist(projectId)) {
logger.error("Project does not exist in the system. Please provide a valid project ID...");
- ProjectNotFoundException exception = new ProjectNotFoundException();
- exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
+ RegistryServiceException exception = new RegistryServiceException("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
@@ -527,19 +506,16 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param limit Amount of results to be fetched.
* @param offset The starting point of the results to be fetched.
*/
- @Override
public List<ExperimentModel> getUserExperiments(String gatewayId, String userName, int limit, int offset)
throws RegistryServiceException, Exception {
if (!validateString(userName)) {
logger.error("Username cannot be empty. Please provide a valid user..");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Username cannot be empty. Please provide a valid user..");
+ RegistryServiceException exception = new RegistryServiceException("Username cannot be empty. Please provide a valid user..");
throw exception;
}
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
List<ExperimentModel> experiments = new ArrayList<ExperimentModel>();
try {
@@ -572,16 +548,15 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param experimentId@return boolean
* Identifier for the success or failure of the deletion operation.
*/
- @Override
public boolean deleteExperiment(String experimentId) throws RegistryServiceException, Exception {
try {
if (!experimentRepository.isExperimentExist(experimentId)) {
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + experimentId + " does not exist in the system..");
}
ExperimentModel experimentModel = experimentRepository.getExperiment(experimentId);
- if (!(experimentModel.getExperimentStatusList().get(0).getState() == ExperimentState.CREATED)) {
+ if (!(experimentModel.getExperimentStatusList().get(0).getState() == ExperimentState.EXPERIMENT_STATE_CREATED)) {
logger.error("Error while deleting the experiment");
throw new ExperimentCatalogException(
"Experiment is not in CREATED state. Hence cannot deleted. ID:" + experimentId);
@@ -635,7 +610,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param airavataExperimentId
*/
- @Override
public ExperimentModel getExperiment(String airavataExperimentId) throws RegistryServiceException, Exception {
ExperimentModel experimentModel = getExperimentInternal(airavataExperimentId);
return experimentModel;
@@ -666,7 +640,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @throws AiravataSystemException This exception will be thrown for any Airavata Server side issues and if the problem cannot be corrected by the client
* rather an Airavata Administrator will be notified to take corrective action.
*/
- @Override
public ExperimentModel getDetailedExperimentTree(String airavataExperimentId)
throws RegistryServiceException, Exception {
try {
@@ -683,7 +656,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
Constants.FieldConstants.JobConstants.TASK_ID, t.getTaskId());
if (jobList != null) {
Collections.sort(jobList, new Comparator<JobModel>() {
- @Override
public int compare(JobModel o1, JobModel o2) {
return (int) (o1.getCreationTime() - o2.getCreationTime());
}
@@ -719,7 +691,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return ExperimentStatus
* ExperimentStatus model with the current status will be returned.
*/
- @Override
public ExperimentStatus getExperimentStatus(String airavataExperimentId)
throws RegistryServiceException, Exception {
ExperimentStatus experimentStatus = getExperimentStatusInternal(airavataExperimentId);
@@ -735,7 +706,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list
* List of experiment outputs will be returned. They will be returned as a list of OutputDataObjectType for the experiment.
*/
- @Override
public List<OutputDataObjectType> getExperimentOutputs(String airavataExperimentId)
throws RegistryServiceException, Exception {
try {
@@ -744,7 +714,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
airavataExperimentId,
"Get experiment outputs failed, experiment {} doesn't exit.",
airavataExperimentId);
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
logger.debug("Airavata retrieved experiment outputs for experiment id : " + airavataExperimentId);
@@ -765,7 +735,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list
* List of intermediate experiment outputs will be returned. They will be returned as a list of OutputDataObjectType for the experiment.
*/
- @Override
public List<OutputDataObjectType> getIntermediateOutputs(String airavataExperimentId)
throws RegistryServiceException, Exception {
return null;
@@ -778,7 +747,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param airavataExperimentId@return JobStatus
* 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, Exception {
try {
@@ -787,7 +755,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
airavataExperimentId,
"Error while retrieving job details, experiment {} doesn't exist.",
airavataExperimentId);
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
List<ProcessModel> processModels = processRepository.getProcessList(
@@ -819,14 +787,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
return jobStatus;
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while retrieving the job statuses", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving the job statuses. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving the job statuses. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addExperimentProcessOutputs(String outputType, List<OutputDataObjectType> outputs, String id)
throws RegistryServiceException, Exception {
@@ -838,14 +803,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
} catch (Exception e) {
logger.error(id, "Error while adding outputs", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding outputs. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding outputs. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addErrors(String errorType, ErrorModel errorModel, String id)
throws RegistryServiceException, Exception {
@@ -859,69 +821,54 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
} catch (Exception e) {
logger.error(id, "Error while adding error", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding error. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding error. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addTaskStatus(TaskStatus taskStatus, String taskId) throws RegistryServiceException, Exception {
try {
taskStatusRepository.addTaskStatus(taskStatus, taskId);
} catch (Exception e) {
logger.error(taskId, "Error while adding task status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding task status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding task status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addProcessStatus(ProcessStatus processStatus, String processId)
throws RegistryServiceException, Exception {
try {
processStatusRepository.addProcessStatus(processStatus, processId);
} catch (Exception e) {
logger.error(processId, "Error while adding process status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding process status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding process status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void updateProcessStatus(ProcessStatus processStatus, String processId)
throws RegistryServiceException, Exception {
try {
processStatusRepository.updateProcessStatus(processStatus, processId);
} catch (Exception e) {
logger.error(processId, "Error while updating process status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while updating process status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while updating process status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void updateExperimentStatus(ExperimentStatus experimentStatus, String experimentId)
throws RegistryServiceException, Exception {
try {
experimentStatusRepository.updateExperimentStatus(experimentStatus, experimentId);
} catch (Exception e) {
logger.error(experimentId, "Error while updating experiment status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while updating experiment status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while updating experiment status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addJobStatus(JobStatus jobStatus, String taskId, String jobId)
throws RegistryServiceException, Exception {
try {
@@ -931,27 +878,21 @@ public class RegistryServerHandler implements RegistryService.Iface {
jobStatusRepository.addJobStatus(jobStatus, jobPK);
} catch (Exception e) {
logger.error(jobId, "Error while adding job status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding job status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding job status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addJob(JobModel jobModel, String processId) throws RegistryServiceException, Exception {
try {
jobRepository.addJob(jobModel, processId);
} catch (Exception e) {
logger.error(processId, "Error while adding job ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding job. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding job. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void deleteJobs(String processId) throws RegistryServiceException, Exception {
try {
List<JobModel> jobs = jobRepository.getJobList(Constants.FieldConstants.JobConstants.PROCESS_ID, processId);
@@ -960,94 +901,73 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
} catch (Exception e) {
logger.error(processId, "Error while deleting job ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while deleting job. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while deleting job. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public String addProcess(ProcessModel processModel, String experimentId)
throws RegistryServiceException, Exception {
try {
return processRepository.addProcess(processModel, experimentId);
} catch (Exception e) {
logger.error(experimentId, "Error while adding process ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding process. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding process. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void updateProcess(ProcessModel processModel, String processId) throws RegistryServiceException, Exception {
try {
processRepository.updateProcess(processModel, processId);
} catch (Exception e) {
logger.error(processId, "Error while updating process ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while updating process. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while updating process. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public String addTask(TaskModel taskModel, String processId) throws RegistryServiceException, Exception {
try {
return taskRepository.addTask(taskModel, processId);
} catch (Exception e) {
logger.error(processId, "Error while adding task ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding task. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding task. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void deleteTasks(String processId) throws RegistryServiceException, Exception {
try {
taskRepository.deleteTasks(processId);
} catch (Exception e) {
logger.error(processId, "Error while adding task ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding task. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding task. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public UserConfigurationDataModel getUserConfigurationData(String experimentId)
throws RegistryServiceException, Exception {
try {
return experimentRepository.getUserConfigurationData(experimentId);
} catch (Exception e) {
logger.error(experimentId, "Error while getting user configuration ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding task. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while adding task. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public ProcessModel getProcess(String processId) throws RegistryServiceException, Exception {
try {
return processRepository.getProcess(processId);
} catch (Exception e) {
logger.error(processId, "Error while retrieving user configuration ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving user configuration. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving user configuration. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public List<ProcessModel> getProcessList(String experimentId) throws RegistryServiceException, Exception {
try {
List<ProcessModel> processModels = processRepository.getProcessList(
@@ -1056,27 +976,21 @@ public class RegistryServerHandler implements RegistryService.Iface {
} catch (Exception e) {
logger.error(experimentId, "Error while retrieving process list ", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving process list. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process list. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public ProcessStatus getProcessStatus(String processId) throws RegistryServiceException, Exception {
try {
return processStatusRepository.getProcessStatus(processId);
} catch (Exception e) {
logger.error(processId, "Error while retrieving process status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving process status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public List<ProcessModel> getProcessListInState(ProcessState processState)
throws RegistryServiceException, Exception {
try {
@@ -1099,23 +1013,16 @@ public class RegistryServerHandler implements RegistryService.Iface {
} while (count == limit);
return finalProcessList;
} catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(
- "Error while retrieving process list with given status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process list with given status. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public List<ProcessStatus> getProcessStatusList(String processId) throws RegistryServiceException, Exception {
try {
return processStatusRepository.getProcessStatusList(processId);
} catch (Exception e) {
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(
- "Error while retrieving process status list for given process Id. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process status list for given process Id. More info : " + e.getMessage());
throw exception;
}
}
@@ -1123,16 +1030,13 @@ public class RegistryServerHandler implements RegistryService.Iface {
/**
* queryType can be PROCESS_ID or TASK_ID
*/
- @Override
public boolean isJobExist(String queryType, String id) throws RegistryServiceException, Exception {
try {
JobModel jobModel = fetchJobModel(queryType, id);
return jobModel != null;
} catch (Exception e) {
logger.error(id, "Error while retrieving job", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving job. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving job. More info : " + e.getMessage());
throw exception;
}
}
@@ -1140,7 +1044,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
/**
* queryType can be PROCESS_ID or TASK_ID
*/
- @Override
public JobModel getJob(String queryType, String id) throws RegistryServiceException, Exception {
try {
JobModel jobModel = fetchJobModel(queryType, id);
@@ -1148,29 +1051,23 @@ public class RegistryServerHandler implements RegistryService.Iface {
throw new Exception("Job not found for queryType: " + queryType + ", id: " + id);
} catch (Exception e) {
logger.error(id, "Error while retrieving job", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving job. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving job. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public List<JobModel> getJobs(String queryType, String id) throws RegistryServiceException, Exception {
try {
return fetchJobModels(queryType, id);
} catch (Exception e) {
logger.error(id, "Error while retrieving jobs for query " + queryType + " and id " + id, e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving jobs for query " + queryType + " and id " + id
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving jobs for query " + queryType + " and id " + id
+ ". More info : " + e.getMessage());
throw exception;
}
}
- @Override
public int getJobCount(
org.apache.airavata.model.status.JobStatus jobStatus, String gatewayId, double searchBackTimeInMinutes)
throws RegistryServiceException, Exception {
@@ -1180,7 +1077,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
return jobStatusList.size();
}
- @Override
public Map<String, Double> getAVGTimeDistribution(String gatewayId, double searchBackTimeInMinutes)
throws RegistryServiceException, Exception {
return processRepository.getAVGTimeDistribution(gatewayId, searchBackTimeInMinutes);
@@ -1225,57 +1121,45 @@ public class RegistryServerHandler implements RegistryService.Iface {
return jobs;
}
- @Override
public List<OutputDataObjectType> getProcessOutputs(String processId) throws RegistryServiceException, Exception {
try {
return processOutputRepository.getProcessOutputs(processId);
} catch (Exception e) {
logger.error("Error while retrieving process outputs for process id " + processId, e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving process outputs. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process outputs. More info : " + e.getMessage());
throw exception;
}
}
- @Override
public List<ProcessWorkflow> getProcessWorkflows(String processId) throws RegistryServiceException, Exception {
try {
return processWorkflowRepository.getProcessWorkflows(processId);
} catch (Exception e) {
logger.error("Error while retrieving process workflows for process id " + processId, e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving process workflows for process id " + processId
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process workflows for process id " + processId
+ ". More info : " + e.getMessage());
throw exception;
}
}
- @Override
public void addProcessWorkflow(ProcessWorkflow processWorkflow) throws RegistryServiceException, Exception {
try {
processWorkflowRepository.addProcessWorkflow(processWorkflow, processWorkflow.getProcessId());
} catch (Exception e) {
logger.error("Error while adding process workflows for process id " + processWorkflow.getProcessId(), e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding process workflows for process id " + processWorkflow.getProcessId()
+ RegistryServiceException exception = new RegistryServiceException("Error while adding process workflows for process id " + processWorkflow.getProcessId()
+ ". More info : " + e.getMessage());
throw exception;
}
}
- @Override
public List<String> getProcessIds(String experimentId) throws RegistryServiceException, Exception {
try {
return processRepository.getProcessIds(DBConstants.Process.EXPERIMENT_ID, experimentId);
} catch (Exception e) {
logger.error(experimentId, "Error while retrieving process ids", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving process ids. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving process ids. More info : " + e.getMessage());
throw exception;
}
}
@@ -1287,7 +1171,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param airavataExperimentId@return list of JobDetails
* Job details.
*/
- @Override
public List<JobModel> getJobDetails(String airavataExperimentId) throws RegistryServiceException, Exception {
try {
if (!experimentRepository.isExperimentExist(airavataExperimentId)) {
@@ -1295,7 +1178,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
airavataExperimentId,
"Error while retrieving job details, experiment {} doesn't exist.",
airavataExperimentId);
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
List<ProcessModel> processModels = processRepository.getProcessList(
@@ -1331,7 +1214,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return applicationModule
* Returns an Application Module Object.
*/
- @Override
public ApplicationModule getApplicationModule(String appModuleId) throws RegistryServiceException, Exception {
try {
ApplicationModule module = applicationInterfaceRepository.getApplicationModule(appModuleId);
@@ -1352,7 +1234,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list
* Returns the list of all Application Module Objects.
*/
- @Override
public List<ApplicationModule> getAllAppModules(String gatewayId) throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
@@ -1378,7 +1259,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list
* Returns the list of all Application Module Objects that are accessible to the user.
*/
- @Override
public List<ApplicationModule> getAccessibleAppModules(
String gatewayId, List<String> accessibleAppIds, List<String> accessibleComputeResourceIds)
throws RegistryServiceException, Exception {
@@ -1406,7 +1286,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteApplicationModule(String appModuleId) throws RegistryServiceException, Exception {
try {
logger.debug("Airavata deleted application module with module id : " + appModuleId);
@@ -1426,7 +1305,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return applicationDeployment
* Returns a application Deployment Object.
*/
- @Override
public ApplicationDeploymentDescription getApplicationDeployment(String appDeploymentId)
throws RegistryServiceException, Exception {
try {
@@ -1449,7 +1327,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteApplicationDeployment(String appDeploymentId) throws RegistryServiceException, Exception {
try {
applicationDeploymentRepository.removeAppDeployment(appDeploymentId);
@@ -1471,7 +1348,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list<applicationDeployment.
* Returns the list of all application Deployment Objects.
*/
- @Override
public List<ApplicationDeploymentDescription> getAllApplicationDeployments(String gatewayId)
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
@@ -1499,7 +1375,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list<applicationDeployment.
* Returns the list of all application Deployment Objects that are accessible to the user.
*/
- @Override
public List<ApplicationDeploymentDescription> getAccessibleApplicationDeployments(
String gatewayId, List<String> accessibleAppDeploymentIds, List<String> accessibleComputeResourceIds)
throws RegistryServiceException, Exception {
@@ -1531,7 +1406,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list<applicationDeployment>
* Returns the list of all application Deployment Objects.
*/
- @Override
public List<ApplicationDeploymentDescription> getAccessibleApplicationDeploymentsForAppModule(
String gatewayId,
String appModuleId,
@@ -1562,7 +1436,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list<string>
* Returns a list of Deployed Resources.
*/
- @Override
public List<String> getAppModuleDeployedResources(String appModuleId) throws RegistryServiceException, Exception {
try {
List<String> appDeployments = new ArrayList<>();
@@ -1583,7 +1456,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<ApplicationDeploymentDescription> getApplicationDeployments(String appModuleId)
throws RegistryServiceException, Exception {
try {
@@ -1607,7 +1479,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return applicationInterface
* Returns an application Interface Object.
*/
- @Override
public ApplicationInterfaceDescription getApplicationInterface(String appInterfaceId)
throws RegistryServiceException, Exception {
try {
@@ -1630,7 +1501,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteApplicationInterface(String appInterfaceId) throws RegistryServiceException, Exception {
try {
boolean removeApplicationInterface =
@@ -1652,7 +1522,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return map<applicationId, applicationInterfaceNames>
* Returns a list of application interfaces with corresponsing ID's
*/
- @Override
public Map<String, String> getAllApplicationInterfaceNames(String gatewayId)
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
@@ -1687,7 +1556,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return map<applicationId, applicationInterfaceNames>
* Returns a list of application interfaces documents (Application Interface ID, name, description, Inputs and Outputs objects).
*/
- @Override
public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(String gatewayId)
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
@@ -1714,7 +1582,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list<application_interface_model.InputDataObjectType>
* Returns a list of application inputs.
*/
- @Override
public List<InputDataObjectType> getApplicationInputs(String appInterfaceId)
throws RegistryServiceException, Exception {
try {
@@ -1737,7 +1604,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return list<application_interface_model.OutputDataObjectType>
* Returns a list of application outputs.
*/
- @Override
public List<OutputDataObjectType> getApplicationOutputs(String appInterfaceId)
throws RegistryServiceException, Exception {
List<OutputDataObjectType> list = getApplicationOutputsInternal(appInterfaceId);
@@ -1753,7 +1619,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* A map of registered compute resource id's and their corresponding hostnames.
* Deployments of each modules listed within the interfaces will be listed.
*/
- @Override
public Map<String, String> getAvailableAppInterfaceComputeResources(String appInterfaceId)
throws RegistryServiceException, Exception {
try {
@@ -1763,8 +1628,8 @@ public class RegistryServerHandler implements RegistryService.Iface {
ApplicationInterfaceDescription applicationInterface =
applicationInterfaceRepository.getApplicationInterface(appInterfaceId);
HashMap<String, String> filters = new HashMap<>();
- List<String> applicationModules = applicationInterface.getApplicationModules();
- if (applicationModules != null && !applicationModules.isEmpty()) {
+ List<String> applicationModules = applicationInterface.getApplicationModulesList();
+ if (!applicationModules.isEmpty()) {
for (String moduleId : applicationModules) {
filters.put(DBConstants.ApplicationDeployment.APPLICATION_MODULE_ID, moduleId);
List<ApplicationDeploymentDescription> applicationDeployments =
@@ -1796,7 +1661,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return computeResourceDescription
* Compute Resource Object created from the datamodel..
*/
- @Override
public ComputeResourceDescription getComputeResource(String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -1818,7 +1682,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return A map of registered compute resource id's and thier corresponding hostnames.
* Compute Resource Object created from the datamodel..
*/
- @Override
public Map<String, String> getAllComputeResourceNames() throws RegistryServiceException, Exception {
try {
Map<String, String> computeResourceIdList = new ComputeResourceRepository().getAllComputeResourceIdList();
@@ -1839,7 +1702,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteComputeResource(String computeResourceId) throws RegistryServiceException, Exception {
try {
new ComputeResourceRepository().removeComputeResource(computeResourceId);
@@ -1860,7 +1722,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return storageResourceDescription
* Storage Resource Object created from the datamodel..
*/
- @Override
public StorageResourceDescription getStorageResource(String storageResourceId)
throws RegistryServiceException, Exception {
try {
@@ -1882,7 +1743,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return A map of registered compute resource id's and thier corresponding hostnames.
* Compute Resource Object created from the datamodel..
*/
- @Override
public Map<String, String> getAllStorageResourceNames() throws RegistryServiceException, Exception {
try {
Map<String, String> resourceIdList = storageResourceRepository.getAllStorageResourceIdList();
@@ -1903,7 +1763,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteStorageResource(String storageResourceId) throws RegistryServiceException, Exception {
try {
storageResourceRepository.removeStorageResource(storageResourceId);
@@ -1922,7 +1781,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param jobSubmissionId@return LOCALSubmission instance
*/
- @Override
public LOCALSubmission getLocalJobSubmission(String jobSubmissionId) throws RegistryServiceException, Exception {
try {
LOCALSubmission localJobSubmission = new ComputeResourceRepository().getLocalJobSubmission(jobSubmissionId);
@@ -1942,7 +1800,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param jobSubmissionId@return SSHJobSubmission instance
*/
- @Override
public SSHJobSubmission getSSHJobSubmission(String jobSubmissionId) throws RegistryServiceException, Exception {
try {
SSHJobSubmission sshJobSubmission = new ComputeResourceRepository().getSSHJobSubmission(jobSubmissionId);
@@ -1969,7 +1826,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param jobSubmissionId
*/
- @Override
public UnicoreJobSubmission getUnicoreJobSubmission(String jobSubmissionId)
throws RegistryServiceException, Exception {
try {
@@ -1997,7 +1853,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param jobSubmissionId
*/
- @Override
public CloudJobSubmission getCloudJobSubmission(String jobSubmissionId)
throws RegistryServiceException, Exception {
try {
@@ -2020,7 +1875,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param dataMovementId The identifier of the datamovement Interface to be retrieved.
* @return LOCALDataMovement instance
*/
- @Override
public LOCALDataMovement getLocalDataMovement(String dataMovementId) throws RegistryServiceException, Exception {
try {
LOCALDataMovement localDataMovement = new ComputeResourceRepository().getLocalDataMovement(dataMovementId);
@@ -2041,7 +1895,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param dataMovementId The identifier of the datamovement Interface to be retrieved.
* @return SCPDataMovement instance
*/
- @Override
public SCPDataMovement getSCPDataMovement(String dataMovementId) throws RegistryServiceException, Exception {
try {
SCPDataMovement scpDataMovement = new ComputeResourceRepository().getSCPDataMovement(dataMovementId);
@@ -2062,7 +1915,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param dataMovementId The identifier of the datamovement Interface to be retrieved.
* @return UnicoreDataMovement instance
*/
- @Override
public UnicoreDataMovement getUnicoreDataMovement(String dataMovementId)
throws RegistryServiceException, Exception {
try {
@@ -2085,7 +1937,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param dataMovementId The identifier of the datamovement Interface to be retrieved.
* @return GridFTPDataMovement instance
*/
- @Override
public GridFTPDataMovement getGridFTPDataMovement(String dataMovementId)
throws RegistryServiceException, Exception {
try {
@@ -2110,7 +1961,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the change.
*/
- @Override
public boolean changeJobSubmissionPriority(String jobSubmissionInterfaceId, int newPriorityOrder)
throws RegistryServiceException, Exception {
return false;
@@ -2124,7 +1974,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the change.
*/
- @Override
public boolean changeDataMovementPriority(String dataMovementInterfaceId, int newPriorityOrder)
throws RegistryServiceException, Exception {
return false;
@@ -2137,7 +1986,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the changes.
*/
- @Override
public boolean changeJobSubmissionPriorities(Map<String, Integer> jobSubmissionPriorityMap)
throws RegistryServiceException, Exception {
return false;
@@ -2150,7 +1998,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the changes.
*/
- @Override
public boolean changeDataMovementPriorities(Map<String, Integer> dataMovementPriorityMap)
throws RegistryServiceException, Exception {
return false;
@@ -2164,7 +2011,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteJobSubmissionInterface(String computeResourceId, String jobSubmissionInterfaceId)
throws RegistryServiceException, Exception {
try {
@@ -2179,7 +2025,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public ResourceJobManager getResourceJobManager(String resourceJobManagerId)
throws RegistryServiceException, Exception {
try {
@@ -2192,7 +2037,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean deleteResourceJobManager(String resourceJobManagerId) throws RegistryServiceException, Exception {
try {
new ComputeResourceRepository().deleteResourceJobManager(resourceJobManagerId);
@@ -2213,7 +2057,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteBatchQueue(String computeResourceId, String queueName)
throws RegistryServiceException, Exception {
try {
@@ -2234,13 +2077,12 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return gatewayResourceProfile
* Gateway Resource Profile Object.
*/
- @Override
public GatewayResourceProfile getGatewayResourceProfile(String gatewayID)
throws RegistryServiceException, Exception {
try {
if (!isGatewayExistInternal(gatewayID)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
GatewayResourceProfile gatewayResourceProfile = gwyResourceProfileRepository.getGatewayProfile(gatewayID);
@@ -2261,7 +2103,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteGatewayResourceProfile(String gatewayID) throws RegistryServiceException, Exception {
try {
if (!isGatewayExistInternal(gatewayID)) {
@@ -2288,7 +2129,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
- @Override
public ComputeResourcePreference getGatewayComputeResourcePreference(String gatewayID, String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -2338,7 +2178,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return StoragePreference
* Returns the StoragePreference object.
*/
- @Override
public StoragePreference getGatewayStoragePreference(String gatewayID, String storageId)
throws RegistryServiceException, Exception {
try {
@@ -2377,7 +2216,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
- @Override
public List<ComputeResourcePreference> getAllGatewayComputeResourcePreferences(String gatewayID)
throws RegistryServiceException, Exception {
try {
@@ -2403,7 +2241,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return StoragePreference
* Returns the StoragePreference object.
*/
- @Override
public List<StoragePreference> getAllGatewayStoragePreferences(String gatewayID)
throws RegistryServiceException, Exception {
try {
@@ -2427,7 +2264,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return GatewayResourceProfile
* Returns all the GatewayResourcePrifle list object.
*/
- @Override
public List<GatewayResourceProfile> getAllGatewayResourceProfiles() throws RegistryServiceException, Exception {
try {
GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
@@ -2447,7 +2283,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteGatewayComputeResourcePreference(String gatewayID, String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -2476,7 +2311,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteGatewayStoragePreference(String gatewayID, String storageId)
throws RegistryServiceException, Exception {
try {
@@ -2495,7 +2329,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public DataProductModel getDataProduct(String productUri) throws RegistryServiceException, Exception {
try {
DataProductModel dataProductModel = dataProductRepository.getDataProduct(productUri);
@@ -2509,7 +2342,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public DataProductModel getParentDataProduct(String productUri) throws RegistryServiceException, Exception {
try {
DataProductModel dataProductModel = dataProductRepository.getParentDataProduct(productUri);
@@ -2523,7 +2355,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<DataProductModel> getChildDataProducts(String productUri) throws RegistryServiceException, Exception {
try {
List<DataProductModel> dataProductModels = dataProductRepository.getChildDataProducts(productUri);
@@ -2537,7 +2368,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<DataProductModel> searchDataProductsByName(
String gatewayId, String userId, String productName, int limit, int offset)
throws RegistryServiceException, Exception {
@@ -2554,7 +2384,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public String createGroupResourceProfile(GroupResourceProfile groupResourceProfile)
throws RegistryServiceException, Exception {
try {
@@ -2575,7 +2404,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void updateGroupResourceProfile(GroupResourceProfile groupResourceProfile)
throws RegistryServiceException, Exception {
try {
@@ -2600,7 +2428,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public GroupResourceProfile getGroupResourceProfile(String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2622,7 +2449,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean isGroupResourceProfileExists(String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2636,7 +2462,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean removeGroupResourceProfile(String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2658,7 +2483,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<GroupResourceProfile> getGroupResourceList(String gatewayId, List<String> accessibleGroupResProfileIds)
throws RegistryServiceException, Exception {
try {
@@ -2672,7 +2496,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean removeGroupComputePrefs(String computeResourceId, String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2689,7 +2512,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean removeGroupComputeResourcePolicy(String resourcePolicyId)
throws RegistryServiceException, Exception {
try {
@@ -2705,7 +2527,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean removeGroupBatchQueueResourcePolicy(String resourcePolicyId)
throws RegistryServiceException, Exception {
try {
@@ -2722,7 +2543,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public GroupComputeResourcePreference getGroupComputeResourcePreference(
String computeResourceId, String groupResourceProfileId) throws RegistryServiceException, Exception {
try {
@@ -2747,7 +2567,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean isGroupComputeResourcePreferenceExists(String computeResourceId, String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2763,7 +2582,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public ComputeResourcePolicy getGroupComputeResourcePolicy(String resourcePolicyId)
throws RegistryServiceException, Exception {
try {
@@ -2785,7 +2603,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public BatchQueueResourcePolicy getBatchQueueResourcePolicy(String resourcePolicyId)
throws RegistryServiceException, Exception {
try {
@@ -2807,7 +2624,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<GroupComputeResourcePreference> getGroupComputeResourcePrefList(String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2823,7 +2639,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<BatchQueueResourcePolicy> getGroupBatchQueueResourcePolicyList(String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2839,7 +2654,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<ComputeResourcePolicy> getGroupComputeResourcePolicyList(String groupResourceProfileId)
throws RegistryServiceException, Exception {
try {
@@ -2854,7 +2668,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public String registerReplicaLocation(DataReplicaLocationModel replicaLocationModel)
throws RegistryServiceException, Exception {
try {
@@ -2874,7 +2687,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param dataProductModel
*/
- @Override
public String registerDataProduct(DataProductModel dataProductModel) throws RegistryServiceException, Exception {
try {
String productUrl = dataProductRepository.registerDataProduct(dataProductModel);
@@ -2897,7 +2709,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the updation.
*/
- @Override
public boolean updateGatewayStoragePreference(
String gatewayID, String storageId, StoragePreference storagePreference)
throws RegistryServiceException, Exception {
@@ -2943,7 +2754,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the updation.
*/
- @Override
public boolean updateGatewayComputeResourcePreference(
String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference)
throws RegistryServiceException, Exception {
@@ -2991,7 +2801,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* Returns a success/failure of the addition. If a profile already exists, this operation will fail.
* Instead an update should be used.
*/
- @Override
public boolean addGatewayStoragePreference(
String gatewayID, String storageResourceId, StoragePreference dataStoragePreference)
throws RegistryServiceException, Exception {
@@ -3032,7 +2841,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* Returns a success/failure of the addition. If a profile already exists, this operation will fail.
* Instead an update should be used.
*/
- @Override
public boolean addGatewayComputeResourcePreference(
String gatewayID, String computeResourceId, ComputeResourcePreference computeResourcePreference)
throws RegistryServiceException, Exception {
@@ -3068,7 +2876,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateGatewayResourceProfile(String gatewayID, GatewayResourceProfile gatewayResourceProfile)
throws RegistryServiceException, Exception {
try {
@@ -3097,24 +2904,23 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public String registerGatewayResourceProfile(GatewayResourceProfile gatewayResourceProfile)
throws RegistryServiceException, Exception {
try {
- if (!validateString(gatewayResourceProfile.getGatewayID())) {
+ if (!validateString(gatewayResourceProfile.getGatewayId())) {
logger.error("Cannot create gateway profile with empty gateway id");
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Cannot create gateway profile with empty gateway id");
throw exception;
}
- if (!isGatewayExistInternal(gatewayResourceProfile.getGatewayID())) {
+ if (!isGatewayExistInternal(gatewayResourceProfile.getGatewayId())) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
throw new RegistryServiceException("Gateway does not exist.Please provide a valid gateway id...");
}
GwyResourceProfileRepository gwyResourceProfileRepository = new GwyResourceProfileRepository();
String resourceProfile = gwyResourceProfileRepository.addGatewayResourceProfile(gatewayResourceProfile);
logger.debug(
- "Airavata registered gateway profile with gateway id : " + gatewayResourceProfile.getGatewayID());
+ "Airavata registered gateway profile with gateway id : " + gatewayResourceProfile.getGatewayId());
return resourceProfile;
} catch (Exception e) {
logger.error("Error while registering gateway resource profile...", e);
@@ -3124,7 +2930,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean updateResourceJobManager(String resourceJobManagerId, ResourceJobManager updatedResourceJobManager)
throws RegistryServiceException, Exception {
try {
@@ -3138,7 +2943,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public String registerResourceJobManager(ResourceJobManager resourceJobManager)
throws RegistryServiceException, Exception {
try {
@@ -3159,7 +2963,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteDataMovementInterface(String resourceId, String dataMovementInterfaceId, DMType dmType)
throws RegistryServiceException, Exception {
try {
@@ -3196,7 +2999,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return boolean
* Returns a success/failure of the update.
*/
- @Override
public boolean updateGridFTPDataMovementDetails(
String dataMovementInterfaceId, GridFTPDataMovement gridFTPDataMovement)
throws RegistryServiceException, Exception {
@@ -3215,7 +3017,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique data movement id.
*/
- @Override
public String addGridFTPDataMovementDetails(
String computeResourceId, DMType dmType, int priorityOrder, GridFTPDataMovement gridFTPDataMovement)
throws RegistryServiceException, Exception {
@@ -3226,16 +3027,14 @@ public class RegistryServerHandler implements RegistryService.Iface {
computeResourceId,
dmType,
computeResourceRepository.addGridFTPDataMovement(gridFTPDataMovement),
- DataMovementProtocol.GridFTP,
+ DataMovementProtocol.GRID_FTP,
priorityOrder);
logger.debug("Airavata registered GridFTP data movement for resource Id: " + computeResourceId);
return addDataMovementInterface;
} catch (AppCatalogException e) {
logger.error(
computeResourceId, "Error while adding data movement interface to resource compute resource...", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
+ RegistryServiceException exception = new RegistryServiceException("Error while adding data movement interface to resource compute resource. More info : "
+ e.getMessage());
throw exception;
}
@@ -3250,7 +3049,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateUnicoreDataMovementDetails(
String dataMovementInterfaceId, UnicoreDataMovement unicoreDataMovement)
throws RegistryServiceException, Exception {
@@ -3269,7 +3067,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique data movement id.
*/
- @Override
public String addUnicoreDataMovementDetails(
String resourceId, DMType dmType, int priorityOrder, UnicoreDataMovement unicoreDataMovement)
throws RegistryServiceException, Exception {
@@ -3302,7 +3099,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateSCPDataMovementDetails(String dataMovementInterfaceId, SCPDataMovement scpDataMovement)
throws RegistryServiceException, Exception {
try {
@@ -3334,7 +3130,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique job submission id.
*/
- @Override
public String addSCPDataMovementDetails(
String resourceId, DMType dmType, int priorityOrder, SCPDataMovement scpDataMovement)
throws RegistryServiceException, Exception {
@@ -3366,7 +3161,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateLocalDataMovementDetails(String dataMovementInterfaceId, LOCALDataMovement localDataMovement)
throws RegistryServiceException, Exception {
try {
@@ -3393,7 +3187,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique job submission id.
*/
- @Override
public String addLocalDataMovementDetails(
String resourceId, DMType dataMoveType, int priorityOrder, LOCALDataMovement localDataMovement)
throws RegistryServiceException, Exception {
@@ -3404,7 +3197,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
resourceId,
dataMoveType,
computeResourceRepository.addLocalDataMovement(localDataMovement),
- DataMovementProtocol.LOCAL,
+ DataMovementProtocol.DATA_MOVEMENT_PROTOCOL_LOCAL,
priorityOrder);
logger.debug("Airavata registered local data movement for resource Id: " + resourceId);
return movementInterface;
@@ -3425,7 +3218,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateUnicoreJobSubmissionDetails(
String jobSubmissionInterfaceId, UnicoreJobSubmission unicoreJobSubmission)
throws RegistryServiceException, Exception {
@@ -3440,7 +3232,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateCloudJobSubmissionDetails(String jobSubmissionInterfaceId, CloudJobSubmission sshJobSubmission)
throws RegistryServiceException, Exception {
try {
@@ -3469,7 +3260,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateSSHJobSubmissionDetails(String jobSubmissionInterfaceId, SSHJobSubmission sshJobSubmission)
throws RegistryServiceException, Exception {
try {
@@ -3513,7 +3303,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param priorityOrder
* @param cloudSubmission
*/
- @Override
public String addCloudJobSubmissionDetails(
String computeResourceId, int priorityOrder, CloudJobSubmission cloudSubmission)
throws RegistryServiceException, Exception {
@@ -3523,7 +3312,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
computeResourceRepository,
computeResourceId,
computeResourceRepository.addCloudJobSubmission(cloudSubmission),
- JobSubmissionProtocol.CLOUD,
+ JobSubmissionProtocol.JSP_CLOUD,
priorityOrder);
logger.debug("Airavata registered Cloud job submission for compute resource id: " + computeResourceId);
return submissionInterface;
@@ -3550,7 +3339,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique job submission id.
*/
- @Override
public String addUNICOREJobSubmissionDetails(
String computeResourceId, int priorityOrder, UnicoreJobSubmission unicoreJobSubmission)
throws RegistryServiceException, Exception {
@@ -3584,7 +3372,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique job submission id.
*/
- @Override
public String addSSHForkJobSubmissionDetails(
String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
throws RegistryServiceException, Exception {
@@ -3621,7 +3408,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique job submission id.
*/
- @Override
public String addSSHJobSubmissionDetails(
String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
throws RegistryServiceException, Exception {
@@ -3656,7 +3442,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean updateLocalSubmissionDetails(String jobSubmissionInterfaceId, LOCALSubmission localSubmission)
throws RegistryServiceException, Exception {
try {
@@ -3687,7 +3472,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns the unique job submission id.
*/
- @Override
public String addLocalSubmissionDetails(
String computeResourceId, int priorityOrder, LOCALSubmission localSubmission)
throws RegistryServiceException, Exception {
@@ -3722,7 +3506,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateStorageResource(
String storageResourceId, StorageResourceDescription storageResourceDescription)
throws RegistryServiceException, Exception {
@@ -3745,7 +3528,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return storageResourceId
* Returns a server-side generated airavata storage resource globally unique identifier.
*/
- @Override
public String registerStorageResource(StorageResourceDescription storageResourceDescription)
throws RegistryServiceException, Exception {
try {
@@ -3768,7 +3550,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateComputeResource(
String computeResourceId, ComputeResourceDescription computeResourceDescription)
throws RegistryServiceException, Exception {
@@ -3791,7 +3572,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return computeResourceId
* Returns a server-side generated airavata compute resource globally unique identifier.
*/
- @Override
public String registerComputeResource(ComputeResourceDescription computeResourceDescription)
throws RegistryServiceException, Exception {
try {
@@ -3814,7 +3594,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateApplicationInterface(
String appInterfaceId, ApplicationInterfaceDescription applicationInterface)
throws RegistryServiceException, Exception {
@@ -3838,7 +3617,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return appInterfaceId
* Returns a server-side generated airavata application interface globally unique identifier.
*/
- @Override
public String registerApplicationInterface(String gatewayId, ApplicationInterfaceDescription applicationInterface)
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
@@ -3866,7 +3644,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateApplicationDeployment(
String appDeploymentId, ApplicationDeploymentDescription applicationDeployment)
throws RegistryServiceException, Exception {
@@ -3890,7 +3667,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return appDeploymentId
* Returns a server-side generated airavata appDeployment globally unique identifier.
*/
- @Override
public String registerApplicationDeployment(
String gatewayId, ApplicationDeploymentDescription applicationDeployment)
throws RegistryServiceException, Exception {
@@ -3919,7 +3695,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateApplicationModule(String appModuleId, ApplicationModule applicationModule)
throws RegistryServiceException, Exception {
try {
@@ -3943,7 +3718,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* Returns the server-side generated airavata appModule globally unique identifier.
* @gatewayId ID of the gateway which is registering the new Application Module.
*/
- @Override
public String registerApplicationModule(String gatewayId, ApplicationModule applicationModule)
throws RegistryServiceException, Exception {
if (!isGatewayExistInternal(gatewayId)) {
@@ -3962,7 +3736,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void updateResourceScheduleing(
String airavataExperimentId, ComputationalResourceSchedulingModel resourceScheduling)
throws RegistryServiceException, Exception {
@@ -3972,17 +3745,17 @@ public class RegistryServerHandler implements RegistryService.Iface {
airavataExperimentId,
"Update resource scheduling failed, experiment {} doesn't exist.",
airavataExperimentId);
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
ExperimentStatus experimentStatus = getExperimentStatusInternal(airavataExperimentId);
if (experimentStatus != null) {
ExperimentState experimentState = experimentStatus.getState();
switch (experimentState) {
- case CREATED:
- case VALIDATED:
- case CANCELED:
- case FAILED:
+ case EXPERIMENT_STATE_CREATED:
+ case EXPERIMENT_STATE_VALIDATED:
+ case EXPERIMENT_STATE_CANCELED:
+ case EXPERIMENT_STATE_FAILED:
processRepository.addProcessResourceSchedule(resourceScheduling, airavataExperimentId);
logger.debug(
airavataExperimentId,
@@ -3995,13 +3768,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
"Error while updating scheduling info. Update experiment is only valid for experiments "
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... ");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(
- "Error while updating experiment. Update experiment is only valid for experiments "
+ RegistryServiceException exception = new RegistryServiceException("Error while updating experiment. Update experiment is only valid for experiments "
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... ");
- throw exception;
+ throw exception;
}
}
} catch (Exception e) {
@@ -4016,7 +3786,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void updateExperimentConfiguration(String airavataExperimentId, UserConfigurationDataModel userConfiguration)
throws RegistryServiceException, Exception {
try {
@@ -4025,17 +3794,17 @@ public class RegistryServerHandler implements RegistryService.Iface {
airavataExperimentId,
"Update experiment configuration failed, experiment {} doesn't exist.",
airavataExperimentId);
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
ExperimentStatus experimentStatus = getExperimentStatusInternal(airavataExperimentId);
if (experimentStatus != null) {
ExperimentState experimentState = experimentStatus.getState();
switch (experimentState) {
- case CREATED:
- case VALIDATED:
- case CANCELED:
- case FAILED:
+ case EXPERIMENT_STATE_CREATED:
+ case EXPERIMENT_STATE_VALIDATED:
+ case EXPERIMENT_STATE_CANCELED:
+ case EXPERIMENT_STATE_FAILED:
experimentRepository.addUserConfigurationData(userConfiguration, airavataExperimentId);
logger.debug(
airavataExperimentId,
@@ -4049,13 +3818,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... ",
airavataExperimentId);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(
- "Error while updating experiment. Update experiment is only valid for experiments "
+ RegistryServiceException exception = new RegistryServiceException("Error while updating experiment. Update experiment is only valid for experiments "
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... ");
- throw exception;
+ throw exception;
}
}
} catch (Exception e) {
@@ -4094,7 +3860,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @throws AiravataSystemException This exception will be thrown for any Airavata Server side issues and if the problem cannot be corrected by the client
* rather an Airavata Administrator will be notified to take corrective action.
*/
- @Override
public void updateExperiment(String airavataExperimentId, ExperimentModel experiment)
throws RegistryServiceException, Exception {
try {
@@ -4111,9 +3876,9 @@ public class RegistryServerHandler implements RegistryService.Iface {
if (experimentStatus != null) {
ExperimentState experimentState = experimentStatus.getState();
switch (experimentState) {
- case CREATED:
- case SCHEDULED:
- case VALIDATED:
+ case EXPERIMENT_STATE_CREATED:
+ case EXPERIMENT_STATE_SCHEDULED:
+ case EXPERIMENT_STATE_VALIDATED:
if (experiment.getUserConfigurationData() != null
&& experiment.getUserConfigurationData().getComputationalResourceScheduling() != null
&& experiment
@@ -4129,9 +3894,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
new ComputeResourceRepository().getComputeResource(compResourceId);
if (!computeResourceDescription.getEnabled()) {
logger.error("Compute Resource is not enabled by the Admin!");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Compute Resource is not enabled by the Admin!");
+ RegistryServiceException exception = new RegistryServiceException("Compute Resource is not enabled by the Admin!");
throw exception;
}
}
@@ -4147,13 +3910,10 @@ public class RegistryServerHandler implements RegistryService.Iface {
"Error while updating experiment. Update experiment is only valid for experiments "
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... ");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(
- "Error while updating experiment. Update experiment is only valid for experiments "
+ RegistryServiceException exception = new RegistryServiceException("Error while updating experiment. Update experiment is only valid for experiments "
+ "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
+ "experiment is in one of above statuses... ");
- throw exception;
+ throw exception;
}
}
} catch (RegistryException e) {
@@ -4213,21 +3973,18 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param gatewayId
* @param experiment
*/
- @Override
public String createExperiment(String gatewayId, ExperimentModel experiment)
throws RegistryServiceException, Exception {
try {
if (!validateString(experiment.getExperimentName())) {
logger.error("Cannot create experiments with empty experiment name");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Cannot create experiments with empty experiment name");
+ RegistryServiceException exception = new RegistryServiceException("Cannot create experiments with empty experiment name");
throw exception;
}
logger.info("Creating experiment with name " + experiment.getExperimentName());
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
if (experiment.getUserConfigurationData() != null
@@ -4246,33 +4003,28 @@ public class RegistryServerHandler implements RegistryService.Iface {
new ComputeResourceRepository().getComputeResource(compResourceId);
if (!computeResourceDescription.getEnabled()) {
logger.error("Compute Resource is not enabled by the Admin!");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Compute Resource is not enabled by the Admin!");
+ RegistryServiceException exception = new RegistryServiceException("Compute Resource is not enabled by the Admin!");
throw exception;
}
} else if (!experiment
.getUserConfigurationData()
- .getAutoScheduledCompResourceSchedulingList()
+ .getAutoScheduledCompResourceSchedulingListList()
.isEmpty()) {
for (ComputationalResourceSchedulingModel computationalResourceScheduling :
- experiment.getUserConfigurationData().getAutoScheduledCompResourceSchedulingList()) {
+ experiment.getUserConfigurationData().getAutoScheduledCompResourceSchedulingListList()) {
ComputeResourceDescription computeResourceDescription = new ComputeResourceRepository()
.getComputeResource(computationalResourceScheduling.getResourceHostId());
if (!computeResourceDescription.getEnabled()) {
logger.error("Compute Resource with id" + computationalResourceScheduling.getResourceHostId()
+ "" + " is not enabled by the Admin!");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage(
- "Compute Resource with id" + computationalResourceScheduling.getResourceHostId() + ""
+ RegistryServiceException exception = new RegistryServiceException("Compute Resource with id" + computationalResourceScheduling.getResourceHostId() + ""
+ " is not enabled by the Admin!");
- throw exception;
+ throw exception;
}
}
}
- experiment.setGatewayId(gatewayId);
+ experiment = experiment.toBuilder().setGatewayId(gatewayId).build();
String experimentId = experimentRepository.addExperiment(experiment);
if (experiment.getExperimentType() == ExperimentType.WORKFLOW) {
workflowRepository.registerWorkflow(experiment.getWorkflow(), experimentId);
@@ -4300,7 +4052,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return ExperimentSummaryModel
* List of experiments for the given search filter. Here only the Experiment summary will be returned.
*/
- @Override
public List<ExperimentSummaryModel> searchExperiments(
String gatewayId,
String userName,
@@ -4311,21 +4062,17 @@ public class RegistryServerHandler implements RegistryService.Iface {
throws RegistryServiceException, Exception {
if (!validateString(userName)) {
logger.error("Username cannot be empty. Please provide a valid user..");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Username cannot be empty. Please provide a valid user..");
+ RegistryServiceException exception = new RegistryServiceException("Username cannot be empty. Please provide a valid user..");
throw exception;
}
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
try {
if (!userRepository.isUserExists(gatewayId, userName)) {
logger.error("User does not exist in the system. Please provide a valid user..");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("User does not exist in the system. Please provide a valid user..");
+ RegistryServiceException exception = new RegistryServiceException("User does not exist in the system. Please provide a valid user..");
throw exception;
}
List<ExperimentSummaryModel> summaries = new ArrayList<ExperimentSummaryModel>();
@@ -4386,7 +4133,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param limit The amount results to be fetched.
* @param offset The starting point of the results to be fetched.
*/
- @Override
public List<Project> searchProjects(
String gatewayId,
String userName,
@@ -4397,21 +4143,17 @@ public class RegistryServerHandler implements RegistryService.Iface {
throws RegistryServiceException, Exception {
if (!validateString(userName)) {
logger.error("Username cannot be empty. Please provide a valid user..");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Username cannot be empty. Please provide a valid user..");
+ RegistryServiceException exception = new RegistryServiceException("Username cannot be empty. Please provide a valid user..");
throw exception;
}
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
try {
if (!userRepository.isUserExists(gatewayId, userName)) {
logger.error("User does not exist in the system. Please provide a valid user..");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("User does not exist in the system. Please provide a valid user..");
+ RegistryServiceException exception = new RegistryServiceException("User does not exist in the system. Please provide a valid user..");
throw exception;
}
List<Project> projects = new ArrayList<>();
@@ -4456,20 +4198,16 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return void
* Currently this does not return any value.
*/
- @Override
public void updateProject(String projectId, Project updatedProject) throws RegistryServiceException, Exception {
if (!validateString(projectId) || !validateString(projectId)) {
logger.error("Project id cannot be empty...");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Project id cannot be empty...");
+ RegistryServiceException exception = new RegistryServiceException("Project id cannot be empty...");
throw exception;
}
try {
if (!projectRepository.isProjectExist(projectId)) {
logger.error("Project does not exist in the system. Please provide a valid project ID...");
- ProjectNotFoundException exception = new ProjectNotFoundException();
- exception.setMessage("Project does not exist in the system. Please provide a valid project ID...");
+ RegistryServiceException exception = new RegistryServiceException("Project does not exist in the system. Please provide a valid project ID...");
throw exception;
}
@@ -4490,20 +4228,19 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param gatewayId The identifier for the requested gateway.
* @param project
*/
- @Override
public String createProject(String gatewayId, Project project) throws RegistryServiceException, Exception {
try {
if (!validateString(project.getName()) || !validateString(project.getOwner())) {
logger.error("Project name and owner cannot be empty...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
if (!validateString(gatewayId)) {
logger.error("Gateway ID cannot be empty...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
if (!isGatewayExistInternal(gatewayId)) {
logger.error("Gateway does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
String projectId = projectRepository.addProject(project, gatewayId);
return projectId;
@@ -4515,7 +4252,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean updateNotification(Notification notification) throws RegistryServiceException, Exception {
try {
notificationRepository.updateNotification(notification);
@@ -4534,7 +4270,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
*
* @param notification
*/
- @Override
public String createNotification(Notification notification) throws RegistryServiceException, Exception {
try {
return notificationRepository.createNotification(notification);
@@ -4555,13 +4290,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
* Modified gateway obejct.
* @throws AiravataClientException
*/
- @Override
public boolean updateGateway(String gatewayId, Gateway updatedGateway) throws RegistryServiceException, Exception {
try {
if (!gatewayRepository.isGatewayExist(gatewayId)) {
logger.error("Gateway does not exist in the system. Please provide a valid gateway ID...");
- AiravataSystemException exception = new AiravataSystemException();
- exception.setMessage("Gateway does not exist in the system. Please provide a valid gateway ID...");
+ RegistryServiceException exception = new RegistryServiceException("Gateway does not exist in the system. Please provide a valid gateway ID...");
throw exception;
}
gatewayRepository.updateGateway(gatewayId, updatedGateway);
@@ -4570,13 +4303,14 @@ public class RegistryServerHandler implements RegistryService.Iface {
// token, if not update
GatewayResourceProfile existingGwyResourceProfile =
new GwyResourceProfileRepository().getGatewayProfile(gatewayId);
- if (existingGwyResourceProfile.getIdentityServerPwdCredToken() == null
+ if (existingGwyResourceProfile.getIdentityServerPwdCredToken().isEmpty()
|| !existingGwyResourceProfile
.getIdentityServerPwdCredToken()
.equals(updatedGateway.getIdentityServerPasswordToken())) {
- existingGwyResourceProfile.setIdentityServerPwdCredToken(
- updatedGateway.getIdentityServerPasswordToken());
- new GwyResourceProfileRepository().updateGatewayResourceProfile(gatewayId, existingGwyResourceProfile);
+ GatewayResourceProfile updatedProfile = existingGwyResourceProfile.toBuilder()
+ .setIdentityServerPwdCredToken(updatedGateway.getIdentityServerPasswordToken())
+ .build();
+ new GwyResourceProfileRepository().updateGatewayResourceProfile(gatewayId, updatedProfile);
}
logger.debug("Airavata update gateway with gateway id : " + gatewayId);
return true;
@@ -4600,21 +4334,20 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return gatewayId
* Th unique identifier of the newly registered gateway.
*/
- @Override
- public String addGateway(Gateway gateway) throws RegistryServiceException, DuplicateEntryException, Exception {
+ public String addGateway(Gateway gateway) throws RegistryServiceException, Exception {
try {
if (!validateString(gateway.getGatewayId())) {
logger.error("Gateway id cannot be empty...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
// check if gateway exists
if (isGatewayExist(gateway.getGatewayId())) {
- throw new DuplicateEntryException(
+ throw new RegistryServiceException(
"Gateway with gatewayId: " + gateway.getGatewayId() + ", already exists in ExperimentCatalog.");
}
// check if gatewayresourceprofile exists
if (new GwyResourceProfileRepository().isGatewayResourceProfileExists(gateway.getGatewayId())) {
- throw new DuplicateEntryException("GatewayResourceProfile with gatewayId: " + gateway.getGatewayId()
+ throw new RegistryServiceException("GatewayResourceProfile with gatewayId: " + gateway.getGatewayId()
+ ", already exists in AppCatalog.");
}
@@ -4622,10 +4355,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
String gatewayId = gatewayRepository.addGateway(gateway);
// add gatewayresourceprofile in appCatalog
- GatewayResourceProfile gatewayResourceProfile = new GatewayResourceProfile();
- gatewayResourceProfile.setGatewayID(gatewayId);
- gatewayResourceProfile.setIdentityServerTenant(gatewayId);
- gatewayResourceProfile.setIdentityServerPwdCredToken(gateway.getIdentityServerPasswordToken());
+ GatewayResourceProfile gatewayResourceProfile = GatewayResourceProfile.newBuilder()
+ .setGatewayId(gatewayId)
+ .setIdentityServerTenant(gatewayId)
+ .setIdentityServerPwdCredToken(gateway.getIdentityServerPasswordToken())
+ .build();
new GwyResourceProfileRepository().addGatewayResourceProfile(gatewayResourceProfile);
logger.debug("Airavata added gateway with gateway id : " + gateway.getGatewayId());
return gatewayId;
@@ -4652,26 +4386,22 @@ public class RegistryServerHandler implements RegistryService.Iface {
/*Following method wraps the logic of isGatewayExist method and this is to be called by any other method of the API as needed.*/
private boolean isGatewayExistInternal(String gatewayId)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
- Exception {
+ throws RegistryServiceException, Exception {
try {
return gatewayRepository.isGatewayExist(gatewayId);
} catch (RegistryException e) {
logger.error("Error while getting gateway", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while getting gateway. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while getting gateway. More info : " + e.getMessage());
throw exception;
}
}
/*This private method wraps the logic of getExperiment method as this method is called internally in the API.*/
private ExperimentModel getExperimentInternal(String airavataExperimentId)
- throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
- AiravataSystemException, Exception {
+ throws RegistryServiceException, Exception {
try {
if (!experimentRepository.isExperimentExist(airavataExperimentId)) {
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
return experimentRepository.getExperiment(airavataExperimentId);
@@ -4685,30 +4415,27 @@ public class RegistryServerHandler implements RegistryService.Iface {
/*Private method wraps the logic of getExperimentStatus method since this method is called internally.*/
private ExperimentStatus getExperimentStatusInternal(String airavataExperimentId)
- throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
- AiravataSystemException, Exception {
+ throws RegistryServiceException, Exception {
try {
if (!experimentRepository.isExperimentExist(airavataExperimentId)) {
logger.error(
airavataExperimentId,
"Error while retrieving experiment status, experiment {} doesn't exist.",
airavataExperimentId);
- throw new ExperimentNotFoundException(
+ throw new RegistryServiceException(
"Requested experiment id " + airavataExperimentId + " does not exist in the system..");
}
return experimentStatusRepository.getExperimentStatus(airavataExperimentId);
} catch (Exception e) {
logger.error(airavataExperimentId, "Error while retrieving the experiment status", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving the experiment status. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving the experiment status. More info : " + e.getMessage());
throw exception;
}
}
/*This private method wraps the logic of getApplicationOutputs method as this method is called internally in the API.*/
private List<OutputDataObjectType> getApplicationOutputsInternal(String appInterfaceId)
- throws InvalidRequestException, AiravataClientException, AiravataSystemException, Exception {
+ throws RegistryServiceException, Exception {
try {
List<OutputDataObjectType> applicationOutputs =
applicationInterfaceRepository.getApplicationOutputs(appInterfaceId);
@@ -4716,9 +4443,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
return applicationOutputs;
} catch (AppCatalogException e) {
logger.error(appInterfaceId, "Error while retrieving application outputs...", e);
- AiravataSystemException exception = new AiravataSystemException();
- exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
- exception.setMessage("Error while retrieving application outputs. More info : " + e.getMessage());
+ RegistryServiceException exception = new RegistryServiceException("Error while retrieving application outputs. More info : " + e.getMessage());
throw exception;
}
}
@@ -4730,10 +4455,11 @@ public class RegistryServerHandler implements RegistryService.Iface {
JobSubmissionProtocol protocolType,
int priorityOrder)
throws AppCatalogException {
- JobSubmissionInterface jobSubmissionInterface = new JobSubmissionInterface();
- jobSubmissionInterface.setJobSubmissionInterfaceId(jobSubmissionInterfaceId);
- jobSubmissionInterface.setPriorityOrder(priorityOrder);
- jobSubmissionInterface.setJobSubmissionProtocol(protocolType);
+ JobSubmissionInterface jobSubmissionInterface = JobSubmissionInterface.newBuilder()
+ .setJobSubmissionInterfaceId(jobSubmissionInterfaceId)
+ .setPriorityOrder(priorityOrder)
+ .setJobSubmissionProtocol(protocolType)
+ .build();
return computeResourceRepository.addJobSubmissionProtocol(computeResourceId, jobSubmissionInterface);
}
@@ -4745,15 +4471,15 @@ public class RegistryServerHandler implements RegistryService.Iface {
DataMovementProtocol protocolType,
int priorityOrder)
throws AppCatalogException {
- DataMovementInterface dataMovementInterface = new DataMovementInterface();
- dataMovementInterface.setDataMovementInterfaceId(dataMovementInterfaceId);
- dataMovementInterface.setPriorityOrder(priorityOrder);
- dataMovementInterface.setDataMovementProtocol(protocolType);
+ DataMovementInterface.Builder dmiBuilder = DataMovementInterface.newBuilder()
+ .setDataMovementInterfaceId(dataMovementInterfaceId)
+ .setPriorityOrder(priorityOrder)
+ .setDataMovementProtocol(protocolType);
if (dmType.equals(DMType.COMPUTE_RESOURCE)) {
- return computeResource.addDataMovementProtocol(computeResourceId, dmType, dataMovementInterface);
+ return computeResource.addDataMovementProtocol(computeResourceId, dmType, dmiBuilder.build());
} else if (dmType.equals(DMType.STORAGE_RESOURCE)) {
- dataMovementInterface.setStorageResourceId(computeResourceId);
- return storageResourceRepository.addDataMovementInterface(dataMovementInterface);
+ dmiBuilder.setStorageResourceId(computeResourceId);
+ return storageResourceRepository.addDataMovementInterface(dmiBuilder.build());
}
return null;
}
@@ -4767,7 +4493,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public String registerUserResourceProfile(UserResourceProfile userResourceProfile)
throws RegistryServiceException, Exception {
try {
@@ -4777,20 +4502,20 @@ public class RegistryServerHandler implements RegistryService.Iface {
exception.setMessage("Cannot create user resource profile with empty gateway id");
throw exception;
}
- if (!validateString(userResourceProfile.getGatewayID())) {
+ if (!validateString(userResourceProfile.getGatewayId())) {
logger.error("Cannot create user resource profile with empty gateway id");
RegistryServiceException exception = new RegistryServiceException();
exception.setMessage("Cannot create user resource profile with empty gateway id");
throw exception;
}
- if (!userRepository.isUserExists(userResourceProfile.getGatewayID(), userResourceProfile.getUserId())) {
+ if (!userRepository.isUserExists(userResourceProfile.getGatewayId(), userResourceProfile.getUserId())) {
logger.error("User does not exist.Please provide a valid user ID...");
throw new RegistryServiceException("User does not exist.Please provide a valid user ID...");
}
String resourceProfile = userResourceProfileRepository.addUserResourceProfile(userResourceProfile);
logger.debug("Airavata registered user resource profile with gateway id : "
- + userResourceProfile.getGatewayID() + "and user id : " + userResourceProfile.getUserId());
+ + userResourceProfile.getGatewayId() + "and user id : " + userResourceProfile.getUserId());
return resourceProfile;
} catch (AppCatalogException e) {
logger.error("Error while registering user resource profile...", e);
@@ -4805,13 +4530,12 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean isUserResourceProfileExists(String userId, String gatewayId)
throws RegistryServiceException, Exception {
try {
if (!userRepository.isUserExists(gatewayId, userId)) {
logger.error("user does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
return userResourceProfileRepository.isUserResourceProfileExists(userId, gatewayId);
} catch (AppCatalogException e) {
@@ -4835,13 +4559,12 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @param userId The identifier for the requested user resource.
* @return UserResourceProfile object
*/
- @Override
public UserResourceProfile getUserResourceProfile(String userId, String gatewayId)
throws RegistryServiceException, Exception {
try {
if (!userRepository.isUserExists(gatewayId, userId)) {
logger.error("user does not exist.Please provide a valid gateway id...");
- throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+ throw new RegistryServiceException("Internal error");
}
UserResourceProfile userResourceProfile =
userResourceProfileRepository.getUserResourceProfile(userId, gatewayId);
@@ -4868,7 +4591,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the update.
*/
- @Override
public boolean updateUserResourceProfile(String userId, String gatewayID, UserResourceProfile userResourceProfile)
throws RegistryServiceException, Exception {
try {
@@ -4900,7 +4622,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteUserResourceProfile(String userId, String gatewayID)
throws RegistryServiceException, Exception {
try {
@@ -4924,13 +4645,12 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public String addUser(UserProfile userProfile)
- throws RegistryServiceException, DuplicateEntryException, Exception {
+ throws RegistryServiceException, Exception {
try {
logger.info("Adding User in Registry: " + userProfile);
if (isUserExists(userProfile.getGatewayId(), userProfile.getUserId())) {
- throw new DuplicateEntryException("User already exists, with userId: " + userProfile.getUserId()
+ throw new RegistryServiceException("User already exists, with userId: " + userProfile.getUserId()
+ ", and gatewayId: " + userProfile.getGatewayId());
}
UserProfile savedUser = userRepository.addUser(userProfile);
@@ -4954,7 +4674,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* Returns a success/failure of the addition. If a profile already exists, this operation will fail.
* Instead an update should be used.
*/
- @Override
public boolean addUserComputeResourcePreference(
String userId,
String gatewayID,
@@ -5000,7 +4719,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the addition. If a resource already exists, this operation will fail.
*/
- @Override
public boolean isUserComputeResourcePreferenceExists(String userId, String gatewayID, String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -5033,7 +4751,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* Returns a success/failure of the addition. If a profile already exists, this operation will fail.
* Instead an update should be used.
*/
- @Override
public boolean addUserStoragePreference(
String userId, String gatewayID, String storageResourceId, UserStoragePreference dataStoragePreference)
throws RegistryServiceException, Exception {
@@ -5077,7 +4794,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
- @Override
public UserComputeResourcePreference getUserComputeResourcePreference(
String userId, String gatewayID, String userComputeResourceId) throws RegistryServiceException, Exception {
try {
@@ -5127,7 +4843,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return StoragePreference
* Returns the StoragePreference object.
*/
- @Override
public UserStoragePreference getUserStoragePreference(String userId, String gatewayID, String storageId)
throws RegistryServiceException, Exception {
try {
@@ -5164,7 +4879,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return UserResourceProfile
* Returns all the UserResourceProfile list object.
*/
- @Override
public List<UserResourceProfile> getAllUserResourceProfiles() throws RegistryServiceException, Exception {
try {
return userResourceProfileRepository.getAllUserResourceProfiles();
@@ -5185,7 +4899,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the updation.
*/
- @Override
public boolean updateUserComputeResourcePreference(
String userId,
String gatewayID,
@@ -5241,7 +4954,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the updation.
*/
- @Override
public boolean updateUserStoragePreference(
String userId, String gatewayID, String storageId, UserStoragePreference userStoragePreference)
throws RegistryServiceException, Exception {
@@ -5291,7 +5003,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteUserComputeResourcePreference(String userId, String gatewayID, String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -5324,7 +5035,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return status
* Returns a success/failure of the deletion.
*/
- @Override
public boolean deleteUserStoragePreference(String userId, String gatewayID, String storageId)
throws RegistryServiceException, Exception {
try {
@@ -5351,7 +5061,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* * Get queue statuses of all compute resources
* *
*/
- @Override
public List<QueueStatusModel> getLatestQueueStatuses() throws RegistryServiceException, Exception {
try {
List<QueueStatusModel> queueStatusModels = queueStatusRepository.getLatestQueueStatuses();
@@ -5364,7 +5073,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void registerQueueStatuses(List<QueueStatusModel> queueStatuses)
throws RegistryServiceException, Exception {
try {
@@ -5377,7 +5085,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public QueueStatusModel getQueueStatus(String hostName, String queueName)
throws RegistryServiceException, Exception {
try {
@@ -5412,7 +5119,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return computeResourcePreference
* Returns the ComputeResourcePreference object.
*/
- @Override
public List<UserComputeResourcePreference> getAllUserComputeResourcePreferences(String userId, String gatewayID)
throws RegistryServiceException, Exception {
try {
@@ -5441,7 +5147,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
* @return StoragePreference
* Returns the StoragePreference object.
*/
- @Override
public List<UserStoragePreference> getAllUserStoragePreferences(String userId, String gatewayID)
throws RegistryServiceException, Exception {
try {
@@ -5461,17 +5166,16 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void createGatewayGroups(GatewayGroups gatewayGroups)
- throws RegistryServiceException, DuplicateEntryException, Exception {
+ throws RegistryServiceException, Exception {
try {
if (gatewayGroupsRepository.isExists(gatewayGroups.getGatewayId())) {
logger.error("GatewayGroups already exists for " + gatewayGroups.getGatewayId());
- throw new DuplicateEntryException(
+ throw new RegistryServiceException(
"GatewayGroups for gatewayId: " + gatewayGroups.getGatewayId() + " already exists.");
}
gatewayGroupsRepository.create(gatewayGroups);
- } catch (DuplicateEntryException e) {
+ } catch (RegistryServiceException e) {
throw e; // re-throw
} catch (Exception e) {
@@ -5484,7 +5188,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void updateGatewayGroups(GatewayGroups gatewayGroups) throws RegistryServiceException, Exception {
try {
if (!gatewayGroupsRepository.isExists(gatewayGroups.getGatewayId())) {
@@ -5506,7 +5209,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean isGatewayGroupsExists(String gatewayId) throws RegistryServiceException, Exception {
try {
return gatewayGroupsRepository.isExists(gatewayId);
@@ -5519,7 +5221,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public GatewayGroups getGatewayGroups(String gatewayId) throws RegistryServiceException, Exception {
try {
if (!gatewayGroupsRepository.isExists(gatewayId)) {
@@ -5540,7 +5241,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public Parser getParser(String parserId, String gatewayId) throws RegistryServiceException, Exception {
try {
@@ -5563,7 +5263,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public String saveParser(Parser parser) throws RegistryServiceException, Exception {
try {
@@ -5579,7 +5278,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<Parser> listAllParsers(String gatewayId) throws RegistryServiceException, Exception {
try {
@@ -5594,7 +5292,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void removeParser(String parserId, String gatewayId) throws RegistryServiceException, Exception {
try {
@@ -5617,7 +5314,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public ParserInput getParserInput(String parserInputId, String gatewayId)
throws RegistryServiceException, Exception {
try {
@@ -5632,7 +5328,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public ParserOutput getParserOutput(String parserOutputId, String gatewayId)
throws RegistryServiceException, Exception {
try {
@@ -5647,7 +5342,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public ParsingTemplate getParsingTemplate(String templateId, String gatewayId)
throws RegistryServiceException, Exception {
@@ -5671,7 +5365,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<ParsingTemplate> getParsingTemplatesForExperiment(String experimentId, String gatewayId)
throws RegistryServiceException, Exception {
@@ -5692,7 +5385,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public String saveParsingTemplate(ParsingTemplate parsingTemplate) throws RegistryServiceException, Exception {
try {
@@ -5708,7 +5400,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public List<ParsingTemplate> listAllParsingTemplates(String gatewayId) throws RegistryServiceException, Exception {
try {
@@ -5723,7 +5414,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void removeParsingTemplate(String templateId, String gatewayId) throws RegistryServiceException, Exception {
try {
@@ -5749,7 +5439,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public boolean isGatewayUsageReportingAvailable(String gatewayId, String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -5764,7 +5453,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public GatewayUsageReportingCommand getGatewayReportingCommand(String gatewayId, String computeResourceId)
throws RegistryServiceException, Exception {
try {
@@ -5789,7 +5477,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void addGatewayUsageReportingCommand(GatewayUsageReportingCommand command)
throws RegistryServiceException, Exception {
try {
@@ -5804,7 +5491,6 @@ public class RegistryServerHandler implements RegistryService.Iface {
}
}
- @Override
public void removeGatewayUsageReportingCommand(String gatewayId, String computeResourceId)
throws RegistryServiceException, Exception {
try {
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentErrorRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentErrorRepository.java
index bf1d42f891..1241d5c494 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentErrorRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentErrorRepository.java
@@ -63,9 +63,9 @@ public class ExperimentErrorRepository
public String addExperimentError(ErrorModel experimentError, String experimentId) throws RegistryException {
- if (experimentError.getErrorId() == null) {
+ if (experimentError.getErrorId().isEmpty()) {
logger.debug("Setting the ExperimentError's ErrorId");
- experimentError.setErrorId(ExpCatalogUtils.getID("ERROR"));
+ experimentError = experimentError.toBuilder().setErrorId(ExpCatalogUtils.getID("ERROR")).build();
}
return saveExperimentError(experimentError, experimentId);
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentRepository.java
index 182e2e3f3c..86674862b5 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentRepository.java
@@ -32,6 +32,7 @@ import org.apache.airavata.execution.util.QueryConstants;
import org.apache.airavata.execution.util.cpi.RegistryException;
import org.apache.airavata.execution.util.cpi.ResultOrderType;
import org.apache.airavata.model.experiment.proto.ExperimentModel;
+import org.apache.airavata.model.process.proto.ProcessModel;
import org.apache.airavata.model.experiment.proto.UserConfigurationDataModel;
import org.apache.airavata.model.status.proto.ExperimentState;
import org.apache.airavata.model.status.proto.ExperimentStatus;
@@ -63,23 +64,30 @@ public class ExperimentRepository extends AbstractRepository<ExperimentModel, Ex
protected ExperimentEntity saveExperiment(ExperimentModel experimentModel) throws RegistryException {
String experimentId = experimentModel.getExperimentId();
- if (experimentModel.getExperimentStatusList() != null) {
+ if (!experimentModel.getExperimentStatusList().isEmpty()) {
logger.debug("Populating the status id of ExperimentStatus objects for the Experiment");
- experimentModel.getExperimentStatusList().forEach(experimentStatusEntity -> {
- if (experimentStatusEntity.getStatusId() == null) {
- experimentStatusEntity.setStatusId(AiravataUtils.getId("EXPERIMENT_STATE"));
+ ExperimentModel.Builder expBuilder = experimentModel.toBuilder().clearExperimentStatus();
+ for (ExperimentStatus es : experimentModel.getExperimentStatusList()) {
+ if (es.getStatusId().isEmpty()) {
+ es = es.toBuilder().setStatusId(AiravataUtils.getId("EXPERIMENT_STATE")).build();
}
- });
+ expBuilder.addExperimentStatus(es);
+ }
+ experimentModel = expBuilder.build();
}
- if (experimentModel.getProcessesList() != null) {
+ if (!experimentModel.getProcessesList().isEmpty()) {
logger.debug("Populating the Process objects' Experiment ID for the Experiment");
- experimentModel.getProcessesList().forEach(processModel -> processModel.setExperimentId(experimentId));
+ ExperimentModel.Builder expBuilder2 = experimentModel.toBuilder().clearProcesses();
+ for (ProcessModel pm : experimentModel.getProcessesList()) {
+ expBuilder2.addProcesses(pm.toBuilder().setExperimentId(experimentId).build());
+ }
+ experimentModel = expBuilder2.build();
}
if (!isExperimentExist(experimentId)) {
logger.debug("Populating creation time if it doesn't already exist");
- experimentModel.setCreationTime(System.currentTimeMillis());
+ experimentModel = experimentModel.toBuilder().setCreationTime(System.currentTimeMillis()).build();
}
ExperimentEntity experimentEntity = ExecutionMapper.INSTANCE.experimentToEntity(experimentModel);
@@ -97,31 +105,31 @@ public class ExperimentRepository extends AbstractRepository<ExperimentModel, Ex
}
}
- if (experimentEntity.getExperimentInputsList() != null) {
+ if (experimentEntity.getExperimentInputs() != null) {
logger.debug("Populating the Primary Key of ExperimentInput objects for the Experiment");
experimentEntity
- .getExperimentInputsList()
+ .getExperimentInputs()
.forEach(experimentInputEntity -> experimentInputEntity.setExperimentId(experimentId));
}
- if (experimentEntity.getExperimentOutputsList() != null) {
+ if (experimentEntity.getExperimentOutputs() != null) {
logger.debug("Populating the Primary Key of ExperimentOutput objects for the Experiment");
experimentEntity
- .getExperimentOutputsList()
+ .getExperimentOutputs()
.forEach(experimentOutputEntity -> experimentOutputEntity.setExperimentId(experimentId));
}
- if (experimentEntity.getExperimentStatusList() != null) {
+ if (experimentEntity.getExperimentStatus() != null) {
logger.debug("Populating the Primary Key of ExperimentStatus objects for the Experiment");
experimentEntity
- .getExperimentStatusList()
+ .getExperimentStatus()
.forEach(experimentStatusEntity -> experimentStatusEntity.setExperimentId(experimentId));
}
- if (experimentEntity.getErrorsList() != null) {
+ if (experimentEntity.getErrors() != null) {
logger.debug("Populating the Primary Key of ExperimentError objects for the Experiment");
experimentEntity
- .getErrorsList()
+ .getErrors()
.forEach(experimentErrorEntity -> experimentErrorEntity.setExperimentId(experimentId));
}
return execute(entityManager -> entityManager.merge(experimentEntity));
@@ -130,7 +138,7 @@ public class ExperimentRepository extends AbstractRepository<ExperimentModel, Ex
public String addExperiment(ExperimentModel experimentModel) throws RegistryException {
ExperimentStatus experimentStatus = ExperimentStatus.newBuilder()
- .setState(ExperimentState.CREATED)
+ .setState(ExperimentState.EXPERIMENT_STATE_CREATED)
.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime())
.build();
String expName = experimentModel.getExperimentName();
@@ -154,7 +162,7 @@ public class ExperimentRepository extends AbstractRepository<ExperimentModel, Ex
public String addUserConfigurationData(UserConfigurationDataModel userConfigurationDataModel, String experimentId)
throws RegistryException {
ExperimentModel experimentModel = getExperiment(experimentId);
- experimentModel.setUserConfigurationData(userConfigurationDataModel);
+ experimentModel = experimentModel.toBuilder().setUserConfigurationData(userConfigurationDataModel).build();
updateExperiment(experimentModel, experimentId);
return experimentId;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentStatusRepository.java
index bcf5aa082f..a1897b76d7 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentStatusRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentStatusRepository.java
@@ -55,14 +55,14 @@ public class ExperimentStatusRepository
protected String saveExperimentStatus(ExperimentStatus experimentStatus, String experimentId)
throws RegistryException {
- if (experimentStatus.getStatusId() == null) {
+ if (experimentStatus.getStatusId().isEmpty()) {
ExperimentStatus currentExperimentStatus = getExperimentStatus(experimentId);
if (currentExperimentStatus == null || currentExperimentStatus.getState() != experimentStatus.getState()) {
- experimentStatus.setStatusId(ExpCatalogUtils.getID("EXPERIMENT_STATE"));
+ experimentStatus = experimentStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("EXPERIMENT_STATE")).build();
} else {
// Update the existing current status if experimentStatus has no status id and the same state
- experimentStatus.setStatusId(currentExperimentStatus.getStatusId());
+ experimentStatus = experimentStatus.toBuilder().setStatusId(currentExperimentStatus.getStatusId()).build();
}
}
ExperimentStatusEntity experimentStatusEntity =
@@ -79,12 +79,13 @@ public class ExperimentStatusRepository
public String addExperimentStatus(ExperimentStatus experimentStatus, String experimentId) throws RegistryException {
- if (experimentStatus.getStatusId() == null) {
+ if (experimentStatus.getStatusId().isEmpty()) {
logger.debug("Setting the ExperimentStatus's StatusId");
- experimentStatus.setStatusId(ExpCatalogUtils.getID("EXPERIMENT_STATE"));
+ experimentStatus = experimentStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("EXPERIMENT_STATE")).build();
}
- experimentStatus.setTimeOfStateChange(
- AiravataUtils.getCurrentTimestamp().getTime());
+ experimentStatus = experimentStatus.toBuilder()
+ .setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime())
+ .build();
return saveExperimentStatus(experimentStatus, experimentId);
}
@@ -116,14 +117,14 @@ public class ExperimentStatusRepository
&& experimentStatusList
.get(i)
.getState()
- .equals(ExperimentState.COMPLETED.toString()))
+ .equals(ExperimentState.EXPERIMENT_STATE_COMPLETED.toString()))
|| (timeOfStateChange.equals(latestExperimentStatus.getTimeOfStateChange())
- && experimentStatusList.get(i).getState().equals(ExperimentState.FAILED.toString()))
+ && experimentStatusList.get(i).getState() == ExperimentState.EXPERIMENT_STATE_FAILED)
|| (timeOfStateChange.equals(latestExperimentStatus.getTimeOfStateChange())
&& experimentStatusList
.get(i)
.getState()
- .equals(ExperimentState.CANCELED.toString()))) {
+ .equals(ExperimentState.EXPERIMENT_STATE_CANCELED.toString()))) {
latestExperimentStatus = experimentStatusList.get(i);
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentSummaryRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentSummaryRepository.java
index a70d2ca318..6f7a405764 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentSummaryRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ExperimentSummaryRepository.java
@@ -253,7 +253,7 @@ public class ExperimentSummaryRepository
try {
- ExperimentStatistics experimentStatistics = new ExperimentStatistics();
+ ExperimentStatistics.Builder experimentStatisticsBuilder = ExperimentStatistics.newBuilder();
String gatewayId = null;
String userName = null;
String applicationName = null;
@@ -319,10 +319,10 @@ public class ExperimentSummaryRepository
accessibleExperimentIds,
limit,
offset);
- experimentStatistics.setAllExperimentCount(allExperimentsCount);
- experimentStatistics.setAllExperiments(allExperiments);
+ experimentStatisticsBuilder.setAllExperimentCount(allExperimentsCount);
+ experimentStatisticsBuilder.addAllAllExperiments(allExperiments);
- List<ExperimentState> createdStates = Arrays.asList(ExperimentState.CREATED, ExperimentState.VALIDATED);
+ List<ExperimentState> createdStates = Arrays.asList(ExperimentState.EXPERIMENT_STATE_CREATED, ExperimentState.EXPERIMENT_STATE_VALIDATED);
int createdExperimentsCount = getExperimentStatisticsCountForState(
createdStates,
gatewayId,
@@ -343,11 +343,11 @@ public class ExperimentSummaryRepository
accessibleExperimentIds,
limit,
offset);
- experimentStatistics.setCreatedExperimentCount(createdExperimentsCount);
- experimentStatistics.setCreatedExperiments(createdExperiments);
+ experimentStatisticsBuilder.setCreatedExperimentCount(createdExperimentsCount);
+ experimentStatisticsBuilder.addAllCreatedExperiments(createdExperiments);
List<ExperimentState> runningStates =
- Arrays.asList(ExperimentState.EXECUTING, ExperimentState.SCHEDULED, ExperimentState.LAUNCHED);
+ Arrays.asList(ExperimentState.EXPERIMENT_STATE_EXECUTING, ExperimentState.EXPERIMENT_STATE_SCHEDULED, ExperimentState.EXPERIMENT_STATE_LAUNCHED);
int runningExperimentsCount = getExperimentStatisticsCountForState(
runningStates,
gatewayId,
@@ -368,10 +368,10 @@ public class ExperimentSummaryRepository
accessibleExperimentIds,
limit,
offset);
- experimentStatistics.setRunningExperimentCount(runningExperimentsCount);
- experimentStatistics.setRunningExperiments(runningExperiments);
+ experimentStatisticsBuilder.setRunningExperimentCount(runningExperimentsCount);
+ experimentStatisticsBuilder.addAllRunningExperiments(runningExperiments);
- List<ExperimentState> completedStates = Arrays.asList(ExperimentState.COMPLETED);
+ List<ExperimentState> completedStates = Arrays.asList(ExperimentState.EXPERIMENT_STATE_COMPLETED);
int completedExperimentsCount = getExperimentStatisticsCountForState(
completedStates,
gatewayId,
@@ -392,10 +392,10 @@ public class ExperimentSummaryRepository
accessibleExperimentIds,
limit,
offset);
- experimentStatistics.setCompletedExperimentCount(completedExperimentsCount);
- experimentStatistics.setCompletedExperiments(completedExperiments);
+ experimentStatisticsBuilder.setCompletedExperimentCount(completedExperimentsCount);
+ experimentStatisticsBuilder.addAllCompletedExperiments(completedExperiments);
- List<ExperimentState> failedStates = Arrays.asList(ExperimentState.FAILED);
+ List<ExperimentState> failedStates = Arrays.asList(ExperimentState.EXPERIMENT_STATE_FAILED);
int failedExperimentsCount = getExperimentStatisticsCountForState(
failedStates,
gatewayId,
@@ -416,10 +416,10 @@ public class ExperimentSummaryRepository
accessibleExperimentIds,
limit,
offset);
- experimentStatistics.setFailedExperimentCount(failedExperimentsCount);
- experimentStatistics.setFailedExperiments(failedExperiments);
+ experimentStatisticsBuilder.setFailedExperimentCount(failedExperimentsCount);
+ experimentStatisticsBuilder.addAllFailedExperiments(failedExperiments);
- List<ExperimentState> cancelledStates = Arrays.asList(ExperimentState.CANCELED, ExperimentState.CANCELING);
+ List<ExperimentState> cancelledStates = Arrays.asList(ExperimentState.EXPERIMENT_STATE_CANCELED, ExperimentState.EXPERIMENT_STATE_CANCELING);
int cancelledExperimentsCount = getExperimentStatisticsCountForState(
cancelledStates,
gatewayId,
@@ -440,10 +440,10 @@ public class ExperimentSummaryRepository
accessibleExperimentIds,
limit,
offset);
- experimentStatistics.setCancelledExperimentCount(cancelledExperimentsCount);
- experimentStatistics.setCancelledExperiments(cancelledExperiments);
+ experimentStatisticsBuilder.setCancelledExperimentCount(cancelledExperimentsCount);
+ experimentStatisticsBuilder.addAllCancelledExperiments(cancelledExperiments);
- return experimentStatistics;
+ return experimentStatisticsBuilder.build();
} catch (RegistryException e) {
logger.error("Error while retrieving experiment statistics from registry", e);
throw new RegistryException(e);
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobRepository.java
index 3c00fe3283..e923950002 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobRepository.java
@@ -60,23 +60,26 @@ public class JobRepository extends AbstractRepository<JobModel, JobEntity, JobPK
}
protected JobEntity saveJob(JobModel jobModel, JobPK jobPK) throws RegistryException {
- if (jobModel.getJobId() == null || jobModel.getJobId().equals("DO_NOT_SET_AT_CLIENTS")) {
+ if (jobModel.getJobId().isEmpty() || jobModel.getJobId().equals("DO_NOT_SET_AT_CLIENTS")) {
logger.debug("Setting the Job's JobId");
- jobModel.setJobId(jobPK.getJobId());
+ jobModel = jobModel.toBuilder().setJobId(jobPK.getJobId()).build();
}
- if (jobModel.getJobStatusesList() != null) {
+ if (!jobModel.getJobStatusesList().isEmpty()) {
logger.debug("Populating the status ids of JobStatus objects for the Job");
- jobModel.getJobStatusesList().forEach(jobStatus -> {
- if (jobStatus.getStatusId() == null) {
- jobStatus.setStatusId(ExpCatalogUtils.getID("JOB_STATE"));
+ JobModel.Builder jobBuilder = jobModel.toBuilder().clearJobStatuses();
+ for (org.apache.airavata.model.status.proto.JobStatus jobStatus : jobModel.getJobStatusesList()) {
+ if (jobStatus.getStatusId().isEmpty()) {
+ jobStatus = jobStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("JOB_STATE")).build();
}
- });
+ jobBuilder.addJobStatuses(jobStatus);
+ }
+ jobModel = jobBuilder.build();
}
if (!isJobExist(jobPK)) {
logger.debug("Setting creation time to current time if does not exist");
- jobModel.setCreationTime(System.currentTimeMillis());
+ jobModel = jobModel.toBuilder().setCreationTime(System.currentTimeMillis()).build();
}
JobEntity jobEntity = ExecutionMapper.INSTANCE.jobToEntity(jobModel);
@@ -89,9 +92,9 @@ public class JobRepository extends AbstractRepository<JobModel, JobEntity, JobPK
String jobId = jobEntity.getJobId();
String taskId = jobEntity.getTaskId();
- if (jobEntity.getJobStatusesList() != null) {
+ if (jobEntity.getJobStatuses() != null) {
logger.debug("Populating the Primary Key of JobStatus objects for the Job");
- jobEntity.getJobStatusesList().forEach(jobStatusEntity -> {
+ jobEntity.getJobStatuses().forEach(jobStatusEntity -> {
jobStatusEntity.setJobId(jobId);
jobStatusEntity.setTaskId(taskId);
jobStatusEntity.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp());
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobStatusRepository.java
index d106446e7c..8560d50cc0 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobStatusRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/JobStatusRepository.java
@@ -71,9 +71,9 @@ public class JobStatusRepository extends AbstractRepository<JobStatus, JobStatus
public String addJobStatus(JobStatus jobStatus, JobPK jobPK) throws RegistryException {
- if (jobStatus.getStatusId() == null) {
+ if (jobStatus.getStatusId().isEmpty()) {
logger.debug("Setting the JobStatusEntity's StatusId");
- jobStatus.setStatusId(ExpCatalogUtils.getID("JOB_STATE"));
+ jobStatus = jobStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("JOB_STATE")).build();
}
return saveJobStatus(jobStatus, jobPK);
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/NotificationRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/NotificationRepository.java
index 477c7f214e..d5c0e2624d 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/NotificationRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/NotificationRepository.java
@@ -81,7 +81,7 @@ public class NotificationRepository extends AbstractRepository<Notification, Not
}
public String createNotification(Notification notification) throws RegistryException {
- notification.setNotificationId(getNotificationId());
+ notification = notification.toBuilder().setNotificationId(getNotificationId()).build();
return saveNotificationData(notification);
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessErrorRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessErrorRepository.java
index e089c6ac99..1802200483 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessErrorRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessErrorRepository.java
@@ -62,9 +62,9 @@ public class ProcessErrorRepository extends AbstractRepository<ErrorModel, Proce
public String addProcessError(ErrorModel processError, String processId) throws RegistryException {
- if (processError.getErrorId() == null) {
+ if (processError.getErrorId().isEmpty()) {
logger.debug("Setting the ProcessError's ErrorId");
- processError.setErrorId(ExpCatalogUtils.getID("ERROR"));
+ processError = processError.toBuilder().setErrorId(ExpCatalogUtils.getID("ERROR")).build();
}
return saveProcessError(processError, processId);
@@ -77,6 +77,6 @@ public class ProcessErrorRepository extends AbstractRepository<ErrorModel, Proce
public List<ErrorModel> getProcessError(String processId) throws RegistryException {
ProcessRepository processRepository = new ProcessRepository();
ProcessModel processModel = processRepository.getProcess(processId);
- return processModel.getProcessErrors();
+ return processModel.getProcessErrorsList();
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessRepository.java
index 0ceca5803e..508ff722ff 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessRepository.java
@@ -66,28 +66,31 @@ public class ProcessRepository extends AbstractRepository<ProcessModel, ProcessE
}
protected ProcessEntity saveProcess(ProcessModel processModel) throws RegistryException {
- if (processModel.getProcessId() == null
+ if (processModel.getProcessId().isEmpty()
|| processModel.getProcessId().equals("DO_NOT_SET_AT_CLIENTS")) {
logger.debug("Setting the Process's ProcessId");
- processModel.setProcessId(ExpCatalogUtils.getID("PROCESS"));
+ processModel = processModel.toBuilder().setProcessId(ExpCatalogUtils.getID("PROCESS")).build();
}
String processId = processModel.getProcessId();
- if (processModel.getProcessStatusesList() != null) {
+ if (!processModel.getProcessStatusesList().isEmpty()) {
logger.debug("Populating the status id of ProcessStatus objects for the Process");
- processModel.getProcessStatusesList().forEach(processStatusEntity -> {
- if (processStatusEntity.getStatusId() == null) {
- processStatusEntity.setStatusId(ExpCatalogUtils.getID("PROCESS_STATE"));
+ ProcessModel.Builder pmBuilder = processModel.toBuilder().clearProcessStatuses();
+ for (ProcessStatus ps : processModel.getProcessStatusesList()) {
+ if (ps.getStatusId().isEmpty()) {
+ ps = ps.toBuilder().setStatusId(ExpCatalogUtils.getID("PROCESS_STATE")).build();
}
- });
+ pmBuilder.addProcessStatuses(ps);
+ }
+ processModel = pmBuilder.build();
}
if (!isProcessExist(processId)) {
logger.debug("Setting creation time if process doesn't already exist");
- processModel.setCreationTime(System.currentTimeMillis());
+ processModel = processModel.toBuilder().setCreationTime(System.currentTimeMillis()).build();
}
- processModel.setLastUpdateTime(System.currentTimeMillis());
+ processModel = processModel.toBuilder().setLastUpdateTime(System.currentTimeMillis()).build();
ProcessEntity processEntity = ExecutionMapper.INSTANCE.processToEntity(processModel);
populateParentIds(processEntity);
@@ -100,8 +103,8 @@ public class ProcessRepository extends AbstractRepository<ProcessModel, ProcessE
processEntity.setExperiment(experimentRef);
}
// Set process back-reference on child tasks
- if (processEntity.getTasksList() != null) {
- processEntity.getTasksList().forEach(taskEntity -> {
+ if (processEntity.getTasks() != null) {
+ processEntity.getTasks().forEach(taskEntity -> {
if (taskEntity.getProcess() == null) {
taskEntity.setProcess(processEntity);
}
@@ -118,21 +121,21 @@ public class ProcessRepository extends AbstractRepository<ProcessModel, ProcessE
processEntity.getProcessResourceSchedule().setProcessId(processId);
}
- if (processEntity.getProcessInputsList() != null) {
+ if (processEntity.getProcessInputs() != null) {
logger.debug("Populating the Primary Key of ProcessInput objects for the Process");
- processEntity.getProcessInputsList().forEach(processInputEntity -> processInputEntity.setProcessId(processId));
+ processEntity.getProcessInputs().forEach(processInputEntity -> processInputEntity.setProcessId(processId));
}
- if (processEntity.getProcessOutputsList() != null) {
+ if (processEntity.getProcessOutputs() != null) {
logger.debug("Populating the Primary Key of ProcessOutput objects for the Process");
processEntity
- .getProcessOutputsList()
+ .getProcessOutputs()
.forEach(processOutputEntity -> processOutputEntity.setProcessId(processId));
}
- if (processEntity.getProcessStatusesList() != null) {
+ if (processEntity.getProcessStatuses() != null) {
logger.debug("Populating the Primary Key of ProcessStatus objects for the Process");
- processEntity.getProcessStatusesList().forEach(processStatusEntity -> {
+ processEntity.getProcessStatuses().forEach(processStatusEntity -> {
processStatusEntity.setProcessId(processId);
processStatusEntity.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp());
});
@@ -143,9 +146,9 @@ public class ProcessRepository extends AbstractRepository<ProcessModel, ProcessE
processEntity.getProcessErrors().forEach(processErrorEntity -> processErrorEntity.setProcessId(processId));
}
- if (processEntity.getTasksList() != null) {
+ if (processEntity.getTasks() != null) {
logger.debug("Populating the Primary Key of Task objects for the Process");
- processEntity.getTasksList().forEach(taskEntity -> {
+ processEntity.getTasks().forEach(taskEntity -> {
taskEntity.setParentProcessId(processId);
taskEntity.setCreationTime(AiravataUtils.getCurrentTimestamp());
taskRepository.populateParentIds(taskEntity);
@@ -155,7 +158,7 @@ public class ProcessRepository extends AbstractRepository<ProcessModel, ProcessE
public String addProcess(ProcessModel process, String experimentId) throws RegistryException {
ProcessStatus processStatus = ProcessStatus.newBuilder()
- .setState(ProcessState.CREATED)
+ .setState(ProcessState.PROCESS_STATE_CREATED)
.build();
process = process.toBuilder()
.setExperimentId(experimentId)
@@ -178,7 +181,9 @@ public class ProcessRepository extends AbstractRepository<ProcessModel, ProcessE
ComputationalResourceSchedulingModel computationalResourceSchedulingModel, String processId)
throws RegistryException {
ProcessModel processModel = getProcess(processId);
- processModel.setProcessResourceSchedule(computationalResourceSchedulingModel);
+ processModel = processModel.toBuilder()
+ .setProcessResourceSchedule(computationalResourceSchedulingModel)
+ .build();
updateProcess(processModel, processId);
return processId;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessStatusRepository.java
index ce3051eb41..78ac56c643 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessStatusRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessStatusRepository.java
@@ -55,14 +55,14 @@ public class ProcessStatusRepository extends AbstractRepository<ProcessStatus, P
}
protected String saveProcessStatus(ProcessStatus processStatus, String processId) throws RegistryException {
- if (processStatus.getStatusId() == null) {
+ if (processStatus.getStatusId().isEmpty()) {
ProcessStatus currentProcessStatus = getProcessStatus(processId);
- if (currentProcessStatus == null || currentProcessStatus.getState() != currentProcessStatus.getState()) {
- processStatus.setStatusId(ExpCatalogUtils.getID("PROCESS_STATE"));
+ if (currentProcessStatus == null || currentProcessStatus.getState() != processStatus.getState()) {
+ processStatus = processStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("PROCESS_STATE")).build();
} else {
// Update the existing current status if processStatus has no status id and the same state
- processStatus.setStatusId(currentProcessStatus.getStatusId());
+ processStatus = processStatus.toBuilder().setStatusId(currentProcessStatus.getStatusId()).build();
}
}
ProcessStatusEntity processStatusEntity = ExecutionMapper.INSTANCE.processStatusToEntity(processStatus);
@@ -78,9 +78,9 @@ public class ProcessStatusRepository extends AbstractRepository<ProcessStatus, P
public String addProcessStatus(ProcessStatus processStatus, String processId) throws RegistryException {
- if (processStatus.getStatusId() == null) {
+ if (processStatus.getStatusId().isEmpty()) {
logger.debug("Setting the ProcessStatus's StatusId");
- processStatus.setStatusId(ExpCatalogUtils.getID("PROCESS_STATE"));
+ processStatus = processStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("PROCESS_STATE")).build();
}
return saveProcessStatus(processStatus, processId);
@@ -109,11 +109,11 @@ public class ProcessStatusRepository extends AbstractRepository<ProcessStatus, P
if (timeOfStateChange.after(new Timestamp(latestProcessStatus.getTimeOfStateChange()))
|| (timeOfStateChange.equals(latestProcessStatus.getTimeOfStateChange())
- && processStatusList.get(i).getState().equals(ProcessState.COMPLETED.toString()))
+ && processStatusList.get(i).getState() == ProcessState.PROCESS_STATE_COMPLETED)
|| (timeOfStateChange.equals(latestProcessStatus.getTimeOfStateChange())
- && processStatusList.get(i).getState().equals(ProcessState.FAILED.toString()))
+ && processStatusList.get(i).getState() == ProcessState.PROCESS_STATE_FAILED)
|| (timeOfStateChange.equals(latestProcessStatus.getTimeOfStateChange())
- && processStatusList.get(i).getState().equals(ProcessState.CANCELED.toString()))) {
+ && processStatusList.get(i).getState() == ProcessState.PROCESS_STATE_CANCELED)) {
latestProcessStatus = processStatusList.get(i);
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessWorkflowRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessWorkflowRepository.java
index 2c6973a8ea..2058fbe39e 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessWorkflowRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProcessWorkflowRepository.java
@@ -77,6 +77,6 @@ public class ProcessWorkflowRepository
public List<ProcessWorkflow> getProcessWorkflows(String processId) throws RegistryException {
ProcessRepository processRepository = new ProcessRepository();
ProcessModel processModel = processRepository.getProcess(processId);
- return processModel.getProcessWorkflows();
+ return processModel.getProcessWorkflowsList();
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProjectRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProjectRepository.java
index e04db4a150..5ff070fcc3 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProjectRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/ProjectRepository.java
@@ -58,13 +58,13 @@ public class ProjectRepository extends AbstractRepository<Project, ProjectEntity
}
protected ProjectEntity saveProject(Project project, String gatewayId) throws RegistryException {
- if (project.getProjectID() == null || project.getProjectID().equals("DO_NOT_SET_AT_CLIENTS")) {
+ if (project.getProjectId().isEmpty() || project.getProjectId().equals("DO_NOT_SET_AT_CLIENTS")) {
logger.debug("Setting the Project's ProjectId");
- project.setProjectID(AiravataUtils.getId(project.getName()));
+ project = project.toBuilder().setProjectId(AiravataUtils.getId(project.getName())).build();
}
ProjectEntity projectEntity = ExecutionMapper.INSTANCE.projectToEntity(project);
- if (project.getGatewayId() == null) {
+ if (project.getGatewayId().isEmpty()) {
logger.debug("Setting the Project's GatewayId");
projectEntity.setGatewayId(gatewayId);
}
@@ -82,7 +82,7 @@ public class ProjectRepository extends AbstractRepository<Project, ProjectEntity
}
public void updateProject(Project project, String projectId) throws RegistryException {
- project.setProjectID(projectId);
+ project = project.toBuilder().setProjectId(projectId).build();
saveProjectData(project, project.getGatewayId());
}
@@ -130,7 +130,7 @@ public class ProjectRepository extends AbstractRepository<Project, ProjectEntity
if (projectList != null && !projectList.isEmpty()) {
logger.debug("The retrieved list is not empty or null");
for (Project project : projectList) {
- projectIds.add(project.getProjectID());
+ projectIds.add(project.getProjectId());
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskErrorRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskErrorRepository.java
index 0f4eca4354..b73823374c 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskErrorRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskErrorRepository.java
@@ -62,9 +62,9 @@ public class TaskErrorRepository extends AbstractRepository<ErrorModel, TaskErro
public String addTaskError(ErrorModel taskError, String taskId) throws RegistryException {
- if (taskError.getErrorId() == null) {
+ if (taskError.getErrorId().isEmpty()) {
logger.debug("Setting the TaskError's ErrorId");
- taskError.setErrorId(ExpCatalogUtils.getID("ERROR"));
+ taskError = taskError.toBuilder().setErrorId(ExpCatalogUtils.getID("ERROR")).build();
}
return saveTaskError(taskError, taskId);
@@ -77,6 +77,6 @@ public class TaskErrorRepository extends AbstractRepository<ErrorModel, TaskErro
public List<ErrorModel> getTaskError(String taskId) throws RegistryException {
TaskRepository taskRepository = new TaskRepository();
TaskModel taskModel = taskRepository.getTask(taskId);
- return taskModel.getTaskErrors();
+ return taskModel.getTaskErrorsList();
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskRepository.java
index bf8fbddabe..f3dfac50fe 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskRepository.java
@@ -62,28 +62,31 @@ public class TaskRepository extends AbstractRepository<TaskModel, TaskEntity, St
}
protected TaskEntity saveTask(TaskModel taskModel) throws RegistryException {
- if (taskModel.getTaskId() == null || taskModel.getTaskId().equals("DO_NOT_SET_AT_CLIENTS")) {
+ if (taskModel.getTaskId().isEmpty() || taskModel.getTaskId().equals("DO_NOT_SET_AT_CLIENTS")) {
logger.debug("Setting the Task's TaskId");
- taskModel.setTaskId(ExpCatalogUtils.getID("TASK"));
+ taskModel = taskModel.toBuilder().setTaskId(ExpCatalogUtils.getID("TASK")).build();
}
String taskId = taskModel.getTaskId();
- if (taskModel.getTaskStatusesList() != null) {
+ if (!taskModel.getTaskStatusesList().isEmpty()) {
logger.debug("Populating the status id of TaskStatus objects for the Task");
- taskModel.getTaskStatusesList().forEach(taskStatusEntity -> {
- if (taskStatusEntity.getStatusId() == null) {
- taskStatusEntity.setStatusId(ExpCatalogUtils.getID("TASK_STATE"));
+ TaskModel.Builder tmBuilder = taskModel.toBuilder().clearTaskStatuses();
+ for (org.apache.airavata.model.status.proto.TaskStatus ts : taskModel.getTaskStatusesList()) {
+ if (ts.getStatusId().isEmpty()) {
+ ts = ts.toBuilder().setStatusId(ExpCatalogUtils.getID("TASK_STATE")).build();
}
- });
+ tmBuilder.addTaskStatuses(ts);
+ }
+ taskModel = tmBuilder.build();
}
if (!isTaskExist(taskId)) {
logger.debug("Setting creation time if Task doesn't already exist");
- taskModel.setCreationTime(System.currentTimeMillis());
+ taskModel = taskModel.toBuilder().setCreationTime(System.currentTimeMillis()).build();
}
- taskModel.setLastUpdateTime(System.currentTimeMillis());
+ taskModel = taskModel.toBuilder().setLastUpdateTime(System.currentTimeMillis()).build();
TaskEntity taskEntity = ExecutionMapper.INSTANCE.taskToEntity(taskModel);
populateParentIds(taskEntity);
@@ -103,9 +106,9 @@ public class TaskRepository extends AbstractRepository<TaskModel, TaskEntity, St
String taskId = taskEntity.getTaskId();
- if (taskEntity.getTaskStatusesList() != null) {
+ if (taskEntity.getTaskStatuses() != null) {
logger.debug("Populating the Primary Key of TaskStatus objects for the Task");
- taskEntity.getTaskStatusesList().forEach(taskStatusEntity -> {
+ taskEntity.getTaskStatuses().forEach(taskStatusEntity -> {
taskStatusEntity.setTaskId(taskId);
taskStatusEntity.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp());
});
@@ -119,9 +122,9 @@ public class TaskRepository extends AbstractRepository<TaskModel, TaskEntity, St
});
}
- if (taskEntity.getJobsList() != null) {
+ if (taskEntity.getJobs() != null) {
logger.debug("Populating the Job objects' Task ID for the Task");
- taskEntity.getJobsList().forEach(jobEntity -> {
+ taskEntity.getJobs().forEach(jobEntity -> {
jobEntity.setTaskId(taskId);
jobRepository.populateParentIds(jobEntity);
});
@@ -129,7 +132,7 @@ public class TaskRepository extends AbstractRepository<TaskModel, TaskEntity, St
}
public String addTask(TaskModel task, String processId) throws RegistryException {
- task.setParentProcessId(processId);
+ task = task.toBuilder().setParentProcessId(processId).build();
String taskId = saveTaskModelData(task);
return taskId;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskStatusRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskStatusRepository.java
index 479089b7d1..df60a0207c 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskStatusRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/TaskStatusRepository.java
@@ -64,9 +64,9 @@ public class TaskStatusRepository extends AbstractRepository<TaskStatus, TaskSta
public String addTaskStatus(TaskStatus taskStatus, String taskId) throws RegistryException {
- if (taskStatus.getStatusId() == null) {
+ if (taskStatus.getStatusId().isEmpty()) {
logger.debug("Setting the TaskStatus's StatusId");
- taskStatus.setStatusId(ExpCatalogUtils.getID("TASK_STATE"));
+ taskStatus = taskStatus.toBuilder().setStatusId(ExpCatalogUtils.getID("TASK_STATE")).build();
}
return saveTaskStatus(taskStatus, taskId);
@@ -92,12 +92,12 @@ public class TaskStatusRepository extends AbstractRepository<TaskStatus, TaskSta
new Timestamp(taskStatusList.get(i).getTimeOfStateChange());
if (timeOfStateChange.after(new Timestamp(latestTaskStatus.getTimeOfStateChange()))
- || (timeOfStateChange.equals(latestTaskStatus.getTimeOfStateChange())
- && taskStatusList.get(i).getState().equals(TaskState.COMPLETED.toString()))
- || (timeOfStateChange.equals(latestTaskStatus.getTimeOfStateChange())
- && taskStatusList.get(i).getState().equals(TaskState.FAILED.toString()))
- || (timeOfStateChange.equals(latestTaskStatus.getTimeOfStateChange())
- && taskStatusList.get(i).getState().equals(TaskState.CANCELED.toString()))) {
+ || (timeOfStateChange.equals(new Timestamp(latestTaskStatus.getTimeOfStateChange()))
+ && taskStatusList.get(i).getState() == TaskState.TASK_STATE_COMPLETED)
+ || (timeOfStateChange.equals(new Timestamp(latestTaskStatus.getTimeOfStateChange()))
+ && taskStatusList.get(i).getState() == TaskState.TASK_STATE_FAILED)
+ || (timeOfStateChange.equals(new Timestamp(latestTaskStatus.getTimeOfStateChange()))
+ && taskStatusList.get(i).getState() == TaskState.TASK_STATE_CANCELED)) {
latestTaskStatus = taskStatusList.get(i);
}
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/repository/WorkflowRepository.java b/airavata-api/src/main/java/org/apache/airavata/execution/repository/WorkflowRepository.java
index 666be51d5d..7bcb65a878 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/repository/WorkflowRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/repository/WorkflowRepository.java
@@ -61,26 +61,29 @@ public class WorkflowRepository extends AbstractRepository<AiravataWorkflow, Air
protected AiravataWorkflowEntity saveWorkflow(AiravataWorkflow workflowModel, String experimentId)
throws WorkflowCatalogException {
- if (workflowModel.getId() == null || workflowModel.getId().equals("DO_NOT_SET_AT_CLIENTS")) {
+ if (workflowModel.getId().isEmpty() || workflowModel.getId().equals("DO_NOT_SET_AT_CLIENTS")) {
String newId = WorkflowCatalogUtils.getID(experimentId);
logger.debug("Setting the ID: " + newId + " for the new Workflow");
- workflowModel.setId(newId);
+ workflowModel = workflowModel.toBuilder().setId(newId).build();
}
- if (workflowModel.getStatuses() != null) {
+ if (!workflowModel.getStatusesList().isEmpty()) {
logger.debug("Populating the status IDs of WorkflowStatus objects for the Workflow with ID: "
+ workflowModel.getId());
- workflowModel.getStatuses().forEach(workflowStatus -> {
- if (workflowStatus.getId() == null) {
- workflowStatus.setId(WorkflowCatalogUtils.getID("WORKFLOW_STATUS"));
+ AiravataWorkflow.Builder wfBuilder = workflowModel.toBuilder().clearStatuses();
+ for (org.apache.airavata.model.workflow.proto.WorkflowStatus ws : workflowModel.getStatusesList()) {
+ if (ws.getId().isEmpty()) {
+ ws = ws.toBuilder().setId(WorkflowCatalogUtils.getID("WORKFLOW_STATUS")).build();
}
- });
+ wfBuilder.addStatuses(ws);
+ }
+ workflowModel = wfBuilder.build();
}
- if (workflowModel.getExperimentId() == null) {
+ if (workflowModel.getExperimentId().isEmpty()) {
logger.debug("Setting the ExperimentID: " + experimentId + " for the new Workflow with ID: "
+ workflowModel.getId());
- workflowModel.setExperimentId(experimentId);
+ workflowModel = workflowModel.toBuilder().setExperimentId(experimentId).build();
}
String workflowId = workflowModel.getId();
diff --git a/airavata-api/src/main/java/org/apache/airavata/execution/scheduler/Utils.java b/airavata-api/src/main/java/org/apache/airavata/execution/scheduler/Utils.java
index 1968d63ab3..b97d54be79 100644
--- a/airavata-api/src/main/java/org/apache/airavata/execution/scheduler/Utils.java
+++ b/airavata-api/src/main/java/org/apache/airavata/execution/scheduler/Utils.java
@@ -30,7 +30,7 @@ import org.apache.airavata.model.messaging.event.proto.ProcessIdentifier;
import org.apache.airavata.model.messaging.event.proto.ProcessStatusChangeEvent;
import org.apache.airavata.model.status.proto.ProcessState;
import org.apache.airavata.model.status.proto.ProcessStatus;
-import org.apache.airavata.registry.api.RegistryService;
+import org.apache.airavata.execution.handler.RegistryServerHandler;
import org.apache.airavata.registry.api.exception.RegistryServiceException;
@@ -39,22 +39,22 @@ import org.apache.airavata.registry.api.exception.RegistryServiceException;
*/
public class Utils {
- private static RegistryService.Iface registryHandler;
+ private static RegistryServerHandler registryHandler;
private static Publisher statusPublisher;
/**
* Sets the registry handler for direct in-JVM calls.
*/
- public static synchronized void setRegistryHandler(RegistryService.Iface handler) {
+ public static synchronized void setRegistryHandler(RegistryServerHandler handler) {
registryHandler = handler;
}
/**
* Provides registry handler to access databases
*
- * @return RegistryService.Iface
+ * @return RegistryServerHandler
*/
- public static synchronized RegistryService.Iface getRegistryHandler() {
+ public static synchronized RegistryServerHandler getRegistryHandler() {
if (registryHandler == null) {
throw new IllegalStateException("Registry handler has not been initialized");
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataProductRepository.java b/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataProductRepository.java
index 79d7fe1613..19b454b33a 100644
--- a/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataProductRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataProductRepository.java
@@ -80,10 +80,11 @@ public class DataProductRepository extends AbstractRepository<DataProductModel,
protected DataProductEntity saveDataProduct(DataProductModel dataProductModel) throws ReplicaCatalogException {
- if (dataProductModel.getProductUri() == null) {
+ if (dataProductModel.getProductUri().isEmpty()) {
logger.debug("Setting the Product URI for the new Data Product");
- dataProductModel.setProductUri(
- DataProductInterface.schema + "://" + UUID.randomUUID().toString());
+ dataProductModel = dataProductModel.toBuilder()
+ .setProductUri(DataProductInterface.schema + "://" + UUID.randomUUID().toString())
+ .build();
}
String productUri = dataProductModel.getProductUri();
diff --git a/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataReplicaLocationRepository.java b/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataReplicaLocationRepository.java
index a9f9fb77e4..24e414ed73 100644
--- a/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataReplicaLocationRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/storage/repository/DataReplicaLocationRepository.java
@@ -70,13 +70,13 @@ public class DataReplicaLocationRepository
private DataReplicaLocationEntity saveDataReplicaLocation(DataReplicaLocationModel dataReplicaLocationModel)
throws ReplicaCatalogException {
- if (dataReplicaLocationModel.getReplicaId() == null) {
+ if (dataReplicaLocationModel.getReplicaId().isEmpty()) {
logger.debug("Setting the Replica ID for the new Data Replica Location");
- dataReplicaLocationModel.setReplicaId(UUID.randomUUID().toString());
+ dataReplicaLocationModel = dataReplicaLocationModel.toBuilder()
+ .setReplicaId(UUID.randomUUID().toString()).build();
}
String replicaId = dataReplicaLocationModel.getReplicaId();
- dataReplicaLocationModel.setReplicaId(replicaId);
DataReplicaLocationEntity dataReplicaLocationEntity =
StorageMapper.INSTANCE.dataReplicaToEntity(dataReplicaLocationModel);
@@ -120,7 +120,7 @@ public class DataReplicaLocationRepository
public List<DataReplicaLocationModel> getAllReplicaLocations(String productUri) throws ReplicaCatalogException {
DataProductRepository dataProductRepository = new DataProductRepository();
DataProductModel dataProductModel = dataProductRepository.getDataProduct(productUri);
- List<DataReplicaLocationModel> dataReplicaLocationModelList = dataProductModel.getReplicaLocations();
+ List<DataReplicaLocationModel> dataReplicaLocationModelList = dataProductModel.getReplicaLocationsList();
return dataReplicaLocationModelList;
}
diff --git a/airavata-api/src/main/java/org/apache/airavata/storage/repository/StorageResourceRepository.java b/airavata-api/src/main/java/org/apache/airavata/storage/repository/StorageResourceRepository.java
index 5c5058451c..a5513955db 100644
--- a/airavata-api/src/main/java/org/apache/airavata/storage/repository/StorageResourceRepository.java
+++ b/airavata-api/src/main/java/org/apache/airavata/storage/repository/StorageResourceRepository.java
@@ -64,15 +64,21 @@ public class StorageResourceRepository
public String addStorageResource(StorageResourceDescription description) throws AppCatalogException {
try {
final String storageResourceId = AppCatalogUtils.getID(description.getHostName());
- if ("".equals(description.getStorageResourceId())
+ StorageResourceDescription.Builder descBuilder = description.toBuilder();
+ if (description.getStorageResourceId().isEmpty()
|| "DO_NOT_SET_AT_CLIENTS".equals(description.getStorageResourceId())) {
- description.setStorageResourceId(storageResourceId);
+ descBuilder.setStorageResourceId(storageResourceId);
}
- description.setCreationTime(System.currentTimeMillis());
- if (description.getDataMovementInterfaces() != null) {
- description.getDataMovementInterfaces().stream()
- .forEach(dm -> dm.setStorageResourceId(description.getStorageResourceId()));
+ descBuilder.setCreationTime(System.currentTimeMillis());
+ if (!description.getDataMovementInterfacesList().isEmpty()) {
+ descBuilder.clearDataMovementInterfaces();
+ for (DataMovementInterface dm : description.getDataMovementInterfacesList()) {
+ descBuilder.addDataMovementInterfaces(dm.toBuilder()
+ .setStorageResourceId(descBuilder.getStorageResourceId())
+ .build());
+ }
}
+ description = descBuilder.build();
StorageResourceDescription storageResourceDescription = create(description);
return storageResourceDescription.getStorageResourceId();
} catch (Exception e) {
@@ -91,11 +97,17 @@ public class StorageResourceRepository
public void updateStorageResource(String storageResourceId, StorageResourceDescription updatedStorageResource)
throws AppCatalogException {
try {
- updatedStorageResource.setUpdateTime(System.currentTimeMillis());
- if (updatedStorageResource.getDataMovementInterfaces() != null) {
- updatedStorageResource.getDataMovementInterfaces().stream()
- .forEach(dm -> dm.setStorageResourceId(updatedStorageResource.getStorageResourceId()));
+ StorageResourceDescription.Builder updBuilder = updatedStorageResource.toBuilder()
+ .setUpdateTime(System.currentTimeMillis());
+ if (!updatedStorageResource.getDataMovementInterfacesList().isEmpty()) {
+ updBuilder.clearDataMovementInterfaces();
+ for (DataMovementInterface dm : updatedStorageResource.getDataMovementInterfacesList()) {
+ updBuilder.addDataMovementInterfaces(dm.toBuilder()
+ .setStorageResourceId(updatedStorageResource.getStorageResourceId())
+ .build());
+ }
}
+ updatedStorageResource = updBuilder.build();
update(updatedStorageResource);
} catch (Exception e) {
logger.error(