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