Commit 895763fb authored by Kyriakos Kritikos's avatar Kyriakos Kritikos

Basic security model with security controls, small update of location model...

Basic security model with security controls, small update of location model with inclusion of limited cloud locations, inclusion of metric model, structuring of CDO Repository
parent 50a12261
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**/*.java" including="**/*.java" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="var" path="M2_REPO/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar"/>
<classpathentry kind="var" path="M2_REPO/eu/paasage/camel/2.0.0-SNAPSHOT/camel-2.0.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/org.eclipse.emf.ecore/2.10.0-v20140514-1158/org.eclipse.emf.ecore-2.10.0-v20140514-1158.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/org.eclipse.emf.common/2.10.0-v20140514-1158/org.eclipse.emf.common-2.10.0-v20140514-1158.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/cdo_4.3.0/v20140520-1823/cdo_4.3.0-v20140520-1823.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/cdo/common_4.3.0/v20140309-0644/common_4.3.0-v20140309-0644.jar"/>
<classpathentry kind="var" path="M2_REPO/eu/paasage/mddb/cdo/client/2.0.0-SNAPSHOT/client-2.0.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/runtime/3.10.0-v20140318-2214/runtime-3.10.0-v20140318-2214.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/osgi/3.10.0-v20140606-1445/osgi-3.10.0-v20140606-1445.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/common/3.6.200-v20130402-1505/common-3.6.200-v20130402-1505.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/jobs/3.6.0-v20140424-0053/jobs-3.6.0-v20140424-0053.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/registry/3.5.400-v20140428-1507/registry-3.5.400-v20140428-1507.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/preferences/3.5.200-v20140224-1527/preferences-3.5.200-v20140224-1527.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/core/contenttype/3.4.200-v20140207-1251/contenttype-3.4.200-v20140207-1251.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/equinox/app/1.3.200-v20130910-1609/app-1.3.200-v20130910-1609.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/birt/runtime/org.eclipse.equinox.common/3.6.200.v20130402-1505/org.eclipse.equinox.common-3.6.200.v20130402-1505.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/birt/runtime/org.eclipse.core.jobs/3.6.0.v20140424-0053/org.eclipse.core.jobs-3.6.0.v20140424-0053.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/runtime/runtime-registry-compatibility/1.0.0/runtime-registry-compatibility-1.0.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/birt/runtime/org.eclipse.equinox.registry/3.5.400.v20140428-1507/org.eclipse.equinox.registry-3.5.400.v20140428-1507.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/birt/runtime/org.eclipse.emf.ecore.change/2.10.0.v20140514-1158/org.eclipse.emf.ecore.change-2.10.0.v20140514-1158.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/org.eclipse.emf.ecore.xmi/2.10.0-v20140514-1158/org.eclipse.emf.ecore.xmi-2.10.0-v20140514-1158.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/net4j/util_3.4.0/v20140308-0604/util_3.4.0-v20140308-0604.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/cdo/net4j_4.1.200/v20140308-0604/net4j_4.1.200-v20140308-0604.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/net4j/tcp_4.1.200/v20140114-0640/tcp_4.1.200-v20140114-0640.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/net4j_4.3.0/v20140308-0604/net4j_4.3.0-v20140308-0604.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/pivot_3.4.0/v20140601-1110/pivot_3.4.0-v20140601-1110.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/xtext/completeocl_3.4.0/v20140528-1458/completeocl_3.4.0-v20140528-1458.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/xtext/oclinecore_3.4.0/v20140528-1458/oclinecore_3.4.0-v20140528-1458.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/xtext/oclstdlib_3.4.0/v20140528-1458/oclstdlib_3.4.0-v20140528-1458.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/domain_3.4.2/v20140725-1916/domain_3.4.2-v20140725-1916.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/library_3.4.2/v20140725-1916/library_3.4.2-v20140725-1916.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/xtext/org.eclipse.xtext/2.7.2/org.eclipse.xtext-2.7.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/xtext/org.eclipse.xtext.util/2.7.2/org.eclipse.xtext.util-2.7.2.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/guava/guava/14.0.1/guava-14.0.1.jar" sourcepath="M2_REPO/com/google/guava/guava/14.0.1/guava-14.0.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/inject/guice/3.0/guice-3.0.jar"/>
<classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/xtext/org.eclipse.xtext.dependencies/2.7.2/org.eclipse.xtext.dependencies-2.7.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/xtext/org.eclipse.xtext.xbase.lib/2.7.2/org.eclipse.xtext.xbase.lib-2.7.2.jar"/>
<classpathentry kind="var" path="M2_REPO/com/ibm/icu/icu4j/52.1/icu4j-52.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/common_1.2.0/v20140610-0641/common_1.2.0-v20140610-0641.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/xtext/essentialocl_3.4.2/v20140819-1601/essentialocl_3.4.2-v20140819-1601.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/xtext/base_3.4.2/v20140725-1916/base_3.4.2-v20140725-1916.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/uml2/uml_5.0.1/v20140910-1354/uml_5.0.1-v20140910-1354.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/ocl/examples/common_3.3.0/v20140712-2020/common_3.3.0-v20140712-2020.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/org.eclipse.emf.edit/2.10.1-v20140901-1055/org.eclipse.emf.edit-2.10.1-v20140901-1055.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/xtext/org.eclipse.xtext.common.types/2.7.2/org.eclipse.xtext.common.types-2.7.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/org.eclipse.emf.codegen/2.10.0-v20150123-0452/org.eclipse.emf.codegen-2.10.0-v20150123-0452.jar"/>
<classpathentry kind="var" path="M2_REPO/org/ow2/asm/asm-commons/5.0.1/asm-commons-5.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/ow2/asm/asm-tree/5.0.1/asm-tree-5.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/ow2/asm/asm/5.0.1/asm-5.0.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/uml2/uml/resources_5.0.0/v20140910-1354/resources_5.0.0-v20140910-1354.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/uml2/common_2.0.1/v20140910-1354/common_2.0.1-v20140910-1354.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/uml2/types_2.0.0/v20140910-1354/types_2.0.0-v20140910-1354.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/uml2/uml/profile/standard_1.0.0/v20140910-1354/standard_1.0.0-v20140910-1354.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/emf/org.eclipse.emf.mapping.ecore2xml/2.8.0-v20140901-1055/org.eclipse.emf.mapping.ecore2xml-2.8.0-v20140901-1055.jar"/>
<classpathentry kind="var" path="M2_REPO/org/javatuples/javatuples/1.2/javatuples-1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-core/2.13.0/jena-core-2.13.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/jena/jena-iri/1.1.2/jena-iri-1.1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.7.6/slf4j-log4j12-1.7.6.jar"/>
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.11.0/xercesImpl-2.11.0.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.4.01/xml-apis-1.4.01.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>importer</name>
<comment></comment>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects>
</projects>
<buildSpec>
......@@ -17,7 +17,7 @@
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="ASCII"?>
<metric:MetricModel
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://www.paasage.eu/camel"
xmlns:metric="http://www.paasage.eu/camel/metric"
xmlns:unit="http://www.paasage.eu/camel/unit"
xsi:schemaLocation="http://www.paasage.eu/camel camel.ecore http://www.paasage.eu/camel/metric camel.ecore#//metric http://www.paasage.eu/camel/unit camel.ecore#//unit"
name="Basic Metric Model">
<metrics
xsi:type="metric:RawMetric"
name="RAW_AVAIL"
valueDirection="1"
unit="//@units.1"
property="//@properties.3"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_AVAIL"
valueDirection="1"
unit="//@units.1"
property="//@properties.3">
<formula
name="AVG_AVAIL_FORMULA"
function="MEAN"
parameters="//@metrics.0"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_CPU_UTILIZATION"
unit="//@units.1"
layer="IaaS"
property="//@properties.8"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_CPU_UTILIZATION"
unit="//@units.1"
layer="IaaS"
property="//@properties.8">
<formula
name="AVG_CPU_FORMULA"
function="MEAN"
parameters="//@metrics.2"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_MEMORY_UTILIZATION"
unit="//@units.1"
layer="IaaS"
property="//@properties.9"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_MEMORY_UTILIZATION"
unit="//@units.1"
layer="IaaS"
property="//@properties.9">
<formula
name="MEAN_MEMORY_FORMULA"
function="MEAN"
parameters="//@metrics.4"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_DISK_UTILIZATION"
unit="//@units.1"
layer="IaaS"
property="//@properties.10"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_DISK_UTILIZATION"
unit="//@units.1"
layer="IaaS"
property="//@properties.10">
<formula
name="AVG_DISK_FORMULA"
function="MEAN"
parameters="//@metrics.6"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_NETWORK_LATENCY"
unit="//@units.2"
layer="IaaS"
property="//@properties.7"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_NETWORK_LATENCY"
unit="//@units.2"
layer="IaaS"
property="//@properties.7">
<formula
name="AVG_NETWORK_LAT_FORMULA"
function="MEAN"
parameters="//@metrics.8"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_EXECUTION_TIME"
unit="//@units.2"
property="//@properties.5"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_EXECUTION_TIME"
unit="//@units.2"
property="//@properties.5">
<formula
name="AVG_ET_FORMULA"
function="MEAN"
parameters="//@metrics.10"/>
</metrics>
<metrics
xsi:type="metric:CompositeMetric"
name="RAW_RESPONSE_TIME"
unit="//@units.2"
property="//@properties.6">
<formula
name="RAW_RT_Formula"
functionArity="BINARY"
parameters="//@metrics.8 //@metrics.10"/>
</metrics>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_RESPONSE_TIME"
unit="//@units.2"
property="//@properties.6">
<formula
name="AVG_RT_FORMULA"
function="MEAN"
parameters="//@metrics.12"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_MTBF"
valueDirection="1"
unit="//@units.0"
property="//@properties.12"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_MTBF"
valueDirection="1"
unit="//@units.2"
property="//@properties.12">
<formula
name="AVG_MTBF_FORMULA"
function="MEAN"
parameters="//@metrics.14"/>
</metrics>
<metrics
xsi:type="metric:RawMetric"
name="RAW_THR"
valueDirection="1"
unit="//@units.3"
property="//@properties.11"/>
<metrics
xsi:type="metric:CompositeMetric"
name="AVG_THR"
valueDirection="1"
unit="//@units.3"
property="//@properties.11">
<formula
name="AVG_THR_FORMULA"
function="MEAN"
parameters="//@metrics.16"/>
</metrics>
<properties
name="COST"
subProperties="//@properties.1 //@properties.2 //@properties.4"/>
<properties
name="VM_COST"/>
<properties
name="IO_COST"/>
<properties
name="AVAILABILITY"
type="MEASURABLE"/>
<properties
name="STORAGE_COST"/>
<properties
name="EXECUTION TIME"
type="MEASURABLE"/>
<properties
name="RESPONSE TIME"
type="MEASURABLE"/>
<properties
name="NETWORK LATENCY"
type="MEASURABLE"/>
<properties
name="CPU UTILIZATION"
type="MEASURABLE"/>
<properties
name="MEMORY UTILIZATION"
type="MEASURABLE"/>
<properties
name="DISK UTILIZATION"
type="MEASURABLE"/>
<properties
name="THROUGHPUT"
type="MEASURABLE"/>
<properties
name="RELIABILITY"
type="MEASURABLE"/>
<units xsi:type="unit:TimeIntervalUnit"
name="months"
unit="MONTHS"/>
<units xsi:type="unit:Dimensionless"
name="percentage"
unit="PERCENTAGE"/>
<units xsi:type="unit:TimeIntervalUnit"
name="SECONDS"
unit="SECONDS"/>
<units xsi:type="unit:ThroughputUnit"
name="Requests per second"
unit="REQUESTS_PER_SECOND"/>
<units xsi:type="unit:MonetaryUnit"
name="euros"
unit="EUROS"/>
</metric:MetricModel>
<?xml version="1.0" encoding="ASCII"?>
<location:LocationModel
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:location="http://www.paasage.eu/camel/location"
xsi:schemaLocation="http://www.paasage.eu/camel/location camel.ecore#//location"
name="Cloud Location Model">
<cloudLocations
name="Virtual Data Center"
abbreviation="VDC">
<subLocations
name="1ff16f43-4a82-34bf-8f07-ea6d210548ab"
abbreviation="KVM"
parent="//@cloudLocations.0"/>
<subLocations
name="e92bb306-72cd-33a2-a952-908db2f47e98"
abbreviation="CEPH"
parent="//@cloudLocations.0"/>
</cloudLocations>
<cloudLocations
name="Region One"
abbreviation="One">
<subLocations
name="Availability Zone Nova"
abbreviation="Nova"
parent="//@cloudLocations.1"/>
</cloudLocations>
</location:LocationModel>
<?xml version="1.0" encoding="ASCII"?>
<camel:CamelModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://www.paasage.eu/camel" xmlns:organisation="http://www.paasage.eu/camel/organisation" xmlns:provider="http://www.paasage.eu/camel/provider" xmlns:type="http://www.paasage.eu/camel/type" xmlns:unit="http://www.paasage.eu/camel/unit" xsi:schemaLocation="http://www.paasage.eu/camel camel.ecore http://www.paasage.eu/camel/organisation camel.ecore#//organisation http://www.paasage.eu/camel/provider camel.ecore#//provider http://www.paasage.eu/camel/type camel.ecore#//type http://www.paasage.eu/camel/unit camel.ecore#//unit" name="Flexiant Camel Model">
<locationModels name="Flexiant Location">
<countries name="Scotland"/>
<countries name="United Kingdom"/>
</locationModels>
<organisationModels name="Flexiant Organisation Model">
<provider name="Flexiant" www="www.flexiant.com" postalAddress="Flexiant Limited, Geddes House, Kirkton North, Livingston, EH54 6GU, UK" email="contact@flexiant.com" public="true" PaaS="true" IaaS="true" providerModel="//@providerModels.0"/>
......
<?xml version="1.0" encoding="ASCII"?>
<camel:CamelModel xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://www.paasage.eu/camel" xmlns:organisation="http://www.paasage.eu/camel/organisation" xmlns:provider="http://www.paasage.eu/camel/provider" xmlns:type="http://www.paasage.eu/camel/type" xmlns:unit="http://www.paasage.eu/camel/unit" xsi:schemaLocation="http://www.paasage.eu/camel camel.ecore http://www.paasage.eu/camel/organisation camel.ecore#//organisation http://www.paasage.eu/camel/provider camel.ecore#//provider http://www.paasage.eu/camel/type camel.ecore#//type http://www.paasage.eu/camel/unit camel.ecore#//unit" name="GWDG Camel Model">
<locationModels name="GQDG Location Model">
<locationModels name="GWDG Location Model">
<countries name="Germany"/>
</locationModels>
<organisationModels name="GWDG Organisation Model">
......
......@@ -74,6 +74,16 @@
<artifactId>jena-core</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -20,22 +20,38 @@ import eu.paasage.camel.CamelFactory;
import eu.paasage.camel.CamelModel;
import eu.paasage.camel.deployment.Component;
import eu.paasage.camel.deployment.DeploymentModel;
import eu.paasage.camel.location.CloudLocation;
import eu.paasage.camel.location.Country;
import eu.paasage.camel.location.GeographicalRegion;
import eu.paasage.camel.location.LocationFactory;
import eu.paasage.camel.location.LocationModel;
import eu.paasage.camel.metric.MetricContext;
import eu.paasage.camel.metric.MetricModel;
import eu.paasage.camel.organisation.CloudProvider;
import eu.paasage.camel.organisation.DataCenter;
import eu.paasage.camel.organisation.Entity;
import eu.paasage.camel.organisation.Organisation;
import eu.paasage.camel.organisation.OrganisationModel;
import eu.paasage.camel.organisation.User;
import eu.paasage.camel.provider.ProviderModel;
import eu.paasage.camel.requirement.LocationRequirement;
import eu.paasage.camel.scalability.ScalabilityModel;
import eu.paasage.camel.type.TypeFactory;
import eu.paasage.camel.type.TypeModel;
import eu.paasage.camel.unit.CoreUnit;
import eu.paasage.camel.unit.Dimensionless;
import eu.paasage.camel.unit.MonetaryUnit;
import eu.paasage.camel.unit.RequestUnit;
import eu.paasage.camel.unit.StorageUnit;
import eu.paasage.camel.unit.ThroughputUnit;
import eu.paasage.camel.unit.TimeIntervalUnit;
import eu.paasage.camel.unit.TransactionUnit;
import eu.paasage.camel.unit.Unit;
import eu.paasage.camel.unit.UnitFactory;
import eu.paasage.camel.unit.UnitType;
import eu.paasage.mddb.cdo.client.CDOClient;
import eu.paasage.mddb.model.importer.location.LocationGenerator;
import eu.paasage.mddb.model.importer.security.SecurityPopulator;
public class ModelImporter {
private boolean inCdo = false;
......@@ -50,7 +66,7 @@ public class ModelImporter {
cl = new CDOClient();
}
public boolean importLocationModels(String path, String outputPath){
public boolean importGeoLocationModels(String path, String outputPath){
LocationGenerator lg = new LocationGenerator(path);
LocationModel lm = lg.getLocationModel();
if (lm != null){
......@@ -87,21 +103,36 @@ public class ModelImporter {
if (inCdo){
File f = new File(dirPath);
if (f.exists() && f.isDirectory()){
boolean created = createCDOFolderStructure("/orgs","providers");
boolean created = createCDOFolderStructure("/orgs","cps");
if (created){
File[] files = f.listFiles();
for (File file: files){
EObject model = cl.loadModel(file.getAbsolutePath());
if (model instanceof CamelModel){
CDOTransaction trans = cl.openTransaction();
CamelModel cm = (CamelModel)model;
EList<LocationModel> locModels = cm.getLocationModels();
if (locModels != null && !locModels.isEmpty()){
fixLocationModel(locModels.get(0),trans);
}
EList<OrganisationModel> oms = cm.getOrganisationModels();
if (oms != null && !oms.isEmpty()){
OrganisationModel om = oms.get(0);
CloudProvider cp = om.getProvider();
if (cp != null){
String name = cp.getName();
boolean created2 = createCDOFolderStructure("/orgs/providers",name);
cl.storeModel(model,"/orgs/providers/" + name + "/" + name,true);
String name = cp.getName().toLowerCase();
boolean created2 = createCDOFolderStructure("/orgs/cps",name);
CDOResource res = trans.getOrCreateResource("/orgs/cps/" + name + "/" + name);
((CamelModel) model).getLocationModels().clear();
res.getContents().add(model);
try{
trans.commit();
}
catch(Exception e){
e.printStackTrace();
}
trans.close();
//cl.storeModel(model,"/orgs/cps/" + name + "/" + name,true);
}
}
}
......@@ -116,7 +147,7 @@ public class ModelImporter {
for (Country country: model.getCountries()){
String name = country.getName();
System.out.println("Processing country: " + name);
Country corCountry = trans.createQuery("hql", "select c from Country c where c.name='" + name + "' or '" + name + "' member of c.alternativeNames").getResult(Country.class).get(0);
Country corCountry = trans.createQuery("hql", "select c from Country c where c.name like '%" + name + "%' or '" + name + "' member of c.alternativeNames").getResult(Country.class).get(0);
Collection<Setting> references = EcoreUtil.UsageCrossReferencer.find(country, country.eResource());
for (Setting setting : references) {
EObject source = setting.getEObject();
......@@ -126,6 +157,10 @@ public class ModelImporter {
lr.getLocations().remove(country);
lr.getLocations().add(corCountry);
}
else if (source instanceof DataCenter){
DataCenter dc = (DataCenter)source;
dc.setLocation(corCountry);
}
}
}
for (GeographicalRegion region: model.getRegions()){
......@@ -141,6 +176,10 @@ public class ModelImporter {
lr.getLocations().remove(region);
lr.getLocations().add(corRegion);
}
else if (source instanceof DataCenter){
DataCenter dc = (DataCenter)source;
dc.setLocation(corRegion);
}
}
}
}
......@@ -158,7 +197,7 @@ public class ModelImporter {
User user = (User)copier.copy(om.getUsers().get(0));
Application app = (Application)copier.copy(cm.getApplications().get(0));
if (org != null){
orgName = org.getName();
orgName = org.getName().toLowerCase();
boolean created = createCDOFolderStructure("/orgs",orgName);
if (created){
for (User u: om.getUsers()) u.getRequirementModels().clear();
......@@ -168,8 +207,8 @@ public class ModelImporter {
}
else{
CloudProvider cp = om.getProvider();
providerName = cp.getName();
boolean created = createCDOFolderStructure("/orgs/providers",providerName);
providerName = cp.getName().toLowerCase();
boolean created = createCDOFolderStructure("/orgs/cps",providerName);
if (created){
for (User u: om.getUsers()) u.getRequirementModels().clear();
ProviderModel pm = cp.getProviderModel();
......@@ -178,13 +217,13 @@ public class ModelImporter {
newModel.setName("Provider " + providerName + " Camel Model");
newModel.getOrganisationModels().add(om);
newModel.getProviderModels().add(pm);
stored = cl.storeModel(newModel, "/orgs/providers/" + providerName + "/" + providerName, true);
stored = cl.storeModel(newModel, "/orgs/cps/" + providerName + "/" + providerName, true);
}
else{
stored = cl.storeModel(om, "/orgs/providers/" + providerName + "/" + providerName, true);
stored = cl.storeModel(om, "/orgs/cps/" + providerName + "/" + providerName, true);
}
}
orgPath = "/orgs/providers/" + providerName;
orgPath = "/orgs/cps/" + providerName;
}
if (stored){
String userEmail = user.getEmail();
......@@ -240,15 +279,187 @@ public class ModelImporter {
return processed;
}
private EObject createEmptyTypeModel(){
TypeModel tm = TypeFactory.eINSTANCE.createTypeModel();
tm.setName("Camel Type Model");
return tm;
}
private boolean importCloudLocations(String path){
boolean ok = false;
LocationModel lm = (LocationModel)cl.loadModel(path);
EList<CloudLocation> cloudLocations = lm.getCloudLocations();
CDOTransaction trans = cl.openTransaction();
CDOResource res = trans.getOrCreateResource("locations/locations");
LocationModel lm2 = (LocationModel)res.getContents().get(0);
EList<CloudLocation> cloudLocations2 = lm2.getCloudLocations();
DataCenter flexiant = trans.createQuery("hql", "select dc from CloudProvider cp, DataCenter dc where cp.name='Flexiant' and dc.cloudProvider=cp").getResult(DataCenter.class).get(0);
DataCenter gwdg = trans.createQuery("hql", "select dc from CloudProvider cp, DataCenter dc where cp.name='GWDG' and dc.cloudProvider=cp").getResult(DataCenter.class).get(0);
for(CloudLocation cloc: cloudLocations){
String abrv = cloc.getAbbreviation();
System.out.println("Checking CloudLocation: " + cloc.getName() + " with abbreviation: " + abrv);
CloudLocation cloc2 = LocationFactory.eINSTANCE.createCloudLocation();
cloc2.setName(cloc.getName());
cloc2.setAbbreviation(cloc.getAbbreviation());
cloc2.setIsAssignable(cloc.isIsAssignable());
EList<CloudLocation> subLocs = cloc2.getSubLocations();
subLocs.addAll(cloc.getSubLocations());
for(CloudLocation subLoc: subLocs) subLoc.setParent(cloc2);
if (abrv.equals("VDC")){
cloc2.setGeographicalRegion((GeographicalRegion)flexiant.getLocation());
}
else if (abrv.equals("One")){
//System.out.println("Adding CloudLocation for GWDG");
cloc2.setGeographicalRegion((GeographicalRegion)gwdg.getLocation());
}
cloudLocations2.add(cloc2);
}
try{
trans.commit();
ok = true;
}
catch(Exception e){
e.printStackTrace();
}
trans.close();
return ok;
}
private EObject createUnitModel(){
//!!!Change to UnitModel in new CAMEL version
CamelModel cm = CamelFactory.eINSTANCE.createCamelModel();
cm.setName("Global Unit Model");
EList<Unit> units = cm.getUnits();
//Create Units per Dimension
CoreUnit cu = UnitFactory.eINSTANCE.createCoreUnit();
cu.setName("cores");
cu.setUnit(UnitType.CORES);
units.add(cu);
Dimensionless dim = UnitFactory.eINSTANCE.createDimensionless();
dim.setUnit(UnitType.PERCENTAGE);
dim.setName("percentage");
units.add(dim);
MonetaryUnit euros = UnitFactory.eINSTANCE.createMonetaryUnit();