Repository: airavata Updated Branches: refs/heads/develop 8b803d7ee -> 3b80b596b
Assign UUID to gateway when creating Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3b80b596 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3b80b596 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3b80b596 Branch: refs/heads/develop Commit: 3b80b596b7bf1114e7314c03206598f9207c4496 Parents: 8b803d7 Author: Marcus Christie <[email protected]> Authored: Fri Jun 16 10:01:48 2017 -0400 Committer: Marcus Christie <[email protected]> Committed: Fri Jun 16 10:01:48 2017 -0400 ---------------------------------------------------------------------- .../service/profile/handlers/TenantProfileServiceHandler.java | 7 +++++-- .../service/profile/tenant/cpi/TenantProfileService.java | 6 ++++++ .../src/main/java/org/apache/airavata/MigrationManager.java | 3 ++- .../profile-service/profile-tenant/profile-tenant-cpi.thrift | 3 +++ 4 files changed, 16 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/3b80b596/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java index c14cbd4..dd84e0c 100644 --- a/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java +++ b/airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java @@ -40,6 +40,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; +import java.util.UUID; /** * Created by goshenoy on 3/6/17. @@ -72,6 +73,8 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface { @SecurityCheck public String addGateway(AuthzToken authzToken, Gateway gateway) throws TenantProfileServiceException, AuthorizationException, TException { try { + // Assign UUID to gateway + gateway.setAiravataInternalGatewayId(UUID.randomUUID().toString()); if (!checkDuplicateGateway(gateway)) { gateway = tenantProfileRepository.create(gateway); if (gateway != null) { @@ -84,8 +87,8 @@ public class TenantProfileServiceHandler implements TenantProfileService.Iface { DBEventManagerConstants.getRoutingKey(DBEventService.DB_EVENT.toString()) ); } - // return gatewayId - return gateway.getGatewayId(); + // return internal id + return gateway.getAiravataInternalGatewayId(); } else { throw new Exception("Gateway object is null."); } http://git-wip-us.apache.org/repos/asf/airavata/blob/3b80b596/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/tenant/cpi/TenantProfileService.java ---------------------------------------------------------------------- diff --git a/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/tenant/cpi/TenantProfileService.java b/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/tenant/cpi/TenantProfileService.java index 5823f17..a815b0b 100644 --- a/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/tenant/cpi/TenantProfileService.java +++ b/airavata-services/profile-service/profile-service-stubs/src/main/java/org/apache/airavata/service/profile/tenant/cpi/TenantProfileService.java @@ -57,6 +57,12 @@ public class TenantProfileService { public String getAPIVersion(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.service.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + /** + * Return the airavataInternalGatewayId assigned to given gateway. + * + * @param authzToken + * @param gateway + */ public String addGateway(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.workspace.Gateway gateway) throws org.apache.airavata.service.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; public boolean updateGateway(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.workspace.Gateway updatedGateway) throws org.apache.airavata.service.profile.tenant.cpi.exception.TenantProfileServiceException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; http://git-wip-us.apache.org/repos/asf/airavata/blob/3b80b596/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java ---------------------------------------------------------------------- diff --git a/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java b/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java index 524c024..5168cb9 100644 --- a/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java +++ b/modules/user-profile-migration/src/main/java/org/apache/airavata/MigrationManager.java @@ -237,7 +237,8 @@ public class MigrationManager { if (!tenantProfileServiceClient.isGatewayExist(authzToken, gatewayId)) { System.out.println("Gateway [" + gatewayId + "] doesn't exist, adding in Profile Service..."); - tenantProfileServiceClient.addGateway(authzToken, gateway); + String airavataInternalGatewayId = tenantProfileServiceClient.addGateway(authzToken, gateway); + gateway.setAiravataInternalGatewayId(airavataInternalGatewayId); } else { System.out.println("Gateway [" + gatewayId + "] already exists in Profile Service"); http://git-wip-us.apache.org/repos/asf/airavata/blob/3b80b596/thrift-interface-descriptions/service-cpis/profile-service/profile-tenant/profile-tenant-cpi.thrift ---------------------------------------------------------------------- diff --git a/thrift-interface-descriptions/service-cpis/profile-service/profile-tenant/profile-tenant-cpi.thrift b/thrift-interface-descriptions/service-cpis/profile-service/profile-tenant/profile-tenant-cpi.thrift index 99bfdc3..1589cbf 100644 --- a/thrift-interface-descriptions/service-cpis/profile-service/profile-tenant/profile-tenant-cpi.thrift +++ b/thrift-interface-descriptions/service-cpis/profile-service/profile-tenant/profile-tenant-cpi.thrift @@ -40,6 +40,9 @@ service TenantProfileService { throws (1: profile_tenant_cpi_errors.TenantProfileServiceException tpe, 2: airavata_errors.AuthorizationException ae) + /** + * Return the airavataInternalGatewayId assigned to given gateway. + */ string addGateway (1: required security_model.AuthzToken authzToken, 2: required workspace_model.Gateway gateway) throws (1: profile_tenant_cpi_errors.TenantProfileServiceException tpe,
