airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Simplified json template loading code
Date Wed, 02 Nov 2016 22:31:36 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop 6d5c632d2 -> ea5fc9bae


Simplified json template loading code


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

Branch: refs/heads/develop
Commit: ea5fc9bae5117a23f86afa0d9a27667d594fd647
Parents: 6d5c632
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Wed Nov 2 18:31:32 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Wed Nov 2 18:31:32 2016 -0400

----------------------------------------------------------------------
 .../cloud/aurora/util/AuroraThriftClientUtil.java         | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/ea5fc9ba/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/AuroraThriftClientUtil.java
----------------------------------------------------------------------
diff --git a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/AuroraThriftClientUtil.java
b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/AuroraThriftClientUtil.java
index f66c739..7cb03b4 100644
--- a/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/AuroraThriftClientUtil.java
+++ b/modules/cloud/aurora-client/src/main/java/org/apache/airavata/cloud/aurora/util/AuroraThriftClientUtil.java
@@ -19,6 +19,7 @@
  */
 package org.apache.airavata.cloud.aurora.util;
 
+import java.io.InputStream;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -43,6 +44,7 @@ import org.apache.airavata.cloud.aurora.client.sdk.Response;
 import org.apache.airavata.cloud.aurora.client.sdk.TaskConfig;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.json.JSONObject;
+import org.json.JSONTokener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -65,11 +67,9 @@ public class AuroraThriftClientUtil {
 		String exeConfigJson = null;
 		try {
 			// read the executor config json template
-			java.net.URL url = AuroraThriftClientUtil.class.getClassLoader().getResource(ServerSettings.getAuroraExecutorConfigTemplateFileName());
-	        java.nio.file.Path resPath = java.nio.file.Paths.get(url.toURI());
-	        String template = new String(java.nio.file.Files.readAllBytes(resPath), "UTF8");
-	        
-			JSONObject exeConfig = new JSONObject(template);
+			InputStream resourceAsStream = AuroraThriftClientUtil.class.getClassLoader()
+					.getResourceAsStream(ServerSettings.getAuroraExecutorConfigTemplateFileName());
+			JSONObject exeConfig = new JSONObject(new JSONTokener(resourceAsStream));
 			if(exeConfig != null) {
 				exeConfig.put("environment", jobConfig.getJob().getEnvironment());
 				exeConfig.put("name", jobConfig.getJob().getName());


Mime
View raw message