[ https://issues.apache.org/jira/browse/AIRAVATA-2697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16434368#comment-16434368 ]
ASF GitHub Bot commented on AIRAVATA-2697: ------------------------------------------ machristie closed pull request #181: [AIRAVATA-2697] Update GroupResourceProfile methods in API server to use sharing API to enforce READ and WRITE rules URL: https://github.com/apache/airavata/pull/181 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index 99a1cb8ac9..47479dc75d 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -45,12 +45,7 @@ import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; -import org.apache.airavata.model.appcatalog.computeresource.CloudJobSubmission; -import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; -import org.apache.airavata.model.appcatalog.computeresource.LOCALSubmission; -import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManager; -import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission; -import org.apache.airavata.model.appcatalog.computeresource.UnicoreJobSubmission; +import org.apache.airavata.model.appcatalog.computeresource.*; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; import org.apache.airavata.model.appcatalog.gatewayprofile.GatewayResourceProfile; import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference; @@ -5079,9 +5074,31 @@ else if(userPermission.getValue().equals(ResourcePermissionType.EXEC)) @SecurityCheck public void createGroupResourceProfile(AuthzToken authzToken, GroupResourceProfile groupResourceProfile) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); + String userName = authzToken.getClaimsMap().get(Constants.USER_NAME); try { - regClient.createGroupResourceProfile(groupResourceProfile); + String groupResourceProfileId = regClient.createGroupResourceProfile(groupResourceProfile); + if(ServerSettings.isEnableSharing()) { + try { + Entity entity = new Entity(); + entity.setEntityId(groupResourceProfileId); + entity.setDomainId(groupResourceProfile.getGatewayId()); + entity.setEntityTypeId(groupResourceProfile.getGatewayId() + ":" + "GROUP_RESOURCE_PROFILE"); + entity.setOwnerId(userName + "@" + groupResourceProfile.getGatewayId()); + entity.setName(groupResourceProfile.getGroupResourceProfileName()); + + sharingClient.createEntity(entity); + } catch (Exception ex) { + logger.error(ex.getMessage(), ex); + logger.error("Rolling back group resource profile creation Group Resource Profile ID : " + groupResourceProfileId); + regClient.removeGroupResourceProfile(groupResourceProfileId); + AiravataSystemException ase = new AiravataSystemException(); + ase.setMessage("Failed to create sharing registry record"); + throw ase; + } + } registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); } catch (Exception e) { String msg = "Error creating group resource profile."; logger.error(msg, e); @@ -5096,9 +5113,23 @@ public void createGroupResourceProfile(AuthzToken authzToken, GroupResourceProfi @SecurityCheck public void updateGroupResourceProfile(AuthzToken authzToken, GroupResourceProfile groupResourceProfile) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfile.getGroupResourceProfileId(), gatewayId + ":WRITE")){ + throw new AuthorizationException("User does not have permission to update group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to update group resource profile"); + } + } regClient.updateGroupResourceProfile(groupResourceProfile); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); } catch (Exception e) { String msg = "Error updating group resource profile. groupResourceProfileId: "+groupResourceProfile.getGroupResourceProfileId(); logger.error(msg, e); @@ -5113,9 +5144,23 @@ public void updateGroupResourceProfile(AuthzToken authzToken, GroupResourceProfi @SecurityCheck public GroupResourceProfile getGroupResourceProfile(AuthzToken authzToken, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { - GroupResourceProfile groupResourceProfile = regClient.getGroupResourceProfile( groupResourceProfileId); + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } + GroupResourceProfile groupResourceProfile = regClient.getGroupResourceProfile(groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return groupResourceProfile; } catch (Exception e) { String msg = "Error retrieving group resource profile. groupResourceProfileId: "+ groupResourceProfileId; @@ -5131,9 +5176,23 @@ public GroupResourceProfile getGroupResourceProfile(AuthzToken authzToken, Strin @SecurityCheck public boolean removeGroupResourceProfile(AuthzToken authzToken, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":WRITE")){ + throw new AuthorizationException("User does not have permission to remove group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to remove group resource profile"); + } + } boolean result = regClient.removeGroupResourceProfile(groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return result; } catch (Exception e) { String msg = "Error removing group resource profile. groupResourceProfileId: "+ groupResourceProfileId; @@ -5152,8 +5211,8 @@ public boolean removeGroupResourceProfile(AuthzToken authzToken, String groupRes SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); String userName = authzToken.getClaimsMap().get(Constants.USER_NAME); try { + List<String> accessibleGroupResProfileIds = new ArrayList<>(); if (ServerSettings.isEnableSharing()) { - List<String> accessibleGroupResProfileIds = new ArrayList<>(); List<SearchCriteria> filters = new ArrayList<>(); SearchCriteria searchCriteria = new SearchCriteria(); searchCriteria.setSearchField(EntitySearchField.ENTITY_TYPE_ID); @@ -5163,19 +5222,12 @@ public boolean removeGroupResourceProfile(AuthzToken authzToken, String groupRes sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID), userName + "@" + gatewayId, filters, 0, -1).stream().forEach(p -> accessibleGroupResProfileIds .add(p.entityId)); - // TODO: push accessibleGroupResProfileIds filtering down - List<GroupResourceProfile> groupResourceProfileList = regClient.getGroupResourceList(gatewayId); - registryClientPool.returnResource(regClient); - sharingClientPool.returnResource(sharingClient); - return groupResourceProfileList.stream() - .filter(grp -> accessibleGroupResProfileIds.contains(grp.getGroupResourceProfileId())) - .collect(Collectors.toList()); - } else { - List<GroupResourceProfile> groupResourceProfileList = regClient.getGroupResourceList(gatewayId); - registryClientPool.returnResource(regClient); - sharingClientPool.returnResource(sharingClient); - return groupResourceProfileList; + } + List<GroupResourceProfile> groupResourceProfileList = regClient.getGroupResourceList(gatewayId, accessibleGroupResProfileIds); + registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); + return groupResourceProfileList; } catch (Exception e) { String msg = "Error retrieving list group resource profile list. GatewayId: "+ gatewayId; logger.error(msg, e); @@ -5191,9 +5243,23 @@ public boolean removeGroupResourceProfile(AuthzToken authzToken, String groupRes @SecurityCheck public boolean removeGroupComputePrefs(AuthzToken authzToken, String computeResourceId, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":WRITE")){ + throw new AuthorizationException("User does not have permission to remove group compute preferences"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to remove group compute preferences"); + } + } boolean result = regClient.removeGroupComputePrefs(computeResourceId, groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return result; } catch (Exception e) { String msg = "Error removing group compute resource preferences. GroupResourceProfileId: "+ groupResourceProfileId; @@ -5209,9 +5275,24 @@ public boolean removeGroupComputePrefs(AuthzToken authzToken, String computeReso @SecurityCheck public boolean removeGroupComputeResourcePolicy(AuthzToken authzToken, String resourcePolicyId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + ComputeResourcePolicy computeResourcePolicy = regClient.getGroupComputeResourcePolicy(resourcePolicyId); + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + computeResourcePolicy.getGroupResourceProfileId(), gatewayId + ":WRITE")){ + throw new AuthorizationException("User does not have permission to remove group compute resource policy"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to remove group compute resource policy"); + } + } boolean result = regClient.removeGroupComputeResourcePolicy(resourcePolicyId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return result; } catch (Exception e) { String msg = "Error removing group compute resource policy. ResourcePolicyId: "+ resourcePolicyId; @@ -5227,9 +5308,24 @@ public boolean removeGroupComputeResourcePolicy(AuthzToken authzToken, String re @SecurityCheck public boolean removeGroupBatchQueueResourcePolicy(AuthzToken authzToken, String resourcePolicyId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + BatchQueueResourcePolicy batchQueueResourcePolicy = regClient.getBatchQueueResourcePolicy(resourcePolicyId); + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + batchQueueResourcePolicy.getGroupResourceProfileId(), gatewayId + ":WRITE")){ + throw new AuthorizationException("User does not have permission to remove batch queue resource policy"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to remove batch queue resource policy"); + } + } boolean result = regClient.removeGroupBatchQueueResourcePolicy(resourcePolicyId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return result; } catch (Exception e) { String msg = "Error removing batch queue resource policy. ResourcePolicyId: "+ resourcePolicyId; @@ -5245,9 +5341,23 @@ public boolean removeGroupBatchQueueResourcePolicy(AuthzToken authzToken, String @SecurityCheck public GroupComputeResourcePreference getGroupComputeResourcePreference(AuthzToken authzToken, String computeResourceId, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } GroupComputeResourcePreference groupComputeResourcePreference = regClient.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return groupComputeResourcePreference; } catch (Exception e) { String msg = "Error retrieving Group compute preference. GroupResourceProfileId: "+ groupResourceProfileId; @@ -5263,9 +5373,25 @@ public GroupComputeResourcePreference getGroupComputeResourcePreference(AuthzTok @SecurityCheck public ComputeResourcePolicy getGroupComputeResourcePolicy(AuthzToken authzToken, String resourcePolicyId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + ComputeResourcePolicy computeResourcePolicy = regClient.getGroupComputeResourcePolicy(resourcePolicyId); + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + computeResourcePolicy.getGroupResourceProfileId(), gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } + ComputeResourcePolicy computeResourcePolicy = regClient.getGroupComputeResourcePolicy(resourcePolicyId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return computeResourcePolicy; } catch (Exception e) { String msg = "Error retrieving Group compute resource policy. ResourcePolicyId: "+ resourcePolicyId; @@ -5281,9 +5407,24 @@ public ComputeResourcePolicy getGroupComputeResourcePolicy(AuthzToken authzToken @SecurityCheck public BatchQueueResourcePolicy getBatchQueueResourcePolicy(AuthzToken authzToken, String resourcePolicyId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + BatchQueueResourcePolicy batchQueueResourcePolicy = regClient.getBatchQueueResourcePolicy(resourcePolicyId); + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + batchQueueResourcePolicy.getGroupResourceProfileId(), gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } BatchQueueResourcePolicy batchQueueResourcePolicy = regClient.getBatchQueueResourcePolicy(resourcePolicyId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return batchQueueResourcePolicy; } catch (Exception e) { String msg = "Error retrieving Group batch queue resource policy. ResourcePolicyId: "+ resourcePolicyId; @@ -5299,9 +5440,23 @@ public BatchQueueResourcePolicy getBatchQueueResourcePolicy(AuthzToken authzToke @SecurityCheck public List<GroupComputeResourcePreference> getGroupComputeResourcePrefList(AuthzToken authzToken, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } List<GroupComputeResourcePreference> groupComputeResourcePreferenceList = regClient.getGroupComputeResourcePrefList(groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return groupComputeResourcePreferenceList; } catch (Exception e) { String msg = "Error retrieving Group compute resource preference. GroupResourceProfileId: "+ groupResourceProfileId; @@ -5317,9 +5472,23 @@ public BatchQueueResourcePolicy getBatchQueueResourcePolicy(AuthzToken authzToke @SecurityCheck public List<BatchQueueResourcePolicy> getGroupBatchQueueResourcePolicyList(AuthzToken authzToken, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } List<BatchQueueResourcePolicy> batchQueueResourcePolicyList = regClient.getGroupBatchQueueResourcePolicyList(groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return batchQueueResourcePolicyList; } catch (Exception e) { String msg = "Error retrieving Group batch queue resource policy list. GroupResourceProfileId: "+ groupResourceProfileId; @@ -5335,9 +5504,23 @@ public BatchQueueResourcePolicy getBatchQueueResourcePolicy(AuthzToken authzToke @SecurityCheck public List<ComputeResourcePolicy> getGroupComputeResourcePolicyList(AuthzToken authzToken, String groupResourceProfileId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { RegistryService.Client regClient = registryClientPool.getResource(); + SharingRegistryService.Client sharingClient = sharingClientPool.getResource(); try { + if(ServerSettings.isEnableSharing()) { + try { + String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); + String userId = authzToken.getClaimsMap().get(Constants.USER_NAME); + if (!sharingClient.userHasAccess(gatewayId, userId + "@" + gatewayId, + groupResourceProfileId, gatewayId + ":READ")){ + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } catch (Exception e) { + throw new AuthorizationException("User does not have permission to access group resource profile"); + } + } List<ComputeResourcePolicy> computeResourcePolicyList = regClient.getGroupComputeResourcePolicyList(groupResourceProfileId); registryClientPool.returnResource(regClient); + sharingClientPool.returnResource(sharingClient); return computeResourcePolicyList; } catch (Exception e) { String msg = "Error retrieving Group compute resource policy list. GroupResourceProfileId: "+ groupResourceProfileId; diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepository.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepository.java index 520c5e1248..51aad42bb4 100644 --- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepository.java +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepository.java @@ -27,9 +27,7 @@ import org.apache.airavata.registry.core.utils.DBConstants; import org.apache.airavata.registry.core.utils.QueryConstants; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; /** * Created by skariyat on 2/8/18. @@ -40,10 +38,26 @@ public GroupResourceProfileRepository() { super(GroupResourceProfile.class, GroupResourceProfileEntity.class); } - public void addGroupResourceProfile(GroupResourceProfile groupResourceProfile) { + public String addGroupResourceProfile(GroupResourceProfile groupResourceProfile) { + final String groupResourceProfileId = UUID.randomUUID().toString(); + groupResourceProfile.setGroupResourceProfileId(groupResourceProfileId); groupResourceProfile.setCreationTime(System.currentTimeMillis()); - updateGroupResourceProfile(groupResourceProfile); + if (groupResourceProfile.getComputePreferences() != null) { + for (GroupComputeResourcePreference groupComputeResourcePreference: groupResourceProfile.getComputePreferences()) { + groupComputeResourcePreference.setGroupResourceProfileId(groupResourceProfileId); + if (groupComputeResourcePreference.getGroupSSHAccountProvisionerConfigs() != null) { + groupComputeResourcePreference.getGroupSSHAccountProvisionerConfigs().forEach(gssh -> gssh.setGroupResourceProfileId(groupResourceProfileId)); + } + } + } + if (groupResourceProfile.getBatchQueueResourcePolicies() != null) { + groupResourceProfile.getBatchQueueResourcePolicies().forEach(bq -> bq.setGroupResourceProfileId(groupResourceProfileId)); + } + if (groupResourceProfile.getComputeResourcePolicies() != null) { + groupResourceProfile.getComputeResourcePolicies().forEach(cr -> cr.setGroupResourceProfileId(groupResourceProfileId)); + } + return updateGroupResourceProfile(groupResourceProfile); } public String updateGroupResourceProfile(GroupResourceProfile updatedGroupResourceProfile) { @@ -72,9 +86,14 @@ public boolean isGroupResourceProfileExists(String groupResourceProfileId) { return isExists(groupResourceProfilePK); } - public List<GroupResourceProfile> getAllGroupResourceProfiles(String gatewayId) { + public List<GroupResourceProfile> getAllGroupResourceProfiles(String gatewayId, List<String> accessibleGroupResProfileIds) { Map<String,Object> queryParameters = new HashMap<>(); queryParameters.put(DBConstants.GroupResourceProfile.GATEWAY_ID, gatewayId); + + if (accessibleGroupResProfileIds != null && !accessibleGroupResProfileIds.isEmpty()) { + queryParameters.put(DBConstants.GroupResourceProfile.ACCESSIBLE_GROUP_RESOURCE_IDS, accessibleGroupResProfileIds); + return select(QueryConstants.FIND_ACCESSIBLE_GROUP_RESOURCE_PROFILES, -1, 0, queryParameters); + } List<GroupResourceProfile> groupResourceProfileList = select(QueryConstants.FIND_ALL_GROUP_RESOURCE_PROFILES, -1, 0, queryParameters); return groupResourceProfileList; } diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java index 15ca0bf9e4..3d5e51ec0e 100644 --- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/DBConstants.java @@ -71,6 +71,7 @@ public static class GroupResourceProfile { public static final String GATEWAY_ID = "gatewayId"; public static final String GROUP_RESOURCE_PROFILE_ID = "groupResourceProfileId"; + public static final String ACCESSIBLE_GROUP_RESOURCE_IDS = "accessibleGroupResProfileIds"; } public static class UserResourceProfile { diff --git a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java index da2869fe6c..6ba4835e14 100644 --- a/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java +++ b/modules/registry-refactoring/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java @@ -87,6 +87,9 @@ String GET_PARALLELISM_PREFIX = "SELECT DISTINCT PF FROM " + ParallelismCommandEntity.class.getSimpleName() + " PF " + "WHERE PF.resourceJobManagerId LIKE :" + DBConstants.ResourceJobManager.RESOURCE_JOB_MANAGER_ID; + String FIND_ACCESSIBLE_GROUP_RESOURCE_PROFILES = "SELECT G FROM " + GroupResourceProfileEntity.class.getSimpleName() + " G " + + "WHERE G.gatewayId LIKE :" + DBConstants.GroupResourceProfile.GATEWAY_ID + " AND G.groupResourceProfileId IN :" + + DBConstants.GroupResourceProfile.ACCESSIBLE_GROUP_RESOURCE_IDS; String FIND_ALL_GROUP_RESOURCE_PROFILES = "SELECT G FROM " + GroupResourceProfileEntity.class.getSimpleName() + " G " + "WHERE G.gatewayId LIKE :" + DBConstants.GroupResourceProfile.GATEWAY_ID; String FIND_ALL_GROUP_COMPUTE_PREFERENCES = "SELECT GC FROM "+ GroupComputeResourcePrefEntity.class.getSimpleName() + " GC " + diff --git a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java index 6b15432cac..b798b03fc1 100644 --- a/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java +++ b/modules/registry-refactoring/src/test/java/org/apache/airavata/registry/core/repositories/appcatalog/GroupResourceProfileRepositoryTest.java @@ -41,8 +41,8 @@ private ComputeResourceRepository computeResourceRepository; private GroupResourceProfileRepository groupResourceProfileRepository; private String gatewayId = "TEST_GATEWAY"; - private String groupResourceProfileId = "TEST_GROUP_PROFILE_ID"; - private static final Logger logger = LoggerFactory.getLogger(GroupResourceProfileRepositoryTest.class); + private String groupResourceProfileId = ""; + private static final Logger logger = LoggerFactory.getLogger(ComputeResourceRepository.class); @Before public void setUp() { @@ -128,19 +128,16 @@ public void GroupResourceProfileRepositoryTest() throws AppCatalogException { groupResourceProfile.setGroupResourceProfileName("TEST_GROUP_PROFILE_NAME"); GroupAccountSSHProvisionerConfig groupAccountSSHProvisionerConfig = new GroupAccountSSHProvisionerConfig(); - groupAccountSSHProvisionerConfig.setGroupResourceProfileId(groupResourceProfileId); groupAccountSSHProvisionerConfig.setResourceId(resourceId1); groupAccountSSHProvisionerConfig.setConfigName("configName"); groupAccountSSHProvisionerConfig.setConfigValue("configvalue"); GroupComputeResourcePreference groupComputeResourcePreference1 = new GroupComputeResourcePreference(); groupComputeResourcePreference1.setComputeResourceId(resourceId1); - groupComputeResourcePreference1.setGroupResourceProfileId(groupResourceProfileId); groupComputeResourcePreference1.addToGroupSSHAccountProvisionerConfigs(groupAccountSSHProvisionerConfig); GroupComputeResourcePreference groupComputeResourcePreference2 = new GroupComputeResourcePreference(); groupComputeResourcePreference2.setComputeResourceId(resourceId2); - groupComputeResourcePreference2.setGroupResourceProfileId(groupResourceProfileId); List<GroupComputeResourcePreference> groupComputeResourcePreferenceList = new ArrayList<>(); groupComputeResourcePreferenceList.add(groupComputeResourcePreference1); @@ -151,13 +148,11 @@ public void GroupResourceProfileRepositoryTest() throws AppCatalogException { ComputeResourcePolicy computeResourcePolicy = new ComputeResourcePolicy(); computeResourcePolicy.setComputeResourceId(resourceId1); computeResourcePolicy.setResourcePolicyId("TEST_COM_RESOURCE_POLICY_ID1"); - computeResourcePolicy.setGroupResourceProfileId(groupResourceProfileId); computeResourcePolicy.addToAllowedBatchQueues("queue1"); ComputeResourcePolicy computeResourcePolicy2 = new ComputeResourcePolicy(); computeResourcePolicy2.setComputeResourceId(resourceId2); computeResourcePolicy2.setResourcePolicyId("TEST_COM_RESOURCE_POLICY_ID2"); - computeResourcePolicy2.setGroupResourceProfileId(groupResourceProfileId); computeResourcePolicy2.addToAllowedBatchQueues("cmqueue1"); List<ComputeResourcePolicy> computeResourcePolicyList = new ArrayList<>(); @@ -168,7 +163,6 @@ public void GroupResourceProfileRepositoryTest() throws AppCatalogException { BatchQueueResourcePolicy batchQueueResourcePolicy = new BatchQueueResourcePolicy(); batchQueueResourcePolicy.setComputeResourceId(resourceId1); - batchQueueResourcePolicy.setGroupResourceProfileId(groupResourceProfileId); batchQueueResourcePolicy.setResourcePolicyId("TEST_BQ_RESOURCE_POLICY_ID1"); batchQueueResourcePolicy.setQueuename("queue1"); batchQueueResourcePolicy.setMaxAllowedCores(2); @@ -176,7 +170,6 @@ public void GroupResourceProfileRepositoryTest() throws AppCatalogException { BatchQueueResourcePolicy batchQueueResourcePolicy2 = new BatchQueueResourcePolicy(); batchQueueResourcePolicy2.setComputeResourceId(resourceId2); - batchQueueResourcePolicy2.setGroupResourceProfileId(groupResourceProfileId); batchQueueResourcePolicy2.setResourcePolicyId("TEST_BQ_RESOURCE_POLICY_ID2"); batchQueueResourcePolicy2.setQueuename("cmqueue1"); batchQueueResourcePolicy2.setMaxAllowedCores(3); @@ -188,7 +181,7 @@ public void GroupResourceProfileRepositoryTest() throws AppCatalogException { groupResourceProfile.setBatchQueueResourcePolicies(batchQueueResourcePolicyList); - groupResourceProfileRepository.addGroupResourceProfile(groupResourceProfile); + groupResourceProfileId = groupResourceProfileRepository.addGroupResourceProfile(groupResourceProfile); if (groupResourceProfileRepository.isGroupResourceProfileExists(groupResourceProfileId)) { GroupResourceProfile getGroupResourceProfile = groupResourceProfileRepository.getGroupResourceProfile(groupResourceProfileId); @@ -212,7 +205,7 @@ public void GroupResourceProfileRepositoryTest() throws AppCatalogException { assertTrue(getBatchQueuePolicy.getMaxAllowedCores() == 3); assertTrue(getBatchQueuePolicy.getMaxAllowedWalltime() == 12); - assertTrue(groupResourceProfileRepository.getAllGroupResourceProfiles(gatewayId).size() == 1); + assertTrue(groupResourceProfileRepository.getAllGroupResourceProfiles(gatewayId, null).size() == 1); assertTrue(groupResourceProfileRepository.getAllGroupComputeResourcePreferences(groupResourceProfileId).size() == 2); assertTrue(groupResourceProfileRepository.getAllGroupComputeResourcePolicies(groupResourceProfileId).size() == 2); assertTrue(groupResourceProfileRepository.getAllGroupBatchQueueResourcePolicies(groupResourceProfileId).size() == 2); diff --git a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java index e9164ed580..c22436f330 100644 --- a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java +++ b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java @@ -2400,22 +2400,16 @@ public DataProductModel getParentDataProduct(String productUri) throws RegistryS } @Override - public void createGroupResourceProfile(GroupResourceProfile groupResourceProfile) throws RegistryServiceException, TException { + public String createGroupResourceProfile(GroupResourceProfile groupResourceProfile) throws RegistryServiceException, TException { try { - if (!validateString(groupResourceProfile.getGroupResourceProfileId())){ - logger.error("Cannot create group resource profile with empty group resource profile id"); - RegistryServiceException exception = new RegistryServiceException(); - exception.setMessage("Cannot create group resource profile with empty gateway id"); - throw exception; - } if (!isGatewayExistInternal(groupResourceProfile.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..."); } - GroupResourceProfileRepository groupResourceProfileRepository = new GroupResourceProfileRepository(); - groupResourceProfileRepository.addGroupResourceProfile(groupResourceProfile); - logger.debug("New Group Resource Profile Created: " + groupResourceProfile.getGroupResourceProfileId()); + String groupResourceProfileId = groupResourceProfileRepository.addGroupResourceProfile(groupResourceProfile); + logger.debug("New Group Resource Profile Created: " + groupResourceProfileId); + return groupResourceProfileId; } catch (Exception e) { logger.error("Error while creating group resource profile...", e); RegistryServiceException exception = new RegistryServiceException(); @@ -2484,10 +2478,10 @@ public boolean removeGroupResourceProfile(String groupResourceProfileId) throws } @Override - public List<GroupResourceProfile> getGroupResourceList(String gatewayId) throws RegistryServiceException, TException { + public List<GroupResourceProfile> getGroupResourceList(String gatewayId, List<String> accessibleGroupResProfileIds) throws RegistryServiceException, TException { try { GroupResourceProfileRepository groupResourceProfileRepository = new GroupResourceProfileRepository(); - return groupResourceProfileRepository.getAllGroupResourceProfiles(gatewayId); + return groupResourceProfileRepository.getAllGroupResourceProfiles(gatewayId, accessibleGroupResProfileIds); } catch (Exception e) { logger.error("Error while retrieving group resource list ", e); RegistryServiceException exception = new RegistryServiceException(); diff --git a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java index cc4defa667..af5c766554 100644 --- a/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java +++ b/modules/registry/registry-server/registry-api-stubs/src/main/java/org/apache/airavata/registry/api/RegistryService.java @@ -2524,7 +2524,7 @@ public java.util.List<org.apache.airavata.model.data.replica.DataProductModel> searchDataProductsByName(java.lang.String gatewayId, java.lang.String userId, java.lang.String productName, int limit, int offset) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; - public void createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; + public java.lang.String createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; public void updateGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; @@ -2532,7 +2532,7 @@ public boolean removeGroupResourceProfile(java.lang.String groupResourceProfileId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; - public java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile> getGroupResourceList(java.lang.String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; + public java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile> getGroupResourceList(java.lang.String gatewayId, java.util.List<java.lang.String> accessibleGroupResProfileIds) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; public boolean removeGroupComputePrefs(java.lang.String computeResourceId, java.lang.String groupResourceProfileId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException; @@ -2896,7 +2896,7 @@ public void searchDataProductsByName(java.lang.String gatewayId, java.lang.String userId, java.lang.String productName, int limit, int offset, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.data.replica.DataProductModel>> resultHandler) throws org.apache.thrift.TException; - public void createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; + public void createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException; public void updateGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException; @@ -2904,7 +2904,7 @@ public void removeGroupResourceProfile(java.lang.String groupResourceProfileId, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException; - public void getGroupResourceList(java.lang.String gatewayId, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler) throws org.apache.thrift.TException; + public void getGroupResourceList(java.lang.String gatewayId, java.util.List<java.lang.String> accessibleGroupResProfileIds, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler) throws org.apache.thrift.TException; public void removeGroupComputePrefs(java.lang.String computeResourceId, java.lang.String groupResourceProfileId, org.apache.thrift.async.AsyncMethodCallback<java.lang.Boolean> resultHandler) throws org.apache.thrift.TException; @@ -7496,10 +7496,10 @@ public void send_searchDataProductsByName(java.lang.String gatewayId, java.lang. throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "searchDataProductsByName failed: unknown result"); } - public void createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException + public java.lang.String createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException { send_createGroupResourceProfile(groupResourceProfile); - recv_createGroupResourceProfile(); + return recv_createGroupResourceProfile(); } public void send_createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.thrift.TException @@ -7509,14 +7509,17 @@ public void send_createGroupResourceProfile(org.apache.airavata.model.appcatalog sendBase("createGroupResourceProfile", args); } - public void recv_createGroupResourceProfile() throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException + public java.lang.String recv_createGroupResourceProfile() throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException { createGroupResourceProfile_result result = new createGroupResourceProfile_result(); receiveBase(result, "createGroupResourceProfile"); + if (result.isSetSuccess()) { + return result.success; + } if (result.rse != null) { throw result.rse; } - return; + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "createGroupResourceProfile failed: unknown result"); } public void updateGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException @@ -7594,16 +7597,17 @@ public boolean recv_removeGroupResourceProfile() throws org.apache.airavata.regi throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "removeGroupResourceProfile failed: unknown result"); } - public java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile> getGroupResourceList(java.lang.String gatewayId) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException + public java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile> getGroupResourceList(java.lang.String gatewayId, java.util.List<java.lang.String> accessibleGroupResProfileIds) throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException { - send_getGroupResourceList(gatewayId); + send_getGroupResourceList(gatewayId, accessibleGroupResProfileIds); return recv_getGroupResourceList(); } - public void send_getGroupResourceList(java.lang.String gatewayId) throws org.apache.thrift.TException + public void send_getGroupResourceList(java.lang.String gatewayId, java.util.List<java.lang.String> accessibleGroupResProfileIds) throws org.apache.thrift.TException { getGroupResourceList_args args = new getGroupResourceList_args(); args.setGatewayId(gatewayId); + args.setAccessibleGroupResProfileIds(accessibleGroupResProfileIds); sendBase("getGroupResourceList", args); } @@ -13722,16 +13726,16 @@ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apa } } - public void createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { + public void createGroupResourceProfile(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException { checkReady(); createGroupResourceProfile_call method_call = new createGroupResourceProfile_call(groupResourceProfile, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } - public static class createGroupResourceProfile_call extends org.apache.thrift.async.TAsyncMethodCall<Void> { + public static class createGroupResourceProfile_call extends org.apache.thrift.async.TAsyncMethodCall<java.lang.String> { private org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile; - public createGroupResourceProfile_call(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + public createGroupResourceProfile_call(org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile groupResourceProfile, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.groupResourceProfile = groupResourceProfile; } @@ -13744,13 +13748,13 @@ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apa prot.writeMessageEnd(); } - public Void getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException { + public java.lang.String getResult() throws org.apache.airavata.registry.api.exception.RegistryServiceException, org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new java.lang.IllegalStateException("Method call not finished!"); } org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return null; + return (new Client(prot)).recv_createGroupResourceProfile(); } } @@ -13850,24 +13854,27 @@ public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apa } } - public void getGroupResourceList(java.lang.String gatewayId, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler) throws org.apache.thrift.TException { + public void getGroupResourceList(java.lang.String gatewayId, java.util.List<java.lang.String> accessibleGroupResProfileIds, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler) throws org.apache.thrift.TException { checkReady(); - getGroupResourceList_call method_call = new getGroupResourceList_call(gatewayId, resultHandler, this, ___protocolFactory, ___transport); + getGroupResourceList_call method_call = new getGroupResourceList_call(gatewayId, accessibleGroupResProfileIds, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } public static class getGroupResourceList_call extends org.apache.thrift.async.TAsyncMethodCall<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> { private java.lang.String gatewayId; - public getGroupResourceList_call(java.lang.String gatewayId, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private java.util.List<java.lang.String> accessibleGroupResProfileIds; + public getGroupResourceList_call(java.lang.String gatewayId, java.util.List<java.lang.String> accessibleGroupResProfileIds, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); this.gatewayId = gatewayId; + this.accessibleGroupResProfileIds = accessibleGroupResProfileIds; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getGroupResourceList", org.apache.thrift.protocol.TMessageType.CALL, 0)); getGroupResourceList_args args = new getGroupResourceList_args(); args.setGatewayId(gatewayId); + args.setAccessibleGroupResProfileIds(accessibleGroupResProfileIds); args.write(prot); prot.writeMessageEnd(); } @@ -18553,7 +18560,7 @@ protected boolean isOneway() { public createGroupResourceProfile_result getResult(I iface, createGroupResourceProfile_args args) throws org.apache.thrift.TException { createGroupResourceProfile_result result = new createGroupResourceProfile_result(); try { - iface.createGroupResourceProfile(args.groupResourceProfile); + result.success = iface.createGroupResourceProfile(args.groupResourceProfile); } catch (org.apache.airavata.registry.api.exception.RegistryServiceException rse) { result.rse = rse; } @@ -18650,7 +18657,7 @@ protected boolean isOneway() { public getGroupResourceList_result getResult(I iface, getGroupResourceList_args args) throws org.apache.thrift.TException { getGroupResourceList_result result = new getGroupResourceList_result(); try { - result.success = iface.getGroupResourceList(args.gatewayId); + result.success = iface.getGroupResourceList(args.gatewayId, args.accessibleGroupResProfileIds); } catch (org.apache.airavata.registry.api.exception.RegistryServiceException rse) { result.rse = rse; } @@ -30220,7 +30227,7 @@ public void start(I iface, searchDataProductsByName_args args, org.apache.thrift } } - public static class createGroupResourceProfile<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, createGroupResourceProfile_args, Void> { + public static class createGroupResourceProfile<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, createGroupResourceProfile_args, java.lang.String> { public createGroupResourceProfile() { super("createGroupResourceProfile"); } @@ -30229,11 +30236,12 @@ public createGroupResourceProfile_args getEmptyArgsInstance() { return new createGroupResourceProfile_args(); } - public org.apache.thrift.async.AsyncMethodCallback<Void> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { + public org.apache.thrift.async.AsyncMethodCallback<java.lang.String> getResultHandler(final org.apache.thrift.server.AbstractNonblockingServer.AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new org.apache.thrift.async.AsyncMethodCallback<Void>() { - public void onComplete(Void o) { + return new org.apache.thrift.async.AsyncMethodCallback<java.lang.String>() { + public void onComplete(java.lang.String o) { createGroupResourceProfile_result result = new createGroupResourceProfile_result(); + result.success = o; try { fcall.sendResponse(fb, result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); } catch (org.apache.thrift.transport.TTransportException e) { @@ -30279,7 +30287,7 @@ protected boolean isOneway() { return false; } - public void start(I iface, createGroupResourceProfile_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws org.apache.thrift.TException { + public void start(I iface, createGroupResourceProfile_args args, org.apache.thrift.async.AsyncMethodCallback<java.lang.String> resultHandler) throws org.apache.thrift.TException { iface.createGroupResourceProfile(args.groupResourceProfile,resultHandler); } } @@ -30540,7 +30548,7 @@ protected boolean isOneway() { } public void start(I iface, getGroupResourceList_args args, org.apache.thrift.async.AsyncMethodCallback<java.util.List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>> resultHandler) throws org.apache.thrift.TException { - iface.getGroupResourceList(args.gatewayId,resultHandler); + iface.getGroupResourceList(args.gatewayId, args.accessibleGroupResProfileIds,resultHandler); } } @@ -187866,15 +187874,18 @@ public void read(org.apache.thrift.protocol.TProtocol prot, createGroupResourceP public static class createGroupResourceProfile_result implements org.apache.thrift.TBase<createGroupResourceProfile_result, createGroupResourceProfile_result._Fields>, java.io.Serializable, Cloneable, Comparable<createGroupResourceProfile_result> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("createGroupResourceProfile_result"); + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRING, (short)0); private static final org.apache.thrift.protocol.TField RSE_FIELD_DESC = new org.apache.thrift.protocol.TField("rse", org.apache.thrift.protocol.TType.STRUCT, (short)1); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new createGroupResourceProfile_resultStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new createGroupResourceProfile_resultTupleSchemeFactory(); + public java.lang.String success; // required public org.apache.airavata.registry.api.exception.RegistryServiceException rse; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"), RSE((short)1, "rse"); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); @@ -187890,6 +187901,8 @@ public void read(org.apache.thrift.protocol.TProtocol prot, createGroupResourceP */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; case 1: // RSE return RSE; default: @@ -187935,6 +187948,8 @@ public short getThriftFieldId() { public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.RSE, new org.apache.thrift.meta_data.FieldMetaData("rse", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.registry.api.exception.RegistryServiceException.class))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); @@ -187945,9 +187960,11 @@ public createGroupResourceProfile_result() { } public createGroupResourceProfile_result( + java.lang.String success, org.apache.airavata.registry.api.exception.RegistryServiceException rse) { this(); + this.success = success; this.rse = rse; } @@ -187955,6 +187972,9 @@ public createGroupResourceProfile_result( * Performs a deep copy on <i>other</i>. */ public createGroupResourceProfile_result(createGroupResourceProfile_result other) { + if (other.isSetSuccess()) { + this.success = other.success; + } if (other.isSetRse()) { this.rse = new org.apache.airavata.registry.api.exception.RegistryServiceException(other.rse); } @@ -187966,9 +187986,34 @@ public createGroupResourceProfile_result deepCopy() { @Override public void clear() { + this.success = null; this.rse = null; } + public java.lang.String getSuccess() { + return this.success; + } + + public createGroupResourceProfile_result setSuccess(java.lang.String success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + public org.apache.airavata.registry.api.exception.RegistryServiceException getRse() { return this.rse; } @@ -187995,6 +188040,14 @@ public void setRseIsSet(boolean value) { public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((java.lang.String)value); + } + break; + case RSE: if (value == null) { unsetRse(); @@ -188008,6 +188061,9 @@ public void setFieldValue(_Fields field, java.lang.Object value) { public java.lang.Object getFieldValue(_Fields field) { switch (field) { + case SUCCESS: + return getSuccess(); + case RSE: return getRse(); @@ -188022,6 +188078,8 @@ public boolean isSet(_Fields field) { } switch (field) { + case SUCCESS: + return isSetSuccess(); case RSE: return isSetRse(); } @@ -188043,6 +188101,15 @@ public boolean equals(createGroupResourceProfile_result that) { if (this == that) return true; + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (!this.success.equals(that.success)) + return false; + } + boolean this_present_rse = true && this.isSetRse(); boolean that_present_rse = true && that.isSetRse(); if (this_present_rse || that_present_rse) { @@ -188059,6 +188126,10 @@ public boolean equals(createGroupResourceProfile_result that) { public int hashCode() { int hashCode = 1; + hashCode = hashCode * 8191 + ((isSetSuccess()) ? 131071 : 524287); + if (isSetSuccess()) + hashCode = hashCode * 8191 + success.hashCode(); + hashCode = hashCode * 8191 + ((isSetRse()) ? 131071 : 524287); if (isSetRse()) hashCode = hashCode * 8191 + rse.hashCode(); @@ -188074,6 +188145,16 @@ public int compareTo(createGroupResourceProfile_result other) { int lastComparison = 0; + lastComparison = java.lang.Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = java.lang.Boolean.valueOf(isSetRse()).compareTo(other.isSetRse()); if (lastComparison != 0) { return lastComparison; @@ -188104,6 +188185,14 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. java.lang.StringBuilder sb = new java.lang.StringBuilder("createGroupResourceProfile_result("); boolean first = true; + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } + first = false; + if (!first) sb.append(", "); sb.append("rse:"); if (this.rse == null) { sb.append("null"); @@ -188154,6 +188243,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, createGroupResource break; } switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; case 1: // RSE if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.rse = new org.apache.airavata.registry.api.exception.RegistryServiceException(); @@ -188178,6 +188275,11 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, createGroupResourc struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeString(struct.success); + oprot.writeFieldEnd(); + } if (struct.rse != null) { oprot.writeFieldBegin(RSE_FIELD_DESC); struct.rse.write(oprot); @@ -188201,10 +188303,16 @@ public createGroupResourceProfile_resultTupleScheme getScheme() { public void write(org.apache.thrift.protocol.TProtocol prot, createGroupResourceProfile_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; java.util.BitSet optionals = new java.util.BitSet(); - if (struct.isSetRse()) { + if (struct.isSetSuccess()) { optionals.set(0); } - oprot.writeBitSet(optionals, 1); + if (struct.isSetRse()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetSuccess()) { + oprot.writeString(struct.success); + } if (struct.isSetRse()) { struct.rse.write(oprot); } @@ -188213,8 +188321,12 @@ public void write(org.apache.thrift.protocol.TProtocol prot, createGroupResource @Override public void read(org.apache.thrift.protocol.TProtocol prot, createGroupResourceProfile_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; - java.util.BitSet incoming = iprot.readBitSet(1); + java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { + struct.success = iprot.readString(); + struct.setSuccessIsSet(true); + } + if (incoming.get(1)) { struct.rse = new org.apache.airavata.registry.api.exception.RegistryServiceException(); struct.rse.read(iprot); struct.setRseIsSet(true); @@ -190604,15 +190716,18 @@ public void read(org.apache.thrift.protocol.TProtocol prot, removeGroupResourceP private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getGroupResourceList_args"); private static final org.apache.thrift.protocol.TField GATEWAY_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("gatewayId", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField ACCESSIBLE_GROUP_RES_PROFILE_IDS_FIELD_DESC = new org.apache.thrift.protocol.TField("accessibleGroupResProfileIds", org.apache.thrift.protocol.TType.LIST, (short)2); private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new getGroupResourceList_argsStandardSchemeFactory(); private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new getGroupResourceList_argsTupleSchemeFactory(); public java.lang.String gatewayId; // required + public java.util.List<java.lang.String> accessibleGroupResProfileIds; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - GATEWAY_ID((short)1, "gatewayId"); + GATEWAY_ID((short)1, "gatewayId"), + ACCESSIBLE_GROUP_RES_PROFILE_IDS((short)2, "accessibleGroupResProfileIds"); private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>(); @@ -190629,6 +190744,8 @@ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // GATEWAY_ID return GATEWAY_ID; + case 2: // ACCESSIBLE_GROUP_RES_PROFILE_IDS + return ACCESSIBLE_GROUP_RES_PROFILE_IDS; default: return null; } @@ -190674,6 +190791,9 @@ public short getThriftFieldId() { java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.GATEWAY_ID, new org.apache.thrift.meta_data.FieldMetaData("gatewayId", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.ACCESSIBLE_GROUP_RES_PROFILE_IDS, new org.apache.thrift.meta_data.FieldMetaData("accessibleGroupResProfileIds", org.apache.thrift.TFieldRequirementType.REQUIRED, + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); metaDataMap = java.util.Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getGroupResourceList_args.class, metaDataMap); } @@ -190682,10 +190802,12 @@ public getGroupResourceList_args() { } public getGroupResourceList_args( - java.lang.String gatewayId) + java.lang.String gatewayId, + java.util.List<java.lang.String> accessibleGroupResProfileIds) { this(); this.gatewayId = gatewayId; + this.accessibleGroupResProfileIds = accessibleGroupResProfileIds; } /** @@ -190695,6 +190817,10 @@ public getGroupResourceList_args(getGroupResourceList_args other) { if (other.isSetGatewayId()) { this.gatewayId = other.gatewayId; } + if (other.isSetAccessibleGroupResProfileIds()) { + java.util.List<java.lang.String> __this__accessibleGroupResProfileIds = new java.util.ArrayList<java.lang.String>(other.accessibleGroupResProfileIds); + this.accessibleGroupResProfileIds = __this__accessibleGroupResProfileIds; + } } public getGroupResourceList_args deepCopy() { @@ -190704,6 +190830,7 @@ public getGroupResourceList_args deepCopy() { @Override public void clear() { this.gatewayId = null; + this.accessibleGroupResProfileIds = null; } public java.lang.String getGatewayId() { @@ -190730,6 +190857,45 @@ public void setGatewayIdIsSet(boolean value) { } } + public int getAccessibleGroupResProfileIdsSize() { + return (this.accessibleGroupResProfileIds == null) ? 0 : this.accessibleGroupResProfileIds.size(); + } + + public java.util.Iterator<java.lang.String> getAccessibleGroupResProfileIdsIterator() { + return (this.accessibleGroupResProfileIds == null) ? null : this.accessibleGroupResProfileIds.iterator(); + } + + public void addToAccessibleGroupResProfileIds(java.lang.String elem) { + if (this.accessibleGroupResProfileIds == null) { + this.accessibleGroupResProfileIds = new java.util.ArrayList<java.lang.String>(); + } + this.accessibleGroupResProfileIds.add(elem); + } + + public java.util.List<java.lang.String> getAccessibleGroupResProfileIds() { + return this.accessibleGroupResProfileIds; + } + + public getGroupResourceList_args setAccessibleGroupResProfileIds(java.util.List<java.lang.String> accessibleGroupResProfileIds) { + this.accessibleGroupResProfileIds = accessibleGroupResProfileIds; + return this; + } + + public void unsetAccessibleGroupResProfileIds() { + this.accessibleGroupResProfileIds = null; + } + + /** Returns true if field accessibleGroupResProfileIds is set (has been assigned a value) and false otherwise */ + public boolean isSetAccessibleGroupResProfileIds() { + return this.accessibleGroupResProfileIds != null; + } + + public void setAccessibleGroupResProfileIdsIsSet(boolean value) { + if (!value) { + this.accessibleGroupResProfileIds = null; + } + } + public void setFieldValue(_Fields field, java.lang.Object value) { switch (field) { case GATEWAY_ID: @@ -190740,6 +190906,14 @@ public void setFieldValue(_Fields field, java.lang.Object value) { } break; + case ACCESSIBLE_GROUP_RES_PROFILE_IDS: + if (value == null) { + unsetAccessibleGroupResProfileIds(); + } else { + setAccessibleGroupResProfileIds((java.util.List<java.lang.String>)value); + } + break; + } } @@ -190748,6 +190922,9 @@ public void setFieldValue(_Fields field, java.lang.Object value) { case GATEWAY_ID: return getGatewayId(); + case ACCESSIBLE_GROUP_RES_PROFILE_IDS: + return getAccessibleGroupResProfileIds(); + } throw new java.lang.IllegalStateException(); } @@ -190761,6 +190938,8 @@ public boolean isSet(_Fields field) { switch (field) { case GATEWAY_ID: return isSetGatewayId(); + case ACCESSIBLE_GROUP_RES_PROFILE_IDS: + return isSetAccessibleGroupResProfileIds(); } throw new java.lang.IllegalStateException(); } @@ -190789,6 +190968,15 @@ public boolean equals(getGroupResourceList_args that) { return false; } + boolean this_present_accessibleGroupResProfileIds = true && this.isSetAccessibleGroupResProfileIds(); + boolean that_present_accessibleGroupResProfileIds = true && that.isSetAccessibleGroupResProfileIds(); + if (this_present_accessibleGroupResProfileIds || that_present_accessibleGroupResProfileIds) { + if (!(this_present_accessibleGroupResProfileIds && that_present_accessibleGroupResProfileIds)) + return false; + if (!this.accessibleGroupResProfileIds.equals(that.accessibleGroupResProfileIds)) + return false; + } + return true; } @@ -190800,6 +190988,10 @@ public int hashCode() { if (isSetGatewayId()) hashCode = hashCode * 8191 + gatewayId.hashCode(); + hashCode = hashCode * 8191 + ((isSetAccessibleGroupResProfileIds()) ? 131071 : 524287); + if (isSetAccessibleGroupResProfileIds()) + hashCode = hashCode * 8191 + accessibleGroupResProfileIds.hashCode(); + return hashCode; } @@ -190821,6 +191013,16 @@ public int compareTo(getGroupResourceList_args other) { return lastComparison; } } + lastComparison = java.lang.Boolean.valueOf(isSetAccessibleGroupResProfileIds()).compareTo(other.isSetAccessibleGroupResProfileIds()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetAccessibleGroupResProfileIds()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.accessibleGroupResProfileIds, other.accessibleGroupResProfileIds); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -190848,6 +191050,14 @@ public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache. sb.append(this.gatewayId); } first = false; + if (!first) sb.append(", "); + sb.append("accessibleGroupResProfileIds:"); + if (this.accessibleGroupResProfileIds == null) { + sb.append("null"); + } else { + sb.append(this.accessibleGroupResProfileIds); + } + first = false; sb.append(")"); return sb.toString(); } @@ -190857,6 +191067,9 @@ public void validate() throws org.apache.thrift.TException { if (gatewayId == null) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'gatewayId' was not present! Struct: " + toString()); } + if (accessibleGroupResProfileIds == null) { + throw new org.apache.thrift.protocol.TProtocolException("Required field 'accessibleGroupResProfileIds' was not present! Struct: " + toString()); + } // check for sub-struct validity } @@ -190902,6 +191115,24 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getGroupResourceLis org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 2: // ACCESSIBLE_GROUP_RES_PROFILE_IDS + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list418 = iprot.readListBegin(); + struct.accessibleGroupResProfileIds = new java.util.ArrayList<java.lang.String>(_list418.size); + java.lang.String _elem419; + for (int _i420 = 0; _i420 < _list418.size; ++_i420) + { + _elem419 = iprot.readString(); + struct.accessibleGroupResProfileIds.add(_elem419); + } + iprot.readListEnd(); + } + struct.setAccessibleGroupResProfileIdsIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -190922,6 +191153,18 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getGroupResourceLi oprot.writeString(struct.gatewayId); oprot.writeFieldEnd(); } + if (struct.accessibleGroupResProfileIds != null) { + oprot.writeFieldBegin(ACCESSIBLE_GROUP_RES_PROFILE_IDS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.accessibleGroupResProfileIds.size())); + for (java.lang.String _iter421 : struct.accessibleGroupResProfileIds) + { + oprot.writeString(_iter421); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -190940,6 +191183,13 @@ public getGroupResourceList_argsTupleScheme getScheme() { public void write(org.apache.thrift.protocol.TProtocol prot, getGroupResourceList_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot; oprot.writeString(struct.gatewayId); + { + oprot.writeI32(struct.accessibleGroupResProfileIds.size()); + for (java.lang.String _iter422 : struct.accessibleGroupResProfileIds) + { + oprot.writeString(_iter422); + } + } } @Override @@ -190947,6 +191197,17 @@ public void read(org.apache.thrift.protocol.TProtocol prot, getGroupResourceList org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot; struct.gatewayId = iprot.readString(); struct.setGatewayIdIsSet(true); + { + org.apache.thrift.protocol.TList _list423 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.accessibleGroupResProfileIds = new java.util.ArrayList<java.lang.String>(_list423.size); + java.lang.String _elem424; + for (int _i425 = 0; _i425 < _list423.size; ++_i425) + { + _elem424 = iprot.readString(); + struct.accessibleGroupResProfileIds.add(_elem424); + } + } + struct.setAccessibleGroupResProfileIdsIsSet(true); } } @@ -191350,14 +191611,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getGroupResourceLis case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list418 = iprot.readListBegin(); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>(_list418.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _elem419; - for (int _i420 = 0; _i420 < _list418.size; ++_i420) + org.apache.thrift.protocol.TList _list426 = iprot.readListBegin(); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>(_list426.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _elem427; + for (int _i428 = 0; _i428 < _list426.size; ++_i428) { - _elem419 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile(); - _elem419.read(iprot); - struct.success.add(_elem419); + _elem427 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile(); + _elem427.read(iprot); + struct.success.add(_elem427); } iprot.readListEnd(); } @@ -191394,9 +191655,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getGroupResourceLi oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _iter421 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _iter429 : struct.success) { - _iter421.write(oprot); + _iter429.write(oprot); } oprot.writeListEnd(); } @@ -191435,9 +191696,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, getGroupResourceLis if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _iter422 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _iter430 : struct.success) { - _iter422.write(oprot); + _iter430.write(oprot); } } } @@ -191452,14 +191713,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, getGroupResourceList java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list423 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>(_list423.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _elem424; - for (int _i425 = 0; _i425 < _list423.size; ++_i425) + org.apache.thrift.protocol.TList _list431 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>(_list431.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile _elem432; + for (int _i433 = 0; _i433 < _list431.size; ++_i433) { - _elem424 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile(); - _elem424.read(iprot); - struct.success.add(_elem424); + _elem432 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile(); + _elem432.read(iprot); + struct.success.add(_elem432); } } struct.setSuccessIsSet(true); @@ -197374,14 +197635,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getGroupComputeReso case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list426 = iprot.readListBegin(); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference>(_list426.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _elem427; - for (int _i428 = 0; _i428 < _list426.size; ++_i428) + org.apache.thrift.protocol.TList _list434 = iprot.readListBegin(); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference>(_list434.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _elem435; + for (int _i436 = 0; _i436 < _list434.size; ++_i436) { - _elem427 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference(); - _elem427.read(iprot); - struct.success.add(_elem427); + _elem435 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference(); + _elem435.read(iprot); + struct.success.add(_elem435); } iprot.readListEnd(); } @@ -197418,9 +197679,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getGroupComputeRes oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _iter429 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _iter437 : struct.success) { - _iter429.write(oprot); + _iter437.write(oprot); } oprot.writeListEnd(); } @@ -197459,9 +197720,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, getGroupComputeReso if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _iter430 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _iter438 : struct.success) { - _iter430.write(oprot); + _iter438.write(oprot); } } } @@ -197476,14 +197737,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, getGroupComputeResou java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list431 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference>(_list431.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _elem432; - for (int _i433 = 0; _i433 < _list431.size; ++_i433) + org.apache.thrift.protocol.TList _list439 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference>(_list439.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference _elem440; + for (int _i441 = 0; _i441 < _list439.size; ++_i441) { - _elem432 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference(); - _elem432.read(iprot); - struct.success.add(_elem432); + _elem440 = new org.apache.airavata.model.appcatalog.groupresourceprofile.GroupComputeResourcePreference(); + _elem440.read(iprot); + struct.success.add(_elem440); } } struct.setSuccessIsSet(true); @@ -198251,14 +198512,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getGroupBatchQueueR case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list434 = iprot.readListBegin(); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy>(_list434.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _elem435; - for (int _i436 = 0; _i436 < _list434.size; ++_i436) + org.apache.thrift.protocol.TList _list442 = iprot.readListBegin(); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy>(_list442.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _elem443; + for (int _i444 = 0; _i444 < _list442.size; ++_i444) { - _elem435 = new org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy(); - _elem435.read(iprot); - struct.success.add(_elem435); + _elem443 = new org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy(); + _elem443.read(iprot); + struct.success.add(_elem443); } iprot.readListEnd(); } @@ -198295,9 +198556,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getGroupBatchQueue oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _iter437 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _iter445 : struct.success) { - _iter437.write(oprot); + _iter445.write(oprot); } oprot.writeListEnd(); } @@ -198336,9 +198597,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, getGroupBatchQueueR if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _iter438 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _iter446 : struct.success) { - _iter438.write(oprot); + _iter446.write(oprot); } } } @@ -198353,14 +198614,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, getGroupBatchQueueRe java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list439 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy>(_list439.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _elem440; - for (int _i441 = 0; _i441 < _list439.size; ++_i441) + org.apache.thrift.protocol.TList _list447 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy>(_list447.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy _elem448; + for (int _i449 = 0; _i449 < _list447.size; ++_i449) { - _elem440 = new org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy(); - _elem440.read(iprot); - struct.success.add(_elem440); + _elem448 = new org.apache.airavata.model.appcatalog.groupresourceprofile.BatchQueueResourcePolicy(); + _elem448.read(iprot); + struct.success.add(_elem448); } } struct.setSuccessIsSet(true); @@ -199128,14 +199389,14 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, getGroupComputeReso case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list442 = iprot.readListBegin(); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy>(_list442.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _elem443; - for (int _i444 = 0; _i444 < _list442.size; ++_i444) + org.apache.thrift.protocol.TList _list450 = iprot.readListBegin(); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy>(_list450.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _elem451; + for (int _i452 = 0; _i452 < _list450.size; ++_i452) { - _elem443 = new org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy(); - _elem443.read(iprot); - struct.success.add(_elem443); + _elem451 = new org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy(); + _elem451.read(iprot); + struct.success.add(_elem451); } iprot.readListEnd(); } @@ -199172,9 +199433,9 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, getGroupComputeRes oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _iter445 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _iter453 : struct.success) { - _iter445.write(oprot); + _iter453.write(oprot); } oprot.writeListEnd(); } @@ -199213,9 +199474,9 @@ public void write(org.apache.thrift.protocol.TProtocol prot, getGroupComputeReso if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _iter446 : struct.success) + for (org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _iter454 : struct.success) { - _iter446.write(oprot); + _iter454.write(oprot); } } } @@ -199230,14 +199491,14 @@ public void read(org.apache.thrift.protocol.TProtocol prot, getGroupComputeResou java.util.BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list447 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy>(_list447.size); - org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _elem448; - for (int _i449 = 0; _i449 < _list447.size; ++_i449) + org.apache.thrift.protocol.TList _list455 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new java.util.ArrayList<org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy>(_list455.size); + org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy _elem456; + for (int _i457 = 0; _i457 < _list455.size; ++_i457) { - _elem448 = new org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy(); - _elem448.read(iprot); - struct.success.add(_elem448); + _elem456 = new org.apache.airavata.model.appcatalog.groupresourceprofile.ComputeResourcePolicy(); + _elem456.read(iprot); + struct.success.add(_elem456); } } struct.setSuccessIsSet(true); diff --git a/thrift-interface-descriptions/component-cpis/registry-api.thrift b/thrift-interface-descriptions/component-cpis/registry-api.thrift index d9c7d1871f..a9aa926476 100644 --- a/thrift-interface-descriptions/component-cpis/registry-api.thrift +++ b/thrift-interface-descriptions/component-cpis/registry-api.thrift @@ -2571,7 +2571,7 @@ service RegistryService { * Group Resource Profile API methods * */ - void createGroupResourceProfile(1: required group_resource_profile_model.GroupResourceProfile groupResourceProfile) + string createGroupResourceProfile(1: required group_resource_profile_model.GroupResourceProfile groupResourceProfile) throws (1: registry_api_errors.RegistryServiceException rse) void updateGroupResourceProfile(1: required group_resource_profile_model.GroupResourceProfile groupResourceProfile) @@ -2583,7 +2583,7 @@ service RegistryService { bool removeGroupResourceProfile(1: required string groupResourceProfileId) throws (1: registry_api_errors.RegistryServiceException rse) - list<group_resource_profile_model.GroupResourceProfile> getGroupResourceList(1: required string gatewayId) + list<group_resource_profile_model.GroupResourceProfile> getGroupResourceList(1: required string gatewayId, 2: required list<string> accessibleGroupResProfileIds) throws (1: registry_api_errors.RegistryServiceException rse) bool removeGroupComputePrefs(1: required string computeResourceId, 2: required string groupResourceProfileId) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Update GroupResourceProfile methods in API server to use sharing API to > enforce READ and WRITE rules > ---------------------------------------------------------------------------------------------------- > > Key: AIRAVATA-2697 > URL: https://issues.apache.org/jira/browse/AIRAVATA-2697 > Project: Airavata > Issue Type: Bug > Reporter: Marcus Christie > Assignee: Sachin Kariyattin > Priority: Major > -- This message was sent by Atlassian JIRA (v7.6.3#76005)