Commit d5088e81 authored by Spiros Koulouzis's avatar Spiros Koulouzis

remove commons from provisiponer

parent d19bb690
......@@ -15,11 +15,6 @@
</properties>
<dependencies>
<dependency>
<groupId>nl.uva.sne.drip</groupId>
<artifactId>drip-commons</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>nl.uva.sne.drip</groupId>
......
......@@ -38,7 +38,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;
import nl.uva.sne.drip.commons.types.MessageParameter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
import org.json.JSONArray;
......@@ -376,12 +375,12 @@ public class Consumer extends DefaultConsumer {
private File getCloudConfigurationFile(JSONArray parameters, String tempInputDirPath) throws JSONException {
for (int i = 0; i < parameters.length(); i++) {
JSONObject param = (JSONObject) parameters.get(i);
String name = (String) param.get(MessageParameter.NAME);
String name = (String) param.get("name");
if (name.equals("ec2.conf") || name.equals("geni.conf")) {
try {
File confFile = new File(tempInputDirPath + File.separator + name);
if (confFile.createNewFile()) {
writeValueToFile((String) param.get(MessageParameter.VALUE), confFile);
writeValueToFile((String) param.get("value"), confFile);
return confFile;
} else {
return null;
......@@ -398,7 +397,7 @@ public class Consumer extends DefaultConsumer {
private File getTopology(JSONArray parameters, String tempInputDirPath, int level) throws JSONException, IOException {
for (int i = 0; i < parameters.length(); i++) {
JSONObject param = (JSONObject) parameters.get(i);
String name = (String) param.get(MessageParameter.NAME);
String name = (String) param.get("name");
if (name.equals("topology")) {
JSONObject attributes = param.getJSONObject("attributes");
int fileLevel = Integer.valueOf((String) attributes.get("level"));
......@@ -419,7 +418,7 @@ public class Consumer extends DefaultConsumer {
File topologyFile = new File(tempInputDirPath + File.separator + fileName);
topologyFile.createNewFile();
String val = (String) param.get(MessageParameter.VALUE);
String val = (String) param.get("value");
writeValueToFile(val, topologyFile);
return topologyFile;
}
......@@ -432,13 +431,13 @@ public class Consumer extends DefaultConsumer {
Map<String, File> files = new HashMap<>();
for (int i = 0; i < parameters.length(); i++) {
JSONObject param = (JSONObject) parameters.get(i);
String name = (String) param.get(MessageParameter.NAME);
String name = (String) param.get("name");
if (name.equals("certificate")) {
JSONObject attribute = param.getJSONObject("attributes");
String fileName = (String) attribute.get("filename");
File certificate = new File(tempInputDirPath + File.separator + fileName + ".pem");
if (certificate.createNewFile()) {
writeValueToFile((String) param.get(MessageParameter.VALUE), certificate);
writeValueToFile((String) param.get("value"), certificate);
files.put(fileName, certificate);
}
}
......@@ -449,9 +448,9 @@ public class Consumer extends DefaultConsumer {
private String getLogDirPath(JSONArray parameters, String tempInputDirPath) throws JSONException {
for (int i = 0; i < parameters.length(); i++) {
JSONObject param = (JSONObject) parameters.get(i);
String name = (String) param.get(MessageParameter.NAME);
String name = (String) param.get("name");
if (name.equals("logdir")) {
return (String) param.get(MessageParameter.VALUE);
return (String) param.get("value");
}
}
return System.getProperty("java.io.tmpdir");
......@@ -460,9 +459,9 @@ public class Consumer extends DefaultConsumer {
private File getSSHKey(JSONArray parameters, String tempInputDirPath) throws JSONException, IOException {
for (int i = 0; i < parameters.length(); i++) {
JSONObject param = (JSONObject) parameters.get(i);
String name = (String) param.get(MessageParameter.NAME);
String name = (String) param.get("name");
if (name.equals("sshkey")) {
String sshKeyContent = (String) param.get(MessageParameter.VALUE);
String sshKeyContent = (String) param.get("value");
File sshKeyFile = new File(tempInputDirPath + File.separator + "user.pem");
if (sshKeyFile.createNewFile()) {
writeValueToFile(sshKeyContent, sshKeyFile);
......@@ -476,9 +475,9 @@ public class Consumer extends DefaultConsumer {
private File getSciptFile(JSONArray parameters, String tempInputDirPath) throws JSONException, IOException {
for (int i = 0; i < parameters.length(); i++) {
JSONObject param = (JSONObject) parameters.get(i);
String name = (String) param.get(MessageParameter.NAME);
String name = (String) param.get("name");
if (name.equals("guiscript")) {
String scriptContent = (String) param.get(MessageParameter.VALUE);
String scriptContent = (String) param.get("value");
File scriptFile = new File(tempInputDirPath + File.separator + "guiscipt.sh");
if (scriptFile.createNewFile()) {
writeValueToFile(scriptContent, scriptFile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment