airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata git commit: initializing a sharing domain when creating a new gateway
Date Mon, 10 Oct 2016 15:33:15 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop a8b15d86c -> a4ed488c9


initializing a sharing domain when creating a new gateway


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/a4ed488c
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/a4ed488c
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/a4ed488c

Branch: refs/heads/develop
Commit: a4ed488c9df36da876b898cbc94a77709856fb78
Parents: a8b15d8
Author: scnakandala <supun.nakandala@gmail.com>
Authored: Mon Oct 10 11:33:09 2016 -0400
Committer: scnakandala <supun.nakandala@gmail.com>
Committed: Mon Oct 10 11:33:09 2016 -0400

----------------------------------------------------------------------
 .../server/handler/AiravataServerHandler.java   | 49 +++++++++++++++++++-
 .../server/SharingRegistryServerHandler.java    |  1 +
 2 files changed, 49 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/a4ed488c/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 0d0b8b8..61b9d83 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
@@ -77,7 +77,10 @@ import org.apache.airavata.model.workspace.Project;
 import org.apache.airavata.registry.api.RegistryService;
 import org.apache.airavata.registry.api.client.RegistryServiceClientFactory;
 import org.apache.airavata.registry.api.exception.RegistryServiceException;
+import org.apache.airavata.sharing.registry.models.Domain;
 import org.apache.airavata.sharing.registry.models.Entity;
+import org.apache.airavata.sharing.registry.models.EntityType;
+import org.apache.airavata.sharing.registry.models.PermissionType;
 import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
@@ -146,7 +149,51 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String addGateway(AuthzToken authzToken, Gateway gateway) throws InvalidRequestException,
             AiravataClientException, AiravataSystemException, AuthorizationException, TException
{
         try {
-            return getRegistryServiceClient().addGateway(gateway);
+            String gatewayId = getRegistryServiceClient().addGateway(gateway);
+            Domain domain = new Domain();
+            domain.setDomainId(gateway.getGatewayId());
+            domain.setName(gateway.getGatewayName());
+            domain.setDescription("Domain entry for " + domain.name);
+            sharingRegistryServerHandler.createDomain(domain);
+
+            //Creating Entity Types for each domain
+            EntityType entityType = new EntityType();
+            entityType.setEntityTypeId(domain.domainId+":PROJECT");
+            entityType.setDomainId(domain.domainId);
+            entityType.setName("PROJECT");
+            entityType.setDescription("Project entity type");
+            sharingRegistryServerHandler.createEntityType(entityType);
+
+            entityType = new EntityType();
+            entityType.setEntityTypeId(domain.domainId+":EXPERIMENT");
+            entityType.setDomainId(domain.domainId);
+            entityType.setName("EXPERIMENT");
+            entityType.setDescription("Experiment entity type");
+            sharingRegistryServerHandler.createEntityType(entityType);
+
+            entityType = new EntityType();
+            entityType.setEntityTypeId(domain.domainId+":FILE");
+            entityType.setDomainId(domain.domainId);
+            entityType.setName("FILE");
+            entityType.setDescription("File entity type");
+            sharingRegistryServerHandler.createEntityType(entityType);
+
+            //Creating Permission Types for each domain
+            PermissionType permissionType = new PermissionType();
+            permissionType.setPermissionTypeId(domain.domainId+":READ");
+            permissionType.setDomainId(domain.domainId);
+            permissionType.setName("READ");
+            permissionType.setDescription("Read permission type");
+            sharingRegistryServerHandler.createPermissionType(permissionType);
+
+            permissionType = new PermissionType();
+            permissionType.setPermissionTypeId(domain.domainId+":WRITE");
+            permissionType.setDomainId(domain.domainId);
+            permissionType.setName("WRITE");
+            permissionType.setDescription("Write permission type");
+            sharingRegistryServerHandler.createPermissionType(permissionType);
+
+            return gatewayId;
         } catch (ApplicationSettingsException | RegistryServiceException e) {
             logger.error("Error while adding gateway", e);
             AiravataSystemException exception = new AiravataSystemException();

http://git-wip-us.apache.org/repos/asf/airavata/blob/a4ed488c/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
index 9b299f0..2d4b576 100644
--- a/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
+++ b/modules/sharing-registry/sharing-registry-core/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServerHandler.java
@@ -22,6 +22,7 @@ package org.apache.airavata.sharing.registry.server;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.model.workspace.Gateway;
 import org.apache.airavata.sharing.registry.db.entities.GroupMembershipEntityPK;
 import org.apache.airavata.sharing.registry.db.entities.SharingEntityPK;
 import org.apache.airavata.sharing.registry.db.repositories.*;


Mime
View raw message