Commit 055ac648 authored by Spiros Koulouzis's avatar Spiros Koulouzis

try ti define tosca

parent e38a692c
......@@ -10,77 +10,13 @@
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-core</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.webcohesion.enunciate</groupId>
<artifactId>enunciate-core-annotations</artifactId>
<version>2.9.1</version>
<type>jar</type>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
<dependency>
<groupId>com.rabbitmq</groupId>
<artifactId>amqp-client</artifactId>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
......
/*
* Copyright 2017 S. Koulouzis.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model;
import java.io.Serializable;
import java.util.Map;
/**
*
* @author S. Koulouzis.
*/
public class MessageParameter implements Serializable {
private String url;
private String encoding;
private String value;
private String name;
private Map<String, String> attributes;
public static final String NAME = "name";
public static final String URL = "url";
public static final String VALUE = "value";
public static final String ENCODING = "encoding";
public String getURL() {
return this.url;
}
public void setURL(String url) {
this.url = url;
}
public String getEncoding() {
return this.encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
/**
* @return the attributes
*/
public Map<String, String> getAttributes() {
return attributes;
}
/**
* @param attributes the attributes to set
*/
public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;
}
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.webcohesion.enunciate.metadata.DocumentationExample;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import static javax.persistence.TemporalType.TIMESTAMP;
import javax.validation.constraints.NotNull;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.security.core.userdetails.User;
/**
* This is the base class for users to own resources. Many classes extend this
* class
*
* @author S. Koulouzis
*/
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
abstract class OwnedDocument {
@Id
private String id;
@CreatedBy
protected User owner;
@CreatedDate
@Temporal(TIMESTAMP)
private Date creationDate;
@LastModifiedBy
private User modifier;
@LastModifiedDate
@Temporal(TIMESTAMP)
protected Date modificationdDate;
/**
* The owner (username) for the particular object. This value is set when
* the DAO saves the object based on the principal who made the call. It is
* created automatically. No need to set during a POST
*
* @return the owner
*/
@DocumentationExample("user1")
public User getOwner() {
return owner;
}
/**
* @param owner the ownerID to set
*/
public void setOwner(User owner) {
this.owner = owner;
}
/**
* The UID of this object. This value is auto generated by the DAO when the
* object is saved.
*
* @return the id
*/
@DocumentationExample("58e3946e0fb4f562d84ba1ad")
public String getId() {
return id;
}
/**
* @return the modifier
*/
@DocumentationExample("user1")
public User getModifieder() {
return modifier;
}
/**
* @param modifieder the modifier to set
*/
public void setModifieder(User modifieder) {
this.modifier = modifieder;
}
/**
* @return the creationDate
*/
public Date getCreationDate() {
return creationDate;
}
/**
* @param creationDate the creationDate to set
*/
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model;
import com.webcohesion.enunciate.metadata.DocumentationExample;
/**
* The lowest level is the VM level. It describes the types of VMs required,
* mainly referring to the computing capacities, CPU, memory, etc
*
* @author S. Koulouzis
*/
public class VM {
/**
* This field can be omitted. After provisioning, you can check the actual
* public address of this VM from this field.
* @return the publicAddress
*/
@DocumentationExample("145.18.150.10")
public String getPublicAddress() {
return publicAddress;
}
/**
* @param publicAddress the publicAddress to set
*/
public void setPublicAddress(String publicAddress) {
this.publicAddress = publicAddress;
}
/**
* It indicates the specific operating system required by the application.
* The value of above two fields should be supported by the Cloud database
* information.
*
* @return the osType
*/
@DocumentationExample("Ubuntu 14.04")
public String getOsType() {
return osType;
}
/**
* @param osType the osType to set
*/
public void setOsType(String osType) {
this.osType = osType;
}
/**
* It indicates the computing capacity of the VM, such as t2.small or
* t2.medium for Cloud EC2.
*
* @return the nodeType
*/
@DocumentationExample("t2.small")
public String getNodeType() {
return nodeType;
}
/**
* @param nodeType the nodeType to set
*/
public void setNodeType(String nodeType) {
this.nodeType = nodeType;
}
/**
* A user-defined node name of this VM. It should be unique in the entire
* infrastructure, e.g., node1. This will also be the hostname of this VM.
* And this VM can be accessed from other connected VMs with this hostname,
* e.g., ping node1.
*
* @return the name
*/
@DocumentationExample("node1")
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
private String name;
private String nodeType;
private String osType;
private String publicAddress;
}
......@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model;
package nl.uva.sne.drip.drip.commons.model.tosca;
/**
*
* @author S. Koulouzis
*/
abstract class Description extends OwnedDocument{
public class Artifact {
}
......@@ -13,18 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model;
import java.util.List;
package nl.uva.sne.drip.drip.commons.model.tosca;
/**
* Description of the infrastructure including network VMs etc.
*
* @author S. Koulouzis
*/
public class InfrastructureDescription extends Description{
private List<VM> VMs;
public abstract class Attribute {
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model.tosca;
/**
*
* @author S. Koulouzis
*/
public enum Constraint {
EQUAL,
GREATERTHAN,
GREATEROREQUAL,
LESSTHAN,
INRANGE,
VALIDVALUES,
LENGTH,
MINLENGTH,
MAXLENGTH,
PATTERN;
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model.tosca;
import java.util.List;
/**
*
* @author S. Koulouzis
*/
public abstract class EntrySchema {
@org.neo4j.ogm.annotation.Property(name = "type")
private String type;
@org.neo4j.ogm.annotation.Property(name = "description")
private String description;
@org.neo4j.ogm.annotation.Property(name = "constraints")
private List<Constraint> constraints;
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model.tosca;
/**
*
* @author S. Koulouzis
*/
public abstract class Interface {
}
/*
* Copyright 2017 S. Koulouzis.
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
......@@ -13,60 +13,38 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model;
package nl.uva.sne.drip.drip.commons.model.tosca;
import java.io.Serializable;
import java.util.List;
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.GeneratedValue;
//import javax.persistence.GenerationType;
//import javax.persistence.Id;
//import javax.persistence.Temporal;
//import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.namespace.QName;
/**
*
*
*
* @author S. Koulouzis.
* @author S. Koulouzis
*/
public class Message implements Serializable {
private String owner;
public abstract class Property {
private Long creationDate;
@org.neo4j.ogm.annotation.Property(name = "type")
private String type;
private List<MessageParameter> parameters;
@org.neo4j.ogm.annotation.Property(name = "description")
private String description;
public Long getCreationDate() {
return this.creationDate;
}
@org.neo4j.ogm.annotation.Property(name = "required")
private Boolean required;
public void setParameters(List<MessageParameter> parameters) {
this.parameters = parameters;
}
@org.neo4j.ogm.annotation.Property(name = "default")
private Object defaultValue;
public List<MessageParameter> getParameters() {
return this.parameters;
}
@org.neo4j.ogm.annotation.Property(name = "status")
private PropertyStatus status;
public void setCreationDate(Long creationDate) {
this.creationDate = creationDate;
}
@org.neo4j.ogm.annotation.Property(name = "constraints")
private List<Constraint> constraints;
/**
* @return the owner
*/
public String getOwner() {
return owner;
}
/**
* @param owner the owner to set
*/
public void setOwner(String owner) {
this.owner = owner;
}
@org.neo4j.ogm.annotation.Property(name = "entry_schema")
private EntrySchema entrySchema;
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model.tosca;
/**
*
* @author S. Koulouzis
*/
public enum PropertyStatus {
SUPPORTED,
UNSUPPORTED,
EXPERIMENTAL,
DEPRECTED;
}
/*
* Copyright 2019 S. Koulouzis, Huan Zhou, Yang Hu
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package nl.uva.sne.drip.drip.commons.model.tosca;
/**
*
* @author S. Koulouzis
*/
public abstract class Requirement {
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.uva.sne.drip.drip.commons.model.tosca.capabilities;
import java.util.List;
import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.namespace.QName;
import nl.uva.sne.drip.drip.commons.model.tosca.Attribute;
import org.neo4j.ogm.annotation.Properties;
import org.neo4j.ogm.annotation.Property;
/**
* http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/os/TOSCA-Simple-Profile-YAML-v1.0-os.html#DEFN_TYPE_CAPABILITIES_ROOT
*
* @author alogo
*/
public abstract class Capabilities {
@Property(name = "type")
private String type;
@Property(name = "description")
private String description;
@Property(name = "valid_source_types")
private List<String> validSourceTypes;
@Property(name = "occurrences")
private List<String> occurrences;
@Properties
private Map<String, nl.uva.sne.drip.drip.commons.model.tosca.Property> properties;
@Properties
private Map<String, Attribute> attributes;
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package nl.uva.sne.drip.drip.commons.model.tosca.nodes;
/**
*
* @author S. Koulouzis
*/
//http://docs.oasis-open.org/tosca/TOSCA-Simple-Profile-YAML/v1.0/os/TOSCA-Simple-Profile-YAML-v1.0-os.html#DEFN_TOSCA_VALUES_STATE
public enum NodeState {
INITIAL,
CREATING,
CREATED,
CONFIGURING,
CONFIGURED,
STARTING,
STARTED,
STOPPING,
DELETING,
ERROR;
}
package nl.uva.sne.drip.drip.commons.model.tosca.nodes;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import nl.uva.sne.drip.drip.commons.model.tosca.Artifact;
import nl.uva.sne.drip.drip.commons.model.tosca.Attribute;
import nl.uva.sne.drip.drip.commons.model.tosca.Interface;
import nl.uva.sne.drip.drip.commons.model.tosca.Requirement;
import nl.uva.sne.drip.drip.commons.model.tosca.capabilities.Capabilities;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Properties;
import org.neo4j.ogm.annotation.Property;
/**
*
* @author S. Koulouzis
*/
@NodeEntity
public abstract class RootNode {
@Id
@GeneratedValue
private Long tosca_id;
@Property(name = "tosca_name")
private String tosca_name;
@Property(name = "state")
private NodeState state;
@Properties
private Map<String, Capabilities> capabilities;
@Properties
private Map<String, Attribute> attributes;
@Properties
private List<Requirement> requirements;
@Properties
private Map<String, Interface> interfaces;
@Properties
private Map<String, Artifact> artifacts;
/**
* @return the tosca_name
*/
public String getTosca_name() {
return tosca_name;
}
/**
* @param tosca_name the tosca_name to set
*/
public void setTosca_name(String tosca_name) {
this.tosca_name = tosca_name;
}
/**
* @return the state
*/
public NodeState getState() {
return state;
}
/**
* @param state the state to set
*/
public void setState(NodeState state) {
this.state = state;
}
/**
* @return the capabilities
*/
public Map<String, Capabilities> getCapabilities() {
return capabilities;
}
/**
* @param capabilities the capabilities to set
*/
public void setCapabilities(Map<String, Capabilities> capabilities) {
this.capabilities = capabilities;
}
/**
* @return the attributes
*/
public Map<String, Attribute> getAttributes() {
return attributes;
}
/**
* @param attributes the attributes to set
*/
public void setAttributes(Map<String, Attribute> attributes) {
this.attributes = attributes;
}
/**
* @return the requirements
*/
public List<Requirement> getRequirements() {
return requirements;
}
/**
* @param requirements the requirements to set
*/
public void setRequirements(List<Requirement> requirements) {
this.requirements = requirements;
}
/**
* @return the interfaces
*/
public Map<String, Interface> getInterfaces() {
return interfaces;
}
/**
* @param interfaces the interfaces to set
*/
public void setInterfaces(Map<String, Interface> interfaces) {
this.interfaces = interfaces;
}
/**
* @return the artifacts
*/
public Map<String, Artifact> getArtifacts() {
return artifacts;
}
/**
* @param artifacts the artifacts to set
*/
public void setArtifacts(Map<String, Artifact> artifacts) {
this.artifacts = artifacts;
}
}
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