You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2016/02/24 16:19:26 UTC

airavata git commit: adding gateway reporting to app catalog

Repository: airavata
Updated Branches:
  refs/heads/develop 03cd77a48 -> 3ac76fefc


adding gateway reporting to app catalog


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

Branch: refs/heads/develop
Commit: 3ac76fefce6d1fa54f9e647f072263992a0c2580
Parents: 03cd77a
Author: Chathuri Wimalasena <ch...@apache.org>
Authored: Wed Feb 24 10:22:13 2016 -0500
Committer: Chathuri Wimalasena <ch...@apache.org>
Committed: Wed Feb 24 10:22:13 2016 -0500

----------------------------------------------------------------------
 .../catalog/impl/GwyResourceProfileImpl.java    |  2 ++
 .../core/app/catalog/model/ComputeResource.java | 33 ++++++++++++++++++++
 .../core/app/catalog/model/GatewayProfile.java  | 11 +++++++
 .../resources/ComputeResourceResource.java      | 30 ++++++++++++++++++
 .../resources/GatewayProfileResource.java       | 11 +++++++
 .../app/catalog/util/AppCatalogJPAUtils.java    |  4 +++
 .../util/AppCatalogThriftConversion.java        |  7 +++++
 .../src/main/resources/appcatalog-derby.sql     |  4 +++
 .../src/main/resources/appcatalog-mysql.sql     |  4 +++
 9 files changed, 106 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
index 1f857ef..d6a708d 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java
@@ -49,6 +49,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
             if (gatewayProfile.getCredentialStoreToken()!= null){
                 profileResource.setCredentialStoreToken(gatewayProfile.getCredentialStoreToken());
             }
+            profileResource.setUsageReportingGWId(gatewayProfile.getUsageReportingGatewayId());
 //            profileResource.setGatewayID(gatewayProfile.getGatewayID());
             profileResource.save();
             List<ComputeResourcePreference> computeResourcePreferences = gatewayProfile.getComputeResourcePreferences();
@@ -103,6 +104,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile {
             GatewayProfileResource profileResource = new GatewayProfileResource();
             GatewayProfileResource existingGP = (GatewayProfileResource)profileResource.get(gatewayId);
             existingGP.setCredentialStoreToken(updatedProfile.getCredentialStoreToken());
+            existingGP.setUsageReportingGWId(updatedProfile.getUsageReportingGatewayId());
             existingGP.save();
 
             List<ComputeResourcePreference> computeResourcePreferences = updatedProfile.getComputeResourcePreferences();

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
index 4396f68..7ad7df7 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResource.java
@@ -54,6 +54,15 @@ public class ComputeResource implements Serializable {
     @Column(name = "ENABLED")
     private boolean enabled;
 
+    @Column(name = "GATEWAY_USAGE_REPORTING")
+    private boolean gatewayUsageReporting;
+
+    @Column(name = "GATEWAY_USAGE_MODULE_LOAD_CMD")
+    private String gatewayUsageModLoadCMD;
+
+    @Column(name = "GATEWAY_USAGE_EXECUTABLE")
+    private String gatewayUsageExec;
+
     public Timestamp getCreationTime() {
         return creationTime;
     }
@@ -109,4 +118,28 @@ public class ComputeResource implements Serializable {
     public void setMaxMemoryPerNode(int maxMemoryPerNode) {
         this.maxMemoryPerNode = maxMemoryPerNode;
     }
+
+    public boolean isGatewayUsageReporting() {
+        return gatewayUsageReporting;
+    }
+
+    public void setGatewayUsageReporting(boolean gatewayUsageReporting) {
+        this.gatewayUsageReporting = gatewayUsageReporting;
+    }
+
+    public String getGatewayUsageModLoadCMD() {
+        return gatewayUsageModLoadCMD;
+    }
+
+    public void setGatewayUsageModLoadCMD(String gatewayUsageModLoadCMD) {
+        this.gatewayUsageModLoadCMD = gatewayUsageModLoadCMD;
+    }
+
+    public String getGatewayUsageExec() {
+        return gatewayUsageExec;
+    }
+
+    public void setGatewayUsageExec(String gatewayUsageExec) {
+        this.gatewayUsageExec = gatewayUsageExec;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
index 70d508e..2d4b455 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/GatewayProfile.java
@@ -43,6 +43,9 @@ public class GatewayProfile implements Serializable {
     @Column(name = "CS_TOKEN")
     private String credentialStoreToken;
 
+    @Column(name = "USAGE_REPORTING_GATEWAY_ID")
+    private String usageReportingGWId;
+
     public Timestamp getCreationTime() {
         return creationTime;
     }
@@ -75,4 +78,12 @@ public class GatewayProfile implements Serializable {
     public void setCredentialStoreToken(String credentialStoreToken) {
         this.credentialStoreToken = credentialStoreToken;
     }
+
+    public String getUsageReportingGWId() {
+        return usageReportingGWId;
+    }
+
+    public void setUsageReportingGWId(String usageReportingGWId) {
+        this.usageReportingGWId = usageReportingGWId;
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
index 09fcdec..bf76ec0 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/ComputeResourceResource.java
@@ -46,6 +46,9 @@ public class ComputeResourceResource extends AppCatAbstractResource {
     private Timestamp updatedTime;
     private int maxMemoryPerNode;
     private boolean enabled;
+    private boolean gatewayUsageReporting;
+    private String gatewayUsageModLoadCMD;
+    private String gatewayUsageExec;
 
     public int getMaxMemoryPerNode() {
         return maxMemoryPerNode;
@@ -338,6 +341,9 @@ public class ComputeResourceResource extends AppCatAbstractResource {
 			computeResource.setHostName(getHostName());
             computeResource.setEnabled(isEnabled());
             computeResource.setMaxMemoryPerNode(getMaxMemoryPerNode());
+            computeResource.setGatewayUsageReporting(gatewayUsageReporting);
+            computeResource.setGatewayUsageModLoadCMD(gatewayUsageModLoadCMD);
+            computeResource.setGatewayUsageExec(gatewayUsageExec);
 			if (existingComputeResource == null) {
 				em.persist(computeResource);
 			} else {
@@ -412,4 +418,28 @@ public class ComputeResourceResource extends AppCatAbstractResource {
 	public void setHostName(String hostName) {
 		this.hostName=hostName;
 	}
+
+    public boolean isGatewayUsageReporting() {
+        return gatewayUsageReporting;
+    }
+
+    public void setGatewayUsageReporting(boolean gatewayUsageReporting) {
+        this.gatewayUsageReporting = gatewayUsageReporting;
+    }
+
+    public String getGatewayUsageModLoadCMD() {
+        return gatewayUsageModLoadCMD;
+    }
+
+    public void setGatewayUsageModLoadCMD(String gatewayUsageModLoadCMD) {
+        this.gatewayUsageModLoadCMD = gatewayUsageModLoadCMD;
+    }
+
+    public String getGatewayUsageExec() {
+        return gatewayUsageExec;
+    }
+
+    public void setGatewayUsageExec(String gatewayUsageExec) {
+        this.gatewayUsageExec = gatewayUsageExec;
+    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
----------------------------------------------------------------------
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
index 6a2ac8b..21f66d5 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/resources/GatewayProfileResource.java
@@ -42,6 +42,7 @@ public class GatewayProfileResource extends AppCatAbstractResource {
     private Timestamp createdTime;
     private Timestamp updatedTime;
     private String credentialStoreToken;
+    private String usageReportingGWId;
 
     public Timestamp getCreatedTime() {
         return createdTime;
@@ -63,6 +64,14 @@ public class GatewayProfileResource extends AppCatAbstractResource {
         return credentialStoreToken;
     }
 
+    public String getUsageReportingGWId() {
+        return usageReportingGWId;
+    }
+
+    public void setUsageReportingGWId(String usageReportingGWId) {
+        this.usageReportingGWId = usageReportingGWId;
+    }
+
     public void setCredentialStoreToken(String credentialStoreToken) {
         this.credentialStoreToken = credentialStoreToken;
     }
@@ -315,6 +324,7 @@ public class GatewayProfileResource extends AppCatAbstractResource {
             em.getTransaction().begin();
             if (existingGatewayProfile != null) {
                 existingGatewayProfile.setUpdateTime(AiravataUtils.getCurrentTimestamp());
+                existingGatewayProfile.setUsageReportingGWId(getUsageReportingGWId());
                 if (credentialStoreToken != null){
                     existingGatewayProfile.setCredentialStoreToken(credentialStoreToken);
                 }
@@ -322,6 +332,7 @@ public class GatewayProfileResource extends AppCatAbstractResource {
             } else {
                 GatewayProfile gatewayProfile = new GatewayProfile();
                 gatewayProfile.setGatewayID(gatewayID);
+                gatewayProfile.setUsageReportingGWId(usageReportingGWId);
                 gatewayProfile.setCreationTime(AiravataUtils.getCurrentTimestamp());
                 if (credentialStoreToken != null){
                     gatewayProfile.setCredentialStoreToken(credentialStoreToken);

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/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 5cfca50..a754114 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
@@ -499,6 +499,9 @@ public class AppCatalogJPAUtils {
             computeResourceResource.setCreatedTime(o.getCreationTime());
             computeResourceResource.setEnabled(o.getEnabled());
             computeResourceResource.setMaxMemoryPerNode(o.getMaxMemoryPerNode());
+            computeResourceResource.setGatewayUsageExec(o.getGatewayUsageExec());
+            computeResourceResource.setGatewayUsageModLoadCMD(o.getGatewayUsageModLoadCMD());
+            computeResourceResource.setGatewayUsageReporting(o.isGatewayUsageReporting());
             if (o.getUpdateTime() != null) {
                 computeResourceResource.setUpdatedTime(o.getUpdateTime());
             }
@@ -842,6 +845,7 @@ public class AppCatalogJPAUtils {
             resource.setGatewayID(o.getGatewayID());
             resource.setCreatedTime(o.getCreationTime());
             resource.setCredentialStoreToken(o.getCredentialStoreToken());
+            resource.setUsageReportingGWId(o.getUsageReportingGWId());
             if (o.getUpdateTime() != null) {
                 resource.setUpdatedTime(o.getUpdateTime());
             }

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/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 056181f..770e29c 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
@@ -51,6 +51,9 @@ public class AppCatalogThriftConversion {
         resource.setResourceId(description.getComputeResourceId());
         resource.setMaxMemoryPerNode(description.getMaxMemoryPerNode());
         resource.setEnabled(description.isEnabled());
+        resource.setGatewayUsageReporting(description.isGatewayUsageReporting());
+        resource.setGatewayUsageExec(description.getGatewayUsageExecutable());
+        resource.setGatewayUsageModLoadCMD(description.getGatewayUsageModuleLoadCommand());
         return resource;
     }
 
@@ -70,6 +73,9 @@ public class AppCatalogThriftConversion {
         description.setResourceDescription(resource.getResourceDescription());
         description.setMaxMemoryPerNode(resource.getMaxMemoryPerNode());
         description.setEnabled(resource.isEnabled());
+        description.setGatewayUsageReporting(resource.isGatewayUsageReporting());
+        description.setGatewayUsageExecutable(resource.getGatewayUsageExec());
+        description.setGatewayUsageModuleLoadCommand(resource.getGatewayUsageModLoadCMD());
         HostAliasAppResource aliasResource = new HostAliasAppResource();
         List<AppCatalogResource> resources = aliasResource.get(AppCatAbstractResource.HostAliasConstants.RESOURCE_ID, resource.getResourceId());
         if (resources != null && !resources.isEmpty()){
@@ -851,6 +857,7 @@ public class AppCatalogThriftConversion {
         gatewayProfile.setCredentialStoreToken(gw.getCredentialStoreToken());
         gatewayProfile.setComputeResourcePreferences(preferences);
         gatewayProfile.setStoragePreferences(storagePreferences);
+        gatewayProfile.setUsageReportingGatewayId(gw.getUsageReportingGWId());
         return gatewayProfile;
     }
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/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 f1b5c7f..f08ed83 100644
--- a/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
+++ b/modules/registry/registry-core/src/main/resources/appcatalog-derby.sql
@@ -28,6 +28,9 @@ CREATE TABLE COMPUTE_RESOURCE
         UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
         MAX_MEMORY_NODE INTEGER,
         ENABLED SMALLINT,
+        GATEWAY_USAGE_REPORTING SMALLINT,
+        GATEWAY_USAGE_MODULE_LOAD_CMD VARCHAR(500),
+        GATEWAY_USAGE_EXECUTABLE VARCHAR(255),
         PRIMARY KEY (RESOURCE_ID)
 );
 
@@ -320,6 +323,7 @@ CREATE TABLE GATEWAY_PROFILE
          CREATION_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
          UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
          CS_TOKEN VARCHAR (255),
+         USAGE_REPORTING_GATEWAY_ID VARCHAR(255),
          PRIMARY KEY(GATEWAY_ID)
 );
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/3ac76fef/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 6695a81..a201897 100644
--- a/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
+++ b/modules/registry/registry-core/src/main/resources/appcatalog-mysql.sql
@@ -27,6 +27,9 @@ CREATE TABLE COMPUTE_RESOURCE
           UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',
           MAX_MEMORY_NODE INTEGER,
           ENABLED SMALLINT,
+          GATEWAY_USAGE_REPORTING SMALLINT,
+          GATEWAY_USAGE_MODULE_LOAD_CMD VARCHAR(500),
+          GATEWAY_USAGE_EXECUTABLE VARCHAR(255),
           PRIMARY KEY (RESOURCE_ID)
 );
 
@@ -318,6 +321,7 @@ CREATE TABLE GATEWAY_PROFILE
 	       CREATION_TIME TIMESTAMP DEFAULT NOW(),
          UPDATE_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00' ,
          CS_TOKEN VARCHAR (255),
+         USAGE_REPORTING_GATEWAY_ID VARCHAR(255),
          PRIMARY KEY(GATEWAY_ID)
 );