Commit e38a692c authored by Spiros Koulouzis's avatar Spiros Koulouzis

replace data model

parent 18fb961e
...@@ -15,10 +15,13 @@ ...@@ -15,10 +15,13 @@
*/ */
package nl.uva.sne.drip.service; package nl.uva.sne.drip.service;
import nl.uva.sne.drip.drip.commons.data.InfrastructureDescription; import lambdaInfrs.engine.TEngine.TEngine;
import nl.uva.sne.drip.drip.commons.model.InfrastructureDescription;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory; import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import topology.analysis.TopologyAnalysisMain;
/** /**
* *
...@@ -27,10 +30,10 @@ import org.springframework.stereotype.Service; ...@@ -27,10 +30,10 @@ import org.springframework.stereotype.Service;
@Service @Service
public class CloudStormService { public class CloudStormService {
@Autowired @Value("${provisioner.queue.prefix}")
CachingConnectionFactory connectionFactory; private String provisionerQueuePrefix;
public InfrastructureDescription provision() { public InfrastructureDescription provision(InfrastructureDescription description) {
return null; return null;
} }
......
...@@ -9,6 +9,23 @@ ...@@ -9,6 +9,23 @@
<artifactId>drip-commons</artifactId> <artifactId>drip-commons</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <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> <dependency>
<groupId>javax</groupId> <groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId> <artifactId>javaee-web-api</artifactId>
......
...@@ -13,12 +13,18 @@ ...@@ -13,12 +13,18 @@
* 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.drip.commons.data; package nl.uva.sne.drip.drip.commons.model;
import java.util.List;
/** /**
* Description of the infrastructure including network VMs etc.
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
public class InfrastructureDescription extends Description{ public class InfrastructureDescription extends Description{
private List<VM> VMs;
} }
...@@ -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.drip.commons.data; package nl.uva.sne.drip.drip.commons.model;
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.drip.commons.data; package nl.uva.sne.drip.drip.commons.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
......
/*
* 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;
}
}
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
* 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.drip.commons.data; package nl.uva.sne.drip.drip.commons.model;
/** /**
* *
* @author S. Koulouzis * @author S. Koulouzis
*/ */
abstract class Description { abstract class Description extends OwnedDocument{
} }
/*
* 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;
}
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