Commit 97dcaa7e authored by Spiros Koulouzis's avatar Spiros Koulouzis

added creation date

moved message to internal
parent fd497934
...@@ -15,7 +15,7 @@ import java.util.concurrent.BlockingQueue; ...@@ -15,7 +15,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
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.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import nl.uva.sne.drip.commons.utils.Converter; import nl.uva.sne.drip.commons.utils.Converter;
import org.json.JSONException; import org.json.JSONException;
......
...@@ -37,8 +37,8 @@ import nl.uva.sne.drip.data.v1.external.DeployRequest; ...@@ -37,8 +37,8 @@ import nl.uva.sne.drip.data.v1.external.DeployRequest;
import nl.uva.sne.drip.data.v1.external.DeployParameter; import nl.uva.sne.drip.data.v1.external.DeployParameter;
import nl.uva.sne.drip.data.v1.external.DeployResponse; import nl.uva.sne.drip.data.v1.external.DeployResponse;
import nl.uva.sne.drip.data.v1.external.Key; import nl.uva.sne.drip.data.v1.external.Key;
import nl.uva.sne.drip.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import nl.uva.sne.drip.data.v1.external.MessageParameter; import nl.uva.sne.drip.data.internal.MessageParameter;
import nl.uva.sne.drip.data.v1.external.ProvisionResponse; import nl.uva.sne.drip.data.v1.external.ProvisionResponse;
import nl.uva.sne.drip.data.v1.external.User; import nl.uva.sne.drip.data.v1.external.User;
import org.json.JSONException; import org.json.JSONException;
...@@ -232,6 +232,7 @@ public class DeployService { ...@@ -232,6 +232,7 @@ public class DeployService {
private DeployResponse handleResponse(List<MessageParameter> params, DeployRequest deployInfo) throws KeyException, IOException { private DeployResponse handleResponse(List<MessageParameter> params, DeployRequest deployInfo) throws KeyException, IOException {
DeployResponse deployResponse = new DeployResponse(); DeployResponse deployResponse = new DeployResponse();
deployResponse.setCreationDate(System.currentTimeMillis());
for (MessageParameter p : params) { for (MessageParameter p : params) {
String name = p.getName(); String name = p.getName();
...@@ -242,6 +243,7 @@ public class DeployService { ...@@ -242,6 +243,7 @@ public class DeployService {
k.setKey(value); k.setKey(value);
k.setType(Key.KeyType.PRIVATE); k.setType(Key.KeyType.PRIVATE);
KeyPair pair = new KeyPair(); KeyPair pair = new KeyPair();
pair.setCreationDate(System.currentTimeMillis());
pair.setPrivateKey(k); pair.setPrivateKey(k);
deployResponse.setKey(pair); deployResponse.setKey(pair);
save(deployResponse); save(deployResponse);
......
...@@ -29,8 +29,8 @@ import nl.uva.sne.drip.api.dao.PlanDao; ...@@ -29,8 +29,8 @@ import nl.uva.sne.drip.api.dao.PlanDao;
import nl.uva.sne.drip.api.exception.BadRequestException; import nl.uva.sne.drip.api.exception.BadRequestException;
import nl.uva.sne.drip.api.exception.NotFoundException; import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.rpc.PlannerCaller; import nl.uva.sne.drip.api.rpc.PlannerCaller;
import nl.uva.sne.drip.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import nl.uva.sne.drip.data.v1.external.MessageParameter; import nl.uva.sne.drip.data.internal.MessageParameter;
import nl.uva.sne.drip.data.v1.external.PlanResponse; import nl.uva.sne.drip.data.v1.external.PlanResponse;
import nl.uva.sne.drip.data.v1.external.ToscaRepresentation; import nl.uva.sne.drip.data.v1.external.ToscaRepresentation;
import nl.uva.sne.drip.commons.utils.Converter; import nl.uva.sne.drip.commons.utils.Converter;
...@@ -86,6 +86,7 @@ public class PlannerService { ...@@ -86,6 +86,7 @@ public class PlannerService {
SimplePlanContainer simplePlan = P2PConverter.convert(jsonArrayString.toString(), "vm_user", "Ubuntu 16.04", "swarm"); SimplePlanContainer simplePlan = P2PConverter.convert(jsonArrayString.toString(), "vm_user", "Ubuntu 16.04", "swarm");
PlanResponse topLevel = new PlanResponse(); PlanResponse topLevel = new PlanResponse();
topLevel.setCreationDate(System.currentTimeMillis());
topLevel.setLevel(0); topLevel.setLevel(0);
topLevel.setToscaID(toscaId); topLevel.setToscaID(toscaId);
topLevel.setName("planner_output_all.yml"); topLevel.setName("planner_output_all.yml");
...@@ -94,6 +95,7 @@ public class PlannerService { ...@@ -94,6 +95,7 @@ public class PlannerService {
Set<String> loweLevelPlansIDs = new HashSet<>(); Set<String> loweLevelPlansIDs = new HashSet<>();
for (String lowLevelNames : map.keySet()) { for (String lowLevelNames : map.keySet()) {
PlanResponse lowLevelPlan = new PlanResponse(); PlanResponse lowLevelPlan = new PlanResponse();
lowLevelPlan.setCreationDate(System.currentTimeMillis());
lowLevelPlan.setLevel(1); lowLevelPlan.setLevel(1);
lowLevelPlan.setToscaID(toscaId); lowLevelPlan.setToscaID(toscaId);
lowLevelPlan.setName(lowLevelNames); lowLevelPlan.setName(lowLevelNames);
......
...@@ -40,8 +40,8 @@ import nl.uva.sne.drip.api.v1.rest.ProvisionController; ...@@ -40,8 +40,8 @@ import nl.uva.sne.drip.api.v1.rest.ProvisionController;
import nl.uva.sne.drip.commons.utils.Converter; import nl.uva.sne.drip.commons.utils.Converter;
import nl.uva.sne.drip.data.v1.external.CloudCredentials; import nl.uva.sne.drip.data.v1.external.CloudCredentials;
import nl.uva.sne.drip.data.v1.external.DeployParameter; import nl.uva.sne.drip.data.v1.external.DeployParameter;
import nl.uva.sne.drip.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import nl.uva.sne.drip.data.v1.external.MessageParameter; import nl.uva.sne.drip.data.internal.MessageParameter;
import nl.uva.sne.drip.data.v1.external.PlanResponse; import nl.uva.sne.drip.data.v1.external.PlanResponse;
import nl.uva.sne.drip.data.v1.external.ProvisionRequest; import nl.uva.sne.drip.data.v1.external.ProvisionRequest;
import nl.uva.sne.drip.data.v1.external.ProvisionResponse; import nl.uva.sne.drip.data.v1.external.ProvisionResponse;
...@@ -128,6 +128,7 @@ public class ProvisionService { ...@@ -128,6 +128,7 @@ public class ProvisionService {
// + File.separator + "ec2_provisioner_provisoned3.json"); // + File.separator + "ec2_provisioner_provisoned3.json");
List<MessageParameter> params = response.getParameters(); List<MessageParameter> params = response.getParameters();
ProvisionResponse provisionResponse = new ProvisionResponse(); ProvisionResponse provisionResponse = new ProvisionResponse();
provisionResponse.setCreationDate(System.currentTimeMillis());
for (MessageParameter p : params) { for (MessageParameter p : params) {
String name = p.getName(); String name = p.getName();
if (name.toLowerCase().contains("exception")) { if (name.toLowerCase().contains("exception")) {
......
...@@ -29,8 +29,8 @@ import java.util.concurrent.TimeoutException; ...@@ -29,8 +29,8 @@ import java.util.concurrent.TimeoutException;
import nl.uva.sne.drip.api.dao.PlanDao; import nl.uva.sne.drip.api.dao.PlanDao;
import nl.uva.sne.drip.api.exception.NotFoundException; import nl.uva.sne.drip.api.exception.NotFoundException;
import nl.uva.sne.drip.api.rpc.PlannerCaller; import nl.uva.sne.drip.api.rpc.PlannerCaller;
import nl.uva.sne.drip.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import nl.uva.sne.drip.data.v1.external.MessageParameter; import nl.uva.sne.drip.data.internal.MessageParameter;
import nl.uva.sne.drip.data.v1.external.PlanResponse; import nl.uva.sne.drip.data.v1.external.PlanResponse;
import nl.uva.sne.drip.data.v1.external.ToscaRepresentation; import nl.uva.sne.drip.data.v1.external.ToscaRepresentation;
import nl.uva.sne.drip.commons.utils.Converter; import nl.uva.sne.drip.commons.utils.Converter;
...@@ -64,6 +64,7 @@ public class SimplePlannerService { ...@@ -64,6 +64,7 @@ public class SimplePlannerService {
Message plannerReturnedMessage = (planner.call(plannerInvokationMessage)); Message plannerReturnedMessage = (planner.call(plannerInvokationMessage));
List<MessageParameter> planFiles = plannerReturnedMessage.getParameters(); List<MessageParameter> planFiles = plannerReturnedMessage.getParameters();
topLevel = new PlanResponse(); topLevel = new PlanResponse();
topLevel.setCreationDate(System.currentTimeMillis());
Set<String> ids = topLevel.getLoweLevelPlanIDs(); Set<String> ids = topLevel.getLoweLevelPlanIDs();
if (ids == null) { if (ids == null) {
ids = new HashSet<>(); ids = new HashSet<>();
...@@ -83,6 +84,7 @@ public class SimplePlannerService { ...@@ -83,6 +84,7 @@ public class SimplePlannerService {
topLevel.setKvMap(Converter.ymlString2Map(p.getValue())); topLevel.setKvMap(Converter.ymlString2Map(p.getValue()));
} else { } else {
lowerLevelPlan = new PlanResponse(); lowerLevelPlan = new PlanResponse();
lowerLevelPlan.setCreationDate(System.currentTimeMillis());
lowerLevelPlan.setName(name); lowerLevelPlan.setName(name);
lowerLevelPlan.setKvMap(Converter.ymlString2Map(p.getValue())); lowerLevelPlan.setKvMap(Converter.ymlString2Map(p.getValue()));
lowerLevelPlan.setLevel(1); lowerLevelPlan.setLevel(1);
......
...@@ -70,6 +70,7 @@ public class CloudConfigurationController0 { ...@@ -70,6 +70,7 @@ public class CloudConfigurationController0 {
throw new NullKeyIDException(); throw new NullKeyIDException();
} }
CloudCredentials cloudCredentials = new CloudCredentials(); CloudCredentials cloudCredentials = new CloudCredentials();
cloudCredentials.setCreationDate(System.currentTimeMillis());
cloudCredentials.setAccessKeyId(configure.keyid); cloudCredentials.setAccessKeyId(configure.keyid);
cloudCredentials.setSecretKey(configure.key); cloudCredentials.setSecretKey(configure.key);
...@@ -79,6 +80,7 @@ public class CloudConfigurationController0 { ...@@ -79,6 +80,7 @@ public class CloudConfigurationController0 {
try { try {
nl.uva.sne.drip.data.v1.external.Key key1 = new nl.uva.sne.drip.data.v1.external.Key(); nl.uva.sne.drip.data.v1.external.Key key1 = new nl.uva.sne.drip.data.v1.external.Key();
KeyPair pair = new KeyPair(); KeyPair pair = new KeyPair();
pair.setCreationDate(System.currentTimeMillis());
key1.setKey(key0.content); key1.setKey(key0.content);
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", key0.domain_name); attributes.put("domain_name", key0.domain_name);
...@@ -108,6 +110,7 @@ public class CloudConfigurationController0 { ...@@ -108,6 +110,7 @@ public class CloudConfigurationController0 {
throw new NullKeyIDException(); throw new NullKeyIDException();
} }
CloudCredentials cloudCredentials = new CloudCredentials(); CloudCredentials cloudCredentials = new CloudCredentials();
cloudCredentials.setCreationDate(System.currentTimeMillis());
// cloudCredentials.setKeyIdAlias(configure.geniKeyAlias); // cloudCredentials.setKeyIdAlias(configure.geniKeyAlias);
cloudCredentials.setAccessKeyId(configure.geniKey); cloudCredentials.setAccessKeyId(configure.geniKey);
cloudCredentials.setSecretKey(configure.geniKeyPass); cloudCredentials.setSecretKey(configure.geniKeyPass);
...@@ -120,6 +123,7 @@ public class CloudConfigurationController0 { ...@@ -120,6 +123,7 @@ public class CloudConfigurationController0 {
key1.setKey(key0.content); key1.setKey(key0.content);
key1.setType(Key.KeyType.PUBLIC); key1.setType(Key.KeyType.PUBLIC);
KeyPair pair = new KeyPair(); KeyPair pair = new KeyPair();
pair.setCreationDate(System.currentTimeMillis());
pair.setPublicKey(key1); pair.setPublicKey(key1);
pair = keyService.save(pair); pair = keyService.save(pair);
loginKeyIDs.add(pair.getId()); loginKeyIDs.add(pair.getId());
...@@ -134,6 +138,7 @@ public class CloudConfigurationController0 { ...@@ -134,6 +138,7 @@ public class CloudConfigurationController0 {
key1.setKey(key0.content); key1.setKey(key0.content);
key1.setType(Key.KeyType.PRIVATE); key1.setType(Key.KeyType.PRIVATE);
KeyPair pair = new KeyPair(); KeyPair pair = new KeyPair();
pair.setCreationDate(System.currentTimeMillis());
pair.setPrivateKey(key1); pair.setPrivateKey(key1);
pair = keyService.save(pair); pair = keyService.save(pair);
loginKeyIDs.add(pair.getId()); loginKeyIDs.add(pair.getId());
......
...@@ -84,6 +84,7 @@ public class ProvisionController0 { ...@@ -84,6 +84,7 @@ public class ProvisionController0 {
String provision(@RequestBody Upload upload) { String provision(@RequestBody Upload upload) {
ProvisionResponse resp = new ProvisionResponse(); ProvisionResponse resp = new ProvisionResponse();
resp.setCreationDate(System.currentTimeMillis());
CloudCredentials cloudCred = cloudCredentialsService.findAll().get(0); CloudCredentials cloudCred = cloudCredentialsService.findAll().get(0);
String cloudCredID = cloudCred.getId(); String cloudCredID = cloudCred.getId();
List<String> idList = new ArrayList<>(); List<String> idList = new ArrayList<>();
......
...@@ -132,6 +132,7 @@ public class CloudCredentialsController { ...@@ -132,6 +132,7 @@ public class CloudCredentialsController {
attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName)); attributes.put("domain_name", FilenameUtils.removeExtension(originalFileName));
key.setAttributes(attributes); key.setAttributes(attributes);
KeyPair pair = new KeyPair(); KeyPair pair = new KeyPair();
pair.setCreationDate(System.currentTimeMillis());
pair.setPrivateKey(key); pair.setPrivateKey(key);
pair = keyService.save(pair); pair = keyService.save(pair);
loginKeyIDs.add(pair.getId()); loginKeyIDs.add(pair.getId());
...@@ -206,15 +207,16 @@ public class CloudCredentialsController { ...@@ -206,15 +207,16 @@ public class CloudCredentialsController {
@RolesAllowed({UserService.USER, UserService.ADMIN}) @RolesAllowed({UserService.USER, UserService.ADMIN})
public @ResponseBody public @ResponseBody
CloudCredentials geta() { CloudCredentials geta() {
CloudCredentials c = new CloudCredentials(); CloudCredentials cloudCredentials = new CloudCredentials();
c.setAccessKeyId("AKIAITY3KHZUQ6M7YBSQ"); cloudCredentials.setCreationDate(System.currentTimeMillis());
c.setCloudProviderName("ec2"); cloudCredentials.setAccessKeyId("AKIAITY3KHZUQ6M7YBSQ");
c.setSecretKey("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"); cloudCredentials.setCloudProviderName("ec2");
cloudCredentials.setSecretKey("6J7uo99ifrff45sa6Gsy5vgb3bmrtwY6hBxtYt9y");
List<String> keyIDs = new ArrayList<>(); List<String> keyIDs = new ArrayList<>();
keyIDs.add("58da4c91f7b43a3282cacdbb"); keyIDs.add("58da4c91f7b43a3282cacdbb");
keyIDs.add("58da4d2af7b43a3282cacdbd"); keyIDs.add("58da4d2af7b43a3282cacdbd");
c.setKeyIDs(keyIDs); cloudCredentials.setKeyIDs(keyIDs);
return c; return cloudCredentials;
} }
} }
...@@ -139,6 +139,7 @@ public class KeyPairController { ...@@ -139,6 +139,7 @@ public class KeyPairController {
KeyPair geta() { KeyPair geta() {
try { try {
KeyPair pair = new KeyPair(); KeyPair pair = new KeyPair();
pair.setCreationDate(System.currentTimeMillis());
Key pk = new Key(); Key pk = new Key();
Map<String, String> attributes = new HashMap<>(); Map<String, String> attributes = new HashMap<>();
attributes.put("domain_name", "Virginia"); attributes.put("domain_name", "Virginia");
......
...@@ -28,8 +28,8 @@ import java.util.Map; ...@@ -28,8 +28,8 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import nl.uva.sne.drip.data.v0.external.Attribute; import nl.uva.sne.drip.data.v0.external.Attribute;
import nl.uva.sne.drip.data.v1.external.CloudCredentials; import nl.uva.sne.drip.data.v1.external.CloudCredentials;
import nl.uva.sne.drip.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import nl.uva.sne.drip.data.v1.external.MessageParameter; import nl.uva.sne.drip.data.internal.MessageParameter;
import nl.uva.sne.drip.data.v1.external.PlanResponse; import nl.uva.sne.drip.data.v1.external.PlanResponse;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.json.JSONArray; import org.json.JSONArray;
...@@ -200,6 +200,7 @@ public class Converter { ...@@ -200,6 +200,7 @@ public class Converter {
public static PlanResponse File2Plan1(Attribute p0) { public static PlanResponse File2Plan1(Attribute p0) {
PlanResponse p1 = new PlanResponse(); PlanResponse p1 = new PlanResponse();
p1.setCreationDate(System.currentTimeMillis());
p1.setLevel(Integer.valueOf(p0.level)); p1.setLevel(Integer.valueOf(p0.level));
p1.setName(p0.name); p1.setName(p0.name);
String yaml = p0.content.replaceAll("\\\\n", "\n"); String yaml = p0.content.replaceAll("\\\\n", "\n");
......
...@@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -20,7 +20,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import nl.uva.sne.drip.data.v1.external.Message; import nl.uva.sne.drip.data.internal.Message;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.json.JSONException; import org.json.JSONException;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package nl.uva.sne.drip.data.v1.external; package nl.uva.sne.drip.data.internal;
import java.io.Serializable; import java.io.Serializable;
import java.util.List; import java.util.List;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package nl.uva.sne.drip.data.v1.external; package nl.uva.sne.drip.data.internal;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
......
...@@ -17,7 +17,6 @@ package nl.uva.sne.drip.data.v1.external; ...@@ -17,7 +17,6 @@ package nl.uva.sne.drip.data.v1.external;
import com.webcohesion.enunciate.metadata.DocumentationExample; import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.util.List; import java.util.List;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
/** /**
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
package nl.uva.sne.drip.data.v1.external; package nl.uva.sne.drip.data.v1.external;
import java.util.List; import java.util.List;
import nl.uva.sne.drip.data.v1.external.ansible.AnsibleOutput;
import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Document;
/** /**
......
...@@ -32,6 +32,8 @@ public class OwnedObject { ...@@ -32,6 +32,8 @@ public class OwnedObject {
@Id @Id
private String id; private String id;
private Long creationDate;
@NotNull @NotNull
private String owner; private String owner;
...@@ -64,4 +66,18 @@ public class OwnedObject { ...@@ -64,4 +66,18 @@ public class OwnedObject {
return id; return id;
} }
/**
* @return the creationDate
*/
public Long getCreationDate() {
return creationDate;
}
/**
* @param creationDate the creationDate to set
*/
public void setCreationDate(Long creationDate) {
this.creationDate = creationDate;
}
} }
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