Added Architect M24

parent 7d4f471c
.settings/
/classes/
/target/
.classpath
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>eu.DECIDEh2020.architect.appManager</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
This diff is collapsed.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.decideh2020</groupId>
<artifactId>appManager</artifactId>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>jgit-repository</id>
<url>https://repo.eclipse.org/content/groups/releases/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- Cloudpatterns dependency -->
<dependency>
<groupId>de.decideh2020</groupId>
<artifactId>cloudpatterns</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>4.9.0.201710071750-r</version>
</dependency>
<!-- Gson: Java to Json conversion -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>apache-jena-libs</artifactId>
<type>pom</type>
<version>3.4.0</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
/*
* Copyright (c) 2017 Fraunhofer FOKUS.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the
* Eclipse Public License version 2.0 which accompanies
* this distribution, and is available at
* https://opensource.org/licenses/EPL-2.0
*
* Contributors:
*
* Torben Jastrow (Fraunhofer FOKUS)
*
* **Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu */
package eu.DECIDEh2020.architect.appManager.models;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.UUID;
import org.apache.jena.rdf.model.Resource;
public class AppDescriptor {
private UUID id;
private String name, description, version;
private Boolean highTechnologicalRisk;
private LinkedList<Microservice> microservices;
private HashSet<Resource> projectNfrs;
private Object app_mcsla,containers[], virtual_machines[];
final public static String plugin_version ="0.2.2-alpha";
public AppDescriptor() {
id = UUID.randomUUID();
microservices = new LinkedList<Microservice>();
setDeploymentOrder();
this.projectNfrs = new HashSet<Resource>();
this.version = plugin_version;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}
/**
* @return the version
*/
public String getVersion() {
return version;
}
/**
* @param version the version to set
*/
public void setVersion(String version) {
this.version = version;
}
/**
* @return the highTechnologicalRisk
*/
public Boolean getHighTechnologicalRisk() {
return highTechnologicalRisk;
}
/**
* @param highTechnologicalRisk the highTechnologicalRisk to set
*/
public void setHighTechnologicalRisk(Boolean highTechnologicalRisk) {
this.highTechnologicalRisk = highTechnologicalRisk;
}
/**
* @return the app_mcsla
*/
public Object getApp_mcsla() {
return app_mcsla;
}
/**
* @param app_mcsla the app_mcsla to set
*/
public void setApp_mcsla(Object app_mcsla) {
this.app_mcsla = app_mcsla;
}
/**
* @return the containers
*/
public Object[] getContainers() {
return containers;
}
/**
* @param containers the containers to set
*/
public void setContainers(Object[] containers) {
this.containers = containers;
}
/**
* @return the virtual_machines
*/
public Object[] getVirtual_machines() {
return virtual_machines;
}
/**
* @param virtual_machines the virtual_machines to set
*/
public void setVirtual_machines(Object[] virtual_machines) {
this.virtual_machines = virtual_machines;
}
/**
* @param id the id to set
*/
public void setId(UUID id) {
this.id = id;
}
public LinkedList<Microservice> changeIndex(int index, int plus) {
int size = microservices.size();
if (index+plus>=0&& index+plus<size) {
Microservice mscv = microservices.get(index);
microservices.remove(index);
microservices.add(index+plus, mscv);
}
setDeploymentOrder();
return microservices;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public void setDeploymentOrder(){
for (Microservice m: microservices) {
m.setDeployment_order(microservices.indexOf(m));
}
}
public LinkedList<Microservice> getMicroservices() {
return microservices;
}
public void setMicroservices(LinkedList<Microservice> microservices) {
this.microservices = microservices;
setDeploymentOrder();
}
public LinkedList<Microservice> addMicroservice(Microservice microservice) {
this.microservices.add(microservice);
setDeploymentOrder();
return this.microservices;
}
public LinkedList<Microservice> addMicroservices(int number){
for (int j = 0; j < number; j++) {
this.microservices.add(new Microservice());
}
setDeploymentOrder();
return this.microservices;
}
public LinkedList<Microservice> removeMicroservice(int index) {
this.microservices.remove(index);
setDeploymentOrder();
return this.microservices;
}
public LinkedList<Microservice> removeMicroservice(Microservice microservice) {
this.microservices.remove(microservice);
setDeploymentOrder();
return this.microservices;
}
public String getIDString() {
return id.toString();
}
/**
* @return the id
*/
public UUID getUID() {
return id;
}
public HashSet<Resource> getProjectNfrs() {
return projectNfrs;
}
public void setProjectNfrs(HashSet<Resource> projectNfrs) {
this.projectNfrs = projectNfrs;
}
public void addProjectNfr(Resource nfr) {
projectNfrs.add(nfr);
}
public void removeProjectNfr(Resource nfr) {
projectNfrs.remove(nfr);
}
}
/*
* Copyright (c) 2017 Fraunhofer FOKUS.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the
* Eclipse Public License version 2.0 which accompanies
* this distribution, and is available at
* https://opensource.org/licenses/EPL-2.0
*
* Contributors:
*
* Torben Jastrow (Fraunhofer FOKUS)
*
* **Initially developed in the context of DECIDE EU project www.DECIDE-h2020.eu */
package eu.DECIDEh2020.architect.appManager.models;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
import org.apache.jena.rdf.model.Resource;
public class Microservice {
private class InfrastructureRequirements{
private String disk_min, disk_max, ram;
/**
* @return the disk_min
*/
public String getDisk_min() {
return disk_min;
}
/**
* @param disk_min the disk_min to set
*/
public void setDisk_min(String disk_min) {
this.disk_min = disk_min;
}
/**
* @return the disk_max
*/
public String getDisk_max() {
return disk_max;
}
/**
* @param disk_max the disk_max to set
*/
public void setDisk_max(String disk_max) {
this.disk_max = disk_max;
}
/**
* @return the ram
*/
public String getRam() {
return ram;
}
/**
* @param ram the ram to set
*/
public void setRam(String ram) {
this.ram = ram;
}
}
private String ms_name, patterns[], programming_language ="", type, category, ms_repo ;
private HashSet<Resource> nfrs;
private UUID ms_uid;
private boolean stateless = false, publicIP =false;
private URI endpoint[], container_ref;
private int deployment_order;
private ArrayList<String> dependencies = new ArrayList<String>();
private InfrastructureRequirements infrastructure_requirements;
/**
* @return the programmingLanguage
*/
public String getProgrammingLanguage() {
return programming_language;
}
/**
* @param programmingLanguage the programmingLanguage to set
*/
public void setProgrammingLanguage(String programmingLanguage) {
this.programming_language = programmingLanguage;
}
/**
* @return the category
*/
public String getCategory() {
return category;
}
/**
* @param category the category to set
*/
public void setCategory(String category) {
this.category = category;
}
/**
* @return the endpoint
*/
public URI[] getEndpoint() {
return endpoint;
}
/**
* @param endpoint the endpoint to set
*/
public void setEndpoint(URI[] endpoint) {
this.endpoint = endpoint;
}
/**
* @return the container_ref
*/
public URI getContainer_ref() {
return container_ref;
}
/**
* @param container_ref the container_ref to set
*/
public void setContainer_ref(URI container_ref) {
this.container_ref = container_ref;
}
/**
* @return the deployment_order
*/
public int getDeployment_order() {
return deployment_order;
}
/**
* @param deployment_order the deployment_order to set
*/
public void setDeployment_order(int deployment_order) {
this.deployment_order = deployment_order;
}
/**
* @return the infrastructure_requirements
*/
public InfrastructureRequirements getInfrastructure_requirements() {
return infrastructure_requirements;
}
/**
* @param infrastructure_requirements the infrastructure_requirements to set
*/
public void setInfrastructure_requirements(InfrastructureRequirements infrastructure_requirements) {
this.infrastructure_requirements = infrastructure_requirements;
}
/**
* @return the repo
*/
public String getRepo() {
return ms_repo;
}
/**
* @param repo the repo to set
*/
public void setRepo(String repo) {
this.ms_repo = repo;
}
/**
* @return the id
*/
public UUID getUID() {
return ms_uid;
}
/**
* @param dependencies the dependencies to set
*/
public void setDependencies(ArrayList<String> dependencies) {
this.dependencies = dependencies;
}
public void addDependency(String dependency) {
this.dependencies.add(dependency);
}
public Microservice() {
this("Microservice ", UUID.randomUUID());
String uuid = this.getUIDstring().substring(0, 8);
this.setName("Microservice " + uuid);
}
public Microservice(String name) {
this(name, UUID.randomUUID());
}
public Microservice(UUID id) {
this("Microservice", id);
}
public Microservice(HashSet<Resource> nfrs) {
this("Microservice", nfrs);
}