Commit d5088e81 authored by Spiros Koulouzis's avatar Spiros Koulouzis

remove commons from provisiponer

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