airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [5/8] airavata git commit: AIRAVATA-2500 Add 'validated' flag to UserComputeResourcePreference
Date Mon, 25 Sep 2017 21:10:45 GMT
AIRAVATA-2500 Add 'validated' flag to UserComputeResourcePreference


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

Branch: refs/heads/AIRAVATA-2500
Commit: 20fc3fdbbd7928c63c0ee6abf1382d9970bbef67
Parents: 596eb5b
Author: Marcus Christie <machristie@apache.org>
Authored: Mon Sep 25 09:24:01 2017 -0400
Committer: Marcus Christie <machristie@apache.org>
Committed: Mon Sep 25 09:57:28 2017 -0400

----------------------------------------------------------------------
 .../accountprovisioning/SSHAccountManager.java  |  1 +
 .../catalog/impl/UsrResourceProfileImpl.java    |  2 ++
 .../model/UserComputeResourcePreference.java    | 10 ++++++
 .../UserComputeHostPreferenceResource.java      | 11 ++++++
 .../app/catalog/util/AppCatalogJPAUtils.java    |  1 +
 .../util/AppCatalogThriftConversion.java        |  1 +
 .../src/main/resources/appcatalog-derby.sql     | 38 +++++++++++++++++++-
 .../src/main/resources/appcatalog-mysql.sql     | 38 ++++++++++++++++++++
 .../DeltaScripts/appCatalog_schema_delta.sql    |  2 ++
 .../user_resource_profile_model.thrift          |  8 ++++-
 10 files changed, 110 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java
----------------------------------------------------------------------
diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java
b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java
index e7e9052..136bbee 100644
--- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java
+++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java
@@ -180,6 +180,7 @@ public class SSHAccountManager {
         userComputeResourcePreference.setComputeResourceId(computeResourceId);
         userComputeResourcePreference.setLoginUserName(username);
         userComputeResourcePreference.setScratchLocation(scratchLocation);
+        userComputeResourcePreference.setValidated(true);
         return userComputeResourcePreference;
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java
index b7a95f8..a7366ca 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java
@@ -83,6 +83,7 @@ public class UsrResourceProfileImpl implements UsrResourceProfile {
                     if (preference.getReservationEndTime() > 0) {
                         resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime()));
                     }
+                    resource.setValidated(preference.isValidated());
                     resource.save();
                 }
             }
@@ -142,6 +143,7 @@ public class UsrResourceProfileImpl implements UsrResourceProfile {
                     if (preference.getReservationEndTime() > 0) {
                         resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime()));
                     }
+                    resource.setValidated(preference.isValidated());
                     resource.save();
                 }
             }

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java
index e86248f..81ef75a 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java
@@ -54,6 +54,8 @@ public class UserComputeResourcePreference {
     private Timestamp reservationStartTime;
     @Column(name = "RESERVATION_END_TIME")
     private Timestamp reservationEndTime;
+    @Column(name = "VALIDATED")
+    private boolean validated;
 
 
     @ManyToOne(cascade= CascadeType.MERGE)
@@ -184,4 +186,12 @@ public class UserComputeResourcePreference {
     public void setReservationEndTime(Timestamp reservationEndTime) {
         this.reservationEndTime = reservationEndTime;
     }
+
+    public boolean isValidated() {
+        return validated;
+    }
+
+    public void setValidated(boolean validated) {
+        this.validated = validated;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserComputeHostPreferenceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserComputeHostPreferenceResource.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserComputeHostPreferenceResource.java
index 3f215c2..9c8cbf0 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserComputeHostPreferenceResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/UserComputeHostPreferenceResource.java
@@ -49,6 +49,7 @@ public class UserComputeHostPreferenceResource extends AppCatAbstractResource
{
     private String reservation;
     private Timestamp reservationStartTime;
     private Timestamp reservationEndTime;
+    private boolean validated = false;
 
     private UserResourceProfileResource userResourceProfileResource;
     private ComputeResourceResource computeHostResource;
@@ -166,6 +167,14 @@ public class UserComputeHostPreferenceResource extends AppCatAbstractResource
{
         this.reservationEndTime = reservationEndTime;
     }
 
+    public boolean isValidated() {
+        return validated;
+    }
+
+    public void setValidated(boolean validated) {
+        this.validated = validated;
+    }
+
     @Override
     public void remove(Object identifier) throws AppCatalogException {
         CompositeIdentifier ids;
@@ -378,6 +387,7 @@ public class UserComputeHostPreferenceResource extends AppCatAbstractResource
{
                 existingPreference.setReservation(reservation);
                 existingPreference.setReservationStartTime(reservationStartTime);
                 existingPreference.setReservationEndTime(reservationEndTime);
+                existingPreference.setValidated(validated);
                 em.merge(existingPreference);
             } else {
                 UserComputeResourcePreference resourcePreference = new UserComputeResourcePreference();
@@ -394,6 +404,7 @@ public class UserComputeHostPreferenceResource extends AppCatAbstractResource
{
                 resourcePreference.setReservation(reservation);
                 resourcePreference.setReservationStartTime(reservationStartTime);
                 resourcePreference.setReservationEndTime(reservationEndTime);
+                resourcePreference.setValidated(validated);
                 em.persist(resourcePreference);
             }
             em.getTransaction().commit();

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
index c41e8a2..2efd419 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogJPAUtils.java
@@ -987,6 +987,7 @@ public class AppCatalogJPAUtils {
             resource.setReservation(o.getReservation());
             resource.setReservationStartTime(o.getReservationStartTime());
             resource.setReservationEndTime(o.getReservationEndTime());
+            resource.setValidated(o.isValidated());
         }
         return resource;
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
index 09258a2..944ad77 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/util/AppCatalogThriftConversion.java
@@ -901,6 +901,7 @@ public class AppCatalogThriftConversion {
         if (resource.getReservationEndTime() != null) {
             preference.setReservationEndTime(resource.getReservationEndTime().getTime());
         }
+        preference.setValidated(resource.isValidated());
         return preference;
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
index c57549e..db9e261 100644
--- a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
@@ -532,7 +532,43 @@ CREATE TABLE WORKFLOW_OUTPUT
          FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
 );
 
-
+CREATE TABLE USER_RESOURCE_PROFILE (
+  USER_ID varchar(255) NOT NULL,
+  CREATION_TIME TIMESTAMP DEFAULT NULL,
+  CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_PWD_CRED_TOKEN varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_TENANT varchar(255) DEFAULT NULL,
+  UPDATE_TIME TIMESTAMP DEFAULT NULL,
+  PRIMARY KEY (USER_ID,GATEWAY_ID)
+);
+
+CREATE TABLE USER_STORAGE_PREFERENCE (
+  STORAGE_RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  FS_ROOT_LOCATION varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  PRIMARY KEY (STORAGE_RESOURCE_ID,USER_ID,GATEWAY_ID)
+);
+
+CREATE TABLE USER_COMPUTE_RESOURCE_PREFERENCE (
+  RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  PREFERED_BATCH_QUEUE varchar(255) DEFAULT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  ALLOCATION_PROJECT_NUMBER varchar(255) DEFAULT NULL,
+  QUALITY_OF_SERVICE varchar(255) DEFAULT NULL,
+  RESERVATION varchar(255) DEFAULT NULL,
+  RESERVATION_END_TIME TIMESTAMP DEFAULT NULL,
+  RESERVATION_START_TIME TIMESTAMP DEFAULT NULL,
+  SCRATCH_LOCATION varchar(255) DEFAULT NULL,
+  VALIDATED SMALLINT NOT NULL DEFAULT 0,
+  PRIMARY KEY (RESOURCE_ID,USER_ID,GATEWAY_ID)
+);
 
 CREATE TABLE CONFIGURATION
 (

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
index 6c07499..3664a63 100644
--- a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
@@ -530,6 +530,44 @@ CREATE TABLE WORKFLOW_OUTPUT
          FOREIGN KEY (WF_TEMPLATE_ID) REFERENCES WORKFLOW(WF_TEMPLATE_ID) ON DELETE CASCADE
 );
 
+CREATE TABLE USER_RESOURCE_PROFILE (
+  USER_ID varchar(255) NOT NULL,
+  CREATION_TIME datetime DEFAULT NULL,
+  CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_PWD_CRED_TOKEN varchar(255) DEFAULT NULL,
+  IDENTITY_SERVER_TENANT varchar(255) DEFAULT NULL,
+  UPDATE_TIME datetime DEFAULT NULL,
+  PRIMARY KEY (USER_ID,GATEWAY_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE USER_STORAGE_PREFERENCE (
+  STORAGE_RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  FS_ROOT_LOCATION varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  PRIMARY KEY (STORAGE_RESOURCE_ID,USER_ID,GATEWAY_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE USER_COMPUTE_RESOURCE_PREFERENCE (
+  RESOURCE_ID varchar(255) NOT NULL,
+  USER_ID varchar(255) NOT NULL,
+  PREFERED_BATCH_QUEUE varchar(255) DEFAULT NULL,
+  RESOURCE_CS_TOKEN varchar(255) DEFAULT NULL,
+  GATEWAY_ID varchar(255) DEFAULT NULL,
+  LOGIN_USERNAME varchar(255) DEFAULT NULL,
+  ALLOCATION_PROJECT_NUMBER varchar(255) DEFAULT NULL,
+  QUALITY_OF_SERVICE varchar(255) DEFAULT NULL,
+  RESERVATION varchar(255) DEFAULT NULL,
+  RESERVATION_END_TIME datetime DEFAULT NULL,
+  RESERVATION_START_TIME datetime DEFAULT NULL,
+  SCRATCH_LOCATION varchar(255) NOT NULL DEFAULT NULL,
+  VALIDATED TINYINT(1) DEFAULT 0,
+  PRIMARY KEY (RESOURCE_ID,USER_ID,GATEWAY_ID)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
 CREATE TABLE CONFIGURATION
 (
           CONFIG_KEY VARCHAR(255),

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql
----------------------------------------------------------------------
diff --git a/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql
b/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql
index 36fc66b..04241e2 100644
--- a/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql
+++ b/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql
@@ -30,3 +30,5 @@ CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG
         PRIMARY KEY (GATEWAY_ID, RESOURCE_ID, CONFIG_NAME),
         FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID,
RESOURCE_ID) ON DELETE CASCADE
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+alter table USER_COMPUTE_RESOURCE_PREFERENCE add VALIDATED tinyint(1) NOT NULL DEFAULT 0;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/thrift-interface-descriptions/data-models/resource-catalog-models/user_resource_profile_model.thrift
----------------------------------------------------------------------
diff --git a/thrift-interface-descriptions/data-models/resource-catalog-models/user_resource_profile_model.thrift
b/thrift-interface-descriptions/data-models/resource-catalog-models/user_resource_profile_model.thrift
index 3dcb53b..6bac85d 100644
--- a/thrift-interface-descriptions/data-models/resource-catalog-models/user_resource_profile_model.thrift
+++ b/thrift-interface-descriptions/data-models/resource-catalog-models/user_resource_profile_model.thrift
@@ -53,6 +53,11 @@ include "../user-tenant-group-models/user_profile_model.thrift"
  *  Resource specific credential store token. If this token is specified, then it is superceeded
by the gateway's
  *   default credential store.
  *
+ * validated:
+ *  If true the the configuration has been validated in the sense that the username and credential
can be used to
+ *  login to the remote host and the scratchLocation is a valid location that the user has
permission to write to.
+ *  Should be treated as read-only and only mutated by Airavata middleware.
+ *
 */
 struct UserComputeResourcePreference {
     1: required string computeResourceId,
@@ -64,7 +69,8 @@ struct UserComputeResourcePreference {
     7: optional string qualityOfService,
     8: optional string reservation,
     9: optional i64 reservationStartTime,
-    10: optional i64 reservationEndTime
+    10: optional i64 reservationEndTime,
+    11: optional bool validated = false
 }
 
 struct UserStoragePreference {


Mime
View raw message