summaryrefslogtreecommitdiffstats
path: root/verigraph/src/main/java/it/polito/escape/verify/model
diff options
context:
space:
mode:
Diffstat (limited to 'verigraph/src/main/java/it/polito/escape/verify/model')
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java75
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Entry.java37
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/ErrorMessage.java62
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Graph.java105
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Link.java71
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java70
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Node.java152
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Test.java62
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/Verification.java69
-rw-r--r--verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties1
10 files changed, 0 insertions, 704 deletions
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java b/verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java
deleted file mode 100644
index 3498a10..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Configuration.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import it.polito.escape.verify.deserializer.ConfigurationCustomDeserializer;
-import it.polito.escape.verify.serializer.CustomConfigurationSerializer;
-
-@XmlRootElement
-@ApiModel("Configuration")
-@JsonSerialize(using = CustomConfigurationSerializer.class)
-@JsonDeserialize(using = ConfigurationCustomDeserializer.class)
-public class Configuration {
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private String id;
-
- @ApiModelProperty(required = false)
- @XmlTransient
- private String description = "";
-
- @ApiModelProperty(required = true)
- private JsonNode configuration;
-
- public Configuration() {
-
- }
-
- public Configuration(String id, String description, JsonNode configuration) {
- this.id = id;
- this.description = description;
- this.configuration = configuration;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public JsonNode getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(JsonNode configuration) {
- this.configuration = configuration;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Entry.java b/verigraph/src/main/java/it/polito/escape/verify/model/Entry.java
deleted file mode 100644
index f2fdf14..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Entry.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-public class Entry {
- private String direction;
- private String destination;
-
- public Entry(String direction, String destination) {
- this.direction = direction;
- this.destination = destination;
- }
-
- public String getDirection() {
- return direction;
- }
-
- public void setDirection(String direction) {
- this.direction = direction;
- }
-
- public String getDestination() {
- return destination;
- }
-
- public void setDestination(String destination) {
- this.destination = destination;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/ErrorMessage.java b/verigraph/src/main/java/it/polito/escape/verify/model/ErrorMessage.java
deleted file mode 100644
index e0e79d3..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/ErrorMessage.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "Error")
-@XmlRootElement
-public class ErrorMessage {
-
- @ApiModelProperty(example = "Error message")
- private String errorMessage;
- @ApiModelProperty(allowableValues = "400,403,404,500", value = "HTTP error code", example = "[400,403,404,500]")
- private int errorCode;
- @ApiModelProperty(example = "http://localhost:8080/verify/api-docs/")
- private String documentation;
-
- public ErrorMessage() {
-
- }
-
- public ErrorMessage(String errorMessage, int errorCode, String documentation) {
- this.errorMessage = errorMessage;
- this.errorCode = errorCode;
- this.documentation = documentation;
- }
-
- public String getErrorMessage() {
- return errorMessage;
- }
-
- public void setErrorMessage(String errorMessage) {
- this.errorMessage = errorMessage;
- }
-
- public int getErrorCode() {
- return errorCode;
- }
-
- public void setErrorCode(int errorCode) {
- this.errorCode = errorCode;
- }
-
- public String getDocumentation() {
- return documentation;
- }
-
- public void setDocumentation(String documentation) {
- this.documentation = documentation;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Graph.java b/verigraph/src/main/java/it/polito/escape/verify/model/Graph.java
deleted file mode 100644
index 44a2273..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Graph.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import it.polito.escape.verify.deserializer.GraphCustomDeserializer;
-import it.polito.escape.verify.serializer.CustomMapSerializer;
-
-@ApiModel(value = "Graph")
-@XmlRootElement
-@JsonDeserialize(using = GraphCustomDeserializer.class)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Graph {
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private long id;
-
- @ApiModelProperty(name = "nodes", notes = "Nodes", dataType = "List[it.polito.escape.verify.model.Node]")
- private Map<Long, Node> nodes = new HashMap<Long, Node>();
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private Set<Link> links = new HashSet<Link>();
-
- public Graph() {
-
- }
-
- public Graph(long id) {
- this.id = id;
- }
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- @JsonSerialize(using = CustomMapSerializer.class)
- public Map<Long, Node> getNodes() {
- return nodes;
- }
-
- public void setNodes(Map<Long, Node> nodes) {
- this.nodes = nodes;
- }
-
- @XmlTransient
- public Set<Link> getLinks() {
- return links;
- }
-
- public void setLinks(Set<Link> links) {
- this.links = links;
- }
-
- public void addLink(String url, String rel) {
- Link link = new Link();
- link.setLink(url);
- link.setRel(rel);
- links.add(link);
- }
-
- public Node searchNodeByName(String name) {
- for (Node node : this.nodes.values()) {
- if (node.getName().equals(name))
- return node;
- }
- return null;
- }
-
- public int nodesWithName(String name) {
- int occurrences = 0;
- for (Node node : this.nodes.values()) {
- if (node.getName().equals(name))
- occurrences++;
-
- }
- return occurrences;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Link.java b/verigraph/src/main/java/it/polito/escape/verify/model/Link.java
deleted file mode 100644
index dc2b4c5..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Link.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "Link")
-public class Link {
- @ApiModelProperty(required = false, hidden = true)
- private String link;
- @ApiModelProperty(required = false, hidden = true)
- private String rel;
-
- public String getLink() {
- return link;
- }
-
- public void setLink(String link) {
- this.link = link;
- }
-
- public String getRel() {
- return rel;
- }
-
- public void setRel(String rel) {
- this.rel = rel;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((link == null) ? 0 : link.hashCode());
- result = prime * result + ((rel == null) ? 0 : rel.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- Link other = (Link) obj;
- if (link == null) {
- if (other.link != null)
- return false;
- }
- else if (!link.equals(other.link))
- return false;
- if (rel == null) {
- if (other.rel != null)
- return false;
- }
- else if (!rel.equals(other.rel))
- return false;
- return true;
- }
-
-} \ No newline at end of file
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java b/verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java
deleted file mode 100644
index 4b1206c..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Neighbour.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import javax.xml.bind.annotation.XmlTransient;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "Neighbour")
-public class Neighbour {
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private long id;
-
- @ApiModelProperty( required = true,
- example = "nat",
- value = "The neighbour name must refer to an existing node of the same graph")
- private String name;
-
- public Neighbour() {
-
- }
-
- public Neighbour(long id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- else
- return false;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Node.java b/verigraph/src/main/java/it/polito/escape/verify/model/Node.java
deleted file mode 100644
index 9f667ce..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Node.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import it.polito.escape.verify.deserializer.NodeCustomDeserializer;
-import it.polito.escape.verify.serializer.CustomMapSerializer;
-
-@ApiModel(value = "Node")
-@XmlRootElement
-@JsonDeserialize(using = NodeCustomDeserializer.class)
-@JsonInclude(JsonInclude.Include.NON_EMPTY)
-public class Node {
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private long id;
-
- @ApiModelProperty(required = true, example = "ep", value = "The name of the node can be any string")
- private String name;
-
- @ApiModelProperty( required = true,
- example = "endpoint",
- value = "The functional types that are currently supported are: endpoint, firewall, nat, antispam, webclient, webserver, mailclient, mailserver")
- private String functional_type;
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private Configuration configuration = new Configuration();
-
- @ApiModelProperty( name = "neighbours",
- notes = "Neighbours",
- dataType = "List[it.polito.escape.verify.model.Neighbour]")
- private Map<Long, Neighbour> neighbours = new HashMap<Long, Neighbour>();
-
- @ApiModelProperty(required = false, hidden = true)
- @XmlTransient
- private Set<Link> links = new HashSet<>();
-
- public Node() {
-
- }
-
- public Node(long id, String name, String functional_type, Configuration configuration) {
- this.id = id;
- this.name = name;
- this.functional_type = functional_type;
- this.configuration = configuration;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getFunctional_type() {
- return functional_type;
- }
-
- public void setFunctional_type(String functional_type) {
- this.functional_type = functional_type;
- }
-
- // @XmlTransient
- public Configuration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(Configuration configuration) {
- this.configuration = configuration;
- }
-
- @JsonSerialize(using = CustomMapSerializer.class)
- public Map<Long, Neighbour> getNeighbours() {
- return neighbours;
- }
-
- public void setNeighbours(Map<Long, Neighbour> neighbours) {
- this.neighbours = neighbours;
- }
-
- public long getId() {
- return this.id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public Set<Link> getLinks() {
- return links;
- }
-
- public void setLinks(Set<Link> links) {
- this.links = links;
- }
-
- public void addLink(String url, String rel) {
- Link link = new Link();
- link.setLink(url);
- link.setRel(rel);
- links.add(link);
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- else
- return false;
- }
-
- public Neighbour searchNeighbourByName(String name) {
- for (Neighbour neighbour : this.neighbours.values()) {
- if (neighbour.getName().equals(name))
- return neighbour;
- }
- return null;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Test.java b/verigraph/src/main/java/it/polito/escape/verify/model/Test.java
deleted file mode 100644
index 1127abc..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Test.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class Test {
- private List<Node> nodes = new ArrayList<Node>();
- private String result;
-
- public Test() {
-
- }
-
- public Test(List<Node> paths, int result) {
- switch (result) {
- case 0:
- this.result = "SAT";
- break;
- case -1:
- this.result = "UNSAT";
- break;
- case -2:
- this.result = "UNKNOWN";
- break;
- default:
- this.result = "UNKNWON";
- break;
- }
- this.nodes = paths;
- }
-
- public Test(List<Node> paths, String result) {
- this.nodes = paths;
- this.result = result;
- }
-
- public List<Node> getPath() {
- return nodes;
- }
-
- public void setPath(List<Node> paths) {
- this.nodes = paths;
- }
-
- public String getResult() {
- return result;
- }
-
- public void setResult(String result) {
- this.result = result;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/Verification.java b/verigraph/src/main/java/it/polito/escape/verify/model/Verification.java
deleted file mode 100644
index 60b4ddb..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/Verification.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2017 Politecnico di Torino and others.
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Apache License, Version 2.0
- * which accompanies this distribution, and is available at
- * http://www.apache.org/licenses/LICENSE-2.0
- *******************************************************************************/
-
-package it.polito.escape.verify.model;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-
-@ApiModel(value = "Policy verification")
-public class Verification {
-
- @ApiModelProperty(example = "SAT | UNSAT | UNKNOWN")
- private String result;
- private String comment;
- private List<Test> tests = new ArrayList<Test>();
-
- public Verification() {
-
- }
-
- public Verification(String result) {
- this.result = result;
- }
-
- public Verification(String result, List<Test> tests, String comment){
- this.result = result;
- this.tests = tests;
- this.comment = comment;
- }
-
- public Verification(String result, String comment){
- this.result = result;
- this.comment = comment;
- }
-
- public String getResult() {
- return result;
- }
-
- public void setResult(String result) {
- this.result = result;
- }
-
- public List<Test> getTests() {
- return tests;
- }
-
- public void setTests(List<Test> tests) {
- this.tests = tests;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
-}
diff --git a/verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties b/verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties
deleted file mode 100644
index 5837a4c..0000000
--- a/verigraph/src/main/java/it/polito/escape/verify/model/jaxb.properties
+++ /dev/null
@@ -1 +0,0 @@
-javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory \ No newline at end of file